By_MaSTeRr
Aileden
item bug olayını hala çözemedim ama sorunun nerede olduğunu sanırım buldum USE [SRO_VT_SHARD]
GO
/****** Object: StoredProcedure [dbo].[_STRG_MOVE_ITEM] Script Date: 09/17/2011 11:40:57 ******/
SETANSI_NULLSON
GO
SETQUOTED_IDENTIFIERON
GO
--------------------------------------------------------------------------------------------------------------------------
-- PROC #3
-- _STRG_MOVE_ITEM ! - by zone0000 ()
--------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------
-- _STRG_MOVE_ITEM Operation(35)(36) ()
-----------------------------------------------------------------
ALTERPROCEDURE [dbo].[_STRG_MOVE_ITEM]
@Operation ASTINYINT,
@UserJID ASINT,
@CharID ASINT,
@GuildID ASBIGINT,-- Operation 39, 40 LinkedItemID .
@Slot_From ASTINYINT,
@Slot_To ASTINYINT,
@Data ASINT,-- 0 .
@RemoveAndOverwrite ASTINYINT
AS
----------------
-- SP_UPDATE_SLOTS_INV 0
-- SP_UPDATE_SLOTS_CHEST 1
-- SP_DEPOSIT_ITEM 2
-- SP_WITHDRAW_ITEM 3
-- SP_UPDATE_SLOTS_INV_COS 16
-- SP_GUILD_CHEST_UPDATE_SLOT 29
-- SP_GUILD_CHEST_DEPOSIT_ITEM 30
-- SP_GUILD_CHEST_WITHDRAW_ITEM 31
-- SP_MOVE_ITEM_AVATAR_PC 35 -- Avatar
-- SP_MOVE_ITEM_PC_AVATAR 36 -- Avatar
-- SP_PUSH_ITEM_INTO_MAGIC_CUBE 39 -- MagicCube
-- SP_POP_ITEM_FROM_MAGIC_CUBE 40 -- MagicCube
----------------
IF (@Operation <> 0 AND @Operation <> 1 AND @Operation <> 2 AND @Operation <> 3 AND @Operation <> 16 AND @Operation <> 29 AND @Operation <> 30 AND @Operation <> 31
AND @Operation <> 35 AND @Operation <> 36 -- Avatar
AND @Operation <> 39 AND @Operation <> 40 )-- MagicCube
BEGIN
RETURN-1000
END
-- overwrite inventory ( reloading)
IF (@RemoveAndOverwrite <> 0 AND @Operation <> 0)
BEGIN
RETURN-1001
END
DECLARE @ItemID_From BIGINT
DECLARE @ItemID_To BIGINT
SET @ItemID_From = 0
SET @ItemID_To = 0
----------------------------------------------------------
-- Step1. Src Slot Dst Slot
----------------------------------------------------------
-------------- Src Item
IF (@Operation = 0 OR @Operation = 2 OR @Operation = 30)-- src: inventory
BEGIN
SELECT @ItemID_From = ItemID FROM _Inventory WHERE CharID = @CharID AND Slot = @Slot_From
END
ELSEIF (@Operation = 1 OR @Operation = 3)-- src: chest
BEGIN
SELECT @ItemID_From = ItemID FROM _Chest WHERE UserJID = @UserJID AND Slot = @Slot_From
END
ELSEIF (@Operation = 16)
BEGIN
SELECT @ItemID_From = ItemID FROM _InvCOS WHERE COSID = @CharID AND Slot = @Slot_From
END
ELSEIF (@Operation = 29 OR @Operation = 31)
BEGIN
SELECT @ItemID_From = ItemID FROM _GuildChest WHERE GuildID = @GuildID AND Slot = @Slot_From
END
-- Avatar ( Avatar -> PC )
ELSEIF (@Operation = 35)
BEGIN
SELECT @ItemID_From = ItemID FROM _InventoryForAvatar WHERE CharID = @CharID AND Slot = @Slot_From
END
-- Avatar ( PC -> Avatar )
ELSEIF (@Operation = 36)
BEGIN
SELECT @ItemID_From = ItemID FROM _Inventory WHERE CharID = @CharID AND Slot = @Slot_From
END
-- MagicCube ( PCInv -> MagicCube )
ELSEIF (@Operation = 39)
BEGIN
SELECT @ItemID_From = ItemID FROM _Inventory WHERE CharID = @CharID AND Slot = @Slot_From
END
-- MagicCube ( MagicCube -> PCInv )
ELSEIF (@Operation = 40)
BEGIN
SELECT @ItemID_From = ItemID FROM _InventoryForLinkedStorage WHERE LinkedItemID = @GuildID AND Slot = @Slot_From
END
-------------- Dst Item
IF (@Operation = 0 OR @Operation = 3 OR @Operation = 31)-- dst: inventory
BEGIN
SELECT @ItemID_To = ItemID FROM _Inventory WHERE CharID = @CharID AND Slot = @Slot_To
END
ELSEIF (@Operation = 1 OR @Operation = 2)-- dst: chest
BEGIN
SELECT @ItemID_To = ItemID FROM _Chest WHERE UserJID = @UserJID AND Slot = @Slot_To
END
ELSEIF (@Operation = 16)
BEGIN
SELECT @ItemID_To = ItemID FROM _InvCOS WHERE COSID = @CharID AND Slot = @Slot_To
END
ELSEIF (@Operation = 29 OR @Operation = 30)
BEGIN
SELECT @ItemID_To = ItemID FROM _GuildChest WHERE GuildID = @GuildID AND Slot = @Slot_To
END
-- Avatar ( Avatar -> PC )
ELSEIF (@Operation = 35)
BEGIN
SELECT @ItemID_To = ItemID FROM _Inventory WHERE CharID = @CharID AND Slot = @Slot_To
END
-- Avatar ( PC -> Avatar )
ELSEIF (@Operation = 36)
BEGIN
SELECT @ItemID_To = ItemID FROM _InventoryForAvatar WHERE CharID = @CharID AND Slot = @Slot_To
END
-- MagicCube ( PCInv -> MagicCube )
ELSEIF (@Operation = 39)
BEGIN
SELECT @ItemID_To = ItemID FROM _InventoryForLinkedStorage WHERE LinkedItemID = @GuildID AND Slot = @Slot_To
END
-- MagicCube ( MagicCube -> PCInv )
ELSEIF (@Operation = 40)
BEGIN
SELECT @ItemID_To = ItemID FROM _Inventory WHERE CharID = @CharID AND Slot = @Slot_To
END
--------------
IF (@RemoveAndOverwrite <> 0)
BEGIN
-- .
IF (@ItemID_From ISNULLOR @ItemID_To ISNULL)
BEGIN
RETURN-1003
END
IF (@ItemID_From = 0 OR @ItemID_To = 0)
BEGIN
RETURN-1004
END
END
ELSE
BEGIN
-- Source .
IF (@ItemID_From ISNULLOR @ItemID_From = 0)
BEGIN
RETURN-1005
END
IF (@ItemID_To ISNOTNULLAND @ItemID_To <> 0)
BEGIN
RETURN-1006
END
END
IF (@Operation = 0)
BEGIN
IF (@Slot_To < 13)
BEGIN
DECLARE @CheckValidity INT
EXEC @CheckValidity = _STRG_CHECKITEM_CANBE_EQUIPED@ItemID_From, @Slot_To
IF (@CheckValidity <= 0)
BEGIN
RETURN @CheckValidity
END
END
END
BEGINTRANSACTION
----------------------------------------------------------
-- Step2. Storage
----------------------------------------------------------
-------------- Src Slot
IF (@Operation = 0 OR @Operation = 2 OR @Operation = 30)
BEGIN
UPDATE _Inventory SET ItemID = 0 WHERE CharID = @CharID AND Slot = @Slot_From
IF (@@ROWCOUNT= 0 OR@@ERROR<> 0)
BEGIN
ROLLBACKTRANSACTION
RETURN-2
END
END
ELSEIF (@Operation = 1 OR @Operation = 3)
BEGIN
UPDATE _Chest SET ItemID = 0 WHERE UserJID = @UserJID AND Slot = @Slot_From
IF (@@ROWCOUNT= 0 OR@@ERROR<> 0)
BEGIN
ROLLBACKTRANSACTION
RETURN-2
END
END
ELSEIF (@Operation = 16)
BEGIN
UPDATE _InvCOS SET ItemID = 0 WHERE COSID = @CharID AND Slot = @Slot_From
IF (@@ROWCOUNT= 0 OR@@ERROR<> 0)
BEGIN
ROLLBACKTRANSACTION
RETURN-2
END
END
ELSEIF (@Operation = 29 OR @Operation = 31)
BEGIN
UPDATE _GuildChest SET ItemID = 0 WHERE GuildID = @GuildID AND Slot = @Slot_From
IF (@@ROWCOUNT= 0 OR@@ERROR<> 0)
BEGIN
ROLLBACKTRANSACTION
RETURN-2
END
END
-- Avatar ( Avatar -> PC )
ELSEIF (@Operation = 35 )
BEGIN
UPDATE _InventoryForAvatar SET ItemID = 0 WHERE CharID = @CharID AND Slot = @Slot_From
IF (@@ROWCOUNT= 0 OR@@ERROR<> 0)
BEGIN
ROLLBACKTRANSACTION
RETURN-2
END
END
-- Avatar ( PC -> Avatar )
ELSEIF (@Operation = 36 )
BEGIN
UPDATE _Inventory SET ItemID = 0 WHERE CharID = @CharID AND Slot = @Slot_From
IF (@@ROWCOUNT= 0 OR@@ERROR<> 0)
BEGIN
ROLLBACKTRANSACTION
RETURN-2
END
END
-- MagicCube ( PCInv -> MagicCube )
ELSEIF (@Operation = 39 )
BEGIN
UPDATE _Inventory SET ItemID = 0 WHERE CharID = @CharID AND Slot = @Slot_From
IF (@@ROWCOUNT= 0 OR@@ERROR<> 0)
BEGIN
ROLLBACKTRANSACTION
RETURN-2
END
END
-- MagicCube ( MagicCube -> PCInv )
ELSEIF (@Operation = 40 )
BEGIN
UPDATE _InventoryForLinkedStorage SET ItemID = 0 WHERE LinkedItemID = @GuildID AND Slot = @Slot_From
IF (@@ROWCOUNT= 0 OR@@ERROR<> 0)
BEGIN
ROLLBACKTRANSACTION
RETURN-2
END
END
-------------- Dst Slot
IF (@Operation = 0 OR @Operation = 3 OR @Operation = 31)
BEGIN
UPDATE _Inventory SET ItemID = @ItemID_From WHERE CharID = @CharID AND Slot = @Slot_To
END
ELSEIF (@Operation = 1 OR @Operation = 2)
BEGIN
UPDATE _Chest SET ItemID = @ItemID_From WHERE UserJID = @UserJID AND Slot = @Slot_To
END
ELSEIF (@Operation = 16)
BEGIN
UPDATE _InvCOS SET ItemID = @ItemID_From WHERE COSID = @CharID AND Slot = @Slot_To
END
ELSEIF (@Operation = 29 OR @Operation = 30)
BEGIN
UPDATE _GuildChest SET ItemID = @ItemID_From WHERE GuildID = @GuildID AND Slot = @Slot_To
END
-- Avatar ( Avatar -> PC )
ELSEIF (@Operation = 35)
BEGIN
UPDATE _Inventory SET ItemID = @ItemID_From WHERE CharID = @CharID AND Slot = @Slot_To
END
-- Avatar ( PC -> Avatar )
ELSEIF (@Operation = 36)
BEGIN
UPDATE _InventoryForAvatar SET ItemID = @ItemID_From WHERE CharID = @CharID AND Slot = @Slot_To
END
-- MagicCube ( PCInv -> MagicCube )
ELSEIF (@Operation = 39)
BEGIN
UPDATE _InventoryForLinkedStorage SET ItemID = @ItemID_From WHERE LinkedItemID = @GuildID AND Slot = @Slot_To
END
-- MagicCube ( MagicCube -> PCInv )
ELSEIF (@Operation = 40)
BEGIN
UPDATE _Inventory SET ItemID = @ItemID_From WHERE CharID = @CharID AND Slot = @Slot_To
END
IF (@@ROWCOUNT= 0 OR@@ERROR<> 0)
BEGIN
ROLLBACKTRANSACTION
RETURN-3
END
----------------------------------------------------------
-- Step3. Overwrite !
----------------------------------------------------------
IF (@RemoveAndOverwrite <> 0)
BEGIN
DECLARE @Rvalue INT
EXEC @Rvalue = _STRG_FREE_ITEM_NoTX@ItemID_To
IF (@Rvalue < 0)
BEGIN
ROLLBACKTRANSACTION
RETURN-4
END
END
----------------------------------------------------------
-- Step4. 4Byte Item Data ( !)
----------------------------------------------------------
DECLARE @Old_ItemData INT
SELECT @Old_ItemData = Data FROM _ITEMS WHERE ID64 = @ItemID_From
IF (@Old_ItemData ISNOTNULLAND @Old_ItemData <> @Data)
BEGIN
UPDATE _Items SET Data = @Data WHERE ID64 = @ItemID_From
IF (@@ROWCOUNT= 0 OR@@ERROR<> 0)
BEGIN
ROLLBACKTRANSACTION
RETURN-4
END
END
----------------------------------------------------------
-- Step4. COMMIT
----------------------------------------------------------
COMMITTRANSACTION
RETURN 1
arkadaslar bu proceduredeki -1006 ile ilgili hata.düzenled,m ama olmadı::S
eminmisin bura olduğuna