- Joined
- Jul 24, 2011
- Messages
- 806
- Reaction score
- 615
What is the Stat Tokens?
Stat Tokens are an ingame items which allow you to add custom amount of Stat Point to the characters using via Account database CABAL_SP_USE_PREMIUMITEM stored procedure.
These tokens was used on my last server concept, in case if you wanna reuse it.
How secure is it?
It's 100% bugless, many defensive interaction implemented to avoid bugs.
Method is simple, they using a coin which is stored in own SQL variable, once they relog, it will apply to PNT.
Functions:
- Handling the different coin types. (You can customize the values)
- Checking the maximum stat cap. (You can customize the cap)
- Returning the unused/bugged tokens/items.
Code:
Create an AddPNT field into the game database (Server01) dbo.cabal_character_table
Account Databse -> Stored Procedures -> CABAL_SP_USE_PREMIUMITEM
Server01 (gamedb) -> Stored Procedures dbo.get_cabal_character
For ingame item simply use PRIM (79) item type both in server and client side, and only the item option matter for this script.
Good luck and have fun!
Stat Tokens are an ingame items which allow you to add custom amount of Stat Point to the characters using via Account database CABAL_SP_USE_PREMIUMITEM stored procedure.
These tokens was used on my last server concept, in case if you wanna reuse it.
How secure is it?
It's 100% bugless, many defensive interaction implemented to avoid bugs.
Method is simple, they using a coin which is stored in own SQL variable, once they relog, it will apply to PNT.
Functions:
- Handling the different coin types. (You can customize the values)
- Checking the maximum stat cap. (You can customize the cap)
- Returning the unused/bugged tokens/items.
Code:
Create an AddPNT field into the game database (Server01) dbo.cabal_character_table
Account Databse -> Stored Procedures -> CABAL_SP_USE_PREMIUMITEM
SQL:
USE [Account]
GO
/****** Object: StoredProcedure [dbo].[CABAL_SP_USE_PREMIUMITEM] Script Date: 2024. 02. 12. 7:17:51 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[CABAL_SP_USE_PREMIUMITEM](@UserNum int, @GoodsNum int)
AS
BEGIN
DECLARE @PREMIUMITEM_APPLY_OK int
DECLARE @PREMIUMITEM_STANDBY_OK int
DECLARE @PREMIUMITEM_ERROR int
SET @PREMIUMITEM_APPLY_OK = 0x11
SET @PREMIUMITEM_STANDBY_OK = 0x12
SET @PREMIUMITEM_ERROR = 0x13
DECLARE @Result int
DECLARE @ServiceType int
SET @ServiceType=1
DECLARE @OutputExpireDate [DateTime]
DECLARE @ExpireDate INT --UTC
SET @ExpireDate = CAST(DATEADD(DAY, 1, GETDATE()) as int)
-- VARS
DECLARE @CurrentChar int
DECLARE @CurrentStats int
DECLARE @CurrentDays int
SELECT @CurrentChar = (SELECT Top 1 CharacterIdx FROM Server01.dbo.cabal_character_table WHERE CharacterIdx/8 = @userNum AND Login = '1' )
SELECT @CurrentStats=STR+DEX+INT+PNT+AddPNT FROM Server01.dbo.cabal_character_table WHERE CharacterIdx=@CurrentChar
-- Days for auto increase of limit.
SET @CurrentDays = DATEDIFF(day, '2024-01-01 07:09:04.797', GETDATE())
-- Stat Token types
IF @goodsNum IN ('10','30','50','100','250','500','1000')
BEGIN
IF @CurrentStats + @GoodsNum <= 200000 + @CurrentDays * 5000
BEGIN
UPDATE Server01.dbo.cabal_character_table SET AddPNT = AddPnt + @GoodsNum, AddPNTDate = GETDATE() WHERE CharacterIdx=@CurrentChar
SET @Result = @PREMIUMITEM_STANDBY_OK
END
ELSE
BEGIN
DECLARE @ItemID INT
IF @GoodsNum='10'
BEGIN
SET @ItemID = '881'
END
ELSE IF @GoodsNum='30'
BEGIN
SET @ItemID = '882'
END
ELSE IF @GoodsNum='50'
BEGIN
SET @ItemID = '883'
END
ELSE IF @GoodsNum='100'
BEGIN
SET @ItemID = '884'
END
ELSE IF @GoodsNum='250'
BEGIN
SET @ItemID = '885'
END
ELSE IF @GoodsNum='500'
BEGIN
SET @ItemID = '886'
END
ELSE IF @GoodsNum='1000'
BEGIN
SET @ItemID = '887'
END
ELSE
BEGIN
SET @ItemID = '0'
END
IF @ItemID>'0'
BEGIN
EXEC Server01.dbo.cabal_sp_mail_send_GM @CurrentChar,
'Stat Point Add Failed',
'You reached your current stat limit. Your Limit increases by 5.000 Stats every day at 12AM Server Time.
You got the failed Token back.', @ItemID, @GoodsNum, 0
END
ELSE
EXEC Server01.dbo.cabal_sp_mail_send_GM @CurrentChar,
'Error',
@GoodsNum, 0, 0, 0
SET @Result = @PREMIUMITEM_STANDBY_OK
END
END
ELSE
BEGIN
SET @Result = @PREMIUMITEM_STANDBY_OK
END
SELECT @Result, @ServiceType, @ExpireDate
END
Server01 (gamedb) -> Stored Procedures dbo.get_cabal_character
SQL:
DECLARE @AddPNT INT
DECLARE @Login INT
SELECT @AddPNT=AddPnt, @Login=Login FROM Server01.dbo.cabal_character_table WHERE CharacterIdx=@CHARACTERIDX
IF (@CH_LEV = 200 AND @AddPNT>0 AND @Login=0)
BEGIN
SET @CH_PNT = @CH_PNT + @AddPNT
DECLARE @statmessage varchar(255)
SET @statmessage = 'Notice: ' + CAST(@AddPNT as varchar) + ' unallocated Stat Points got added to your character!'
UPDATE Server01.dbo.cabal_character_table SET PNT=@CH_PNT, AddPnt = 0 WHERE CharacterIdx=@CHARACTERIDX
EXEC Server01.dbo.cabal_sp_mail_send_GM @CHARACTERIDX,
'Stat Points added',
@statmessage, 0, 0, 0
END
For ingame item simply use PRIM (79) item type both in server and client side, and only the item option matter for this script.
Good luck and have fun!