Jump to content
  • 0
Sign in to follow this  
Zirius

Who/which updates "ragsrvinfo" table?

Question

I just want to know how reliable is "ragsrvinfo", I like to put it on my fluxCP. The thing is I implemented floating rates, so I want to know if ragsrvinfo table is constantly getting updated or it remains static for a long time. Or it would be good that it gets updated everytime my floating rates NPC change the rates.

 

Thanks!

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Memory leaks have nothing to do with database values.
 
Seems char server deletes the table only on server startup, any changes will just insert a new row on it. Try to get the last row only, or perform an edit to remove the contents of the table prior to insert it.
 
I don't understand the char server's code very much, but if you've got only one server (since that index seems to change on the amount of servers you've active on your machine) try the following:
 
src/char/char.c

				if( SQL_ERROR == SQL->Query(sql_handle, "INSERT INTO `%s` SET index`='%d',`name`='%s',`exp`='%d',`jexp`='%d',`drop`='%d'",					ragsrvinfo_db, fd, esc_server_name, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)) )					Sql_ShowDebug(sql_handle);

 

Add just BEFORE that:

	if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s`", ragsrvinfo_db) )		Sql_ShowDebug(sql_handle);

 

And recompile your char server. This way you'll only have 1 entry on your SQL table at a time since any other entries will get deleted, then the line will be inserted.

 

Please perform this on a backup: I haven't tested it and, I repeat, I've got no experience with char server.

Share this post


Link to post
Share on other sites
  • 0

The values of the `ragsvrinfo` tables are set via this function in src/map/chrif.c on the map server, which sends it to the char server to store:

 

/*========================================== * Send rates to char server [Wizputer] * S 2b16 <base rate>.L <job rate>.L <drop rate>.L *------------------------------------------*/bool chrif_ragsrvinfo(int base_rate, int job_rate, int drop_rate) {	chrif_check(false);	WFIFOHEAD(chrif->fd,14);	WFIFOW(chrif->fd,0) = 0x2b16;	WFIFOL(chrif->fd,2) = base_rate;	WFIFOL(chrif->fd,6) = job_rate;	WFIFOL(chrif->fd,10) = drop_rate;	WFIFOSET(chrif->fd,14);		return true;}

 

These rates are placed on server boot and seem (not sure) to get instantly updated when you issue the GM @reloadbattleconf atcommand on the server. It just sends base, job and common item drop rates to the table.

 

You can give it a try.

Share this post


Link to post
Share on other sites
  • 0

The values of the `ragsvrinfo` tables are set via this function in src/map/chrif.c on the map server, which sends it to the char server to store:

 

/*========================================== * Send rates to char server [Wizputer] * S 2b16 <base rate>.L <job rate>.L <drop rate>.L *------------------------------------------*/bool chrif_ragsrvinfo(int base_rate, int job_rate, int drop_rate) {	chrif_check(false);	WFIFOHEAD(chrif->fd,14);	WFIFOW(chrif->fd,0) = 0x2b16;	WFIFOL(chrif->fd,2) = base_rate;	WFIFOL(chrif->fd,6) = job_rate;	WFIFOL(chrif->fd,10) = drop_rate;	WFIFOSET(chrif->fd,14);		return true;}

 

These rates are placed on server boot and seem (not sure) to get instantly updated when you issue the GM @reloadbattleconf atcommand on the server. It just sends base, job and common item drop rates to the table.

 

You can give it a try.

 

Yes thanks! Evidently it showed what you described. But, I think there's something wrong?

 

I got sooooo many entries in ragsrvinfo with the same indexes. Is that normal?

 

post-6720-0-02741000-1409497907_thumb.png

 

Memory leak i think?

 

edit. If you want to reproduce "this", @reloadbattleconf creates another entry in SQL everytime you type that command, i am using the latest git.

Edited by Zirius

Share this post


Link to post
Share on other sites
  • 0

so I want to know if ragsrvinfo table is constantly getting updated or it remains static for a long time.

it constantly getting updated

 

when @reloadbattleconf, it sends (srcmapatcommand.c)

chrif->ragsrvinfo(battle_config.base_exp_rate, battle_config.job_exp_rate, battle_config.item_rate_common);
then map-server.exe send the value to char-server.exe via (srccharchar.c)
				if( SQL_ERROR == SQL->Query(sql_handle, "INSERT INTO `%s` SET `index`='%d',`name`='%s',`exp`='%d',`jexp`='%d',`drop`='%d'",					ragsrvinfo_db, fd, esc_server_name, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)) )
.

.

ok ... I don't understand why they need a sql table to send a server rate ...

but for sure, whenever map-server change rate, it does send to the `ragsrvinfo` table

 

1 reason ... that I am just guessing ... is to support multi map-server

so with just 1 login server, the player can select which server they like to play, and each map-server has different rates

and that index indicate different map-server

I'm just guessing though, maybe try ask Ind

 

ok now I know why

in case that map-server.exe crash, and char-server.exe still up

it can retrieve the last value from SQL, because char-server.exe handles to rates

(srcmapcharif.c)

/*========================================== * timerFunction  * Check the connection to char server, (if it down) *------------------------------------------*/
.

.

.

... any changes will just insert a new row on it. Try to get the last row only...

I'm quite sure that inserting a new row in a non-indexed table, will be the 1st row

just do a

select * from ragsrvinfo limit 1;

would suffice

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0

 

so I want to know if ragsrvinfo table is constantly getting updated or it remains static for a long time.

it constantly getting updated

 

when @reloadbattleconf, it sends (srcmapatcommand.c)

chrif->ragsrvinfo(battle_config.base_exp_rate, battle_config.job_exp_rate, battle_config.item_rate_common);
then map-server.exe send the value to char-server.exe via (srccharchar.c)
				if( SQL_ERROR == SQL->Query(sql_handle, "INSERT INTO `%s` SET `index`='%d',`name`='%s',`exp`='%d',`jexp`='%d',`drop`='%d'",					ragsrvinfo_db, fd, esc_server_name, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)) )
.

.

ok ... I don't understand why they need a sql table to send a server rate ...

but for sure, whenever map-server change rate, it does send to the `ragsrvinfo` table

 

1 reason ... that I am just guessing ... is to support multi map-server

so with just 1 login server, the player can select which server they like to play, and each map-server has different rates

and that index indicate different map-server

I'm just guessing though, maybe try ask Ind

 

ok now I know why

in case that map-server.exe crash, and char-server.exe still up

it can retrieve the last value from SQL, because char-server.exe handles to rates

(srcmapcharif.c)

/*========================================== * timerFunction  * Check the connection to char server, (if it down) *------------------------------------------*/
.

.

.

>>>... any changes will just insert a new row on it. Try to get the last row only...

I'm quite sure that inserting a new row in a non-indexed table, will be the 1st row

just do a

select * from ragsrvinfo limit 1;

would suffice

 

 

Is there a way to stop Hercules' @reloadbattleconf on updating the table? That seems to be the only problem anyway.

jaBote's diff is enough. works great. Thanks!

 

Memory leaks have nothing to do with database values.

 

Seems char server deletes the table only on server startup, any changes will just insert a new row on it. Try to get the last row only, or perform an edit to remove the contents of the table prior to insert it.

 

I don't understand the char server's code very much, but if you've got only one server (since that index seems to change on the amount of servers you've active on your machine) try the following:

 

src/char/char.c

				if( SQL_ERROR == SQL->Query(sql_handle, "INSERT INTO `%s` SET index`='%d',`name`='%s',`exp`='%d',`jexp`='%d',`drop`='%d'",					ragsrvinfo_db, fd, esc_server_name, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)) )					Sql_ShowDebug(sql_handle);

 

Add just BEFORE that:

	if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s`", ragsrvinfo_db) )		Sql_ShowDebug(sql_handle);

 

And recompile your char server. This way you'll only have 1 entry on your SQL table at a time since any other entries will get deleted, then the line will be inserted.

 

Please perform this on a backup: I haven't tested it and, I repeat, I've got no experience with char server.

 

I had the option to create my own "ragsrvinfo" table that gets update everytime my floating rates NPC changes rates, but.... I think core edits are better, so I choose yours.

Edited by Zirius

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.