By completing this guide, you should be able to trigger job item sell success to function and build your own custom systems.
Stored Procedure: _OnCOSCartSellSuccess
Parameters:
@NPCID INT - NPC ID
@NPCCodeName128 VARCHAR(129) - NPC CodeName128
@CharID INT - Character ID
@CosID INT - Trade pet ID
@Slot TINYINT - Slot number
@RefItemID INT - Item ID
@RefItemCodeName128 VARCHAR(129) - Item CodeName128
@Quantity SMALLINT - Quantity of items
Let's count the amount of sold items 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].[_OnCOSCartSellSuccess] Script Date: 1/11/2024 3:45:16 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- ALTER date: <ALTER Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[_OnCOSCartSellSuccess]
@NPCID INT,
@NPCCodeName128 VARCHAR(129),
@CharID INT,
@CosID INT,
@Slot TINYINT,
@RefItemID INT,
@RefItemCodeName128 VARCHAR(129),
@Quantity SMALLINT
AS
BEGIN
SET NOCOUNT ON;
/*
This procedure is executed whenever a character
successfully sells job items from a trade pet.
*/
--------- Your code starts here --------
-- Declaring a message to be sent to the character
DECLARE @Message VARCHAR(255) = 'You sold ' + CAST(@Quantity AS NVARCHAR) + ' items.';
-- Sending the message to the character
EXEC _Char_SendTextNotification @CharID, @Message, 1, 0, 0;
END