because there are still some guys they dont know how to write simple querys iīll release one
PHP Code:
IF (@Operation = 90 AND @strDesc like '%Opt: +13%') BEGIN UPDATE SRO_VT_SHARD.dbo._Items SET OptLevel = 12 WHERE Serial64 = @ItemSerial END
Bonus:
Remove OptLevel limit from SMC:
PHP Code:
USE [SRO_VT_SHARD] GO /****** Object: StoredProcedure [dbo].[_SMC_ADD_ITEM] Script Date: 04/17/2014 18:50:37 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO ----------------------------------------------------------------------- ALTER PROCEDURE [dbo].[_SMC_ADD_ITEM] ----------------------------------------------------- params to find target item @TargetStorage int, /* 0 = inventory, 1 = chest , 2 = guild chest, 3 = Avatar Inventory */ @OwnerName varchar(128), ----------------------------------------------------- params to modify the item @RefItemID int, @OptLvl tinyint, @Variance bigint, @Data int, @szCreater varchar(32), @MagParamNum int, @MagParam1 bigint, @MagParam2 bigint, @MagParam3 bigint, @MagParam4 bigint, @MagParam5 bigint, @MagParam6 bigint, @MagParam7 bigint, @MagParam8 bigint, @MagParam9 bigint, @MagParam10 bigint, @MagParam11 bigint, @MagParam12 bigint as ---------------------------------------------------- -- step 1. check validity of parameters ---------------------------------------------------- if (@TargetStorage <> 0 and @TargetStorage <> 1 and @TargetStorage <> 2 and @TargetStorage <> 3) begin select -1, cast(0 as bigint), cast(0 as bigint) -- invalid target storage return end declare @ownerid int declare @ItemID bigint set @ownerid = 0 set @ItemID = 0 declare @empty_slot int set @empty_slot = -1 if (@TargetStorage = 0) begin select @ownerid = charid from _char where charname16 = @OwnerName if (@@rowcount = 0 or @ownerid = 0 or @ownerid is null) begin select -2, cast(0 as bigint), cast(0 as bigint)-- can't find owner return end
select top 1 @empty_slot = slot from _inventory where charid = @ownerid and slot >= 13 and itemid = 0 and slot < (select top 1 InventorySize from _Char where CharID = @ownerid) order by slot asc
if (@@rowcount = 0) begin select -3, cast(0 as bigint), cast(0 as bigint) -- inventory full return end end else if (@TargetStorage = 1) begin select @ownerid = JID from _AccountJID where AccountID = @ownername if (@@rowcount = 0 or @ownerid = 0 or @ownerid is null) begin select -2, cast(0 as bigint), cast(0 as bigint) -- can't find owner return end select top 1 @empty_slot = slot from _chest where userjid = @ownerid and (itemid = 0 or ItemID is null) order by slot asc if (@@rowcount = 0) begin select -3, cast(0 as bigint), cast(0 as bigint) -- chest full return end end else if (@TargetStorage = 2) begin select @ownerid = [ID] from _guild where [name] = @ownername if (@@rowcount = 0 or @ownerid = 0 or @ownerid is null) begin select -2, cast(0 as bigint), cast(0 as bigint) -- can't find owner return end select top 1 @empty_slot = slot from _guildchest where guildid = @ownerid and (itemid = 0 or ItemID is null) order by slot asc if (@@rowcount = 0) begin select -3, cast(0 as bigint), cast(0 as bigint) -- chest full return end
-- 길드 레벨에 따른 길드 슬롯수 제한을 확인하자. declare @lvl tinyint declare @max_slot tinyint select @lvl = Lvl from _guild where [id] = @ownerid set @max_slot = 30 * (@lvl - 1) - 1
if @empty_slot > @max_slot begin select -3, cast(0 as bigint), cast(0 as bigint) -- chest full return end end else begin select @ownerid = charid from _char where charname16 = @OwnerName if (@@rowcount = 0 or @ownerid = 0 or @ownerid is null) begin select -2, cast(0 as bigint), cast(0 as bigint)-- can't find owner return end
select top 1 @empty_slot = slot from _InventoryForAvatar where charid = @ownerid and itemid = 0 and slot < 4 -- 프로시져 하드코딩(아바타 슬롯은 0, 1, 2, 3이다.) order by slot asc
if (@@rowcount = 0) begin select -3, cast(0 as bigint), cast(0 as bigint) -- inventory full return end end
if (@empty_slot < 0 or @empty_slot is null) begin select -4, cast(0 as bigint), cast(0 as bigint) -- unknown error ??? return end
declare @tid1 int declare @tid2 int declare @tid3 int declare @tid4 int
select @tid1 = TypeID1, @tid2 = TypeID2, @tid3 = TypeID3, @tid4 = TypeID4 from _RefObjCommon where ID = @RefItemID if (@tid1 <> 3) begin select -5, cast(0 as bigint), cast(0 as bigint) -- about to assign non-item object return end if (@tid2 <> 1) -- is not equipment begin -- can't assign magic param or optlevel to non-equip item if (@MagParamNum > 0 or @OptLvl > 0) begin select -6, cast(0 as bigint), cast(0 as bigint) return end end
---------------------------------------------------- -- step 2. correct some non-critical parameters ---------------------------------------------------- if (@tid2 = 3 and @Data = 0) -- can't assign overlap count 0 to expendable item begin set @Data = 1 end
-- clamp optlevel to 12(Equip 아이템에만 적용)
if (LEN(@szCreater) = 0) set @szCreater = NULL
---------------------------------------------------- -- step add. equip and pet @data setting ---------------------------------------------------- declare @IS_EQUIP int declare @IS_PET int
set @IS_EQUIP = 0 set @IS_PET = 0
if (@tid1 = 3 and @tid2 = 1) set @IS_EQUIP = 1 else if (@tid1 = 3 and @tid2 = 2 and @tid3 = 1 and (@tid4 = 1 or @tid4 = 2)) set @IS_PET = 1
if (@IS_EQUIP = 1) begin -- SMC_SR_UserEdit_Char_Item_or_Guild_Item PATCH READY에서 @RefItemID를 참조하는 쿼리 수정이 빠져 있었다. by zone0000(2008.05.30) select @Data = Dur_L from _RefObjItem as Roi with(nolock) join _RefObjCommon as Roc with(nolock) on Roi.id = Roc.link where Roc.ID = @RefItemID
-- clamp optlevel to 12는 장비 아이템에만 적용한다. if (@OptLvl < 0) set @OptLvl = 0 end else begin
if( @IS_PET = 1 ) set @Data = 0 else begin declare @MaxCount int
-- 2007. 10. 30 석민우 -> 단순히 _RefObjItem 의 id와 @RefItemID를 비교하여 질의가 이상한 결과를 반환했다. -- _RefObjCommon 의 정보와 _RefObjItem의 정보를 조인해야 제대로된 질의가 완성된다. select @MaxCount = MaxStack from _RefObjItem as Roi with(nolock) join _RefObjCommon as Roc with(nolock) on Roi.id = Roc.link where Roc.ID = @RefItemID
if (@Data <= 0 or @Data > @MaxCount) set @Data = @MaxCount end
set @OptLvl = 0 end
---------------------------------------------------------- -- Step3. create item and set to associated storage ---------------------------------------------------------- set xact_abort on begin transaction
declare @NewItemID bigint declare @Serial64 bigint set @NewItemID = 0 set @Serial64 = 0 exec @NewItemID = _STRG_ALLOC_ITEM_NoTX @Serial64 OUTPUT if (@NewItemID = 0) begin rollback transaction select -7, cast(0 as bigint), cast(0 as bigint) return end if (@MagParamNum = 0) begin update _Items set RefItemID = @RefItemID, OptLevel = @OptLvl, Variance = @Variance, Data = @Data, MagParamNum = 0, Serial64 = @Serial64 where ID64 = @NewItemID end else begin update _Items set RefItemID = @RefItemID, OptLevel = @OptLvl, Variance = @Variance, Data = @Data, MagParamNum = @MagParamNum, MagParam1 = @MagParam1, MagParam2 = @MagParam2, MagParam3 = @MagParam3, MagParam4 = @MagParam4, MagParam5 = @MagParam5, MagParam6 = @MagParam6, MagParam7 = @MagParam7, MagParam8 = @MagParam8, MagParam9 = @MagParam9, MagParam10= @MagParam10, MagParam11 = @MagParam11, MagParam12 = @MagParam12, Serial64 = @Serial64 where ID64 = @NewItemID end if (@@error <> 0) begin rollback transaction select -8, cast(0 as bigint), cast(0 as bigint) return end if (@TargetStorage = 0) update _Inventory set ItemID = @NewItemID where CharID = @OwnerID and Slot = @empty_slot else if (@TargetStorage = 1) update _chest set ItemID = @NewItemID where UserJID = @OwnerID and slot = @empty_slot else if (@TargetStorage = 2) update _guildchest set ItemID = @NewItemID where guildid = @OwnerID and slot = @empty_slot else update _InventoryForAvatar set ItemID = @NewItemID where CharID = @OwnerID and Slot = @empty_slot
if (@@rowcount = 0 or @@error <> 0) begin rollback transaction select -9, cast(0 as bigint), cast(0 as bigint) return end
USE [SRO_VT_SHARD] GO /****** Object: StoredProcedure [dbo].[_SMC_EDIT_ITEM] Script Date: 04/17/2014 18:51:30 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[_SMC_EDIT_ITEM] ----------------------------------------------------- params to find target item @TargetStorage int, /* 0 = inventory, 1 = chest, 2 = guild chest, 3 = Avatar Inventory */ @OwnerName varchar(128), /* account id or char id */ @Slot int, @ItemIDToEdit bigint, /* just for check validity */ ----------------------------------------------------- params to modify the item @RefItemID int, @OptLvl tinyint, @Variance bigint, @Data int, @szCreater varchar(32), @MagParamNum int, @MagParam1 bigint, @MagParam2 bigint, @MagParam3 bigint, @MagParam4 bigint, @MagParam5 bigint, @MagParam6 bigint, @MagParam7 bigint, @MagParam8 bigint, @MagParam9 bigint, @MagParam10 bigint, @MagParam11 bigint, @MagParam12 bigint as ---------------------------------------------------- -- step 1. check validity of parameters ---------------------------------------------------- if (@TargetStorage <> 0 and @TargetStorage <> 1 and @TargetStorage <> 2 and @TargetStorage <> 3) begin select -1 -- invalid target storage return end declare @ownerid int declare @ItemID bigint set @ownerid = 0 set @ItemID = 0 if (@TargetStorage = 0) begin select @ownerid = charid from _char where charname16 = @OwnerName if (@@rowcount = 0 or @ownerid = 0 or @ownerid is null) begin select -2 -- can't find owner return end select @ItemID = ItemID from _inventory where charid = @ownerid and slot = @slot end else if (@TargetStorage = 1) begin select @ownerid = JID from _AccountJID where AccountID = @ownername if (@@rowcount = 0 or @ownerid = 0 or @ownerid is null) begin select -2 -- can't find owner return end select @ItemID = itemid from _chest where userjid = @ownerid and slot = @slot end else if (@TargetStorage = 2) begin select @ownerid = [id] from _guild where [name] = @ownername if (@@rowcount = 0 or @ownerid = 0 or @ownerid is null) begin select -2 -- can't find owner return end select @ItemID = itemid from _guildchest where guildid = @ownerid and slot = @slot end else begin select @ownerid = charid from _char where charname16 = @OwnerName if (@@rowcount = 0 or @ownerid = 0 or @ownerid is null) begin select -2 -- can't find owner return end select @ItemID = ItemID from _InventoryForAvatar where charid = @ownerid and slot = @slot end
if (@itemID = 0 or @itemid is null) begin select -3 -- can't find the item return end if (@itemid <> @ItemIDToEdit) begin select -4 -- it's not the one that you wanna edit return end declare @tid1 int declare @tid2 int select @tid1 = TypeID1, @tid2 = TypeID2 from _RefObjCommon with(nolock) where ID = @RefItemID if (@tid1 <> 3) begin select -5 -- about to assign non-item object return end if (@tid2 <> 1) -- is equipment begin -- can't assign magic param or optlevel to non-equip item if (@MagParamNum > 0 or @OptLvl > 0) begin select -6 return end end
---------------------------------------------------- -- step 2. correct some non-critical parameters ---------------------------------------------------- if (LEN(@szCreater) = 0) set @szCreater = NULL
---------------------------------------------------- -- step 3. modify target item to desired values ---------------------------------------------------- if (@MagParamNum = 0) begin update _Items set RefItemID = @RefItemID, OptLevel = @OptLvl, Variance = @Variance, Data = @Data, CreaterName = @szCreater, MagParamNum = 0 where id64 = @ItemID end else begin update _Items set RefItemID = @RefItemID, OptLevel = @OptLvl, Variance = @Variance, Data = @Data, CreaterName = @szCreater, MagParamNum = @MagParamNum, MagParam1 = @MagParam1, MagParam2 = @MagParam2, MagParam3 = @MagParam3, MagParam4 = @MagParam4, MagParam5 = @MagParam5, MagParam6 = @MagParam6, MagParam7 = @MagParam7, MagParam8 = @MagParam8, MagParam9 = @MagParam9, MagParam10 = @MagParam10, MagParam11 = @MagParam11, MagParam12 = @MagParam12 where id64 = @ItemID end
if (@@error <> 0 or @@rowcount = 0) begin select -7 return end select 1 return
if (@Operation = 90)
begin
set @len_desc1 = CHARINDEX (']',@strDesc)
if(@len_desc1 = 9)
begin
set @strDesc = SUBSTRING(@strDesc,0,9)
set @strDesc_separado = SUBSTRING(@strDesc, 8, 1)
end
else if(@len_desc1 = 10)
begin
set @strDesc = SUBSTRING(@strDesc,0,1.)
set @strDesc_separado = SUBSTRING(@strDesc, 8, 2)
end
if(@strDesc_separado > 12)
begin
UPDATE SRO_VT_SHARD.dbo._Items SET OptLevel = 12 WHERE Serial64 = @ItemSerial
return -3
END
I don't know how you will get disconnected without the return -3 but anyway this will work too.. if(@strDesc_separado > 12) if plus of item is above 12..
if (@Operation = 90)
begin
set @len_desc1 = CHARINDEX (']',@strDesc)
if(@len_desc1 = 9)
begin
set @strDesc = SUBSTRING(@strDesc,0,9)
set @strDesc_separado = SUBSTRING(@strDesc, 8, 1)
end
else if(@len_desc1 = 10)
begin
set @strDesc = SUBSTRING(@strDesc,0,1.)
set @strDesc_separado = SUBSTRING(@strDesc, 8, 2)
end
if(@strDesc_separado > 12)
begin
UPDATE SRO_VT_SHARD.dbo._Items SET OptLevel = 12 WHERE Serial64 = @ItemSerial
return -3
END
I don't know how you will get disconnected without the return -3 but anyway this will work too.. if(@strDesc_separado > 12) if plus of item is above 12..
RETURN -3 isnt working for _AddLogItem and till now i dont know why, i try to find a force dc.
and btw ur query wont work cuz there are so many dif. Descīs
the best and fastest way to update a >12 Optlevel is this
Code:
IF (@Operation = 90)
BEGIN
DECLARE @OptLevel INT = (SELECT OptLevel from SRO_CH_SHARD.dbo._Items WHERE Serial64 = @ItemSerial)
IF (@OptLevel > 12)
BEGIN
UPDATE SRO_CH_SHARD.dbo._Items SET OptLevel = 12 WHERE Serial64 = @ItemSerial)
END
END
if (@Operation = 90)
begin
set @len_desc1 = CHARINDEX (']',@strDesc)
if(@len_desc1 = 9)
begin
set @strDesc = SUBSTRING(@strDesc,0,9)
set @strDesc_separado = SUBSTRING(@strDesc, 8, 1)
end
else if(@len_desc1 = 10)
begin
set @strDesc = SUBSTRING(@strDesc,0,1.)
set @strDesc_separado = SUBSTRING(@strDesc, 8, 2)
end
if(@strDesc_separado > 12)
begin
UPDATE SRO_VT_SHARD.dbo._Items SET OptLevel = 12 WHERE Serial64 = @ItemSerial
return -3
END
I don't know how you will get disconnected without the return -3 but anyway this will work too.. if(@strDesc_separado > 12) if plus of item is above 12..
Return -3 wont DC the char. _AddLogXXX are asynchronous queries, there is a callback at the end, however, they don't matter.
To limit plusing:
Code:
IF @Operation = 90 AND @dwData >= 655369 -- Change here depending on whats required.
UPDATE SRO_VT_SHARD.dbo._Items SET OptLevel = 9 WHERE Serial64 = @ItemSerial64
That's all you have to add in _addLogItem.
It will limit the fusing to +9 max. For a +10 limit put this number: 720906, +11 = 786443, +12 = 851980, +13 = 917517, +14 = 983054
also change the @ItemSerial64 variable name.. its different than that. @RefSerial64 or shit like that probably. dont remember.
Anyways, why do you fuckers write 20 lines when only 2 lines are needed... Don't just go and drain performance whenever you can.