summaryrefslogtreecommitdiff
path: root/src/map/chrif.c
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-12-12 00:44:38 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-12-12 00:44:38 +0000
commit2ce7aa656df82a7261c94fe14b9abc59ab6e4826 (patch)
treee1333f9d1a0ee3fb8b81648e3b577a8fa7de8015 /src/map/chrif.c
parent9d66536843f514671766257c54ad9350923548fe (diff)
downloadhercules-2ce7aa656df82a7261c94fe14b9abc59ab6e4826.tar.gz
hercules-2ce7aa656df82a7261c94fe14b9abc59ab6e4826.tar.bz2
hercules-2ce7aa656df82a7261c94fe14b9abc59ab6e4826.tar.xz
hercules-2ce7aa656df82a7261c94fe14b9abc59ab6e4826.zip
* Updates to dynamic server information `ragsrvinfo` on SQL.
- Fixed exp and drop rates (int) getting truncated (short) when sent to char-server. - Removed `motd` from `ragsrvinfo` as it is not dynamically changed by the server and as such can be read by 3rd party applications directly from conf/motd.txt if required. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14579 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/chrif.c')
-rw-r--r--src/map/chrif.c38
1 files changed, 8 insertions, 30 deletions
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 40e7ca8d1..a9634d2c2 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -74,7 +74,7 @@ static const int packet_len_table[0x3d] = { // U - used, F - free
//2b13: Incoming, chrif_accountdeletion -> 'Delete acc XX, if the player is on, kick ....'
//2b14: Incoming, chrif_accountban -> 'not sure: kick the player with message XY'
//2b15: FREE
-//2b16: Outgoing, chrif_ragsrvinfo -> 'sends motd / rates ....'
+//2b16: Outgoing, chrif_ragsrvinfo -> 'sends base / job / drop rates ....'
//2b17: Outgoing, chrif_char_offline -> 'tell the charserver that the char is now offline'
//2b18: Outgoing, chrif_char_reset_offline -> 'set all players OFF!'
//2b19: Outgoing, chrif_char_online -> 'tell the charserver that the char .. is online'
@@ -1229,40 +1229,18 @@ int chrif_load_scdata(int fd)
/*==========================================
* Send rates and motd to char server [Wizputer]
- * S 2b16 <base rate>.w <job rate>.w <drop rate>.w <motd len>.w <motd>.256B
+ * S 2b16 <base rate>.L <job rate>.L <drop rate>.L
*------------------------------------------*/
- int chrif_ragsrvinfo(int base_rate, int job_rate, int drop_rate)
+int chrif_ragsrvinfo(int base_rate, int job_rate, int drop_rate)
{
- char buf[256];
- FILE *fp;
- int i;
-
chrif_check(-1);
- WFIFOHEAD(char_fd, sizeof(buf) + 10);
+ WFIFOHEAD(char_fd,14);
WFIFOW(char_fd,0) = 0x2b16;
- WFIFOW(char_fd,2) = base_rate;
- WFIFOW(char_fd,4) = job_rate;
- WFIFOW(char_fd,6) = drop_rate;
- WFIFOW(char_fd,8) = sizeof(buf) + 10;
-
- if ((fp = fopen(motd_txt, "r")) != NULL) {
- if (fgets(buf, sizeof(buf), fp) != NULL)
- {
- for(i = 0; buf[i]; i++) {
- if (buf[i] == '\r' || buf[i] == '\n') {
- buf[i] = 0;
- break;
- }
- }
- memcpy(WFIFOP(char_fd,10), buf, sizeof(buf));
- }
- fclose(fp);
- } else {
- memset(buf, 0, sizeof(buf)); //No data found, send empty packets?
- memcpy(WFIFOP(char_fd,10), buf, sizeof(buf));
- }
- WFIFOSET(char_fd,WFIFOW(char_fd,8));
+ WFIFOL(char_fd,2) = base_rate;
+ WFIFOL(char_fd,6) = job_rate;
+ WFIFOL(char_fd,10) = drop_rate;
+ WFIFOSET(char_fd,14);
return 0;
}