USE [SRO_VT_SHARD]
GO
/****** Object: StoredProcedure [dbo].[_STRG_DEL_ITEM] Script Date: 27.02.2018 14:38:47 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
ALTER PROCEDURE [dbo].[_STRG_DEL_ITEM]
@Operation AS TINYINT,
@CharID AS INT,
@Slot AS TINYINT,
@RemainGold AS BIGINT
AS
-- SP_DROP_ITEM : 7
-- SP_SELL_ITEM : 9
-- SP_DEL_ITEM_BY_SERVER : 15
-- SP_DROP_ITEM_COS : 18
-- SP_SELL_ITEM_COS : 20
-- SP_DEL_COSITEM_BY_SERVER : 22
-- SP_DEL_ITEM_IN_MAGIC_CUBE : 41
----------------------------------------------------------
-- Step1. »èÁ¦ÇÏ·Á´Â ¾ÆÀÌÅÛ ½½·Ô¿¡ ½ÇÁ¦·Î ¾ÆÀÌÅÛ Àִ°¡ È®ÀÎ
----------------------------------------------------------
DECLARE @IsPCOperation INT
IF (@Operation = 7 OR @Operation = 9 OR @Operation = 15)
BEGIN SET @IsPCOperation = 1 END
ELSE IF (@Operation = 41 )
BEGIN SET @IsPCOperation = 2 END
ELSE
BEGIN SET @IsPCOperation = 0 END
IF (@IsPCOperation <> 0)
BEGIN
DECLARE @CheckValidity INT
EXEC @CheckValidity = _STRG_MINIMAL_CHECK_VALIDITY @Operation, @Slot
IF (@CheckValidity <= 0)
BEGIN
RETURN @CheckValidity
END
END
begin transaction
declare @result int
exec @result = _STRG_DEL_ITEM_NoTX @IsPCOperation, @CharID, @Slot
if (@result < 0)
begin
rollback transaction
return (@result - 2000)
end
----------------------------------------------------------
-- Step4. ³²Àº °ñµå °»½Å
----------------------------------------------------------
IF (@Operation = 9 OR @Operation = 20) -- »óÁ¡ ÆǸŶó¸é...
BEGIN
DECLARE @PC_ID INT
IF (@IsPCOperation <> 0)
SET @PC_ID = @CharID
ELSE
SELECT @PC_ID = OwnerCharID FROM _CharCOS WHERE ID = @CharID -- COS ¿ë ¹°Ç°À» ÆǸÅÇѰŸé... ÁåÀå ã¾Æ¼ µ· ³Ö¾îÁØ´Ù..
UPDATE _Char SET RemainGold = @RemainGold WHERE CharID = @PC_ID
IF (@@ERROR <> 0)
BEGIN
rollback transaction
return -2010
END
END
----------------------------------------------------------
-- Step5. COMMIT
----------------------------------------------------------
commit transaction
return 1
GO
/****** Object: StoredProcedure [dbo].[_STRG_DEL_ITEM] Script Date: 27.02.2018 14:38:47 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
ALTER PROCEDURE [dbo].[_STRG_DEL_ITEM]
@Operation AS TINYINT,
@CharID AS INT,
@Slot AS TINYINT,
@RemainGold AS BIGINT
AS
-- SP_DROP_ITEM : 7
-- SP_SELL_ITEM : 9
-- SP_DEL_ITEM_BY_SERVER : 15
-- SP_DROP_ITEM_COS : 18
-- SP_SELL_ITEM_COS : 20
-- SP_DEL_COSITEM_BY_SERVER : 22
-- SP_DEL_ITEM_IN_MAGIC_CUBE : 41
----------------------------------------------------------
-- Step1. »èÁ¦ÇÏ·Á´Â ¾ÆÀÌÅÛ ½½·Ô¿¡ ½ÇÁ¦·Î ¾ÆÀÌÅÛ Àִ°¡ È®ÀÎ
----------------------------------------------------------
DECLARE @IsPCOperation INT
IF (@Operation = 7 OR @Operation = 9 OR @Operation = 15)
BEGIN SET @IsPCOperation = 1 END
ELSE IF (@Operation = 41 )
BEGIN SET @IsPCOperation = 2 END
ELSE
BEGIN SET @IsPCOperation = 0 END
IF (@IsPCOperation <> 0)
BEGIN
DECLARE @CheckValidity INT
EXEC @CheckValidity = _STRG_MINIMAL_CHECK_VALIDITY @Operation, @Slot
IF (@CheckValidity <= 0)
BEGIN
RETURN @CheckValidity
END
END
begin transaction
declare @result int
exec @result = _STRG_DEL_ITEM_NoTX @IsPCOperation, @CharID, @Slot
if (@result < 0)
begin
rollback transaction
return (@result - 2000)
end
----------------------------------------------------------
-- Step4. ³²Àº °ñµå °»½Å
----------------------------------------------------------
IF (@Operation = 9 OR @Operation = 20) -- »óÁ¡ ÆǸŶó¸é...
BEGIN
DECLARE @PC_ID INT
IF (@IsPCOperation <> 0)
SET @PC_ID = @CharID
ELSE
SELECT @PC_ID = OwnerCharID FROM _CharCOS WHERE ID = @CharID -- COS ¿ë ¹°Ç°À» ÆǸÅÇѰŸé... ÁåÀå ã¾Æ¼ µ· ³Ö¾îÁØ´Ù..
UPDATE _Char SET RemainGold = @RemainGold WHERE CharID = @PC_ID
IF (@@ERROR <> 0)
BEGIN
rollback transaction
return -2010
END
END
----------------------------------------------------------
-- Step5. COMMIT
----------------------------------------------------------
commit transaction
return 1