USE [PS_GameLog]
GO
/****** Object: Trigger [dbo].[GetDP] Script Date: 12/11/2018 9:13:45 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <[Dev]Velocity>
-- Create date: <12-11-18>
-- Description: <Get DP>
-- =============================================
CREATE trigger [dbo].[GetDP] on [PS_GameLog].[dbo].[ActionLog]
after insert, update
as
begin
declare @
ID int = (select UserUID from inserted)
DECLARE @
D int = (select CharID from inserted)
DECLARE @
Type tinyint = (Select ActionType FROM inserted)
DECLARE @
varchar(100) = (Select Text2 FROM inserted)
DECLARE @
int = (Select Value2 FROM inserted)
DECLARE @
4 int = (Select Value4 FROM inserted)
IF( @
Type = 114 )
BEGIN
IF( @
= 94007 )
BEGIN
UPDATE ps_userdata.dbo.users_master
SET point = point + ( 1 * @
4 )
WHERE useruid = @
ID
END
IF( @
= 94008 )
BEGIN
UPDATE ps_userdata.dbo.users_master
SET point = point + ( 2 * @
4 )
WHERE useruid = @
ID
END
IF( @
= 94009 )
BEGIN
UPDATE ps_userdata.dbo.users_master
SET point = point + ( 3 * @
4 )
WHERE useruid = @
ID
END
IF( @
= 94010 )
BEGIN
UPDATE ps_userdata.dbo.users_master
SET point = point + ( 4 * @
4 )
WHERE useruid = @
ID
END
IF( @
= 94011 )
BEGIN
UPDATE ps_userdata.dbo.users_master
SET point = point + ( 5 * @
4 )
WHERE useruid = @
ID
END
IF( @
= 94012 )
BEGIN
UPDATE ps_userdata.dbo.users_master
SET point = point + ( 6 * @
4 )
WHERE useruid = @
ID
END
IF( @
= 94013 )
BEGIN
UPDATE ps_userdata.dbo.users_master
SET point = point + ( 7 * @
4 )
WHERE useruid = @
ID
END
IF( @
= 94014 )
BEGIN
UPDATE ps_userdata.dbo.users_master
SET point = point + ( 8 * @
4 )
WHERE useruid = @
ID
END
IF( @
= 94025 )
BEGIN
UPDATE ps_userdata.dbo.users_master
SET point = point + ( 1 * @
4 )
WHERE useruid = @
ID
END
END
END