By completing this guide, you should be able to trigger adding kills to the counter and build your own custom systems.
Stored Procedure: _Counter_AddKill
Parameters:
@GroupID INT - Group ID
@CharID INT - Character ID
@Name VARCHAR(129) - Column 1 name
@P INT - Points
Let's add points to the selected counter and send a text notification to the character using _Char_SendTextNotification to ensure that the trigger works fine for us.
USE [vPlus]
GO
/****** Object: StoredProcedure [dbo].[_Counter_AddKill] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[_Counter_AddKill]
@GroupID INT,
@CharID INT,
@Name VARCHAR(129),
@P INT
AS
BEGIN
SET NOCOUNT ON;
/*
This procedure is used to add points to a custom counter.
If the character already exists in the counter data,
the points will be updated.
If the character does not exist yet, a new record
will be inserted.
*/
--------- Your code starts here --------
UPDATE _BattleLogSoloData
SET Points += @P
WHERE GroupID = @GroupID
AND Name = @Name;
IF (@@ROWCOUNT = 0)
BEGIN
INSERT INTO _BattleLogSoloData
(GroupID, CharID, Name, Points)
VALUES
(@GroupID, @CharID, @Name, @P);
END
DECLARE @Message VARCHAR(255) = 'You have earned ' + CAST(@P AS VARCHAR(16)) + ' points';
EXEC _Char_SendTextNotification @CharID, @Message, 1, 0, 0;
END
The selected character will receive points in the custom counter, and a text notification will be sent when the procedure is executed.