Jp over flow

07/20/2015 06:14 mlejnek2#1
so is there anything i can do to keep the jp from overflowing when players get too much jp they get that cannot connect to server error and what not when i drop there total_jp to 0 or lower number then they dont get the error so is there a way to cap the total_jp ? or is there a way to add a function to a LUA that auto detects players Total_jp and caps it out or resets it back to 0 ?
07/20/2015 12:59 ThunderNikk#2
Sure there is a way to write a lua to reset the JP back to a smaller value and there is also a way to create a JP trader to allow players to transfer their JP into something else.

[Only registered and activated users can see links. Click Here To Register...]
07/20/2015 20:21 mlejnek2#3
its not the jp they have thats overflowing its the Total_jp that is causing this problem
07/20/2015 20:34 ThunderNikk#4
S if it is a cumulative total_jp number that stays the same even if they trade their jp or you change their jp to a lower number.

This total JP is only used if they reset their JP on a rebirth or a respec potion?

Maybe change total_jp column to a larger allowed integer?

You could do a on log in function that reduces this number or run a script that sets the number to 0 on a global scale once a week for maintenance but I am not sure what will be affected.

update telecaster.dbo.character set total_jp = 0 where name like '%'

That is if total_jp is in the character tables.

on_login lua

Use the get_value or gv total_jp function

if total_jp > 600,000,000,000 then set total_jp = (total_jp - 100,000,000,000)

Or something like that. I cant really write one without testing it.
07/20/2015 21:51 TheOnlyOneRaskim#5
Or just use the allmighty smp for that case : smp_read_character_list

Code:
USE [Telecaster]
GO
/****** Object:  StoredProcedure [dbo].[smp_read_character_list]    Script Date: 20.07.2015 21:49:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- start of smp_read_character_list
ALTER PROCEDURE [dbo].[smp_read_character_list]

@IN_ACCOUNT_ID		INT

AS
SET NOCOUNT ON

--SET ROWCOUNT 1
--WHILE 1=1
--BEGIN
--	UPDATE dbo.Character SET name = '@' + name + ' '+ SUBSTRING( CONVERT(varchar(40), GETDATE(), 21) , 3, 18 ) WHERE account_id = @IN_ACCOUNT_ID AND delete_time <= GETDATE() and name not like '@%';
--	IF @@ROWCOUNT = 0 BREAK
--END
--SET ROWCOUNT 0

SELECT	sid,
		name,
		race,
		sex,
		lv,
		jlv,
		exp,
		hp,
		mp,
		job,
		permission,
		skin_color,
		model_00,
		model_01,
		model_02,
		model_03,
		model_04,
		hair_color_index,
		hair_color_rgb,
		hide_equip_flag,
		texture_id,
		permission,
		create_time,
		delete_time,
		login_time,
		login_count,
		logout_time,
		play_time
		FROM dbo.Character WITH (NOLOCK) WHERE account_id = @IN_ACCOUNT_ID AND name NOT LIKE '@%' ORDER BY sid;



                -------- updating high values here---------------
                -------- this is just an example.....
		update dbo.Character set total_jp = 500000000 where total_jp > 500000000 

RETURN @@ERROR
07/21/2015 04:50 mlejnek2#6
its in the table and i would really like it if there was a On log in Lua so hen players log on it auto resets there total_jp is say over 10 bil it will set it back to 10 bil so when they relog they dont get that error anymore...
07/21/2015 05:18 mlejnek2#7
If you are willing to make me a LUA function i would surely inject it into my lua and use it that would be greatfull and as always tyvm for the help
07/21/2015 05:22 mlejnek2#8
Quote:
Originally Posted by TheOnlyOneRaskim View Post
Or just use the allmighty smp for that case : smp_read_character_list

Code:
USE [Telecaster]
GO
/****** Object:  StoredProcedure [dbo].[smp_read_character_list]    Script Date: 20.07.2015 21:49:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- start of smp_read_character_list
ALTER PROCEDURE [dbo].[smp_read_character_list]

@IN_ACCOUNT_ID		INT

AS
SET NOCOUNT ON

--SET ROWCOUNT 1
--WHILE 1=1
--BEGIN
--	UPDATE dbo.Character SET name = '@' + name + ' '+ SUBSTRING( CONVERT(varchar(40), GETDATE(), 21) , 3, 18 ) WHERE account_id = @IN_ACCOUNT_ID AND delete_time <= GETDATE() and name not like '@%';
--	IF @@ROWCOUNT = 0 BREAK
--END
--SET ROWCOUNT 0

SELECT	sid,
		name,
		race,
		sex,
		lv,
		jlv,
		exp,
		hp,
		mp,
		job,
		permission,
		skin_color,
		model_00,
		model_01,
		model_02,
		model_03,
		model_04,
		hair_color_index,
		hair_color_rgb,
		hide_equip_flag,
		texture_id,
		permission,
		create_time,
		delete_time,
		login_time,
		login_count,
		logout_time,
		play_time
		FROM dbo.Character WITH (NOLOCK) WHERE account_id = @IN_ACCOUNT_ID AND name NOT LIKE '@%' ORDER BY sid;



                -------- updating high values here---------------
                -------- this is just an example.....
		update dbo.Character set total_jp = 500000000 where total_jp > 500000000 

RETURN @@ERROR
try'ed this and still not changing the total_jp to any number no matter what i set it too with this its still stays what it was and also why is the smp.update_character locked cant even check it to see if the error is in there its encryted and i cant do anything with it
07/22/2015 14:45 Xijezu#9
Quote:
Originally Posted by thndr View Post
Maybe change total_jp column to a larger allowed integer?
It doesn't affect anything since the GS simply converts the number back into its type (probably an Int32).
Also I wouldn't recommend such changes anyways, you'll never know how it affects the gameserver itself, it may cause crashes or other issues.

Quote:
Originally Posted by mlejnek2 View Post
its in the table and i would really like it if there was a On log in Lua so hen players log on it auto resets there total_jp is say over 10 bil it will set it back to 10 bil so when they relog they dont get that error anymore...
I'm not quite sure if the total_jp is actually needed somehow (probably, as mentioned before, on a jobreset) but you could simply add something like this to the onlogin() function (if set_value supports total_jp, not sure about this):

Code:
-- The max value of 32-bit integer is 2,147,483,647
-- so we simply set it back to 1,000,000,000.
-- There is now enough left to not overflow 
-- (except you powerlevel with 170 for 24 hours or something)
if gv("total_jp") > 1000000000 then
    sv("total_jp", 1000000000)
end
07/22/2015 20:47 mlejnek2#10
ty Xijezu will try that is the GS for the posted 9.1 files also 32 bit cause thats what im using atm.