浏览代码

- Increased MAX_PACKET_DB to 0x300 and added a warning for when packet ids greater than MAX_PACKET_DB are found.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9506 54d463be-8e91-2dee-dedb-b68131a5f0ec
FlavioJS 18 年之前
父节点
当前提交
25cd5a05f4
共有 3 个文件被更改,包括 30 次插入5 次删除
  1. 3 0
      Changelog-Trunk.txt
  2. 26 4
      src/map/clif.c
  3. 1 1
      src/map/clif.h

+ 3 - 0
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.
 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.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 
+2006/12/16
+	* Increased MAX_PACKET_DB to 0x300 and added a warning for when packet ids 
+	  greater than MAX_PACKET_DB are found. [FlavioJS]
 2006/12/15
 2006/12/15
 	* There will be now warnings printed when a shop sells an item which's buy
 	* There will be now warnings printed when a shop sells an item which's buy
 	  price is 20z, since those usually are "rare" items with no buyying price
 	  price is 20z, since those usually are "rare" items with no buyying price

+ 26 - 4
src/map/clif.c

@@ -53,6 +53,8 @@ struct 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];
 
 
+static const int packet_len_table[MAX_PACKET_DB];
+/*
 static const int packet_len_table[MAX_PACKET_DB] = {
 static const int packet_len_table[MAX_PACKET_DB] = {
    10,  0,  0,  0,  0,  0,  0,  0,   0,  0,  0,  0,  0,  0,  0,  0,
    10,  0,  0,  0,  0,  0,  0,  0,   0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,   0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,   0,  0,  0,  0,  0,  0,  0,  0,
@@ -110,6 +112,7 @@ static const int packet_len_table[MAX_PACKET_DB] = {
    -1, -1,  -1, -1, -1,  3,  4,  8,  -1,  3, 70,  4,  8,12,  4, 10,
    -1, -1,  -1, -1, -1,  3,  4,  8,  -1,  3, 70,  4,  8,12,  4, 10,
     3, 32,  -1,  3,  3,  5,  5,  8,   2,  3, -1, -1,  4,-1,  4
     3, 32,  -1,  3,  3,  5,  5,  8,   2,  3, -1, -1,  4,-1,  4
 };
 };
+*/
 
 
 //Converts item type in case of pet eggs.
 //Converts item type in case of pet eggs.
 #define itemtype(a) (a == 7)?4:a
 #define itemtype(a) (a == 7)?4:a
@@ -639,16 +642,26 @@ int clif_authok(struct map_session_data *sd) {
 	WFIFOW(fd, 0) = 0x73;
 	WFIFOW(fd, 0) = 0x73;
 	WFIFOL(fd, 2) = gettick();
 	WFIFOL(fd, 2) = gettick();
 	WFIFOPOS(fd, 6, sd->bl.x, sd->bl.y, sd->ud.dir);
 	WFIFOPOS(fd, 6, sd->bl.x, sd->bl.y, sd->ud.dir);
-	WFIFOB(fd, 9) = 5;
-	WFIFOB(fd,10) = 5;
+	WFIFOB(fd, 9) = 5; // ignored
+	WFIFOB(fd,10) = 5; // ignored
 	WFIFOSET(fd,packet_len_table[0x73]);
 	WFIFOSET(fd,packet_len_table[0x73]);
 
 
 	return 0;
 	return 0;
 }
 }
 
 
 /*==========================================
 /*==========================================
- *
+ * Authentication failed/disconnect client.
  *------------------------------------------
  *------------------------------------------
+ * The client closes it's socket and displays a message according to type:
+ *  1 - server closed -> MsgStringTable[4]
+ *  2 - ID already logged in -> MsgStringTable[5]
+ *  3 - timeout/too much lag -> MsgStringTable[241]
+ *  4 - server full -> MsgStringTable[264]
+ *  5 - underaged -> MsgStringTable[305]
+ *  9 - too many connections from this ip -> MsgStringTable[529]
+ *  10 - payed time has ended -> MsgStringTable[530]
+ *  15 - disconnected by a GM -> if( servicetype == taiwan ) MsgStringTable[579]
+ *  other - disconnected -> MsgStringTable[3]
  */
  */
 int clif_authfail_fd(int fd, int type) {
 int clif_authfail_fd(int fd, int type) {
 	if (!fd || !session[fd] || session[fd]->func_parse != clif_parse) //clif_authfail should only be invoked on players!
 	if (!fd || !session[fd] || session[fd]->func_parse != clif_parse) //clif_authfail should only be invoked on players!
@@ -4195,8 +4208,9 @@ int clif_clearchar_skillunit(struct skill_unit *unit,int fd)
 }
 }
 
 
 /*==========================================
 /*==========================================
- *
+ * Unknown... trap related?
  *------------------------------------------
  *------------------------------------------
+ * Only affects units with class [139,153] client-side
  */
  */
 int clif_01ac(struct block_list *bl)
 int clif_01ac(struct block_list *bl)
 {
 {
@@ -12079,6 +12093,7 @@ static int packetdb_readdb(void)
 	char line[1024];
 	char line[1024];
 	int ln=0;
 	int ln=0;
 	int cmd,i,j,k,packet_ver;
 	int cmd,i,j,k,packet_ver;
+	int max_cmd=-1;
 	char *str[64],*p,*str2[64],*p2,w1[64],w2[64];
 	char *str[64],*p,*str2[64],*p2,w1[64],w2[64];
 
 
 	struct {
 	struct {
@@ -12270,6 +12285,8 @@ static int packetdb_readdb(void)
 		if(str[0]==NULL)
 		if(str[0]==NULL)
 			continue;
 			continue;
 		cmd=strtol(str[0],(char **)NULL,0);
 		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;
 			continue;
 		if(str[1]==NULL){
 		if(str[1]==NULL){
@@ -12324,6 +12341,11 @@ static int packetdb_readdb(void)
 //			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);
 //			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);
 	fclose(fp);
+	if(max_cmd > MAX_PACKET_DB)
+	{
+		ShowWarning("Found packets up to 0x%X, ignored 0x%X and above.\n", max_cmd, MAX_PACKET_DB);
+		ShowWarning("Please increase MAX_PACKET_DB and recompile.\n");
+	}
 	if (!clif_config.connect_cmd[clif_config.packet_db_ver])
 	if (!clif_config.connect_cmd[clif_config.packet_db_ver])
 	{	//Locate the nearest version that we still support. [Skotlex]
 	{	//Locate the nearest version that we still support. [Skotlex]
 		for(j = clif_config.packet_db_ver; j >= 0 && !clif_config.connect_cmd[j]; j--);
 		for(j = clif_config.packet_db_ver; j >= 0 && !clif_config.connect_cmd[j]; j--);

+ 1 - 1
src/map/clif.h

@@ -10,7 +10,7 @@
 #define PACKETVER			7
 #define PACKETVER			7
 
 
 // packet DB
 // packet DB
-#define MAX_PACKET_DB		0x25f
+#define MAX_PACKET_DB		0x300
 #define MAX_PACKET_VER		25
 #define MAX_PACKET_VER		25
 
 
 struct packet_db {
 struct packet_db {