By completing this guide, you should be able to trigger PvP Matching event end and build your own custom systems.
Stored Procedure: _EventPvPMatching_End
Parameters:
@CharID1 INT - First character ID / Winner character ID
@CharName1 VARCHAR(64) - First character name / Winner character name
@CharID2 INT - Second character ID
@CharName2 VARCHAR(64) - Second character name
@IsDraw BIT - Determines whether the match ended as a draw
Let's send a text notification to both characters using _Char_SendTextNotification to ensure that the trigger works fine for us.
USE [vPlus]
GO
/****** Object: StoredProcedure [dbo].[_EventPvPMatching_End] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- ALTER date: <ALTER Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[_EventPvPMatching_End]
@CharID1 INT,
@CharName1 VARCHAR(64),
@CharID2 INT,
@CharName2 VARCHAR(64),
@IsDraw BIT
AS
BEGIN
SET NOCOUNT ON;
/*
This procedure is executed when PvP Matching ends.
@CharID1 and @CharName1 represent the winner character
when the match does not end as a draw.
@IsDraw determines whether the match ended as a draw.
*/
--------- Your code starts here --------
IF (@IsDraw = 1)
BEGIN
EXEC _Char_SendTextNotification @CharID1, 'Your PvP Matching battle ended as a draw!', 1, 0, 0;
EXEC _Char_SendTextNotification @CharID2, 'Your PvP Matching battle ended as a draw!', 1, 0, 0;
RETURN;
END
EXEC _Char_SendTextNotification @CharID1, 'You have won the PvP Matching battle!', 1, 0, 0;
EXEC _Char_SendTextNotification @CharID2, 'You have lost the PvP Matching battle!', 1, 0, 0;
END