USE [SRO_VT_LOG]
GO
/****** Object: StoredProcedure [dbo].[_DyeSysSHSP] Script Date: 27.4.2020 19:59:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-------------------------------------------------------------------------------------------------------------------
-- Step 2
-- ±âÁ¸ ¾ÆÀÌÅÛ ·Î±× ÀÔ·Â Stored procedure ¼öÁ¤
-- DataBase : Shard Log
ALTER procedure [dbo].[_DyeSysSHSP]
@CharID int,
@ItemRefID int
as
DECLARE @ItemID int
,@RefItemID int
,@Color varchar(16)
,@RareT varchar(16)
,@NItem int
,@DG INT
,@T1 tinyint
,@T2 tinyint
,@T3 tinyint
,@T4 tinyint
SELECT @Color = CASE WHEN @ItemRefID = '42169' THEN 'BLUE'
WHEN @ItemRefID = '42170' THEN 'BODH'
WHEN @ItemRefID = '42171' THEN 'BODZ'
WHEN @ItemRefID = '42172' THEN 'FIRE'
WHEN @ItemRefID = '42173' THEN 'FIRE_1'
WHEN @ItemRefID = '42174' THEN 'GREEN'
WHEN @ItemRefID = '42175' THEN 'RED'
WHEN @ItemRefID = '42176' THEN 'YELLOW'
WHEN @ItemRefID = '42177' THEN 'RAINBOW'
WHEN @ItemRefID = '42178' THEN 'PURB'
WHEN @ItemRefID = '42179' THEN 'ORANGE'
WHEN @ItemRefID = '42180' THEN 'NORMAL'
ELSE NULL END
SELECT @ItemID=I.ID64 , @RefItemID = I.RefItemID
FROM SRO_VT_SHARD.dbo._Items I INNER JOIN SRO_VT_SHARD.dbo._Inventory Iv
ON I.ID64 = Iv.ItemID
WHERE Iv.Slot = '7' AND Iv.CharID = @CharID
-- First item
SELECT @T1 = TypeID1 , @T2 = TypeID2 , @T3 = TypeID3 , @T4 = TypeID4 , @DG = DG
FROM SRO_VT_LOG.dbo._DyeSysSH WHERE ID = @RefItemID
-- Secound item
SELECT @NItem = ID FROM SRO_VT_LOG.dbo._DyeSysSH
WHERE TypeID1 = @T1
AND TypeID2 = @T2
AND TypeID3 = @T3
AND TypeID4 = @T4
AND Color = @Color
AND DG = @DG
-- Upcating
UPDATE SRO_VT_SHARD.dbo._Items SET RefItemID = @NItem WHERE ID64 = @ItemID