- Joined
- Aug 15, 2006
- Messages
- 20
- Reaction score
- 0
While testing the server files (996x 8-15 release)..
found vault bug when typing /keep <negative number> (ex. /keep -999).
With this, all can have more than the number of vault
(ex. WareHouseNum = 3) u specified in gamserver.ini .
Say, for WareHouseNum=3..
Players can select vault 0 to 3 but cant access vault 4 up.
Unfortunately, players can access vault -1 to -999 above if they type
/keep -1 to /keep -999 above which in turn creating huge number
of vaults for each account.
I cross examined the extra warehouse procedures and come up with
a simple fix below (correct me if I'm wrong or got better idea):
Just edit the following Stored Procedures like so:
For WHS_SELECT:
For WHS_UPD_Items:
For WHS_UPD_MnyPwDbv:
For WHS_UPD_Money:
What the changes do?
Whenever a player tries to type /keep <negative number>..
He will be redirected to vault 0 (normal vault).
NOTE: If u have better FIX please post here.
I hope this helps.
found vault bug when typing /keep <negative number> (ex. /keep -999).
With this, all can have more than the number of vault
(ex. WareHouseNum = 3) u specified in gamserver.ini .
Say, for WareHouseNum=3..
Players can select vault 0 to 3 but cant access vault 4 up.
Unfortunately, players can access vault -1 to -999 above if they type
/keep -1 to /keep -999 above which in turn creating huge number
of vaults for each account.
I cross examined the extra warehouse procedures and come up with
a simple fix below (correct me if I'm wrong or got better idea):
Just edit the following Stored Procedures like so:
For WHS_SELECT:
Code:
CREATE proc WHS_SELECT
@op int,
@Accountid varchar(10)
as
set nocount on
declare @aid varchar(10)
,@cknum int
if @op=1 begin --读取ID,检查仓库是否存在
SELECT @aid=AccountID,@cknum=NeedExtCK FROM warehouse WHERE AccountID=@accountid
if @cknum is null begin --打开主仓库
INSERT INTO warehouse (AccountID, Items, Money, EndUseDate, DbVersion)
VALUES (@accountid,cast(REPLICATE(char(0xff),1200) as varbinary(1200))
,0, getdate(), 1)
Select @accountid AS AccountID
end else begin
Update warehouse Set ExtCKNum=NeedExtCK WHERE AccountID=@accountid
if @cknum[COLOR=red]<[/COLOR]=0
Select @aid AS AccountID
else begin
if not EXISTS (select AccountID FROM ExtWareHouse WHERE AccountID=@accountid and Number=@cknum) begin
INSERT INTO ExtWarehouse (AccountID,Number,Items, Money, EndUseDate, DbVersion)
VALUES (@accountid,@cknum,cast(REPLICATE(char(0xff),1200) as varbinary(1200))
,0, getdate(), 1)
end
Select @accountid AS AccountID
end
end
end else if @op=2 begin
SELECT @cknum=ExtCKNum FROM warehouse WHERE AccountID=@accountid
if @cknum[COLOR=red]<[/COLOR]=0 begin
SELECT Items from warehouse where AccountID=@accountid
end
else begin
SELECT Items from ExtWareHouse WHERE AccountID=@Accountid AND Number=@cknum
end
end else begin
SELECT @cknum=ExtCKNum FROM warehouse WHERE AccountID=@accountid
if @cknum[COLOR=red]<[/COLOR]=0
SELECT Money, DbVersion, pw from warehouse where AccountID=@accountid
else
SELECT Money, DbVersion, pw from ExtWareHouse where AccountID=@accountid AND Number=@cknum
end
set nocount off
GO
For WHS_UPD_Items:
Code:
CREATE proc WHS_UPD_Items
@items varchar(2500),
@Accountid varchar(10)
as
set nocount on
declare @cknum int
SELECT @cknum=ExtCKNum FROM warehouse WHERE AccountID=@accountid
if @cknum[COLOR=red]<[/COLOR]=0 --主仓库
UPDATE warehouse set Items=cast(@items as varbinary(1200))
where AccountID=@accountid
else
UPDATE ExtWareHouse set Items=cast(@items as varbinary(1200))
where AccountID=@accountid AND Number=@cknum
--waitfor delay '00:00:10'
set nocount off
GO
For WHS_UPD_MnyPwDbv:
Code:
CREATE proc WHS_UPD_MnyPwDbv
@mny int,
@pw int,
@dbv int,
@Accountid varchar(10)
as
set nocount on
declare @cknum int
SELECT @cknum=ExtCKNum FROM warehouse WHERE AccountID=@accountid
if @cknum[COLOR=red]<[/COLOR]=0 begin --主仓库
if @pw=0
UPDATE warehouse set Money=@mny,pw=@pw,DbVersion=@dbv
where AccountID=@accountid
else
UPDATE warehouse set Money=@mny,pw=@pw,lastpw=@pw,DbVersion=@dbv
where AccountID=@accountid
UPDATE ExtWareHouse set pw=@pw where AccountID=@accountid
end else begin
UPDATE ExtWareHouse set Money=@mny,pw=@pw,DbVersion=@dbv
where AccountID=@accountid AND Number=@cknum
UPDATE ExtWareHouse set pw=@pw where AccountID=@accountid
if @pw=0
UPDATE WareHouse set pw=@pw where AccountID=@accountid
else
UPDATE WareHouse set pw=@pw,lastpw=@pw where AccountID=@accountid
end
--waitfor delay '00:00:10'
set nocount off
GO
For WHS_UPD_Money:
Code:
CREATE proc WHS_UPD_Money
@mny int,
@Accountid varchar(10)
as
set nocount on
declare @cknum int
SELECT @cknum=ExtCKNum FROM warehouse WHERE AccountID=@accountid
if @cknum[COLOR=red]<[/COLOR]=0 --主仓库
UPDATE warehouse set Money=@mny
where AccountID=@accountid
else
UPDATE ExtWareHouse set Money=@mny
where AccountID=@accountid AND Number=@cknum
--waitfor delay '00:00:10'
set nocount off
GO
What the changes do?
Whenever a player tries to type /keep <negative number>..
He will be redirected to vault 0 (normal vault).
NOTE: If u have better FIX please post here.
I hope this helps.
Last edited: