Cookies


Vsroplus only uses the cookies it needs to keep you signed in and remember your language. No ads, no tracking.

Got it

Need to learn more? Privacy policy

Our guides are in English for now.

Job Experience

Stored Procedure: _OnJobExpEarned

Parameters:

  • @UserJID INT - User JID
  • @CharID INT - Character ID
  • @CharName16 VARCHAR(64) - Character name
  • @NickName16 VARCHAR(64) - Job nickname
  • @JobType TINYINT - Job type
  • @ExpEarned INT - EXP gained

Let us send a text notification to the character using _Char_SendTextNotification to make sure that the trigger works correctly.

USE [vPlus]
GO
/****** Object:  StoredProcedure [dbo].[_OnJobExpEarned]    Script Date: 1/16/2024 2:02:36 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[_OnJobExpEarned]
    @UserJID INT,
    @CharID INT,
    @CharName16 VARCHAR(64),
    @NickName16 VARCHAR(64),
    @JobType TINYINT,
    @ExpEarned INT
AS
BEGIN
    SET NOCOUNT ON;

    UPDATE _RankingJobPoints
    SET Points += @ExpEarned / 100, LastUpdate = GETDATE()
    WHERE CharID = @CharID AND JobType = @JobType

    IF (@@ROWCOUNT = 0)
        INSERT INTO _RankingJobPoints VALUES (@CharID, @JobType, @ExpEarned / 100, GETDATE())

    --------- Your code starts here --------
    -- Declaring text notification message
    DECLARE @Message VARCHAR(255) = 'You have gained ' + CAST(@ExpEarned AS NVARCHAR) + ' job EXP'

    EXEC _Char_SendTextNotification @CharID, @Message, 1, 0, 0
END

Last updated: 16 January, 2024

An error has occurred. This application may no longer respond until reloaded. Reload 🗙