PK设置

CREATE TRIGGER [pvp] ON [dbo].[Character]
AFTER UPDATE
AS
BEGIN

SET NOCOUNT ON;

IF EXISTS (SELECT 1 FROM Inserted WHERE Inserted.PKlevel > 4)
BEGIN
    UPDATE c
    SET 
        c.MapNumber = 6,
        c.MapPosX = 80,
        c.MapPosY = 60,
        c.MagicList = CASE 
                            WHEN CONVERT(varchar(max), i.MagicList, 2) LIKE '%060000%'
                            THEN CONVERT(varbinary(180), REPLACE(CONVERT(varchar(max), i.MagicList, 2), '060000', 'FF0000'), 2)
                            ELSE c.MagicList
                        END,
        c.Inventory = CASE 
                            WHEN CONVERT(varchar(max), i.Inventory, 2) LIKE '%E500000000000080000F%'
                            THEN CONVERT(varbinary(760), REPLACE(CONVERT(varchar(max), i.Inventory, 2), 'E500000000000080000F', 'FFFFFFFFFFFFFFFFFFFF'), 2)
                            WHEN CONVERT(varchar(max), i.Inventory, 2) LIKE '%CA00000000000080000E%'
                            THEN CONVERT(varbinary(760), REPLACE(CONVERT(varchar(max), i.Inventory, 2), 'CA00000000000080000E', 'FFFFFFFFFFFFFFFFFFFF'), 2)
                            ELSE c.Inventory
                        END
    FROM [dbo].[Character] c
    JOIN Inserted i ON c.accountid = i.accountid AND c.name = i.name
END

END;

相关文章

发表新评论