diff options
-rw-r--r-- | Changelog-Trunk.txt | 3 | ||||
-rw-r--r-- | db/Changelog.txt | 2 | ||||
-rw-r--r-- | db/packet_db.txt | 87 | ||||
-rw-r--r-- | npc/Changelog.txt | 2 | ||||
-rw-r--r-- | npc/scripts_custom.conf | 2 | ||||
-rw-r--r-- | src/char/char.c | 4 | ||||
-rw-r--r-- | src/char_sql/char.c | 4 | ||||
-rw-r--r-- | src/common/cbasetypes.h | 2 | ||||
-rw-r--r-- | src/common/socket.c | 7 | ||||
-rw-r--r-- | src/common/socket.h | 1 | ||||
-rw-r--r-- | src/login/login.c | 4 | ||||
-rw-r--r-- | src/login_sql/login.c | 4 | ||||
-rw-r--r-- | src/map/clif.c | 24 | ||||
-rw-r--r-- | src/map/clif.h | 4 |
14 files changed, 75 insertions, 75 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index e214ecb83..ac588aa68 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -3,6 +3,9 @@ Date Added AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. +2007/04/21 + * Added ntows() to properly handle that client port number deficiency + * Adjusted the packet_db array for a more consistent look [ultramage] 2007/04/20 * Cleaned up the doc folder. Removed outdated, untranslated, useless files and began normalizing a bit other ones~ [DracoRPG] diff --git a/db/Changelog.txt b/db/Changelog.txt index 395019900..15e9a9804 100644 --- a/db/Changelog.txt +++ b/db/Changelog.txt @@ -19,6 +19,8 @@ ----- ======================== +04/21 + * Reorganized some entries in packet_db.txt [ultramage] 04/20 * Fixed Aegis onspawn bug [Playtester] * Minor summoning behavior fixes [Playtester] diff --git a/db/packet_db.txt b/db/packet_db.txt index bfca0c8e8..ff634078f 100644 --- a/db/packet_db.txt +++ b/db/packet_db.txt @@ -1,14 +1,15 @@ // The packet database allows you to add support for new clients, // because packets change every release. // Note: Every packet version needs a wanttoconnection specification, since -// that is the packet used to identify a client's version, if multiple versions -// have the same connection packet, the higher version will be used (unless -// the lower one is specified as the default) +// that is the packet used to identify a client's version. +// If multiple versions have the same connection packet, the higher version +// will be used (unless the lower one is specified as the default) // Main packet version of the DB to use (default = max available version) -// Client detection is faster when all clients use the specified here version. +// Client detection is faster when all clients use this version. packet_db_ver: default + packet_ver: 5 0x0064,55 0x0065,17 @@ -751,19 +752,19 @@ packet_ver: 18 //2006-04-03aSakexe by blackhole89 packet_ver: 19 +0x0072,26,useskilltoid,11:18:22 +0x007e,120,useskilltoposinfo,5:15:29:38:40 +0x0085,12,changedir,7:11 +0x008c,12,getcharnamerequest,8 +0x0094,23,movetokafra,5:19 0x009b,37,wanttoconnection,9:21:28:32:36 +0x009f,24,useitem,9:20 0x00a2,11,solvecharname,7 -0x008c,12,getcharnamerequest,8 0x00a7,15,walktoxy,12 -0x0116,17,dropitem,8:15 0x00f5,13,takeitem,9 -0x009f,24,useitem,9:20 -0x0072,26,useskilltoid,11:18:22 -0x0113,40,useskilltopos,5:15:29:38 -0x0085,12,changedir,7:11 -0x007e,120,useskilltoposinfo,5:15:29:38:40 -0x0094,23,movetokafra,5:19 0x00f7,26,movefromkafra,11:22 +0x0113,40,useskilltopos,5:15:29:38 +0x0116,17,dropitem,8:15 0x0190,18,actionrequest,7:17 //2006-06-07aSakexe @@ -822,9 +823,8 @@ packet_ver: 19 //2006-10-23aSakexe 0x006d,110 -//2007-01-08aSakexe (http://www.eathena.ws/board/index.php?s=&showtopic=141398&view=findpost&p=779954) +//2007-01-08aSakexe packet_ver: 20 -0x006d,110 0x0072,30,useskilltoid,10:14:26 0x007e,120,useskilltoposinfo,10:19:23:38:40 0x0085,14,changedir,10:13 @@ -843,7 +843,26 @@ packet_ver: 20 0x0190,10,actionrequest,4:9 0x0193,2,closekafra,0 -//Unknown-Sakexe (http://www.eathena.ws/board/index.php?s=&showtopic=141398&view=findpost&p=780882) +//2007-02-12aSakexe +packet_ver: 21 +0x006d,110 +0x0072,25,useskilltoid,6:10:21 +0x007e,102,useskilltoposinfo,5:9:12:20:22 +0x0085,11,changedir,7:10 +0x0089,8,ticksend,4 +0x008c,11,getcharnamerequest,7 +0x0094,14,movetokafra,7:10 +0x009b,26,wanttoconnection,4:9:17:18:25 +0x009f,14,useitem,4:10 +0x00a2,15,solvecharname,11 +0x00a7,8,walktoxy,5 +0x00f3,-1,globalmessage,2:4 +0x00f5,8,takeitem,4 +0x00f7,22,movefromkafra,14:18 +0x0113,22,useskilltopos,5:9:12:20 +0x0116,10,dropitem,5:8 +0x0190,19,actionrequest,5:18 +0x0193,2,closekafra,0 0x028b,-1 0x028c,46 0x028d,34 @@ -865,45 +884,11 @@ packet_ver: 20 0x029d,-1 0x029e,11 0x029f,3 -0x02a0,0 -0x02a1,0 -0x02a2,0 -0x02a3,0 -0x02a4,0 -0x02a5,8 -0x02a6,0 -0x02a7,0 -0x02a8,0 -0x02a9,0 -0x02aa,4 -0x02ab,36 -0x02ac,6 - -//2007-02-12aSakexe (http://www.eathena.ws/board/index.php?s=&showtopic=141398&view=findpost&p=779954) -packet_ver: 21 -0x006d,110 -0x0072,25,useskilltoid,6:10:21 -0x007e,102,useskilltoposinfo,5:9:12:20:22 -0x0085,11,changedir,7:10 -0x0089,8,ticksend,4 -0x008c,11,getcharnamerequest,7 -0x0094,14,movetokafra,7:10 -0x009b,26,wanttoconnection,4:9:17:18:25 -0x009f,14,useitem,4:10 -0x00a2,15,solvecharname,11 -0x00a7,8,walktoxy,5 -0x00f3,-1,globalmessage,2:4 -0x00f5,8,takeitem,4 -0x00f7,22,movefromkafra,14:18 -0x0113,22,useskilltopos,5:9:12:20 -0x0116,10,dropitem,5:8 -0x0190,19,actionrequest,5:18 -0x0193,2,closekafra,0 -0x029b,72 +0x02a2,8 0x02a5,8 0x02aa,4 0x02ab,36 0x02ac,6 // Add new packets here -packet_ver: 22 +//packet_ver: 22
\ No newline at end of file diff --git a/npc/Changelog.txt b/npc/Changelog.txt index 5ef6f1c2f..2e836427d 100644 --- a/npc/Changelog.txt +++ b/npc/Changelog.txt @@ -1,5 +1,7 @@ Date Added ====== +2007/04/21 + * Fixed a small scripts_custom.conf typo [ultramage] 2007/04/15 * Updated Kiel Hyre quest thanks to L0ne_W0lf [Playtester] * Lowered the amount of Dimiks spawning in Juperos F1 [Playtester] diff --git a/npc/scripts_custom.conf b/npc/scripts_custom.conf index f7e609f06..76dbd10f3 100644 --- a/npc/scripts_custom.conf +++ b/npc/scripts_custom.conf @@ -128,7 +128,7 @@ npc: npc/custom/adoption.txt // -- A quest for Jewel Case for 99 Level Players of any 2nd Class //npc: npc/custom/quests/lvl99_quest.txt // Disable shops in the Prontera streets and open a special market place. -//npc/custom/market.txt +//npc: npc/custom/market.txt // Quest for: Bird Nest,Lion Mask,Skeleton Manteau,Fashion Hip Sack,Sales Banner //npc: npc/custom/quests/may_hats.txt // Random change of Drop/Exp rates 1x ~ 1.5x every 6 hours on your server diff --git a/src/char/char.c b/src/char/char.c index 5b9b5d87b..66601f644 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -3499,8 +3499,8 @@ int parse_char(int fd) // Advanced subnet check [LuzZza] subnet_map_ip = lan_subnetcheck(ipl); - WFIFOL(fd,22) = (subnet_map_ip) ? htonl(subnet_map_ip) : htonl(server[i].ip); - WFIFOW(fd,26) = server[i].port; // /!\ must be sent in intel host byte order /!\ (client bug) + WFIFOL(fd,22) = htonl((subnet_map_ip) ? subnet_map_ip : server[i].ip); + WFIFOW(fd,26) = ntows(htons(server[i].port)); // [!] LE byte order here [!] WFIFOSET(fd,28); ShowInfo("Character selection '%s' (account: %d, slot: %d).\n", diff --git a/src/char_sql/char.c b/src/char_sql/char.c index d9fcea839..dcec47c42 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -3349,8 +3349,8 @@ int parse_char(int fd) // Advanced subnet check [LuzZza] subnet_map_ip = lan_subnetcheck(ipl); - WFIFOL(fd,22) = (subnet_map_ip) ? htonl(subnet_map_ip) : htonl(server[i].ip); - WFIFOW(fd,26) = server[i].port; // /!\ must be sent in intel host byte order /!\ (client bug) + WFIFOL(fd,22) = htonl((subnet_map_ip) ? subnet_map_ip : server[i].ip); + WFIFOW(fd,26) = ntows(htons(server[i].port)); // [!] LE byte order here [!] WFIFOSET(fd,28); } if (auth_fifo_pos >= AUTH_FIFO_SIZE) diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h index c066c1ebd..ae6430a62 100644 --- a/src/common/cbasetypes.h +++ b/src/common/cbasetypes.h @@ -291,7 +291,7 @@ typedef char bool; ////////////////////////////////////////////////////////////////////////// // Has to be unsigned to avoid problems in some systems -// Problems arise when these functions expect an argument in the range [0,256[ and are feed a signed char. +// Problems arise when these functions expect an argument in the range [0,256[ and are fed a signed char. #include <ctype.h> #define ISALNUM(c) (isalnum((unsigned char)(c))) #define ISALPHA(c) (isalpha((unsigned char)(c))) diff --git a/src/common/socket.c b/src/common/socket.c index f8bdcdc7a..f406a0eea 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -1117,3 +1117,10 @@ uint32 str2ip(const char* ip_str) { return ntohl(inet_addr(ip_str)); } + +// Reorders bytes from network to little endian (Windows). +// Neccessary for sending port numbers to the RO client until Gravity notices that they forgot ntohs() calls. +uint16 ntows(uint16 neshort) +{ + return ((neshort & 0xFF) << 8) | ((neshort & 0xFF00) >> 8); +} diff --git a/src/common/socket.h b/src/common/socket.h index 41acbeabd..801da8807 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -130,6 +130,7 @@ uint32 host2ip(const char* hostname); const char* ip2str(uint32 ip, char ip_str[16]); uint32 str2ip(const char* ip_str); #define CONVIP(ip) (ip>>24)&0xFF,(ip>>16)&0xFF,(ip>>8)&0xFF,(ip>>0)&0xFF +uint16 ntows(uint16 netshort); int socket_getips(uint32* ips, int max); diff --git a/src/login/login.c b/src/login/login.c index e948264b2..e18396b23 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -3079,8 +3079,8 @@ int parse_login(int fd) if (server_fd[i] >= 0) { // Advanced subnet check [LuzZza] uint32 subnet_char_ip = lan_subnetcheck(ipl); - WFIFOL(fd,47+server_num*32) = (subnet_char_ip) ? htonl(subnet_char_ip) : htonl(server[i].ip); - WFIFOW(fd,47+server_num*32+4) = server[i].port; // /!\ must be sent in intel host byte order /!\ (client bug) + WFIFOL(fd,47+server_num*32) = htonl((subnet_char_ip) ? subnet_char_ip : server[i].ip); + WFIFOW(fd,47+server_num*32+4) = ntows(htons(server[i].port)); // [!] LE byte order here [!] memcpy(WFIFOP(fd,47+server_num*32+6), server[i].name, 20); WFIFOW(fd,47+server_num*32+26) = server[i].users; WFIFOW(fd,47+server_num*32+28) = server[i].maintenance; diff --git a/src/login_sql/login.c b/src/login_sql/login.c index af0621d80..74e32f740 100644 --- a/src/login_sql/login.c +++ b/src/login_sql/login.c @@ -1426,8 +1426,8 @@ int parse_login(int fd) if (server_fd[i] >= 0) { // Advanced subnet check [LuzZza] uint32 subnet_char_ip = lan_subnetcheck(ipl); - WFIFOL(fd,47+server_num*32) = (subnet_char_ip) ? htonl(subnet_char_ip) : htonl(server[i].ip); - WFIFOW(fd,47+server_num*32+4) = server[i].port; // /!\ must be sent in intel host byte order /!\ (client bug) + WFIFOL(fd,47+server_num*32) = htonl((subnet_char_ip) ? subnet_char_ip : server[i].ip); + WFIFOW(fd,47+server_num*32+4) = ntows(htons(server[i].port)); // [!] LE byte order here [!] memcpy(WFIFOP(fd,47+server_num*32+6), server[i].name, 20); WFIFOW(fd,47+server_num*32+26) = server[i].users; WFIFOW(fd,47+server_num*32+28) = server[i].maintenance; diff --git a/src/map/clif.c b/src/map/clif.c index 62ea6169c..4e4a701c5 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -50,7 +50,7 @@ struct Clif_Config { int connect_cmd[MAX_PACKET_VER + 1]; //Store the connect command for all versions. [Skotlex] } clif_config; -struct packet_db packet_db[MAX_PACKET_VER + 1][MAX_PACKET_DB]; +struct packet_db packet_db[MAX_PACKET_VER + 1][MAX_PACKET_DB + 1]; //Converts item type in case of pet eggs. #define itemtype(a) (a == 7)?4:a @@ -1684,7 +1684,7 @@ int clif_changemapserver(struct map_session_data* sd, const char* mapname, int x WFIFOW(fd,18) = x; WFIFOW(fd,20) = y; WFIFOL(fd,22) = htonl(ip); - WFIFOW(fd,26) = port; // /!\ must be sent in intel host byte order /!\ (client bug) + WFIFOW(fd,26) = ntows(htons(port)); // [!] LE byte order here [!] WFIFOSET(fd, packet_len(0x92)); return 0; @@ -11903,7 +11903,7 @@ int clif_parse(int fd) } // ゲーム用以外パケットか、認証を終える前に0072以外が来たら、切断する - if (cmd >= MAX_PACKET_DB || packet_db[packet_ver][cmd].len == 0) { // if packet is not inside these values: session is incorrect?? or auth packet is unknown + if (cmd > MAX_PACKET_DB || packet_db[packet_ver][cmd].len == 0) { // if packet is not inside these values: session is incorrect?? or auth packet is unknown ShowWarning("clif_parse: Received unsupported packet (packet 0x%04x, %d bytes received), disconnecting session #%d.\n", cmd, RFIFOREST(fd), fd); session[fd]->eof = 1; return 0; @@ -12259,10 +12259,13 @@ static int packetdb_readdb(void) clif_config.packet_db_ver = MAX_PACKET_VER; packet_ver = MAX_PACKET_VER; // read into packet_db's version by default - while(fgets(line,1020,fp)){ + while( fgets(line,sizeof(line),fp) ) + { + ln++; if(line[0]=='/' && line[1]=='/') continue; - if (sscanf(line,"%[^:]: %[^\r\n]",w1,w2) == 2) { + if (sscanf(line,"%256[^:]: %256[^\r\n]",w1,w2) == 2) + { if(strcmpi(w1,"packet_ver")==0) { int prev_ver = packet_ver; skip_ver = 0; @@ -12319,7 +12322,8 @@ static int packetdb_readdb(void) continue; // Skipping current packet version memset(str,0,sizeof(str)); - for(j=0,p=line;j<4 && p;j++){ + for(j=0,p=line;j<4 && p; ++j) + { str[j]=p; p=strchr(p,','); if(p) *p++=0; @@ -12329,7 +12333,7 @@ static int packetdb_readdb(void) cmd=strtol(str[0],(char **)NULL,0); if(max_cmd < cmd) max_cmd = cmd; - if(cmd<=0 || cmd>=MAX_PACKET_DB) + if(cmd <= 0 || cmd > MAX_PACKET_DB) continue; if(str[1]==NULL){ ShowError("packet_db: packet len error\n"); @@ -12349,7 +12353,7 @@ static int packetdb_readdb(void) { if (packet_db[packet_ver][cmd].func != clif_parse_func[j].func) { //If we are updating a function, we need to zero up the previous one. [Skotlex] - for(i=0;i<MAX_PACKET_DB;i++){ + for(i=0;i<=MAX_PACKET_DB;i++){ if (packet_db[packet_ver][i].func == clif_parse_func[j].func) { memset(&packet_db[packet_ver][i], 0, sizeof(struct packet_db)); @@ -12377,10 +12381,6 @@ static int packetdb_readdb(void) // if (packet_db[packet_ver][cmd].pos[j] != k && clif_config.prefer_packet_db) // not used for now packet_db[packet_ver][cmd].pos[j] = k; } - - ln++; -// if(packet_db[clif_config.packet_db_ver][cmd].len > 2 /* && packet_db[cmd].pos[0] == 0 */) -// printf("packet_db ver %d: %d 0x%x %d %s %p\n",packet_ver,ln,cmd,packet_db[packet_ver][cmd].len,str[2],packet_db[packet_ver][cmd].func); } fclose(fp); if(max_cmd > MAX_PACKET_DB) diff --git a/src/map/clif.h b/src/map/clif.h index 947f63a9d..13506be11 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -8,7 +8,7 @@ // packet DB #define MAX_PACKET_DB 0x300 -#define MAX_PACKET_VER 25 +#define MAX_PACKET_VER 21 struct packet_db { short len; @@ -48,7 +48,7 @@ enum { // packet_db[SERVER] is reserved for server use #define SERVER 0 #define packet_len(x) packet_db[SERVER][x].len -extern struct packet_db packet_db[MAX_PACKET_VER + 1][MAX_PACKET_DB]; +extern struct packet_db packet_db[MAX_PACKET_VER + 1][MAX_PACKET_DB + 1]; int clif_setip(const char* ip); void clif_setbindip(const char* ip); |