Simple Query to fix Job Exp negative value (database side)
This prolly an old problem, but not sure if there's any fixes around :)
Problem is sometimes when we reached lvl 7 job at 100%, the client still adding exp despite if you set NULL or -1 in [_RefLevel] or leveldata.txt (No idea what's the offset for it, especially on client side), so I added a trigger to reset it back to normal value during the update, on client side will take effect after the char teleported.
here's the boring part:
Code:
USE [SRO_VT_SHARD]
GO
/* Trigger to fix "Exp" and "Contribution point" whenever they
* bumped to more than 2147483647 (Maximum INT value)
*
* Change ALTER TRIGGER to CREATE TRIGGER on first time use.
*
* Compatibility: SQL 2008/SQL 2012
*/
ALTER TRIGGER TR_CHARTRIJOB_EXP_CHECK ON _CharTriJob AFTER UPDATE
AS
BEGIN
/*
* Get newest updated character ID and contribution point
*/
DECLARE @CharID AS INT = (SELECT TOP(1) CharID FROM INSERTED)
DECLARE @Contribution AS INT = (SELECT TOP(1) [Contribution] FROM INSERTED)
/*
* If contribution point more than 2147483647 or negative, reset it back to 2147483647
*/
IF (@Contribution > 2147483647 OR @Contribution < 0)
BEGIN
UPDATE _CharTriJob SET [Contribution] = 2147483647 WHERE CharID = @CharID
END
/*
* If level is 7, always reset exp back to 0
*/
DECLARE @level AS INT = (SELECT TOP(1) [Level] FROM INSERTED)
IF (@level = 7)
BEGIN
UPDATE _CharTriJob SET [Exp] = 0 WHERE CharID = @CharID
END
END
GO
It's probably useless but u may use it if you like :)
IMPORTANT!: If this is the first time you create the trigger, change the ALTER TRIGGER to CREATE TRIGGER. Once the trigger exist in your db you can use ALTER TRIGGER on every modifications you made on that trigger :)
Re: Simple Query to fox Job Exp negative value (database side)
Re: Simple Query to fox Job Exp negative value (database side)
Re: Simple Query to fix Job Exp negative value (database side)
Msg 208, Level 16, State 6, Procedure TR_CHARTRIJOB_EXP_CHECK, Line 10
Invalid object name 'TR_CHARTRIJOB_EXP_CHECK'.