summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--src/char/char.c12
-rw-r--r--src/char_sql/char.c12
-rw-r--r--src/common/mmo.h4
-rw-r--r--src/map/chrif.c32
5 files changed, 57 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 0dff88c72..0d95c0f86 100644
--- a/Makefile
+++ b/Makefile
@@ -25,6 +25,8 @@ OPT += -ffast-math
OPT += -Wall -Wno-sign-compare
# Uncomment this one if you are using GCC 4.X
# OPT += -Wno-unused-parameter -Wno-pointer-sign
+# Server Packet Protocol version (also defined in src/common/mmo.h)
+# OPT += -DPACKETVER=8
# Makes map-wide script variables be saved to SQL instead of TXT files.
# OPT += -DMAPREGSQL
# Turbo is an alternate socket access implementation which should be faster.
diff --git a/src/char/char.c b/src/char/char.c
index 9a251d733..1e95d7644 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -2676,6 +2676,16 @@ int char_send_fame_list(int fd) {
return 0;
}
+void char_update_fame_list(int type, int index, int fame)
+{
+ char buf[9];
+ WBUFW(buf,0) = 0x2b22;
+ WBUFB(buf,2) = type;
+ WBUFB(buf,3) = index;
+ WBUFL(buf,4) = fame;
+ mapif_sendall(buf, 8);
+}
+
int search_mapserver(unsigned short map, long ip, short port);
int parse_frommap(int fd) {
@@ -3174,7 +3184,7 @@ int parse_frommap(int fd) {
(pos == size-1 || fame > list[pos+1].fame)
) { //No change in order.
list[(int)pos].fame = fame;
- char_send_fame_list(fd);
+ char_update_fame_list(type, pos, fame);
break;
}
// If the player's already in the list, remove the entry and shift the following ones 1 step up
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index c6a8e606e..4db97be38 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -2399,6 +2399,16 @@ int char_send_fame_list(int fd) {
return 0;
}
+void char_update_fame_list(int type, int index, int fame)
+{
+ char buf[9];
+ WBUFW(buf,0) = 0x2b22;
+ WBUFB(buf,2) = type;
+ WBUFB(buf,3) = index;
+ WBUFL(buf,4) = fame;
+ mapif_sendall(buf, 8);
+}
+
int search_mapserver(unsigned short map, long ip, short port);
//Loads a character's name and stores it in the buffer given (must be NAME_LENGTH in size)
@@ -2964,7 +2974,7 @@ int parse_frommap(int fd) {
(pos == size-1 || fame > list[pos+1].fame)
) { //No change in order.
list[(int)pos].fame = fame;
- char_send_fame_list(fd);
+ char_update_fame_list(type, pos, fame);
break;
}
// If the player's already in the list, remove the entry and shift the following ones 1 step up
diff --git a/src/common/mmo.h b/src/common/mmo.h
index f946b46cb..ea997aa5a 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -9,7 +9,9 @@
#include "utils.h" // _WIN32
// server protocol version
-#define PACKETVER 8
+#ifndef PACKETVER
+ #define PACKETVER 8
+#endif
#define FIFOSIZE_SERVERLINK 256*1024
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 68b97e5b2..f3cf7b7b2 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -38,7 +38,7 @@ static const int packet_len_table[0x3d] = {
6,30,-1,10,86, 7,44,34, // 2b08-2b0f: U->2b08, U->2b09, U->2b0a, U->2b0b, U->2b0c, U->2b0d, U->2b0e, U->2b0f
0,-1,10, 6,11,-1, 0, 0, // 2b10-2b17: U->2b10, U->2b11, U->2b12, U->2b13, U->2b14, U->2b15, U->2b16, U->2b17
-1,-1,-1,-1,-1,-1, 2, 7, // 2b18-2b1f: U->2b18, U->2b19, U->2b1a, U->2b1b, U->2b1c, U->2b1d, U->2b1e, U->2b1f
- -1,10,-1,-1,-1,-1,-1,-1, // 2b20-2b27: U->2b20, U->2b21, F->2b22, F->2b23, F->2b24, F->2b25, F->2b26, F->2b27
+ -1,10, 8,-1,-1,-1,-1,-1, // 2b20-2b27: U->2b20, U->2b21, U->2b22, U->2b23, F->2b24, F->2b25, F->2b26, F->2b27
};
//Used Packets:
@@ -84,7 +84,8 @@ static const int packet_len_table[0x3d] = {
//2b1f: Incomming, chrif_disconnectplayer -> 'disconnects a player (aid X) with the message XY ... 0x81 ..' [Sirius]
//2b20: Incomming, chrif_removemap -> 'remove maps of a server (sample: its going offline)' [Sirius]
//2b21: Incomming, chrif_save_ack. Returned after a character has been "final saved" on the char-server. [Skotlex]
-//2b22-2b27: FREE
+//2b22: Incomming, chrif_updatefamelist_ack. Updated one position in the fame list.
+//2b24-2b27: FREE
int chrif_connected = 0;
int char_fd = 0; //Using 0 instead of -1 is safer against crashes. [Skotlex]
@@ -1192,6 +1193,32 @@ int chrif_recvfamelist(int fd)
return 0;
}
+int chrif_updatefamelist_ack(int fd)
+{
+ struct fame_list *list;
+ char index;
+ RFIFOHEAD(fd);
+ switch (RFIFOB(fd, 2))
+ {
+ case 1:
+ list = smith_fame_list;
+ break;
+ case 2:
+ list = chemist_fame_list;
+ break;
+ case 3:
+ list = taekwon_fame_list;
+ break;
+ default:
+ return 0;
+ }
+ index = RFIFOB(fd, 3);
+ if (index < 0 || index >= MAX_FAME_LIST)
+ return 0;
+ list[(int)index].fame = RFIFOL(fd, 4);
+ return 1;
+}
+
int chrif_save_scdata(struct map_session_data *sd)
{ //parses the sc_data of the player and sends it to the char-server for saving. [Skotlex]
#ifdef ENABLE_SC_SAVING
@@ -1480,6 +1507,7 @@ int chrif_parse(int fd)
case 0x2b1f: chrif_disconnectplayer(fd); break;
case 0x2b20: chrif_removemap(fd); break;
case 0x2b21: chrif_save_ack(fd); break;
+ case 0x2b22: chrif_updatefamelist_ack(fd); break;
default:
if (battle_config.error_log)