summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c1129
-rw-r--r--src/map/clif.h3
2 files changed, 582 insertions, 550 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index ae25472f4..a695ee78b 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -53,67 +53,6 @@ struct Clif_Config {
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] = {
- 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,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-//#0x0040
- 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, 55, 17, 3, 37, 46, -1, 23, -1, 3,108, 3, 2,
-#if PACKETVER < 2
- 3, 28, 19, 11, 3, -1, 9, 5, 52, 51, 56, 58, 41, 2, 6, 6,
-#else // 78-7b 亀島以降 lv99エフェクト用
- 3, 28, 19, 11, 3, -1, 9, 5, 54, 53, 58, 60, 41, 2, 6, 6,
-#endif
-//#0x0080
- 7, 3, 2, 2, 2, 5, 16, 12, 10, 7, 29, 2, -1, -1, -1, 0, // 0x8b changed to 2 (was 23)
- 7, 22, 28, 2, 6, 30, -1, -1, 3, -1, -1, 5, 9, 17, 17, 6,
- 23, 6, 6, -1, -1, -1, -1, 8, 7, 6, 7, 4, 7, 0, -1, 6,
- 8, 8, 3, 3, -1, 6, 6, -1, 7, 6, 2, 5, 6, 44, 5, 3,
-//#0x00C0
- 7, 2, 6, 8, 6, 7, -1, -1, -1, -1, 3, 3, 6, 3, 2, 27, // 0xcd change to 3 (was 6)
- 3, 4, 4, 2, -1, -1, 3, -1, 6, 14, 3, -1, 28, 29, -1, -1,
- 30, 30, 26, 2, 6, 26, 3, 3, 8, 19, 5, 2, 3, 2, 2, 2,
- 3, 2, 6, 8, 21, 8, 8, 2, 2, 26, 3, -1, 6, 27, 30, 10,
-
-//#0x0100
- 2, 6, 6, 30, 79, 31, 10, 10, -1, -1, 4, 6, 6, 2, 11, -1,
- 10, 39, 4, 10, 31, 35, 10, 18, 2, 13, 15, 20, 68, 2, 3, 16,
- 6, 14, -1, -1, 21, 8, 8, 8, 8, 8, 2, 2, 3, 4, 2, -1,
- 6, 86, 6, -1, -1, 7, -1, 6, 3, 16, 4, 4, 4, 6, 24, 26,
-//#0x0140
- 22, 14, 6, 10, 23, 19, 6, 39, 8, 9, 6, 27, -1, 2, 6, 6,
- 110, 6, -1, -1, -1, -1, -1, 6, -1, 54, 66, 54, 90, 42, 6, 42,
- -1, -1, -1, -1, -1, 30, -1, 3, 14, 3, 30, 10, 43, 14,186,182,
- 14, 30, 10, 3, -1, 6,106, -1, 4, 5, 4, -1, 6, 7, -1, -1,
-//#0x0180
- 6, 3,106, 10, 10, 34, 0, 6, 8, 4, 4, 4, 29, -1, 10, 6,
-#if PACKETVER < 1
- 90, 86, 24, 6, 30,102, 8, 4, 8, 4, 14, 10, -1, 6, 2, 6,
-#else // 196 comodo以降 状態表示アイコン用
- 90, 86, 24, 6, 30,102, 9, 4, 8, 4, 14, 10, -1, 6, 2, 6,
-#endif
- 3, 3, 35, 5, 11, 26, -1, 4, 4, 6, 10, 12, 6, -1, 4, 4,
- 11, 7, -1, 67, 12, 18,114, 6, 3, 6, 26, 26, 26, 26, 2, 3,
-//#0x01C0, Set 0x1d5=-1
- 2, 14, 10, -1, 22, 22, 4, 2, 13, 97, 3, 9, 9, 30, 6, 28,
- 8, 14, 10, 35, 6, -1, 4, 11, 54, 53, 60, 2, -1, 47, 33, 6,
- 30, 8, 34, 14, 2, 6, 26, 2, 28, 81, 6, 10, 26, 2, -1, -1,
- -1, -1, 20, 10, 32, 9, 34, 14, 2, 6, 48, 56, -1, 4, 5, 10,
-//#0x200
- 26, -1, 26, 10, 18, 26, 11, 34, 14, 36, 10, 0, 0, -1, 32, 10, // 0x20c change to 0 (was 19)
- 22, 0, 26, 26, 42, 6, 6, 2, 2,282,282,10, 10, -1, -1, 66,
- 10, -1, -1, 8, 10, 2,282, 18, 18, 15, 58, 57, 64, 5, 71, 5,
- 12, 26, 9, 11, -1, -1, 10, 2, 282, 11, 4, 36, -1,-1, 4, 2,
- -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
-};
-*/
-
//Converts item type in case of pet eggs.
#define itemtype(a) (a == 7)?4:a
@@ -638,13 +577,13 @@ int clif_authok(struct map_session_data *sd) {
return 0;
fd = sd->fd;
- WFIFOHEAD(fd, packet_len_table[0x73]);
+ WFIFOHEAD(fd, packet_len(0x73));
WFIFOW(fd, 0) = 0x73;
WFIFOL(fd, 2) = gettick();
WFIFOPOS(fd, 6, sd->bl.x, sd->bl.y, sd->ud.dir);
WFIFOB(fd, 9) = 5; // ignored
WFIFOB(fd,10) = 5; // ignored
- WFIFOSET(fd,packet_len_table[0x73]);
+ WFIFOSET(fd,packet_len(0x73));
return 0;
}
@@ -667,10 +606,10 @@ 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!
return 0;
- WFIFOHEAD(fd, packet_len_table[0x81]);
+ WFIFOHEAD(fd, packet_len(0x81));
WFIFOW(fd,0) = 0x81;
WFIFOB(fd,2) = type;
- WFIFOSET(fd,packet_len_table[0x81]);
+ WFIFOSET(fd,packet_len(0x81));
clif_setwaitclose(fd);
return 0;
}
@@ -700,10 +639,10 @@ int clif_charselectok(int id) {
return 1;
fd = sd->fd;
- WFIFOHEAD(fd, packet_len_table[0xb3]);
+ WFIFOHEAD(fd, packet_len(0xb3));
WFIFOW(fd,0) = 0xb3;
WFIFOB(fd,2) = 1;
- WFIFOSET(fd,packet_len_table[0xb3]);
+ WFIFOSET(fd,packet_len(0xb3));
return 0;
}
@@ -731,7 +670,7 @@ static int clif_set009e(struct flooritem_data *fitem,unsigned char *buf) {
WBUFB(buf,14) = fitem->suby;
WBUFW(buf,15) = fitem->item_data.amount;
- return packet_len_table[0x9e];
+ return packet_len(0x9e);
}
/*==========================================
@@ -746,7 +685,7 @@ int clif_dropflooritem(struct flooritem_data *fitem) {
if (fitem->item_data.nameid <= 0)
return 0;
clif_set009e(fitem, buf);
- clif_send(buf, packet_len_table[0x9e], &fitem->bl, AREA);
+ clif_send(buf, packet_len(0x9e), &fitem->bl, AREA);
return 0;
}
@@ -764,11 +703,11 @@ int clif_clearflooritem(struct flooritem_data *fitem, int fd) {
WBUFL(buf,2) = fitem->bl.id;
if (fd == 0) {
- clif_send(buf, packet_len_table[0xa1], &fitem->bl, AREA);
+ clif_send(buf, packet_len(0xa1), &fitem->bl, AREA);
} else {
- WFIFOHEAD(fd,packet_len_table[0xa1]);
+ WFIFOHEAD(fd,packet_len(0xa1));
memcpy(WFIFOP(fd,0), buf, 6);
- WFIFOSET(fd,packet_len_table[0xa1]);
+ WFIFOSET(fd,packet_len(0xa1));
}
return 0;
@@ -787,10 +726,10 @@ int clif_clearchar(struct block_list *bl, int type) {
WBUFL(buf,2) = bl->id;
WBUFB(buf,6) = type;
- clif_send(buf, packet_len_table[0x80], bl, type == 1 ? AREA : AREA_WOS);
+ clif_send(buf, packet_len(0x80), bl, type == 1 ? AREA : AREA_WOS);
if(disguised(bl)) {
WBUFL(buf,2) = -bl->id;
- clif_send(buf, packet_len_table[0x80], bl, SELF);
+ clif_send(buf, packet_len(0x80), bl, SELF);
}
return 0;
@@ -819,11 +758,11 @@ int clif_clearchar_delay(unsigned int tick, struct block_list *bl, int type) {
*/
int clif_clearchar_id(int id, int type, int fd) {
- WFIFOHEAD(fd, packet_len_table[0x80]);
+ WFIFOHEAD(fd, packet_len(0x80));
WFIFOW(fd,0) = 0x80;
WFIFOL(fd,2) = id;
WFIFOB(fd,6) = (char)type; // Why use int for a char in the first place?
- WFIFOSET(fd, packet_len_table[0x80]);
+ WFIFOSET(fd, packet_len(0x80));
return 0;
}
@@ -917,7 +856,7 @@ static int clif_set0078(struct block_list *bl, struct view_data *vd, unsigned ch
lv = status_get_lv(bl);
if(pcdb_checkid(vd->class_)) {
#if PACKETVER > 6
- malloc_set(buf,0,packet_len_table[0x22a]);
+ malloc_set(buf,0,packet_len(0x22a));
WBUFW(buf,0)=0x22a;
WBUFL(buf,2)=bl->id;
@@ -950,9 +889,9 @@ static int clif_set0078(struct block_list *bl, struct view_data *vd, unsigned ch
WBUFB(buf,54)=5;
WBUFB(buf,55)=vd->dead_sit;
WBUFW(buf,56)=clif_setlevel(lv);
- return packet_len_table[0x22a];
+ return packet_len(0x22a);
#elif PACKETVER > 3
- malloc_set(buf,0,packet_len_table[0x1d8]);
+ malloc_set(buf,0,packet_len(0x1d8));
WBUFW(buf,0)=0x1d8;
WBUFL(buf,2)=bl->id;
@@ -985,9 +924,9 @@ static int clif_set0078(struct block_list *bl, struct view_data *vd, unsigned ch
WBUFB(buf,50)=5;
WBUFB(buf,51)=vd->dead_sit;
WBUFW(buf,52)=clif_setlevel(lv);
- return packet_len_table[0x1d8];
+ return packet_len(0x1d8);
#else
- malloc_set(buf,0,packet_len_table[0x78]);
+ malloc_set(buf,0,packet_len(0x78));
WBUFW(buf,0)=0x78;
WBUFL(buf,2)=bl->id;
@@ -1018,11 +957,11 @@ static int clif_set0078(struct block_list *bl, struct view_data *vd, unsigned ch
WBUFB(buf,50)=5;
WBUFB(buf,51)=vd->dead_sit;
WBUFW(buf,52)=clif_setlevel(lv);
- return packet_len_table[0x78];
+ return packet_len(0x78);
#endif
}
//Non-player sprites need just a few fields filled.
- malloc_set(buf,0,packet_len_table[0x78]);
+ malloc_set(buf,0,packet_len(0x78));
WBUFW(buf,0)=0x78;
WBUFL(buf,2)=bl->id;
@@ -1048,7 +987,7 @@ static int clif_set0078(struct block_list *bl, struct view_data *vd, unsigned ch
WBUFB(buf,49)=5;
WBUFB(buf,50)=5;
WBUFW(buf,52)=clif_setlevel(lv);
- return packet_len_table[0x78];
+ return packet_len(0x78);
}
/*==========================================
@@ -1070,7 +1009,7 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
if(pcdb_checkid(vd->class_)) {
#if PACKETVER > 6
- malloc_set(buf,0,packet_len_table[0x22c]);
+ malloc_set(buf,0,packet_len(0x22c));
WBUFW(buf,0)=0x22c;
WBUFL(buf,2)=bl->id;
@@ -1105,9 +1044,9 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
WBUFB(buf,61)=0;
WBUFW(buf,62)=clif_setlevel(lv);
- return packet_len_table[0x22c];
+ return packet_len(0x22c);
#elif PACKETVER > 3
- malloc_set(buf,0,packet_len_table[0x1da]);
+ malloc_set(buf,0,packet_len(0x1da));
WBUFW(buf,0)=0x1da;
WBUFL(buf,2)=bl->id;
@@ -1142,9 +1081,9 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
WBUFB(buf,57)=5;
WBUFW(buf,58)=clif_setlevel(lv);
- return packet_len_table[0x1da];
+ return packet_len(0x1da);
#else
- malloc_set(buf,0,packet_len_table[0x7b]);
+ malloc_set(buf,0,packet_len(0x7b));
WBUFW(buf,0)=0x7b;
WBUFL(buf,2)=bl->id;
@@ -1177,12 +1116,12 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
WBUFB(buf,57)=5;
WBUFW(buf,58)=clif_setlevel(lv);
- return packet_len_table[0x7b];
+ return packet_len(0x7b);
#endif
}
//Non-player sprites only require a few fields.
#if PACKETVER > 6
- malloc_set(buf,0,packet_len_table[0x22c]);
+ malloc_set(buf,0,packet_len(0x22c));
WBUFW(buf,0)=0x22c;
WBUFL(buf,2)=bl->id;
@@ -1205,9 +1144,9 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
WBUFB(buf,60)=0;
WBUFB(buf,61)=0;
WBUFW(buf,62)=clif_setlevel(lv);
- return packet_len_table[0x22c];
+ return packet_len(0x22c);
#else
- malloc_set(buf,0,packet_len_table[0x7b]);
+ malloc_set(buf,0,packet_len(0x7b));
WBUFW(buf,0)=0x7b;
WBUFL(buf,2)=bl->id;
@@ -1230,7 +1169,7 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
WBUFB(buf,56)=5;
WBUFB(buf,57)=5;
WBUFW(buf,58)=clif_setlevel(lv);
- return packet_len_table[0x7b];
+ return packet_len(0x7b);
#endif
}
@@ -1280,7 +1219,7 @@ int clif_class_change(struct block_list *bl,int class_,int type)
WBUFL(buf,2)=bl->id;
WBUFB(buf,6)=type;
WBUFL(buf,7)=class_;
- clif_send(buf,packet_len_table[0x1b0],bl,AREA);
+ clif_send(buf,packet_len(0x1b0),bl,AREA);
}
return 0;
}
@@ -1291,11 +1230,11 @@ int clif_class_change(struct block_list *bl,int class_,int type)
*/
static void clif_spiritball_single(int fd, struct map_session_data *sd)
{
- WFIFOHEAD(fd, packet_len_table[0x1e1]);
+ WFIFOHEAD(fd, packet_len(0x1e1));
WFIFOW(fd,0)=0x1e1;
WFIFOL(fd,2)=sd->bl.id;
WFIFOW(fd,6)=sd->spiritball;
- WFIFOSET(fd, packet_len_table[0x1e1]);
+ WFIFOSET(fd, packet_len(0x1e1));
}
/*==========================================
@@ -1303,24 +1242,24 @@ static void clif_spiritball_single(int fd, struct map_session_data *sd)
*------------------------------------------
*/
static int clif_set0192(int fd, int m, int x, int y, int type) {
- WFIFOHEAD(fd, packet_len_table[0x192]);
+ WFIFOHEAD(fd, packet_len(0x192));
WFIFOW(fd,0) = 0x192;
WFIFOW(fd,2) = x;
WFIFOW(fd,4) = y;
WFIFOW(fd,6) = type;
memcpy(WFIFOP(fd,8),map[m].name,MAP_NAME_LENGTH);
- WFIFOSET(fd,packet_len_table[0x192]);
+ WFIFOSET(fd,packet_len(0x192));
return 0;
}
// new and improved weather display [Valaris]
static void clif_weather_sub(int fd, int id, int type) {
- WFIFOHEAD(fd, packet_len_table[0x1f3]);
+ WFIFOHEAD(fd, packet_len(0x1f3));
WFIFOW(fd,0) = 0x1f3;
WFIFOL(fd,2) = id;
WFIFOL(fd,6) = type;
- WFIFOSET(fd,packet_len_table[0x1f3]);
+ WFIFOSET(fd,packet_len(0x1f3));
}
/*==========================================
@@ -1393,26 +1332,26 @@ int clif_spawn(struct block_list *bl)
case 0x78: //Convert to 0x79
WBUFW(buf, 0) = 0x79;
WBUFW(buf,51) = WBUFW(buf,52); //Lv is placed on offset 52
- clif_send(buf, packet_len_table[0x79], bl, AREA_WOS);
+ clif_send(buf, packet_len(0x79), bl, AREA_WOS);
if (disguised(bl))
- clif_setdisguise((TBL_PC*)bl, buf, packet_len_table[0x79], 0);
+ clif_setdisguise((TBL_PC*)bl, buf, packet_len(0x79), 0);
break;
#if PACKETVER > 3
case 0x1d8: //Convert to 0x1d9
WBUFW(buf, 0) = 0x1d9;
WBUFW(buf,51) = WBUFW(buf,52); //Lv is placed on offset 52
- clif_send(buf, packet_len_table[0x1d9], bl, AREA_WOS);
+ clif_send(buf, packet_len(0x1d9), bl, AREA_WOS);
if (disguised(bl))
- clif_setdisguise((TBL_PC*)bl, buf, packet_len_table[0x1d9], 0);
+ clif_setdisguise((TBL_PC*)bl, buf, packet_len(0x1d9), 0);
break;
#endif
#if PACKETVER > 6
case 0x22a: //Convert to 0x22b
WBUFW(buf, 0) = 0x22b;
WBUFW(buf,55) = WBUFW(buf,56); //Lv is placed on offset 56
- clif_send(buf, packet_len_table[0x22b], bl, AREA_WOS);
+ clif_send(buf, packet_len(0x22b), bl, AREA_WOS);
if (disguised(bl))
- clif_setdisguise((TBL_PC*)bl, buf, packet_len_table[0x22b], 0);
+ clif_setdisguise((TBL_PC*)bl, buf, packet_len(0x22b), 0);
break;
#endif
}
@@ -1432,10 +1371,10 @@ int clif_spawn(struct block_list *bl)
WBUFW(buf,24)=vd->head_bottom; //Pet armor
WBUFPOS(buf,36,bl->x,bl->y,unit_getdir(bl));
- clif_send(buf,packet_len_table[0x7c],bl,AREA_WOS);
+ clif_send(buf,packet_len(0x7c),bl,AREA_WOS);
if (disguised(bl)) {
WBUFL(buf,2)=-bl->id;
- clif_send(buf,packet_len_table[0x7c],bl,SELF);
+ clif_send(buf,packet_len(0x7c),bl,SELF);
}
}
@@ -1477,7 +1416,7 @@ int clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag)
nullpo_retr(0, hd);
status = &hd->battle_status;
- malloc_set(buf,0,packet_len_table[0x22e]);
+ malloc_set(buf,0,packet_len(0x22e));
WBUFW(buf,0)=0x22e;
memcpy(WBUFP(buf,2),hd->homunculus.name,NAME_LENGTH);
// Bit field, bit 0 : rename_flag (1 = already renamed), bit 1 : homunc vaporized (1 = true), bit 2 : homunc dead (1 = true)
@@ -1512,19 +1451,19 @@ int clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag)
WBUFL(buf,63)=hd->exp_next;
WBUFW(buf,67)=hd->homunculus.skillpts;
WBUFW(buf,69)=1; // FIXME: Attackable? When exactly is a homun not attackable? [Skotlex]
- clif_send(buf,packet_len_table[0x22e],&sd->bl,SELF);
+ clif_send(buf,packet_len(0x22e),&sd->bl,SELF);
return 0;
}
void clif_send_homdata(struct map_session_data *sd, int type, int param) { //[orn]
int fd = sd->fd;
- WFIFOHEAD(fd, packet_len_table[0x230]);
+ WFIFOHEAD(fd, packet_len(0x230));
nullpo_retv(sd->hd);
WFIFOW(fd,0)=0x230;
WFIFOW(fd,2)=type;
WFIFOL(fd,4)=sd->hd->bl.id;
WFIFOL(fd,8)=param;
- WFIFOSET(fd,packet_len_table[0x230]);
+ WFIFOSET(fd,packet_len(0x230));
return;
}
@@ -1563,7 +1502,7 @@ int clif_homskillinfoblock(struct map_session_data *sd) { //[orn]
void clif_homskillup(struct map_session_data *sd, int skill_num) { //[orn]
struct homun_data *hd;
int fd=sd->fd, skillid;
- WFIFOHEAD(fd, packet_len_table[0x239]);
+ WFIFOHEAD(fd, packet_len(0x239));
nullpo_retv(sd);
skillid = skill_num - HM_SKILLBASE - 1;
@@ -1575,7 +1514,7 @@ void clif_homskillup(struct map_session_data *sd, int skill_num) { //[orn]
WFIFOW(fd,6) = skill_get_sp(skill_num,hd->homunculus.hskill[skillid].lv);
WFIFOW(fd,8) = skill_get_range2(&hd->bl, skill_num,hd->homunculus.hskill[skillid].lv);
WFIFOB(fd,10) = (hd->homunculus.hskill[skillid].lv < skill_get_max(hd->homunculus.hskill[skillid].id)) ? 1 : 0;
- WFIFOSET(fd,packet_len_table[0x239]);
+ WFIFOSET(fd,packet_len(0x239));
return;
}
@@ -1657,11 +1596,11 @@ void clif_parse_HomMenu(int fd, struct map_session_data *sd) { //[orn]
int clif_hom_food(struct map_session_data *sd,int foodid,int fail) //[orn]
{
int fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x22f]);
+ WFIFOHEAD(fd,packet_len(0x22f));
WFIFOW(fd,0)=0x22f;
WFIFOB(fd,2)=fail;
WFIFOW(fd,3)=foodid;
- WFIFOSET(fd,packet_len_table[0x22f]);
+ WFIFOSET(fd,packet_len(0x22f));
return 0;
}
@@ -1673,12 +1612,12 @@ int clif_hom_food(struct map_session_data *sd,int foodid,int fail) //[orn]
int clif_walkok(struct map_session_data *sd)
{
int fd=sd->fd;
- WFIFOHEAD(fd, packet_len_table[0x87]);
+ WFIFOHEAD(fd, packet_len(0x87));
WFIFOW(fd,0)=0x87;
WFIFOL(fd,2)=gettick();
WFIFOPOS2(fd,6,sd->bl.x,sd->bl.y,sd->ud.to_x,sd->ud.to_y);
WFIFOB(fd,11)=0x88;
- WFIFOSET(fd,packet_len_table[0x87]);
+ WFIFOSET(fd,packet_len(0x87));
return 0;
}
@@ -1701,7 +1640,7 @@ int clif_movepc(struct map_session_data *sd) {
|| map[sd->bl.m].flag.rain
|| map[sd->bl.m].flag.clouds2
) {
- malloc_set(buf,0,packet_len_table[0x7b]);
+ malloc_set(buf,0,packet_len(0x7b));
WBUFW(buf,0)=0x7b;
WBUFL(buf,2)=-10;
WBUFW(buf,6)=sd->battle_status.speed;
@@ -1713,7 +1652,7 @@ int clif_movepc(struct map_session_data *sd) {
WBUFPOS2(buf,50,sd->bl.x,sd->bl.y,sd->ud.to_x,sd->ud.to_y);
WBUFB(buf,56)=5;
WBUFB(buf,57)=5;
- clif_send(buf, packet_len_table[0x7b], &sd->bl, SELF);
+ clif_send(buf, packet_len(0x7b), &sd->bl, SELF);
}
return 0;
@@ -1842,12 +1781,12 @@ int clif_changemap(struct map_session_data *sd, short map, int x, int y) {
fd = sd->fd;
- WFIFOHEAD(fd, packet_len_table[0x91]);
+ WFIFOHEAD(fd, packet_len(0x91));
WFIFOW(fd,0) = 0x91;
memcpy(WFIFOP(fd,2), mapindex_id2name(map), MAP_NAME_LENGTH);
WFIFOW(fd,18) = x;
WFIFOW(fd,20) = y;
- WFIFOSET(fd, packet_len_table[0x91]);
+ WFIFOSET(fd, packet_len(0x91));
return 0;
}
@@ -1862,7 +1801,7 @@ int clif_changemapserver(struct map_session_data *sd, char *mapname, int x, int
nullpo_retr(0, sd);
fd = sd->fd;
- WFIFOHEAD(fd, packet_len_table[0x92]);
+ WFIFOHEAD(fd, packet_len(0x92));
WFIFOW(fd,0) = 0x92;
//Better not trust the null-terminator is there. [Skotlex]
memcpy(WFIFOP(fd,2), mapname, MAP_NAME_LENGTH);
@@ -1871,7 +1810,7 @@ int clif_changemapserver(struct map_session_data *sd, char *mapname, int x, int
WFIFOW(fd,20) = y;
WFIFOL(fd,22) = ip;
WFIFOW(fd,26) = port;
- WFIFOSET(fd, packet_len_table[0x92]);
+ WFIFOSET(fd, packet_len(0x92));
return 0;
}
@@ -1894,10 +1833,10 @@ int clif_fixpos(struct block_list *bl) {
WBUFL(buf,2)=bl->id;
WBUFW(buf,6)=bl->x;
WBUFW(buf,8)=bl->y;
- clif_send(buf, packet_len_table[0x88], bl, AREA);
+ clif_send(buf, packet_len(0x88), bl, AREA);
if (disguised(bl)) {
WBUFL(buf,2)=-bl->id;
- clif_send(buf, packet_len_table[0x88], bl, SELF);
+ clif_send(buf, packet_len(0x88), bl, SELF);
}
return 0;
}
@@ -1912,10 +1851,10 @@ int clif_npcbuysell(struct map_session_data* sd, int id) {
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd, packet_len_table[0xc4]);
+ WFIFOHEAD(fd, packet_len(0xc4));
WFIFOW(fd,0)=0xc4;
WFIFOL(fd,2)=id;
- WFIFOSET(fd,packet_len_table[0xc4]);
+ WFIFOSET(fd,packet_len(0xc4));
return 0;
}
@@ -2014,10 +1953,10 @@ int clif_scriptnext(struct map_session_data *sd,int npcid) {
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd, packet_len_table[0xb5]);
+ WFIFOHEAD(fd, packet_len(0xb5));
WFIFOW(fd,0)=0xb5;
WFIFOL(fd,2)=npcid;
- WFIFOSET(fd,packet_len_table[0xb5]);
+ WFIFOSET(fd,packet_len(0xb5));
return 0;
}
@@ -2032,10 +1971,10 @@ int clif_scriptclose(struct map_session_data *sd, int npcid) {
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd, packet_len_table[0xb6]);
+ WFIFOHEAD(fd, packet_len(0xb6));
WFIFOW(fd,0)=0xb6;
WFIFOL(fd,2)=npcid;
- WFIFOSET(fd,packet_len_table[0xb6]);
+ WFIFOSET(fd,packet_len(0xb6));
return 0;
}
@@ -2046,16 +1985,16 @@ int clif_scriptclose(struct map_session_data *sd, int npcid) {
*/
void clif_sendfakenpc(struct map_session_data *sd, int npcid) {
int fd = sd->fd;
- WFIFOHEAD(fd, packet_len_table[0x78]);
+ WFIFOHEAD(fd, packet_len(0x78));
sd->state.using_fake_npc = 1;
- malloc_set(WFIFOP(fd,0), 0, packet_len_table[0x78]);
+ malloc_set(WFIFOP(fd,0), 0, packet_len(0x78));
WFIFOW(fd,0)=0x78;
WFIFOL(fd,2)=npcid;
WFIFOW(fd,14)=111;
WFIFOPOS(fd,46,sd->bl.x,sd->bl.y,sd->ud.dir);
WFIFOB(fd,49)=5;
WFIFOB(fd,50)=5;
- WFIFOSET(fd, packet_len_table[0x78]);
+ WFIFOSET(fd, packet_len(0x78));
return;
}
@@ -2099,10 +2038,10 @@ int clif_scriptinput(struct map_session_data *sd, int npcid) {
clif_sendfakenpc(sd, npcid);
fd=sd->fd;
- WFIFOHEAD(fd, packet_len_table[0x142]);
+ WFIFOHEAD(fd, packet_len(0x142));
WFIFOW(fd,0)=0x142;
WFIFOL(fd,2)=npcid;
- WFIFOSET(fd,packet_len_table[0x142]);
+ WFIFOSET(fd,packet_len(0x142));
return 0;
}
@@ -2123,10 +2062,10 @@ int clif_scriptinputstr(struct map_session_data *sd, int npcid) {
clif_sendfakenpc(sd, npcid);
fd=sd->fd;
- WFIFOHEAD(fd, packet_len_table[0x1d4]);
+ WFIFOHEAD(fd, packet_len(0x1d4));
WFIFOW(fd,0)=0x1d4;
WFIFOL(fd,2)=npcid;
- WFIFOSET(fd,packet_len_table[0x1d4]);
+ WFIFOSET(fd,packet_len(0x1d4));
return 0;
}
@@ -2141,7 +2080,7 @@ int clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd, packet_len_table[0x144]);
+ WFIFOHEAD(fd, packet_len(0x144));
WFIFOW(fd,0)=0x144;
WFIFOL(fd,2)=npc_id;
WFIFOL(fd,6)=type;
@@ -2149,7 +2088,7 @@ int clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int
WFIFOL(fd,14)=y;
WFIFOB(fd,18)=id;
WFIFOL(fd,19)=color;
- WFIFOSET(fd,packet_len_table[0x144]);
+ WFIFOSET(fd,packet_len(0x144));
return 0;
}
@@ -2164,11 +2103,11 @@ int clif_cutin(struct map_session_data *sd, char *image, int type) {
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd, packet_len_table[0x1b3]);
+ WFIFOHEAD(fd, packet_len(0x1b3));
WFIFOW(fd,0)=0x1b3;
strncpy((char*)WFIFOP(fd,2),image,64);
WFIFOB(fd,66)=type;
- WFIFOSET(fd,packet_len_table[0x1b3]);
+ WFIFOSET(fd,packet_len(0x1b3));
return 0;
}
@@ -2241,7 +2180,7 @@ int clif_additem(struct map_session_data *sd, int n, int amount, int fail) {
if (!session_isActive(fd)) //Sasuke-
return 0;
- WFIFOHEAD(fd,packet_len_table[0xa0]);
+ WFIFOHEAD(fd,packet_len(0xa0));
buf = WFIFOP(fd,0);
if(fail) {
WBUFW(buf,0)=0xa0;
@@ -2278,7 +2217,7 @@ int clif_additem(struct map_session_data *sd, int n, int amount, int fail) {
WBUFB(buf,22)=fail;
}
- WFIFOSET(fd,packet_len_table[0xa0]);
+ WFIFOSET(fd,packet_len(0xa0));
return 0;
}
@@ -2293,12 +2232,12 @@ int clif_delitem(struct map_session_data *sd,int n,int amount)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd, packet_len_table[0xaf]);
+ WFIFOHEAD(fd, packet_len(0xaf));
WFIFOW(fd,0)=0xaf;
WFIFOW(fd,2)=n+2;
WFIFOW(fd,4)=amount;
- WFIFOSET(fd,packet_len_table[0xaf]);
+ WFIFOSET(fd,packet_len(0xaf));
return 0;
}
@@ -2573,7 +2512,7 @@ int clif_guild_xy(struct map_session_data *sd)
WBUFL(buf,2)=sd->status.account_id;
WBUFW(buf,6)=sd->bl.x;
WBUFW(buf,8)=sd->bl.y;
- clif_send(buf,packet_len_table[0x1eb],&sd->bl,GUILD_SAMEMAP_WOS);
+ clif_send(buf,packet_len(0x1eb),&sd->bl,GUILD_SAMEMAP_WOS);
return 0;
}
@@ -2585,12 +2524,12 @@ int clif_guild_xy(struct map_session_data *sd)
int clif_guild_xy_single(int fd, struct map_session_data *sd)
{
- WFIFOHEAD(fd,packet_len_table[0x1eb]);
+ WFIFOHEAD(fd,packet_len(0x1eb));
WFIFOW(fd,0)=0x1eb;
WFIFOL(fd,2)=sd->status.account_id;
WFIFOW(fd,6)=sd->bl.x;
WFIFOW(fd,8)=sd->bl.y;
- WFIFOSET(fd,packet_len_table[0x1eb]);
+ WFIFOSET(fd,packet_len(0x1eb));
return 0;
}
@@ -2605,7 +2544,7 @@ int clif_guild_xy_remove(struct map_session_data *sd)
WBUFL(buf,2)=sd->status.account_id;
WBUFW(buf,6)=-1;
WBUFW(buf,8)=-1;
- clif_send(buf,packet_len_table[0x1eb],&sd->bl,GUILD_SAMEMAP_WOS);
+ clif_send(buf,packet_len(0x1eb),&sd->bl,GUILD_SAMEMAP_WOS);
return 0;
}
@@ -2849,7 +2788,7 @@ int clif_changestatus(struct block_list *bl,int type,int val)
ShowError("clif_changestatus : unrecognized type %d.\n",type);
return 1;
}
- clif_send(buf,packet_len_table[0x1ab],bl,AREA_WOS);
+ clif_send(buf,packet_len(0x1ab),bl,AREA_WOS);
}
return 0;
}
@@ -2939,7 +2878,7 @@ int clif_changelook(struct block_list *bl,int type,int val)
WBUFL(buf,2)=bl->id;
WBUFB(buf,6)=type;
WBUFB(buf,7)=val;
- clif_send(buf,packet_len_table[0xc3],bl,AREA);
+ clif_send(buf,packet_len(0xc3),bl,AREA);
#else
if(type == LOOK_WEAPON || type == LOOK_SHIELD) {
WBUFW(buf,0)=0x1d7;
@@ -2947,7 +2886,7 @@ int clif_changelook(struct block_list *bl,int type,int val)
WBUFB(buf,6)=LOOK_WEAPON;
WBUFW(buf,7)=vd->weapon;
WBUFW(buf,9)=vd->shield;
- clif_send(buf,packet_len_table[0x1d7],bl,AREA);
+ clif_send(buf,packet_len(0x1d7),bl,AREA);
}
else
{
@@ -2956,7 +2895,7 @@ int clif_changelook(struct block_list *bl,int type,int val)
WBUFB(buf,6)=type;
WBUFW(buf,7)=val;
WBUFW(buf,9)=0;
- clif_send(buf,packet_len_table[0x1d7],bl,AREA);
+ clif_send(buf,packet_len(0x1d7),bl,AREA);
}
#endif
return 0;
@@ -2971,14 +2910,14 @@ void clif_changetraplook(struct block_list *bl,int val)
WBUFL(buf,2)=bl->id;
WBUFB(buf,6)=LOOK_BASE;
WBUFB(buf,7)=val;
- clif_send(buf,packet_len_table[0xc3],bl,AREA);
+ clif_send(buf,packet_len(0xc3),bl,AREA);
#else
WBUFW(buf,0)=0x1d7;
WBUFL(buf,2)=bl->id;
WBUFB(buf,6)=LOOK_BASE;
WBUFW(buf,7)=val;
WBUFW(buf,9)=0;
- clif_send(buf,packet_len_table[0x1d7],bl,AREA);
+ clif_send(buf,packet_len(0x1d7),bl,AREA);
#endif
@@ -2993,14 +2932,14 @@ void clif_refreshlook(struct block_list *bl,int id,int type,int val,int area)
WBUFL(buf,2)=id;
WBUFB(buf,6)=type;
WBUFB(buf,7)=val;
- clif_send(buf,packet_len_table[0xc3],bl,area);
+ clif_send(buf,packet_len(0xc3),bl,area);
#else
WBUFW(buf,0)=0x1d7;
WBUFL(buf,2)=id;
WBUFB(buf,6)=type;
WBUFW(buf,7)=val;
WBUFW(buf,9)=0;
- clif_send(buf,packet_len_table[0x1d7],bl,area);
+ clif_send(buf,packet_len(0x1d7),bl,area);
#endif
return;
}
@@ -3017,7 +2956,7 @@ int clif_initialstatus(struct map_session_data *sd)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xbd]);
+ WFIFOHEAD(fd,packet_len(0xbd));
buf=WFIFOP(fd,0);
WBUFW(buf,0)=0xbd;
@@ -3053,7 +2992,7 @@ int clif_initialstatus(struct map_session_data *sd)
WBUFW(buf,40) = sd->status.karma;
WBUFW(buf,42) = sd->status.manner;
- WFIFOSET(fd,packet_len_table[0xbd]);
+ WFIFOSET(fd,packet_len(0xbd));
clif_updatestatus(sd,SP_STR);
clif_updatestatus(sd,SP_AGI);
@@ -3081,11 +3020,11 @@ int clif_arrowequip(struct map_session_data *sd,int val)
pc_stop_attack(sd); // [Valaris]
fd=sd->fd;
- WFIFOHEAD(fd, packet_len_table[0x013c]);
+ WFIFOHEAD(fd, packet_len(0x013c));
WFIFOW(fd,0)=0x013c;
WFIFOW(fd,2)=val+2;//矢のアイテムID
- WFIFOSET(fd,packet_len_table[0x013c]);
+ WFIFOSET(fd,packet_len(0x013c));
return 0;
}
@@ -3101,11 +3040,11 @@ int clif_arrow_fail(struct map_session_data *sd,int type)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd, packet_len_table[0x013b]);
+ WFIFOHEAD(fd, packet_len(0x013b));
WFIFOW(fd,0)=0x013b;
WFIFOW(fd,2)=type;
- WFIFOSET(fd,packet_len_table[0x013b]);
+ WFIFOSET(fd,packet_len(0x013b));
return 0;
}
@@ -3158,12 +3097,12 @@ int clif_statusupack(struct map_session_data *sd,int type,int ok,int val)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xbc]);
+ WFIFOHEAD(fd,packet_len(0xbc));
WFIFOW(fd,0)=0xbc;
WFIFOW(fd,2)=type;
WFIFOB(fd,4)=ok;
WFIFOB(fd,5)=val;
- WFIFOSET(fd,packet_len_table[0xbc]);
+ WFIFOSET(fd,packet_len(0xbc));
return 0;
}
@@ -3179,12 +3118,12 @@ int clif_equipitemack(struct map_session_data *sd,int n,int pos,int ok)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xaa]);
+ WFIFOHEAD(fd,packet_len(0xaa));
WFIFOW(fd,0)=0xaa;
WFIFOW(fd,2)=n+2;
WFIFOW(fd,4)=pos;
WFIFOB(fd,6)=ok;
- WFIFOSET(fd,packet_len_table[0xaa]);
+ WFIFOSET(fd,packet_len(0xaa));
return 0;
}
@@ -3200,12 +3139,12 @@ int clif_unequipitemack(struct map_session_data *sd,int n,int pos,int ok)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xac]);
+ WFIFOHEAD(fd,packet_len(0xac));
WFIFOW(fd,0)=0xac;
WFIFOW(fd,2)=n+2;
WFIFOW(fd,4)=pos;
WFIFOB(fd,6)=ok;
- WFIFOSET(fd,packet_len_table[0xac]);
+ WFIFOSET(fd,packet_len(0xac));
return 0;
}
@@ -3224,7 +3163,7 @@ int clif_misceffect(struct block_list* bl,int type)
WBUFL(buf,2) = bl->id;
WBUFL(buf,6) = type;
- clif_send(buf,packet_len_table[0x19b],bl,AREA);
+ clif_send(buf,packet_len(0x19b),bl,AREA);
return 0;
}
@@ -3233,13 +3172,13 @@ int clif_misceffect2(struct block_list *bl, int type) {
nullpo_retr(0, bl);
- malloc_set(buf, 0, packet_len_table[0x1f3]);
+ malloc_set(buf, 0, packet_len(0x1f3));
WBUFW(buf,0) = 0x1f3;
WBUFL(buf,2) = bl->id;
WBUFL(buf,6) = type;
- clif_send(buf, packet_len_table[0x1f3], bl, AREA);
+ clif_send(buf, packet_len(0x1f3), bl, AREA);
return 0;
@@ -3265,14 +3204,14 @@ int clif_changeoption(struct block_list* bl)
WBUFL(buf,10) = sc->option;
WBUFB(buf,14) = 0; // PK???
if(disguised(bl)) {
- clif_send(buf,packet_len_table[0x229],bl,AREA_WOS);
+ clif_send(buf,packet_len(0x229),bl,AREA_WOS);
WBUFL(buf,2) = -bl->id;
- clif_send(buf,packet_len_table[0x229],bl,SELF);
+ clif_send(buf,packet_len(0x229),bl,SELF);
WBUFL(buf,2) = bl->id;
WBUFL(buf,10) = OPTION_INVISIBLE;
- clif_send(buf,packet_len_table[0x229],bl,SELF);
+ clif_send(buf,packet_len(0x229),bl,SELF);
} else
- clif_send(buf,packet_len_table[0x229],bl,AREA);
+ clif_send(buf,packet_len(0x229),bl,AREA);
#else
WBUFW(buf,0) = 0x119;
WBUFL(buf,2) = bl->id;
@@ -3281,14 +3220,14 @@ int clif_changeoption(struct block_list* bl)
WBUFW(buf,10) = sc->option;
WBUFB(buf,12) = 0; // ??
if(disguised(bl)) {
- clif_send(buf,packet_len_table[0x119],bl,AREA_WOS);
+ clif_send(buf,packet_len(0x119),bl,AREA_WOS);
WBUFL(buf,2) = -bl->id;
- clif_send(buf,packet_len_table[0x119],bl,SELF);
+ clif_send(buf,packet_len(0x119),bl,SELF);
WBUFL(buf,2) = bl->id;
WBUFW(buf,10) = OPTION_INVISIBLE;
- clif_send(buf,packet_len_table[0x119],bl,SELF);
+ clif_send(buf,packet_len(0x119),bl,SELF);
} else
- clif_send(buf,packet_len_table[0x119],bl,AREA);
+ clif_send(buf,packet_len(0x119),bl,AREA);
#endif
return 0;
@@ -3304,22 +3243,22 @@ int clif_useitemack(struct map_session_data *sd,int index,int amount,int ok)
if(!ok) {
int fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xa8]);
+ WFIFOHEAD(fd,packet_len(0xa8));
WFIFOW(fd,0)=0xa8;
WFIFOW(fd,2)=index+2;
WFIFOW(fd,4)=amount;
WFIFOB(fd,6)=ok;
- WFIFOSET(fd,packet_len_table[0xa8]);
+ WFIFOSET(fd,packet_len(0xa8));
}
else {
#if PACKETVER < 3
int fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xa8]);
+ WFIFOHEAD(fd,packet_len(0xa8));
WFIFOW(fd,0)=0xa8;
WFIFOW(fd,2)=index+2;
WFIFOW(fd,4)=amount;
WFIFOB(fd,6)=ok;
- WFIFOSET(fd,packet_len_table[0xa8]);
+ WFIFOSET(fd,packet_len(0xa8));
#else
unsigned char buf[32];
@@ -3332,7 +3271,7 @@ int clif_useitemack(struct map_session_data *sd,int index,int amount,int ok)
WBUFL(buf,6)=sd->bl.id;
WBUFW(buf,10)=amount;
WBUFB(buf,12)=ok;
- clif_send(buf,packet_len_table[0x1c8],&sd->bl,AREA);
+ clif_send(buf,packet_len(0x1c8),&sd->bl,AREA);
#endif
}
@@ -3350,10 +3289,10 @@ int clif_createchat(struct map_session_data *sd,int fail)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xd6]);
+ WFIFOHEAD(fd,packet_len(0xd6));
WFIFOW(fd,0)=0xd6;
WFIFOB(fd,2)=fail;
- WFIFOSET(fd,packet_len_table[0xd6]);
+ WFIFOSET(fd,packet_len(0xd6));
return 0;
}
@@ -3426,11 +3365,11 @@ int clif_clearchat(struct chat_data *cd,int fd)
WBUFW(buf,0)=0xd8;
WBUFL(buf,2)=cd->bl.id;
if(fd){
- WFIFOHEAD(fd,packet_len_table[0xd8]);
- memcpy(WFIFOP(fd,0),buf,packet_len_table[0xd8]);
- WFIFOSET(fd,packet_len_table[0xd8]);
+ WFIFOHEAD(fd,packet_len(0xd8));
+ memcpy(WFIFOP(fd,0),buf,packet_len(0xd8));
+ WFIFOSET(fd,packet_len(0xd8));
} else {
- clif_send(buf,packet_len_table[0xd8],*cd->owner,AREA_WOSC);
+ clif_send(buf,packet_len(0xd8),*cd->owner,AREA_WOSC);
}
return 0;
@@ -3448,10 +3387,10 @@ int clif_joinchatfail(struct map_session_data *sd,int fail)
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xda]);
+ WFIFOHEAD(fd,packet_len(0xda));
WFIFOW(fd,0)=0xda;
WFIFOB(fd,2)=fail;
- WFIFOSET(fd,packet_len_table[0xda]);
+ WFIFOSET(fd,packet_len(0xda));
return 0;
}
@@ -3498,7 +3437,7 @@ int clif_addchat(struct chat_data* cd,struct map_session_data *sd)
WBUFW(buf, 0) = 0x0dc;
WBUFW(buf, 2) = cd->users;
memcpy(WBUFP(buf, 4),sd->status.name,NAME_LENGTH);
- clif_send(buf,packet_len_table[0xdc],&sd->bl,CHAT_WOS);
+ clif_send(buf,packet_len(0xdc),&sd->bl,CHAT_WOS);
return 0;
}
@@ -3521,7 +3460,7 @@ int clif_changechatowner(struct chat_data* cd,struct map_session_data *sd)
WBUFL(buf,32) = 0;
memcpy(WBUFP(buf,36),sd->status.name,NAME_LENGTH);
- clif_send(buf,packet_len_table[0xe1]*2,&sd->bl,CHAT);
+ clif_send(buf,packet_len(0xe1)*2,&sd->bl,CHAT);
return 0;
}
@@ -3542,7 +3481,7 @@ int clif_leavechat(struct chat_data* cd,struct map_session_data *sd)
memcpy(WBUFP(buf,4),sd->status.name,NAME_LENGTH);
WBUFB(buf,28) = 0;
- clif_send(buf,packet_len_table[0xdd],&sd->bl,CHAT);
+ clif_send(buf,packet_len(0xdd),&sd->bl,CHAT);
return 0;
}
@@ -3559,12 +3498,12 @@ int clif_traderequest(struct map_session_data *sd,char *name)
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xe5]);
+ WFIFOHEAD(fd,packet_len(0xe5));
WFIFOW(fd,0)=0xe5;
strcpy((char*)WFIFOP(fd,2),name);
- WFIFOSET(fd,packet_len_table[0xe5]);
+ WFIFOSET(fd,packet_len(0xe5));
return 0;
}
@@ -3580,10 +3519,10 @@ int clif_tradestart(struct map_session_data *sd,int type)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xe7]);
+ WFIFOHEAD(fd,packet_len(0xe7));
WFIFOW(fd,0)=0xe7;
WFIFOB(fd,2)=type;
- WFIFOSET(fd,packet_len_table[0xe7]);
+ WFIFOSET(fd,packet_len(0xe7));
return 0;
}
@@ -3600,7 +3539,7 @@ int clif_tradeadditem(struct map_session_data *sd,struct map_session_data *tsd,i
nullpo_retr(0, tsd);
fd=tsd->fd;
- WFIFOHEAD(fd,packet_len_table[0xe9]);
+ WFIFOHEAD(fd,packet_len(0xe9));
WFIFOW(fd,0)=0xe9;
WFIFOL(fd,2)=amount;
if(index==0){
@@ -3624,7 +3563,7 @@ int clif_tradeadditem(struct map_session_data *sd,struct map_session_data *tsd,i
WFIFOB(fd,10)= sd->status.inventory[index].refine; //refine
clif_addcards(WFIFOP(fd, 11), &sd->status.inventory[index]);
}
- WFIFOSET(fd,packet_len_table[0xe9]);
+ WFIFOSET(fd,packet_len(0xe9));
return 0;
}
@@ -3640,11 +3579,11 @@ int clif_tradeitemok(struct map_session_data *sd,int index,int fail)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xea]);
+ WFIFOHEAD(fd,packet_len(0xea));
WFIFOW(fd,0)=0xea;
WFIFOW(fd,2)=index;
WFIFOB(fd,4)=fail;
- WFIFOSET(fd,packet_len_table[0xea]);
+ WFIFOSET(fd,packet_len(0xea));
return 0;
}
@@ -3660,10 +3599,10 @@ int clif_tradedeal_lock(struct map_session_data *sd,int fail)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xec]);
+ WFIFOHEAD(fd,packet_len(0xec));
WFIFOW(fd,0)=0xec;
WFIFOB(fd,2)=fail; // 0=you 1=the other person
- WFIFOSET(fd,packet_len_table[0xec]);
+ WFIFOSET(fd,packet_len(0xec));
return 0;
}
@@ -3679,9 +3618,9 @@ int clif_tradecancelled(struct map_session_data *sd)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xee]);
+ WFIFOHEAD(fd,packet_len(0xee));
WFIFOW(fd,0)=0xee;
- WFIFOSET(fd,packet_len_table[0xee]);
+ WFIFOSET(fd,packet_len(0xee));
return 0;
}
@@ -3697,10 +3636,10 @@ int clif_tradecompleted(struct map_session_data *sd,int fail)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xf0]);
+ WFIFOHEAD(fd,packet_len(0xf0));
WFIFOW(fd,0)=0xf0;
WFIFOB(fd,2)=fail;
- WFIFOSET(fd,packet_len_table[0xf0]);
+ WFIFOSET(fd,packet_len(0xf0));
return 0;
}
@@ -3717,11 +3656,11 @@ int clif_updatestorageamount(struct map_session_data *sd,struct storage *stor)
nullpo_retr(0, stor);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xf2]);
+ WFIFOHEAD(fd,packet_len(0xf2));
WFIFOW(fd,0) = 0xf2; // update storage amount
WFIFOW(fd,2) = stor->storage_amount; //items
WFIFOW(fd,4) = MAX_STORAGE; //items max
- WFIFOSET(fd,packet_len_table[0xf2]);
+ WFIFOSET(fd,packet_len(0xf2));
return 0;
}
@@ -3738,7 +3677,7 @@ int clif_storageitemadded(struct map_session_data *sd,struct storage *stor,int i
nullpo_retr(0, stor);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xf4]);
+ WFIFOHEAD(fd,packet_len(0xf4));
WFIFOW(fd,0) =0xf4; // Storage item added
WFIFOW(fd,2) =index+1; // index
WFIFOL(fd,4) =amount; // amount
@@ -3750,7 +3689,7 @@ int clif_storageitemadded(struct map_session_data *sd,struct storage *stor,int i
WFIFOB(fd,11)=stor->storage_[index].attribute; // attribute
WFIFOB(fd,12)=stor->storage_[index].refine; //refine
clif_addcards(WFIFOP(fd,13), &stor->storage_[index]);
- WFIFOSET(fd,packet_len_table[0xf4]);
+ WFIFOSET(fd,packet_len(0xf4));
return 0;
}
@@ -3767,11 +3706,11 @@ int clif_updateguildstorageamount(struct map_session_data *sd,struct guild_stora
nullpo_retr(0, stor);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xf2]);
+ WFIFOHEAD(fd,packet_len(0xf2));
WFIFOW(fd,0) = 0xf2; // update storage amount
WFIFOW(fd,2) = stor->storage_amount; //items
WFIFOW(fd,4) = MAX_GUILD_STORAGE; //items max
- WFIFOSET(fd,packet_len_table[0xf2]);
+ WFIFOSET(fd,packet_len(0xf2));
return 0;
}
@@ -3788,7 +3727,7 @@ int clif_guildstorageitemadded(struct map_session_data *sd,struct guild_storage
nullpo_retr(0, stor);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xf4]);
+ WFIFOHEAD(fd,packet_len(0xf4));
WFIFOW(fd,0) =0xf4; // Storage item added
WFIFOW(fd,2) =index+1; // index
WFIFOL(fd,4) =amount; // amount
@@ -3800,7 +3739,7 @@ int clif_guildstorageitemadded(struct map_session_data *sd,struct guild_storage
WFIFOB(fd,11)=stor->storage_[index].attribute; // attribute
WFIFOB(fd,12)=stor->storage_[index].refine; //refine
clif_addcards(WFIFOP(fd,13), &stor->storage_[index]);
- WFIFOSET(fd,packet_len_table[0xf4]);
+ WFIFOSET(fd,packet_len(0xf4));
return 0;
}
@@ -3816,11 +3755,11 @@ int clif_storageitemremoved(struct map_session_data *sd,int index,int amount)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xf6]);
+ WFIFOHEAD(fd,packet_len(0xf6));
WFIFOW(fd,0)=0xf6; // Storage item removed
WFIFOW(fd,2)=index+1;
WFIFOL(fd,4)=amount;
- WFIFOSET(fd,packet_len_table[0xf6]);
+ WFIFOSET(fd,packet_len(0xf6));
return 0;
}
@@ -3836,9 +3775,9 @@ int clif_storageclose(struct map_session_data *sd)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xf8]);
+ WFIFOHEAD(fd,packet_len(0xf8));
WFIFOW(fd,0)=0xf8; // Storage Closed
- WFIFOSET(fd,packet_len_table[0xf8]);
+ WFIFOSET(fd,packet_len(0xf8));
return 0;
}
@@ -3895,21 +3834,21 @@ void clif_getareachar_char(struct map_session_data* sd,struct block_list *bl)
if (ud && ud->walktimer != -1)
{
#if PACKETVER > 6
- WFIFOHEAD(fd, packet_len_table[0x22c]);
+ WFIFOHEAD(fd, packet_len(0x22c));
#elif PACKETVER > 3
- WFIFOHEAD(fd, packet_len_table[0x1da]);
+ WFIFOHEAD(fd, packet_len(0x1da));
#else
- WFIFOHEAD(fd, packet_len_table[0x7b]);
+ WFIFOHEAD(fd, packet_len(0x7b));
#endif
len = clif_set007b(bl,vd,ud,WFIFOP(fd,0));
WFIFOSET(fd,len);
} else {
#if PACKETVER > 6
- WFIFOHEAD(fd,packet_len_table[0x22a]);
+ WFIFOHEAD(fd,packet_len(0x22a));
#elif PACKETVER > 3
- WFIFOHEAD(fd,packet_len_table[0x1d8]);
+ WFIFOHEAD(fd,packet_len(0x1d8));
#else
- WFIFOHEAD(fd,packet_len_table[0x78]);
+ WFIFOHEAD(fd,packet_len(0x78));
#endif
len = clif_set0078(bl,vd,WFIFOP(fd,0));
WFIFOSET(fd,len);
@@ -4044,7 +3983,7 @@ int clif_damage(struct block_list *src,struct block_list *dst,unsigned int tick,
}
WBUFW(buf,24)=div;
WBUFB(buf,26)=type;
- clif_send(buf,packet_len_table[0x8a],src,AREA);
+ clif_send(buf,packet_len(0x8a),src,AREA);
if(disguised(src)) {
WBUFL(buf,2)=-src->id;
@@ -4052,7 +3991,7 @@ int clif_damage(struct block_list *src,struct block_list *dst,unsigned int tick,
WBUFW(buf,22)=-1;
if(damage2 > 0)
WBUFW(buf,27)=-1;
- clif_send(buf,packet_len_table[0x8a],src,SELF);
+ clif_send(buf,packet_len(0x8a),src,SELF);
}
if (disguised(dst)) {
WBUFL(buf,6)=-dst->id;
@@ -4064,7 +4003,7 @@ int clif_damage(struct block_list *src,struct block_list *dst,unsigned int tick,
if(damage2 > 0)
WBUFW(buf,27)=-1;
}
- clif_send(buf,packet_len_table[0x8a],dst,SELF);
+ clif_send(buf,packet_len(0x8a),dst,SELF);
}
//Return adjusted can't walk delay for further processing.
return clif_calc_walkdelay(dst,ddelay,type,damage+damage2,div);
@@ -4079,7 +4018,7 @@ void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fi
int view,fd;
fd=sd->fd;
//009d <ID>.l <item ID>.w <identify flag>.B <X>.w <Y>.w <amount>.w <subX>.B <subY>.B
- WFIFOHEAD(fd,packet_len_table[0x9d]);
+ WFIFOHEAD(fd,packet_len(0x9d));
WFIFOW(fd,0)=0x9d;
WFIFOL(fd,2)=fitem->bl.id;
@@ -4093,7 +4032,7 @@ void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fi
WFIFOW(fd,13)=fitem->item_data.amount;
WFIFOB(fd,15)=fitem->subx;
WFIFOB(fd,16)=fitem->suby;
- WFIFOSET(fd,packet_len_table[0x9d]);
+ WFIFOSET(fd,packet_len(0x9d));
}
/*==========================================
@@ -4109,8 +4048,8 @@ int clif_getareachar_skillunit(struct map_session_data *sd,struct skill_unit *un
bl=map_id2bl(unit->group->src_id);
#if PACKETVER >= 3
if(unit->group->unit_id==UNT_GRAFFITI) { // Graffiti [Valaris]
- WFIFOHEAD(fd,packet_len_table[0x1c9]);
- malloc_set(WFIFOP(fd,0),0,packet_len_table[0x1c9]);
+ WFIFOHEAD(fd,packet_len(0x1c9));
+ malloc_set(WFIFOP(fd,0),0,packet_len(0x1c9));
WFIFOW(fd, 0)=0x1c9;
WFIFOL(fd, 2)=unit->bl.id;
WFIFOL(fd, 6)=unit->group->src_id;
@@ -4120,12 +4059,12 @@ int clif_getareachar_skillunit(struct map_session_data *sd,struct skill_unit *un
WFIFOB(fd,15)=1;
WFIFOB(fd,16)=1;
memcpy(WFIFOP(fd,17),unit->group->valstr,MESSAGE_SIZE);
- WFIFOSET(fd,packet_len_table[0x1c9]);
+ WFIFOSET(fd,packet_len(0x1c9));
return 0;
}
#endif
- WFIFOHEAD(fd,packet_len_table[0x11f]);
- malloc_set(WFIFOP(fd,0),0,packet_len_table[0x11f]);
+ WFIFOHEAD(fd,packet_len(0x11f));
+ malloc_set(WFIFOP(fd,0),0,packet_len(0x11f));
WFIFOW(fd, 0)=0x11f;
WFIFOL(fd, 2)=unit->bl.id;
WFIFOL(fd, 6)=unit->group->src_id;
@@ -4137,14 +4076,14 @@ int clif_getareachar_skillunit(struct map_session_data *sd,struct skill_unit *un
else
WFIFOB(fd,14)=unit->group->unit_id;
WFIFOB(fd,15)=0;
- WFIFOSET(fd,packet_len_table[0x11f]);
+ WFIFOSET(fd,packet_len(0x11f));
if(unit->group->skill_id == WZ_ICEWALL)
clif_set0192(fd,unit->bl.m,unit->bl.x,unit->bl.y,5);
return 0;
/* Previous implementation guess of packet 0x1c9, who can understand what all those fields are for? [Skotlex]
- WFIFOHEAD(fd,packet_len_table[0x1c9]);
- malloc_set(WFIFOP(fd,0),0,packet_len_table[0x1c9]);
+ WFIFOHEAD(fd,packet_len(0x1c9));
+ malloc_set(WFIFOP(fd,0),0,packet_len(0x1c9));
WFIFOW(fd, 0)=0x1c9;
WFIFOL(fd, 2)=unit->bl.id;
WFIFOL(fd, 6)=unit->group->src_id;
@@ -4180,7 +4119,7 @@ int clif_getareachar_skillunit(struct map_session_data *sd,struct skill_unit *un
WFIFOB(fd,15+81)=0xaa; //81終端文字0xaa
}
- WFIFOSET(fd,packet_len_table[0x1c9]);
+ WFIFOSET(fd,packet_len(0x1c9));
#endif
if(unit->group->skill_id == WZ_ICEWALL)
clif_set0192(fd,unit->bl.m,unit->bl.x,unit->bl.y,5);
@@ -4197,10 +4136,10 @@ int clif_clearchar_skillunit(struct skill_unit *unit,int fd)
{
nullpo_retr(0, unit);
- WFIFOHEAD(fd,packet_len_table[0x120]);
+ WFIFOHEAD(fd,packet_len(0x120));
WFIFOW(fd, 0)=0x120;
WFIFOL(fd, 2)=unit->bl.id;
- WFIFOSET(fd,packet_len_table[0x120]);
+ WFIFOSET(fd,packet_len(0x120));
if(unit->group && unit->group->skill_id == WZ_ICEWALL)
clif_set0192(fd,unit->bl.m,unit->bl.x,unit->bl.y,unit->val2);
@@ -4221,7 +4160,7 @@ int clif_01ac(struct block_list *bl)
WBUFW(buf, 0) = 0x1ac;
WBUFL(buf, 2) = bl->id;
- clif_send(buf,packet_len_table[0x1ac],bl,AREA);
+ clif_send(buf,packet_len(0x1ac),bl,AREA);
return 0;
}
@@ -4355,7 +4294,7 @@ int clif_skillinfo(struct map_session_data *sd,int skillid,int type,int range)
fd=sd->fd;
if( (id=sd->status.skill[skillid].id) <= 0 )
return 0;
- WFIFOHEAD(fd,packet_len_table[0x147]);
+ WFIFOHEAD(fd,packet_len(0x147));
WFIFOW(fd,0)=0x147;
WFIFOW(fd,2) = id;
if(type < 0)
@@ -4378,7 +4317,7 @@ int clif_skillinfo(struct map_session_data *sd,int skillid,int type,int range)
WFIFOB(fd,38)= (sd->status.skill[skillid].lv < skill_tree_get_max(id, sd->status.class_) && sd->status.skill[skillid].flag ==0 )? 1:0;
else
WFIFOB(fd,38) = 0;
- WFIFOSET(fd,packet_len_table[0x147]);
+ WFIFOSET(fd,packet_len(0x147));
return 0;
}
@@ -4436,7 +4375,7 @@ int clif_skillup(struct map_session_data *sd,int skill_num)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x10e]);
+ WFIFOHEAD(fd,packet_len(0x10e));
WFIFOW(fd,0) = 0x10e;
WFIFOW(fd,2) = skill_num;
WFIFOW(fd,4) = sd->status.skill[skill_num].lv;
@@ -4444,7 +4383,7 @@ int clif_skillup(struct map_session_data *sd,int skill_num)
WFIFOW(fd,8) = skill_get_range2(&sd->bl,skill_num,sd->status.skill[skill_num].lv);
//WFIFOB(fd,10) = (sd->status.skill[skill_num].lv < skill_get_max(sd->status.skill[skill_num].id)) ? 1 : 0;
WFIFOB(fd,10) = (sd->status.skill[skill_num].lv < skill_tree_get_max(sd->status.skill[skill_num].id, sd->status.class_)) ? 1 : 0;
- WFIFOSET(fd,packet_len_table[0x10e]);
+ WFIFOSET(fd,packet_len(0x10e));
return 0;
}
@@ -4466,11 +4405,11 @@ int clif_skillcasting(struct block_list* bl,
WBUFW(buf,14) = skill_num;
WBUFL(buf,16) = pl<0?0:pl; //Avoid sending negatives as element [Skotlex]
WBUFL(buf,20) = casttime;
- clif_send(buf,packet_len_table[0x13e], bl, AREA);
+ clif_send(buf,packet_len(0x13e), bl, AREA);
if (disguised(bl)) {
WBUFL(buf,2) = -src_id;
WBUFL(buf,20) = 0;
- clif_send(buf,packet_len_table[0x13e], bl, SELF);
+ clif_send(buf,packet_len(0x13e), bl, SELF);
}
return 0;
@@ -4488,7 +4427,7 @@ int clif_skillcastcancel(struct block_list* bl)
WBUFW(buf,0) = 0x1b9;
WBUFL(buf,2) = bl->id;
- clif_send(buf,packet_len_table[0x1b9], bl, AREA);
+ clif_send(buf,packet_len(0x1b9), bl, AREA);
return 0;
}
@@ -4520,14 +4459,14 @@ int clif_skill_fail(struct map_session_data *sd,int skill_id,int type,int btype)
if(skill_id == TF_POISON && battle_config.display_skill_fail&8)
return 0;
- WFIFOHEAD(fd,packet_len_table[0x110]);
+ WFIFOHEAD(fd,packet_len(0x110));
WFIFOW(fd,0) = 0x110;
WFIFOW(fd,2) = skill_id;
WFIFOW(fd,4) = btype;
WFIFOW(fd,6) = 0;
WFIFOB(fd,8) = 0;
WFIFOB(fd,9) = type;
- WFIFOSET(fd,packet_len_table[0x110]);
+ WFIFOSET(fd,packet_len(0x110));
return 1;
}
@@ -4569,7 +4508,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,
{ //Needed for appropiate knockback on the receiving client.
WBUFW(buf,24)=-30000;
WBUFB(buf,30)=6;
- clif_send(buf,packet_len_table[0x114],dst,SELF);
+ clif_send(buf,packet_len(0x114),dst,SELF);
}
#endif
if (battle_config.hide_woe_damage && map_flag_gvg(src->m)) {
@@ -4578,12 +4517,12 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,
WBUFW(buf,24)=damage;
}
WBUFB(buf,30)=type;
- clif_send(buf,packet_len_table[0x114],src,AREA);
+ clif_send(buf,packet_len(0x114),src,AREA);
if(disguised(src)) {
WBUFL(buf,4)=-src->id;
if(damage > 0)
WBUFW(buf,24)=-1;
- clif_send(buf,packet_len_table[0x114],src,SELF);
+ clif_send(buf,packet_len(0x114),src,SELF);
}
if (disguised(dst)) {
WBUFL(buf,8)=-dst->id;
@@ -4591,7 +4530,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,
WBUFL(buf,4)=src->id;
else if(damage > 0)
WBUFW(buf,24)=-1;
- clif_send(buf,packet_len_table[0x114],dst,SELF);
+ clif_send(buf,packet_len(0x114),dst,SELF);
}
#else
WBUFW(buf,0)=0x1de;
@@ -4608,7 +4547,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,
{ //Needed for appropiate knockback on the receiving client.
WBUFL(buf,24)=-30000;
WBUFB(buf,32)=6;
- clif_send(buf,packet_len_table[0x114],dst,SELF);
+ clif_send(buf,packet_len(0x114),dst,SELF);
}
#endif
if (battle_config.hide_woe_damage && map_flag_gvg(src->m)) {
@@ -4617,12 +4556,12 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,
WBUFL(buf,24)=damage;
}
WBUFB(buf,32)=type;
- clif_send(buf,packet_len_table[0x1de],src,AREA);
+ clif_send(buf,packet_len(0x1de),src,AREA);
if(disguised(src)) {
WBUFL(buf,4)=-src->id;
if(damage > 0)
WBUFL(buf,24)=-1;
- clif_send(buf,packet_len_table[0x1de],src,SELF);
+ clif_send(buf,packet_len(0x1de),src,SELF);
}
if (disguised(dst)) {
WBUFL(buf,8)=-dst->id;
@@ -4630,7 +4569,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,
WBUFL(buf,4)=src->id;
else if(damage > 0)
WBUFL(buf,24)=-1;
- clif_send(buf,packet_len_table[0x1de],dst,SELF);
+ clif_send(buf,packet_len(0x1de),dst,SELF);
}
#endif
@@ -4677,12 +4616,12 @@ int clif_skill_damage2(struct block_list *src,struct block_list *dst,
WBUFW(buf,30)=skill_lv;
WBUFW(buf,32)=div;
WBUFB(buf,34)=type;
- clif_send(buf,packet_len_table[0x115],src,AREA);
+ clif_send(buf,packet_len(0x115),src,AREA);
if(disguised(src)) {
WBUFL(buf,4)=-src->id;
if(damage > 0)
WBUFW(buf,28)=-1;
- clif_send(buf,packet_len_table[0x115],src,SELF);
+ clif_send(buf,packet_len(0x115),src,SELF);
}
if (disguised(dst)) {
WBUFL(buf,8)=-dst->id;
@@ -4690,7 +4629,7 @@ int clif_skill_damage2(struct block_list *src,struct block_list *dst,
WBUFL(buf,4)=src->id;
else if(damage > 0)
WBUFW(buf,28)=-1;
- clif_send(buf,packet_len_table[0x115],dst,SELF);
+ clif_send(buf,packet_len(0x115),dst,SELF);
}
//Because the damage delay must be synced with the client, here is where the can-walk tick must be updated. [Skotlex]
@@ -4714,18 +4653,18 @@ int clif_skill_nodamage(struct block_list *src,struct block_list *dst,
WBUFL(buf,6)=dst->id;
WBUFL(buf,10)=src?src->id:0;
WBUFB(buf,14)=fail;
- clif_send(buf,packet_len_table[0x11a],dst,AREA);
+ clif_send(buf,packet_len(0x11a),dst,AREA);
if (disguised(dst)) {
WBUFL(buf,6)=-dst->id;
- clif_send(buf,packet_len_table[0x115],dst,SELF);
+ clif_send(buf,packet_len(0x115),dst,SELF);
}
if(src && disguised(src)) {
WBUFL(buf,10)=-src->id;
if (disguised(dst))
WBUFL(buf,6)=dst->id;
- clif_send(buf,packet_len_table[0x115],src,SELF);
+ clif_send(buf,packet_len(0x115),src,SELF);
}
return fail;
@@ -4748,10 +4687,10 @@ int clif_skill_poseffect(struct block_list *src,int skill_id,int val,int x,int y
WBUFW(buf,10)=x;
WBUFW(buf,12)=y;
WBUFL(buf,14)=tick;
- clif_send(buf,packet_len_table[0x117],src,AREA);
+ clif_send(buf,packet_len(0x117),src,AREA);
if(disguised(src)) {
WBUFL(buf,4)=-src->id;
- clif_send(buf,packet_len_table[0x117],src,SELF);
+ clif_send(buf,packet_len(0x117),src,SELF);
}
return 0;
@@ -4777,7 +4716,7 @@ int clif_skill_setunit(struct skill_unit *unit)
#if PACKETVER >= 3
if(unit->group->unit_id==UNT_GRAFFITI) { // Graffiti [Valaris]
- malloc_set(WBUFP(buf, 0),0,packet_len_table[0x1c9]);
+ malloc_set(WBUFP(buf, 0),0,packet_len(0x1c9));
WBUFW(buf, 0)=0x1c9;
WBUFL(buf, 2)=unit->bl.id;
WBUFL(buf, 6)=unit->group->src_id;
@@ -4791,11 +4730,11 @@ int clif_skill_setunit(struct skill_unit *unit)
WBUFB(buf,15)=1;
WBUFB(buf,16)=1;
memcpy(WBUFP(buf,17),unit->group->valstr,MESSAGE_SIZE);
- clif_send(buf,packet_len_table[0x1c9],&unit->bl,AREA);
+ clif_send(buf,packet_len(0x1c9),&unit->bl,AREA);
return 0;
}
#endif
- malloc_set(WBUFP(buf, 0),0,packet_len_table[0x11f]);
+ malloc_set(WBUFP(buf, 0),0,packet_len(0x11f));
WBUFW(buf, 0)=0x11f;
WBUFL(buf, 2)=unit->bl.id;
WBUFL(buf, 6)=unit->group->src_id;
@@ -4807,11 +4746,11 @@ int clif_skill_setunit(struct skill_unit *unit)
WBUFB(buf,14)=unit->group->unit_id;
}
WBUFB(buf,15)=0;
- clif_send(buf,packet_len_table[0x11f],&unit->bl,AREA);
+ clif_send(buf,packet_len(0x11f),&unit->bl,AREA);
return 0;
/* Previous mysterious implementation noone really understands. [Skotlex]
- malloc_set(WBUFP(buf, 0),0,packet_len_table[0x1c9]);
+ malloc_set(WBUFP(buf, 0),0,packet_len(0x1c9));
WBUFW(buf, 0)=0x1c9;
WBUFL(buf, 2)=unit->bl.id;
WBUFL(buf, 6)=unit->group->src_id;
@@ -4846,7 +4785,7 @@ int clif_skill_setunit(struct skill_unit *unit)
WBUFL(buf,15+77)=unit->bl.m; //77-80マップIDかなぁ?かなり2バイトで足りそうな数字
WBUFB(buf,15+81)=0xaa; //81終端文字0xaa
}
- clif_send(buf,packet_len_table[0x1c9],&unit->bl,AREA);
+ clif_send(buf,packet_len(0x1c9),&unit->bl,AREA);
#endif
return 0;
*/
@@ -4863,7 +4802,7 @@ int clif_skill_delunit(struct skill_unit *unit)
WBUFW(buf, 0)=0x120;
WBUFL(buf, 2)=unit->bl.id;
- clif_send(buf,packet_len_table[0x120],&unit->bl,AREA);
+ clif_send(buf,packet_len(0x120),&unit->bl,AREA);
return 0;
}
/*==========================================
@@ -4878,14 +4817,14 @@ int clif_skill_warppoint(struct map_session_data *sd,int skill_num,int skill_lv,
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x11c]);
+ WFIFOHEAD(fd,packet_len(0x11c));
WFIFOW(fd,0)=0x11c;
WFIFOW(fd,2)=skill_num;
strncpy((char*)WFIFOP(fd, 4),map1,MAP_NAME_LENGTH);
strncpy((char*)WFIFOP(fd,20),map2,MAP_NAME_LENGTH);
strncpy((char*)WFIFOP(fd,36),map3,MAP_NAME_LENGTH);
strncpy((char*)WFIFOP(fd,52),map4,MAP_NAME_LENGTH);
- WFIFOSET(fd,packet_len_table[0x11c]);
+ WFIFOSET(fd,packet_len(0x11c));
sd->menuskill_id = skill_num;
if (skill_num == AL_WARP)
sd->menuskill_lv = (sd->ud.skillx<<16)|sd->ud.skilly; //Store warp position here.
@@ -4905,10 +4844,10 @@ int clif_skill_memo(struct map_session_data *sd,int flag)
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x11e]);
+ WFIFOHEAD(fd,packet_len(0x11e));
WFIFOW(fd,0)=0x11e;
WFIFOB(fd,2)=flag;
- WFIFOSET(fd,packet_len_table[0x11e]);
+ WFIFOSET(fd,packet_len(0x11e));
return 0;
}
int clif_skill_teleportmessage(struct map_session_data *sd,int flag)
@@ -4918,10 +4857,10 @@ int clif_skill_teleportmessage(struct map_session_data *sd,int flag)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x189]);
+ WFIFOHEAD(fd,packet_len(0x189));
WFIFOW(fd,0)=0x189;
WFIFOW(fd,2)=flag;
- WFIFOSET(fd,packet_len_table[0x189]);
+ WFIFOSET(fd,packet_len(0x189));
return 0;
}
@@ -4959,7 +4898,7 @@ int clif_skill_estimation(struct map_session_data *sd,struct block_list *dst)
// The following caps negative attributes to 0 since the client displays them as 255-fix. [Skotlex]
// WBUFB(buf,20+i)= (unsigned char)((fix=battle_attr_fix(NULL,dst,100,i+1,status->def_ele, status->ele_lv))<0?0:fix);
- clif_send(buf,packet_len_table[0x18c],&sd->bl,
+ clif_send(buf,packet_len(0x18c),&sd->bl,
sd->status.party_id>0?PARTY_SAMEMAP:SELF);
return 0;
}
@@ -5014,12 +4953,12 @@ int clif_status_load(struct block_list *bl,int type, int flag)
fd = ((struct map_session_data*)bl)->fd;
- WFIFOHEAD(fd,packet_len_table[0x196]);
+ WFIFOHEAD(fd,packet_len(0x196));
WFIFOW(fd,0)=0x0196;
WFIFOW(fd,2)=type;
WFIFOL(fd,4)=bl->id;
WFIFOB(fd,8)=flag; //Status start
- WFIFOSET(fd, packet_len_table[0x196]);
+ WFIFOSET(fd, packet_len(0x196));
return 0;
}
/*==========================================
@@ -5039,7 +4978,7 @@ int clif_status_change(struct block_list *bl,int type,int flag)
WBUFW(buf,2)=type;
WBUFL(buf,4)=bl->id;
WBUFB(buf,8)=flag;
- clif_send(buf,packet_len_table[0x196],bl,AREA);
+ clif_send(buf,packet_len(0x196),bl,AREA);
return 0;
}
@@ -5179,11 +5118,11 @@ int clif_announce(struct block_list *bl, char* mes, int len, unsigned long color
*/
int clif_heal(int fd,int type,int val)
{
- WFIFOHEAD(fd,packet_len_table[0x13d]);
+ WFIFOHEAD(fd,packet_len(0x13d));
WFIFOW(fd,0)=0x13d;
WFIFOW(fd,2)=type;
WFIFOW(fd,4)=val;
- WFIFOSET(fd,packet_len_table[0x13d]);
+ WFIFOSET(fd,packet_len(0x13d));
return 0;
}
@@ -5202,7 +5141,7 @@ int clif_resurrection(struct block_list *bl,int type)
WBUFL(buf,2)=bl->id;
WBUFW(buf,6)=type;
- clif_send(buf,packet_len_table[0x148],bl,type==1 ? AREA : AREA_WOS);
+ clif_send(buf,packet_len(0x148),bl,type==1 ? AREA : AREA_WOS);
if (disguised(bl))
clif_spawn(bl);
@@ -5215,10 +5154,10 @@ int clif_resurrection(struct block_list *bl,int type)
*/
int clif_set0199(int fd,int type)
{
- WFIFOHEAD(fd,packet_len_table[0x199]);
+ WFIFOHEAD(fd,packet_len(0x199));
WFIFOW(fd,0)=0x199;
WFIFOW(fd,2)=type;
- WFIFOSET(fd,packet_len_table[0x199]);
+ WFIFOSET(fd,packet_len(0x199));
return 0;
}
@@ -5232,12 +5171,12 @@ int clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type)
nullpo_retr(0, sd);
if(type == 2) {
- WFIFOHEAD(sd->fd,packet_len_table[0x19a]);
+ WFIFOHEAD(sd->fd,packet_len(0x19a));
WFIFOW(sd->fd,0) = 0x19a;
WFIFOL(sd->fd,2) = sd->bl.id;
WFIFOL(sd->fd,6) = pvprank;
WFIFOL(sd->fd,10) = pvpnum;
- WFIFOSET(sd->fd,packet_len_table[0x19a]);
+ WFIFOSET(sd->fd,packet_len(0x19a));
} else {
unsigned char buf[32];
WBUFW(buf,0) = 0x19a;
@@ -5248,11 +5187,11 @@ int clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type)
WBUFL(buf,6) = pvprank;
WBUFL(buf,10) = pvpnum;
if(sd->sc.option&OPTION_INVISIBLE)
- clif_send(buf,packet_len_table[0x19a],&sd->bl,SELF);
+ clif_send(buf,packet_len(0x19a),&sd->bl,SELF);
else if(!type)
- clif_send(buf,packet_len_table[0x19a],&sd->bl,AREA);
+ clif_send(buf,packet_len(0x19a),&sd->bl,AREA);
else
- clif_send(buf,packet_len_table[0x19a],&sd->bl,ALL_SAMEMAP);
+ clif_send(buf,packet_len(0x19a),&sd->bl,ALL_SAMEMAP);
}
return 0;
@@ -5272,7 +5211,7 @@ int clif_send0199(int map,int type)
bl.m = map;
WBUFW(buf,0)=0x199;
WBUFW(buf,2)=type;
- clif_send(buf,packet_len_table[0x199],&bl,ALL_SAMEMAP);
+ clif_send(buf,packet_len(0x199),&bl,ALL_SAMEMAP);
return 0;
}
@@ -5283,12 +5222,12 @@ int clif_send0199(int map,int type)
*/
int clif_refine(int fd,struct map_session_data *sd,int fail,int index,int val)
{
- WFIFOHEAD(fd,packet_len_table[0x188]);
+ WFIFOHEAD(fd,packet_len(0x188));
WFIFOW(fd,0)=0x188;
WFIFOW(fd,2)=fail;
WFIFOW(fd,4)=index+2;
WFIFOW(fd,6)=val;
- WFIFOSET(fd,packet_len_table[0x188]);
+ WFIFOSET(fd,packet_len(0x188));
return 0;
}
@@ -5316,10 +5255,10 @@ int clif_wis_message(int fd, char *nick, char *mes, int mes_len) // R 0097 <len>
*/
int clif_wis_end(int fd, int flag) // R 0098 <type>.B: 0: success to send wisper, 1: target character is not loged in, 2: ignored by target, 3: everyone ignored by target
{
- WFIFOHEAD(fd,packet_len_table[0x98]);
+ WFIFOHEAD(fd,packet_len(0x98));
WFIFOW(fd,0) = 0x98;
WFIFOW(fd,2) = flag;
- WFIFOSET(fd,packet_len_table[0x98]);
+ WFIFOSET(fd,packet_len(0x98));
return 0;
}
@@ -5336,11 +5275,11 @@ int clif_solved_charname(struct map_session_data *sd,int char_id)
fd=sd->fd;
if(p!=NULL){
- WFIFOHEAD(fd,packet_len_table[0x194]);
+ WFIFOHEAD(fd,packet_len(0x194));
WFIFOW(fd,0)=0x194;
WFIFOL(fd,2)=char_id;
memcpy(WFIFOP(fd,6), p, NAME_LENGTH);
- WFIFOSET(fd,packet_len_table[0x194]);
+ WFIFOSET(fd,packet_len(0x194));
}else{
map_reqchariddb(sd,char_id);
chrif_searchcharid(char_id);
@@ -5413,12 +5352,12 @@ int clif_insert_card(struct map_session_data *sd,int idx_equip,int idx_card,int
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x17d]);
+ WFIFOHEAD(fd,packet_len(0x17d));
WFIFOW(fd,0)=0x17d;
WFIFOW(fd,2)=idx_equip+2;
WFIFOW(fd,4)=idx_card+2;
WFIFOB(fd,6)=flag;
- WFIFOSET(fd,packet_len_table[0x17d]);
+ WFIFOSET(fd,packet_len(0x17d));
return 0;
}
@@ -5463,11 +5402,11 @@ int clif_item_identified(struct map_session_data *sd,int idx,int flag)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x179]);
+ WFIFOHEAD(fd,packet_len(0x179));
WFIFOW(fd, 0)=0x179;
WFIFOW(fd, 2)=idx+2;
WFIFOB(fd, 4)=flag;
- WFIFOSET(fd,packet_len_table[0x179]);
+ WFIFOSET(fd,packet_len(0x179));
return 0;
}
@@ -5515,14 +5454,14 @@ int clif_item_repaireffect(struct map_session_data *sd,int nameid,int flag)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x1fe]);
+ WFIFOHEAD(fd,packet_len(0x1fe));
WFIFOW(fd, 0)=0x1fe;
if((view = itemdb_viewid(nameid)) > 0)
WFIFOW(fd, 2)=view;
else
WFIFOW(fd, 2)=nameid;
WFIFOB(fd, 4)=flag;
- WFIFOSET(fd,packet_len_table[0x1fe]);
+ WFIFOSET(fd,packet_len(0x1fe));
return 0;
}
@@ -5583,7 +5522,7 @@ int clif_item_skill(struct map_session_data *sd,int skillid,int skilllv,const ch
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x147]);
+ WFIFOHEAD(fd,packet_len(0x147));
WFIFOW(fd, 0)=0x147;
WFIFOW(fd, 2)=skillid;
WFIFOW(fd, 4)=skill_get_inf(skillid);
@@ -5593,7 +5532,7 @@ int clif_item_skill(struct map_session_data *sd,int skillid,int skilllv,const ch
WFIFOW(fd,12)=skill_get_range2(&sd->bl, skillid,skilllv);
strncpy((char*)WFIFOP(fd,14),name,NAME_LENGTH);
WFIFOB(fd,38)=0;
- WFIFOSET(fd,packet_len_table[0x147]);
+ WFIFOSET(fd,packet_len(0x147));
return 0;
}
@@ -5609,7 +5548,7 @@ int clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x124]);
+ WFIFOHEAD(fd,packet_len(0x124));
buf=WFIFOP(fd,0);
if(n<0 || n>=MAX_CART || sd->status.cart[n].nameid<=0)
return 1;
@@ -5625,7 +5564,7 @@ int clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail)
WBUFB(buf,11)=sd->status.cart[n].attribute;
WBUFB(buf,12)=sd->status.cart[n].refine;
clif_addcards(WBUFP(buf,13), &sd->status.cart[n]);
- WFIFOSET(fd,packet_len_table[0x124]);
+ WFIFOSET(fd,packet_len(0x124));
return 0;
}
@@ -5641,12 +5580,12 @@ int clif_cart_delitem(struct map_session_data *sd,int n,int amount)
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x125]);
+ WFIFOHEAD(fd,packet_len(0x125));
WFIFOW(fd,0)=0x125;
WFIFOW(fd,2)=n+2;
WFIFOL(fd,4)=amount;
- WFIFOSET(fd,packet_len_table[0x125]);
+ WFIFOSET(fd,packet_len(0x125));
return 0;
}
@@ -5662,10 +5601,10 @@ int clif_openvendingreq(struct map_session_data *sd,int num)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x12d]);
+ WFIFOHEAD(fd,packet_len(0x12d));
WFIFOW(fd,0)=0x12d;
WFIFOW(fd,2)=num;
- WFIFOSET(fd,packet_len_table[0x12d]);
+ WFIFOSET(fd,packet_len(0x12d));
return 0;
}
@@ -5684,11 +5623,11 @@ int clif_showvendingboard(struct block_list* bl,char *message,int fd)
WBUFL(buf,2)=bl->id;
strncpy((char*)WBUFP(buf,6),message,80);
if(fd){
- WFIFOHEAD(fd,packet_len_table[0x131]);
- memcpy(WFIFOP(fd,0),buf,packet_len_table[0x131]);
- WFIFOSET(fd,packet_len_table[0x131]);
+ WFIFOHEAD(fd,packet_len(0x131));
+ memcpy(WFIFOP(fd,0),buf,packet_len(0x131));
+ WFIFOSET(fd,packet_len(0x131));
}else{
- clif_send(buf,packet_len_table[0x131],bl,AREA_WOS);
+ clif_send(buf,packet_len(0x131),bl,AREA_WOS);
}
return 0;
}
@@ -5706,11 +5645,11 @@ int clif_closevendingboard(struct block_list* bl,int fd)
WBUFW(buf,0)=0x132;
WBUFL(buf,2)=bl->id;
if(fd){
- WFIFOHEAD(fd,packet_len_table[0x132]);
- memcpy(WFIFOP(fd,0),buf,packet_len_table[0x132]);
- WFIFOSET(fd,packet_len_table[0x132]);
+ WFIFOHEAD(fd,packet_len(0x132));
+ memcpy(WFIFOP(fd,0),buf,packet_len(0x132));
+ WFIFOSET(fd,packet_len(0x132));
}else{
- clif_send(buf,packet_len_table[0x132],bl,AREA_WOS);
+ clif_send(buf,packet_len(0x132),bl,AREA_WOS);
}
return 0;
@@ -5774,12 +5713,12 @@ int clif_buyvending(struct map_session_data *sd,int index,int amount,int fail)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x135]);
+ WFIFOHEAD(fd,packet_len(0x135));
WFIFOW(fd,0)=0x135;
WFIFOW(fd,2)=index+2;
WFIFOW(fd,4)=amount;
WFIFOB(fd,6)=fail;
- WFIFOSET(fd,packet_len_table[0x135]);
+ WFIFOSET(fd,packet_len(0x135));
return 0;
}
@@ -5839,11 +5778,11 @@ int clif_vendingreport(struct map_session_data *sd,int index,int amount)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x137]);
+ WFIFOHEAD(fd,packet_len(0x137));
WFIFOW(fd,0)=0x137;
WFIFOW(fd,2)=index+2;
WFIFOW(fd,4)=amount;
- WFIFOSET(fd,packet_len_table[0x137]);
+ WFIFOSET(fd,packet_len(0x137));
return 0;
}
@@ -5858,10 +5797,10 @@ int clif_party_created(struct map_session_data *sd,int flag)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xfa]);
+ WFIFOHEAD(fd,packet_len(0xfa));
WFIFOW(fd,0)=0xfa;
WFIFOB(fd,2)=flag;
- WFIFOSET(fd,packet_len_table[0xfa]);
+ WFIFOSET(fd,packet_len(0xfa));
return 0;
}
@@ -5886,9 +5825,9 @@ int clif_party_main_info(struct party_data *p, int fd)
WBUFB(buf,79) = (p->party.item&1)?1:0;
WBUFB(buf,80) = (p->party.item&2)?1:0;
if(fd>=0){
- WFIFOHEAD(fd,packet_len_table[0x1e9]);
- memcpy(WFIFOP(fd,0),buf,packet_len_table[0x1e9]);
- WFIFOSET(fd,packet_len_table[0x1e9]);
+ WFIFOHEAD(fd,packet_len(0x1e9));
+ memcpy(WFIFOP(fd,0),buf,packet_len(0x1e9));
+ WFIFOSET(fd,packet_len(0x1e9));
return 1;
}
if (!sd) {
@@ -5896,7 +5835,7 @@ int clif_party_main_info(struct party_data *p, int fd)
if (i >= MAX_PARTY) return 0; //Should never happen...
sd=p->data[i].sd;
}
- clif_send(buf,packet_len_table[0x1e9],&sd->bl,PARTY);
+ clif_send(buf,packet_len(0x1e9),&sd->bl,PARTY);
return 1;
}
@@ -5914,7 +5853,7 @@ int clif_party_join_info(struct party *p, struct map_session_data *sd)
memcpy(WBUFP(buf,63), mapindex_id2name(sd->mapindex), MAP_NAME_LENGTH);
WBUFB(buf,79) = (p->item&1)?1:0;
WBUFB(buf,80) = (p->item&2)?1:0;
- clif_send(buf,packet_len_table[0x1e9],&sd->bl,PARTY_WOS);
+ clif_send(buf,packet_len(0x1e9),&sd->bl,PARTY_WOS);
return 1;
}
@@ -5973,11 +5912,11 @@ int clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd)
if( (p=party_search(sd->status.party_id))==NULL )
return 0;
- WFIFOHEAD(fd,packet_len_table[0xfe]);
+ WFIFOHEAD(fd,packet_len(0xfe));
WFIFOW(fd,0)=0xfe;
WFIFOL(fd,2)=sd->status.account_id;
memcpy(WFIFOP(fd,6),p->party.name,NAME_LENGTH);
- WFIFOSET(fd,packet_len_table[0xfe]);
+ WFIFOSET(fd,packet_len(0xfe));
return 0;
}
@@ -5997,11 +5936,11 @@ int clif_party_inviteack(struct map_session_data *sd,char *nick,int flag)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xfd]);
+ WFIFOHEAD(fd,packet_len(0xfd));
WFIFOW(fd,0)=0xfd;
memcpy(WFIFOP(fd,2),nick,NAME_LENGTH);
WFIFOB(fd,26)=flag;
- WFIFOSET(fd,packet_len_table[0xfd]);
+ WFIFOSET(fd,packet_len(0xfd));
return 0;
}
@@ -6033,11 +5972,11 @@ int clif_party_option(struct party_data *p,struct map_session_data *sd,int flag)
WBUFW(buf,2)=((flag&0x01)?2:p->party.exp);
WBUFW(buf,4)=0; //NOTE: We don't know yet what this is for, it is NOT for item share rules, though. [Skotlex]
if(flag==0)
- clif_send(buf,packet_len_table[0x101],&sd->bl,PARTY);
+ clif_send(buf,packet_len(0x101),&sd->bl,PARTY);
else {
- WFIFOHEAD(sd->fd,packet_len_table[0x101]);
- memcpy(WFIFOP(sd->fd,0),buf,packet_len_table[0x101]);
- WFIFOSET(sd->fd,packet_len_table[0x101]);
+ WFIFOHEAD(sd->fd,packet_len(0x101));
+ memcpy(WFIFOP(sd->fd,0),buf,packet_len(0x101));
+ WFIFOSET(sd->fd,packet_len(0x101));
}
return 0;
}
@@ -6064,11 +6003,11 @@ int clif_party_leaved(struct party_data *p,struct map_session_data *sd,int accou
sd = p->data[i].sd;
}
if (sd)
- clif_send(buf,packet_len_table[0x105],&sd->bl,PARTY);
+ clif_send(buf,packet_len(0x105),&sd->bl,PARTY);
} else if (sd!=NULL) {
- WFIFOHEAD(sd->fd,packet_len_table[0x105]);
- memcpy(WFIFOP(sd->fd,0),buf,packet_len_table[0x105]);
- WFIFOSET(sd->fd,packet_len_table[0x105]);
+ WFIFOHEAD(sd->fd,packet_len(0x105));
+ memcpy(WFIFOP(sd->fd,0),buf,packet_len(0x105));
+ WFIFOSET(sd->fd,packet_len(0x105));
}
return 0;
}
@@ -6109,7 +6048,7 @@ int clif_party_xy(struct map_session_data *sd)
WBUFL(buf,2)=sd->status.account_id;
WBUFW(buf,6)=sd->bl.x;
WBUFW(buf,8)=sd->bl.y;
- clif_send(buf,packet_len_table[0x107],&sd->bl,PARTY_SAMEMAP_WOS);
+ clif_send(buf,packet_len(0x107),&sd->bl,PARTY_SAMEMAP_WOS);
return 0;
}
@@ -6121,12 +6060,12 @@ int clif_party_xy(struct map_session_data *sd)
int clif_party_xy_single(int fd, struct map_session_data *sd)
{
- WFIFOHEAD(fd,packet_len_table[0x107]);
+ WFIFOHEAD(fd,packet_len(0x107));
WFIFOW(fd,0)=0x107;
WFIFOL(fd,2)=sd->status.account_id;
WFIFOW(fd,6)=sd->bl.x;
WFIFOW(fd,8)=sd->bl.y;
- WFIFOSET(fd,packet_len_table[0x107]);
+ WFIFOSET(fd,packet_len(0x107));
return 0;
}
@@ -6150,7 +6089,7 @@ int clif_party_hp(struct map_session_data *sd)
WBUFW(buf,6) = sd->battle_status.hp;
WBUFW(buf,8) = sd->battle_status.max_hp;
}
- clif_send(buf,packet_len_table[0x106],&sd->bl,PARTY_AREA_WOS);
+ clif_send(buf,packet_len(0x106),&sd->bl,PARTY_AREA_WOS);
return 0;
}
@@ -6160,7 +6099,7 @@ int clif_party_hp(struct map_session_data *sd)
*/
static void clif_hpmeter_single(int fd, struct map_session_data *sd)
{
- WFIFOHEAD(fd,packet_len_table[0x106]);
+ WFIFOHEAD(fd,packet_len(0x106));
WFIFOW(fd,0) = 0x106;
WFIFOL(fd,2) = sd->status.account_id;
if (sd->battle_status.max_hp > SHRT_MAX) { //To correctly display the %hp bar. [Skotlex]
@@ -6170,7 +6109,7 @@ static void clif_hpmeter_single(int fd, struct map_session_data *sd)
WFIFOW(fd,6) = sd->battle_status.hp;
WFIFOW(fd,8) = sd->battle_status.max_hp;
}
- WFIFOSET (fd, packet_len_table[0x106]);
+ WFIFOSET (fd, packet_len(0x106));
}
/*==========================================
@@ -6210,9 +6149,9 @@ int clif_hpmeter(struct map_session_data *sd)
(level = pc_isGM(sd2)) < battle_config.disp_hpmeter ||
level < pc_isGM(sd))
continue;
- WFIFOHEAD (i, packet_len_table[0x106]);
- memcpy (WFIFOP(i,0), buf, packet_len_table[0x106]);
- WFIFOSET (i, packet_len_table[0x106]);
+ WFIFOHEAD (i, packet_len(0x106));
+ memcpy (WFIFOP(i,0), buf, packet_len(0x106));
+ WFIFOSET (i, packet_len(0x106));
}
}
@@ -6239,7 +6178,7 @@ int clif_party_move(struct party *p,struct map_session_data *sd,int online)
memcpy(WBUFP(buf,15),p->name, NAME_LENGTH);
memcpy(WBUFP(buf,39),sd->status.name, NAME_LENGTH);
memcpy(WBUFP(buf,63),map[sd->bl.m].name, MAP_NAME_LENGTH);
- clif_send(buf,packet_len_table[0x104],&sd->bl,PARTY);
+ clif_send(buf,packet_len(0x104),&sd->bl,PARTY);
return 0;
}
/*==========================================
@@ -6254,7 +6193,7 @@ int clif_movetoattack(struct map_session_data *sd,struct block_list *bl)
nullpo_retr(0, bl);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x139]);
+ WFIFOHEAD(fd,packet_len(0x139));
WFIFOW(fd, 0)=0x139;
WFIFOL(fd, 2)=bl->id;
WFIFOW(fd, 6)=bl->x;
@@ -6262,7 +6201,7 @@ int clif_movetoattack(struct map_session_data *sd,struct block_list *bl)
WFIFOW(fd,10)=sd->bl.x;
WFIFOW(fd,12)=sd->bl.y;
WFIFOW(fd,14)=sd->battle_status.rhw.range;
- WFIFOSET(fd,packet_len_table[0x139]);
+ WFIFOSET(fd,packet_len(0x139));
return 0;
}
/*==========================================
@@ -6281,14 +6220,14 @@ int clif_produceeffect(struct map_session_data *sd,int flag,int nameid)
map_addchariddb(sd->status.char_id,sd->status.name);
clif_solved_charname(sd,sd->status.char_id);
- WFIFOHEAD(fd,packet_len_table[0x18f]);
+ WFIFOHEAD(fd,packet_len(0x18f));
WFIFOW(fd, 0)=0x18f;
WFIFOW(fd, 2)=flag;
if((view = itemdb_viewid(nameid)) > 0)
WFIFOW(fd, 4)=view;
else
WFIFOW(fd, 4)=nameid;
- WFIFOSET(fd,packet_len_table[0x18f]);
+ WFIFOSET(fd,packet_len(0x18f));
return 0;
}
@@ -6300,9 +6239,9 @@ int clif_catch_process(struct map_session_data *sd)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x19e]);
+ WFIFOHEAD(fd,packet_len(0x19e));
WFIFOW(fd,0)=0x19e;
- WFIFOSET(fd,packet_len_table[0x19e]);
+ WFIFOSET(fd,packet_len(0x19e));
sd->menuskill_id = SA_TAMINGMONSTER;
if (sd->ud.skillid == SA_TAMINGMONSTER)
sd->menuskill_lv = 0; //Free catch
@@ -6318,10 +6257,10 @@ int clif_pet_rulet(struct map_session_data *sd,int data)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x1a0]);
+ WFIFOHEAD(fd,packet_len(0x1a0));
WFIFOW(fd,0)=0x1a0;
WFIFOB(fd,2)=data;
- WFIFOSET(fd,packet_len_table[0x1a0]);
+ WFIFOSET(fd,packet_len(0x1a0));
return 0;
}
@@ -6371,12 +6310,12 @@ int clif_send_petdata(struct map_session_data *sd,int type,int param)
nullpo_retr(0, sd->pd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x1a4]);
+ WFIFOHEAD(fd,packet_len(0x1a4));
WFIFOW(fd,0)=0x1a4;
WFIFOB(fd,2)=type;
WFIFOL(fd,3)=sd->pd->bl.id;
WFIFOL(fd,7)=param;
- WFIFOSET(fd,packet_len_table[0x1a4]);
+ WFIFOSET(fd,packet_len(0x1a4));
return 0;
}
@@ -6391,7 +6330,7 @@ int clif_send_petstatus(struct map_session_data *sd)
fd=sd->fd;
pet = &sd->pd->pet;
- WFIFOHEAD(fd,packet_len_table[0x1a2]);
+ WFIFOHEAD(fd,packet_len(0x1a2));
WFIFOW(fd,0)=0x1a2;
memcpy(WFIFOP(fd,2),pet->name,NAME_LENGTH);
WFIFOB(fd,26)=(battle_config.pet_rename == 1)? 0:pet->rename_flag;
@@ -6399,7 +6338,7 @@ int clif_send_petstatus(struct map_session_data *sd)
WFIFOW(fd,29)=pet->hungry;
WFIFOW(fd,31)=pet->intimate;
WFIFOW(fd,33)=pet->equip;
- WFIFOSET(fd,packet_len_table[0x1a2]);
+ WFIFOSET(fd,packet_len(0x1a2));
return 0;
}
@@ -6414,7 +6353,7 @@ int clif_pet_emotion(struct pet_data *pd,int param)
nullpo_retr(0, pd);
- malloc_set(buf,0,packet_len_table[0x1aa]);
+ malloc_set(buf,0,packet_len(0x1aa));
WBUFW(buf,0)=0x1aa;
WBUFL(buf,2)=pd->bl.id;
@@ -6428,7 +6367,7 @@ int clif_pet_emotion(struct pet_data *pd,int param)
}
WBUFL(buf,6)=param;
- clif_send(buf,packet_len_table[0x1aa],&pd->bl,AREA);
+ clif_send(buf,packet_len(0x1aa),&pd->bl,AREA);
return 0;
}
@@ -6439,14 +6378,14 @@ int clif_pet_performance(struct block_list *bl,int param)
nullpo_retr(0, bl);
- malloc_set(buf,0,packet_len_table[0x1a4]);
+ malloc_set(buf,0,packet_len(0x1a4));
WBUFW(buf,0)=0x1a4;
WBUFB(buf,2)=4;
WBUFL(buf,3)=bl->id;
WBUFL(buf,7)=param;
- clif_send(buf,packet_len_table[0x1a4],bl,AREA);
+ clif_send(buf,packet_len(0x1a4),bl,AREA);
return 0;
}
@@ -6457,13 +6396,13 @@ int clif_pet_equip(struct pet_data *pd)
nullpo_retr(0, pd);
- malloc_set(buf,0,packet_len_table[0x1a4]);
+ malloc_set(buf,0,packet_len(0x1a4));
WBUFW(buf,0)=0x1a4;
WBUFB(buf,2)=3;
WBUFL(buf,3)=pd->bl.id;
WBUFL(buf,7)=pd->vd.shield;
- clif_send(buf,packet_len_table[0x1a4],&pd->bl,AREA);
+ clif_send(buf,packet_len(0x1a4),&pd->bl,AREA);
return 0;
}
@@ -6475,11 +6414,11 @@ int clif_pet_food(struct map_session_data *sd,int foodid,int fail)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x1a3]);
+ WFIFOHEAD(fd,packet_len(0x1a3));
WFIFOW(fd,0)=0x1a3;
WFIFOB(fd,2)=fail;
WFIFOW(fd,3)=foodid;
- WFIFOSET(fd,packet_len_table[0x1a3]);
+ WFIFOSET(fd,packet_len(0x1a3));
return 0;
}
@@ -6495,7 +6434,7 @@ int clif_autospell(struct map_session_data *sd,int skilllv)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x1cd]);
+ WFIFOHEAD(fd,packet_len(0x1cd));
WFIFOW(fd, 0)=0x1cd;
if(skilllv>0 && pc_checkskill(sd,MG_NAPALMBEAT)>0)
@@ -6527,7 +6466,7 @@ int clif_autospell(struct map_session_data *sd,int skilllv)
else
WFIFOL(fd,26)= 0x00000000;
- WFIFOSET(fd,packet_len_table[0x1cd]);
+ WFIFOSET(fd,packet_len(0x1cd));
sd->menuskill_id = SA_AUTOSPELL;
sd->menuskill_lv = skilllv;
@@ -6559,7 +6498,7 @@ int clif_devotion(struct map_session_data *sd)
WBUFB(buf,26)=8;
WBUFB(buf,27)=0;
- clif_send(buf,packet_len_table[0x1cf],&sd->bl,AREA);
+ clif_send(buf,packet_len(0x1cf),&sd->bl,AREA);
return 0;
}
@@ -6577,7 +6516,7 @@ int clif_marionette(struct block_list *src, struct block_list *target)
WBUFB(buf,26)=8;
WBUFB(buf,27)=0;
- clif_send(buf,packet_len_table[0x1cf],src,AREA);
+ clif_send(buf,packet_len(0x1cf),src,AREA);
return 0;
}
@@ -6594,7 +6533,7 @@ int clif_spiritball(struct map_session_data *sd)
WBUFW(buf,0)=0x1d0;
WBUFL(buf,2)=sd->bl.id;
WBUFW(buf,6)=sd->spiritball;
- clif_send(buf,packet_len_table[0x1d0],&sd->bl,AREA);
+ clif_send(buf,packet_len(0x1d0),&sd->bl,AREA);
return 0;
}
@@ -6611,7 +6550,7 @@ int clif_combo_delay(struct block_list *bl,int wait)
WBUFW(buf,0)=0x1d2;
WBUFL(buf,2)=bl->id;
WBUFL(buf,6)=wait;
- clif_send(buf,packet_len_table[0x1d2],bl,AREA);
+ clif_send(buf,packet_len(0x1d2),bl,AREA);
return 0;
}
@@ -6632,7 +6571,7 @@ int clif_bladestop(struct block_list *src,struct block_list *dst,
WBUFL(buf,6)=dst->id;
WBUFL(buf,10)=_bool;
- clif_send(buf,packet_len_table[0x1d1],src,AREA);
+ clif_send(buf,packet_len(0x1d1),src,AREA);
return 0;
}
@@ -6656,9 +6595,9 @@ int clif_changemapcell(int m,int x,int y,int cell_type,int type)
WBUFW(buf,6) = cell_type;
memcpy(WBUFP(buf,8),map[m].name,MAP_NAME_LENGTH);
if(!type)
- clif_send(buf,packet_len_table[0x192],&bl,AREA);
+ clif_send(buf,packet_len(0x192),&bl,AREA);
else
- clif_send(buf,packet_len_table[0x192],&bl,ALL_SAMEMAP);
+ clif_send(buf,packet_len(0x192),&bl,ALL_SAMEMAP);
return 0;
}
@@ -6675,7 +6614,7 @@ int clif_mvp_effect(struct map_session_data *sd)
WBUFW(buf,0)=0x10c;
WBUFL(buf,2)=sd->bl.id;
- clif_send(buf,packet_len_table[0x10c],&sd->bl,AREA);
+ clif_send(buf,packet_len(0x10c),&sd->bl,AREA);
return 0;
}
/*==========================================
@@ -6689,13 +6628,13 @@ int clif_mvp_item(struct map_session_data *sd,int nameid)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x10a]);
+ WFIFOHEAD(fd,packet_len(0x10a));
WFIFOW(fd,0)=0x10a;
if((view = itemdb_viewid(nameid)) > 0)
WFIFOW(fd,2)=view;
else
WFIFOW(fd,2)=nameid;
- WFIFOSET(fd,packet_len_table[0x10a]);
+ WFIFOSET(fd,packet_len(0x10a));
return 0;
}
/*==========================================
@@ -6709,10 +6648,10 @@ int clif_mvp_exp(struct map_session_data *sd,unsigned long exp)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x10b]);
+ WFIFOHEAD(fd,packet_len(0x10b));
WFIFOW(fd,0)=0x10b;
WFIFOL(fd,2)=exp;
- WFIFOSET(fd,packet_len_table[0x10b]);
+ WFIFOSET(fd,packet_len(0x10b));
return 0;
}
@@ -6727,10 +6666,10 @@ int clif_guild_created(struct map_session_data *sd,int flag)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x167]);
+ WFIFOHEAD(fd,packet_len(0x167));
WFIFOW(fd,0)=0x167;
WFIFOB(fd,2)=flag;
- WFIFOSET(fd,packet_len_table[0x167]);
+ WFIFOSET(fd,packet_len(0x167));
return 0;
}
/*==========================================
@@ -6747,14 +6686,14 @@ int clif_guild_belonginfo(struct map_session_data *sd,struct guild *g)
fd=sd->fd;
ps=guild_getposition(sd,g);
- WFIFOHEAD(fd,packet_len_table[0x16c]);
- malloc_set(WFIFOP(fd,0),0,packet_len_table[0x16c]);
+ WFIFOHEAD(fd,packet_len(0x16c));
+ malloc_set(WFIFOP(fd,0),0,packet_len(0x16c));
WFIFOW(fd,0)=0x16c;
WFIFOL(fd,2)=g->guild_id;
WFIFOL(fd,6)=g->emblem_id;
WFIFOL(fd,10)=g->position[ps].mode;
memcpy(WFIFOP(fd,19),g->name,NAME_LENGTH);
- WFIFOSET(fd,packet_len_table[0x16c]);
+ WFIFOSET(fd,packet_len(0x16c));
return 0;
}
/*==========================================
@@ -6774,9 +6713,9 @@ int clif_guild_memberlogin_notice(struct guild *g,int idx,int flag)
if(g->member[idx].sd==NULL){
struct map_session_data *sd=guild_getavailablesd(g);
if(sd!=NULL)
- clif_send(buf,packet_len_table[0x16d],&sd->bl,GUILD);
+ clif_send(buf,packet_len(0x16d),&sd->bl,GUILD);
}else
- clif_send(buf,packet_len_table[0x16d],&g->member[idx].sd->bl,GUILD_WOS);
+ clif_send(buf,packet_len(0x16d),&g->member[idx].sd->bl,GUILD_WOS);
return 0;
}
@@ -6797,7 +6736,7 @@ int clif_guild_send_onlineinfo(struct map_session_data *sd) {
nullpo_retr(0, sd);
- p_len = packet_len_table[0x16d];
+ p_len = packet_len(0x16d);
if(!(g = guild_search(sd->status.guild_id)))
return 0;
@@ -6833,10 +6772,10 @@ int clif_guild_masterormember(struct map_session_data *sd)
fd=sd->fd;
if(sd->state.gmaster_flag)
type=0xd7;
- WFIFOHEAD(fd,packet_len_table[0x14e]);
+ WFIFOHEAD(fd,packet_len(0x14e));
WFIFOW(fd,0)=0x14e;
WFIFOL(fd,2)=type;
- WFIFOSET(fd,packet_len_table[0x14e]);
+ WFIFOSET(fd,packet_len(0x14e));
return 0;
}
/*==========================================
@@ -6856,7 +6795,7 @@ int clif_guild_basicinfo(struct map_session_data *sd)
if(g==NULL)
return 0;
- WFIFOHEAD(fd,packet_len_table[0x1b6]);
+ WFIFOHEAD(fd,packet_len(0x1b6));
WFIFOW(fd, 0)=0x1b6;//0x150;
WFIFOL(fd, 2)=g->guild_id;
WFIFOL(fd, 6)=g->guild_lv;
@@ -6882,7 +6821,7 @@ int clif_guild_basicinfo(struct map_session_data *sd)
else
strncpy((char*)WFIFOP(fd,94),msg_txt(299),20);
- WFIFOSET(fd,packet_len_table[WFIFOW(fd,0)]);
+ WFIFOSET(fd,packet_len(WFIFOW(fd,0)));
return 0;
}
@@ -7139,11 +7078,11 @@ int clif_guild_notice(struct map_session_data *sd,struct guild *g)
return 0;
if(*g->mes1==0 && *g->mes2==0)
return 0;
- WFIFOHEAD(fd,packet_len_table[0x16f]);
+ WFIFOHEAD(fd,packet_len(0x16f));
WFIFOW(fd,0)=0x16f;
memcpy(WFIFOP(fd,2),g->mes1,60);
memcpy(WFIFOP(fd,62),g->mes2,120);
- WFIFOSET(fd,packet_len_table[0x16f]);
+ WFIFOSET(fd,packet_len(0x16f));
return 0;
}
@@ -7159,11 +7098,11 @@ int clif_guild_invite(struct map_session_data *sd,struct guild *g)
nullpo_retr(0, g);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x16a]);
+ WFIFOHEAD(fd,packet_len(0x16a));
WFIFOW(fd,0)=0x16a;
WFIFOL(fd,2)=g->guild_id;
memcpy(WFIFOP(fd,6),g->name,NAME_LENGTH);
- WFIFOSET(fd,packet_len_table[0x16a]);
+ WFIFOSET(fd,packet_len(0x16a));
return 0;
}
/*==========================================
@@ -7177,10 +7116,10 @@ int clif_guild_inviteack(struct map_session_data *sd,int flag)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x169]);
+ WFIFOHEAD(fd,packet_len(0x169));
WFIFOW(fd,0)=0x169;
WFIFOB(fd,2)=flag;
- WFIFOSET(fd,packet_len_table[0x169]);
+ WFIFOSET(fd,packet_len(0x169));
return 0;
}
/*==========================================
@@ -7196,7 +7135,7 @@ int clif_guild_leave(struct map_session_data *sd,const char *name,const char *me
WBUFW(buf, 0)=0x15a;
memcpy(WBUFP(buf, 2),name,NAME_LENGTH);
memcpy(WBUFP(buf,26),mes,40);
- clif_send(buf,packet_len_table[0x15a],&sd->bl,GUILD);
+ clif_send(buf,packet_len(0x15a),&sd->bl,GUILD);
return 0;
}
/*==========================================
@@ -7214,7 +7153,7 @@ int clif_guild_expulsion(struct map_session_data *sd,const char *name,const char
memcpy(WBUFP(buf, 2),name,NAME_LENGTH);
memcpy(WBUFP(buf,26),mes,40);
memcpy(WBUFP(buf,66),"dummy",NAME_LENGTH);
- clif_send(buf,packet_len_table[0x15c],&sd->bl,GUILD);
+ clif_send(buf,packet_len(0x15c),&sd->bl,GUILD);
return 0;
}
/*==========================================
@@ -7303,11 +7242,11 @@ int clif_guild_reqalliance(struct map_session_data *sd,int account_id,const char
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x171]);
+ WFIFOHEAD(fd,packet_len(0x171));
WFIFOW(fd,0)=0x171;
WFIFOL(fd,2)=account_id;
memcpy(WFIFOP(fd,6),name,NAME_LENGTH);
- WFIFOSET(fd,packet_len_table[0x171]);
+ WFIFOSET(fd,packet_len(0x171));
return 0;
}
/*==========================================
@@ -7327,10 +7266,10 @@ int clif_guild_allianceack(struct map_session_data *sd,int flag)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x173]);
+ WFIFOHEAD(fd,packet_len(0x173));
WFIFOW(fd,0)=0x173;
WFIFOL(fd,2)=flag;
- WFIFOSET(fd,packet_len_table[0x173]);
+ WFIFOSET(fd,packet_len(0x173));
return 0;
}
/*==========================================
@@ -7346,11 +7285,11 @@ int clif_guild_delalliance(struct map_session_data *sd,int guild_id,int flag)
fd = sd->fd;
if (fd <= 0)
return 0;
- WFIFOHEAD(fd,packet_len_table[0x184]);
+ WFIFOHEAD(fd,packet_len(0x184));
WFIFOW(fd,0)=0x184;
WFIFOL(fd,2)=guild_id;
WFIFOL(fd,6)=flag;
- WFIFOSET(fd,packet_len_table[0x184]);
+ WFIFOSET(fd,packet_len(0x184));
return 0;
}
/*==========================================
@@ -7364,10 +7303,10 @@ int clif_guild_oppositionack(struct map_session_data *sd,int flag)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x181]);
+ WFIFOHEAD(fd,packet_len(0x181));
WFIFOW(fd,0)=0x181;
WFIFOB(fd,2)=flag;
- WFIFOSET(fd,packet_len_table[0x181]);
+ WFIFOSET(fd,packet_len(0x181));
return 0;
}
/*==========================================
@@ -7381,7 +7320,7 @@ int clif_guild_oppositionack(struct map_session_data *sd,int flag)
WBUFL(fd,2)=g->alliance[idx].opposition;
WBUFL(fd,6)=g->alliance[idx].guild_id;
memcpy(WBUFP(fd,10),g->alliance[idx].name,NAME_LENGTH);
- clif_send(buf,packet_len_table[0x185],guild_getavailablesd(g),GUILD);
+ clif_send(buf,packet_len(0x185),guild_getavailablesd(g),GUILD);
return 0;
}*/
@@ -7396,10 +7335,10 @@ int clif_guild_broken(struct map_session_data *sd,int flag)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x15e]);
+ WFIFOHEAD(fd,packet_len(0x15e));
WFIFOW(fd,0)=0x15e;
WFIFOL(fd,2)=flag;
- WFIFOSET(fd,packet_len_table[0x15e]);
+ WFIFOSET(fd,packet_len(0x15e));
return 0;
}
@@ -7416,7 +7355,7 @@ void clif_emotion(struct block_list *bl,int type)
WBUFW(buf,0)=0xc0;
WBUFL(buf,2)=bl->id;
WBUFB(buf,6)=type;
- clif_send(buf,packet_len_table[0xc0],bl,AREA);
+ clif_send(buf,packet_len(0xc0),bl,AREA);
}
/*==========================================
@@ -7432,7 +7371,7 @@ void clif_talkiebox(struct block_list *bl,char* talkie)
WBUFW(buf,0)=0x191;
WBUFL(buf,2)=bl->id;
memcpy(WBUFP(buf,6),talkie,MESSAGE_SIZE);
- clif_send(buf,packet_len_table[0x191],bl,AREA);
+ clif_send(buf,packet_len(0x191),bl,AREA);
}
/*==========================================
@@ -7446,7 +7385,7 @@ void clif_wedding_effect(struct block_list *bl) {
WBUFW(buf,0) = 0x1ea;
WBUFL(buf,2) = bl->id;
- clif_send(buf, packet_len_table[0x1ea], bl, AREA);
+ clif_send(buf, packet_len(0x1ea), bl, AREA);
}
/*==========================================
* あなたに逢いたい使用時名前叫び
@@ -7469,7 +7408,7 @@ void clif_callpartner(struct map_session_data *sd)
chrif_searchcharid(sd->status.partner_id);
WBUFB(buf,2) = 0;
}
- clif_send(buf,packet_len_table[0x1e6],&sd->bl,AREA);
+ clif_send(buf,packet_len(0x1e6),&sd->bl,AREA);
}
return;
}
@@ -7484,9 +7423,9 @@ void clif_adopt_process(struct map_session_data *sd)
nullpo_retv(sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x1f8]);
+ WFIFOHEAD(fd,packet_len(0x1f8));
WFIFOW(fd,0)=0x1f8;
- WFIFOSET(fd,packet_len_table[0x1f8]);
+ WFIFOSET(fd,packet_len(0x1f8));
}
/*==========================================
* Marry [DracoRPG]
@@ -7498,9 +7437,9 @@ void clif_marriage_process(struct map_session_data *sd)
nullpo_retv(sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x1e4]);
+ WFIFOHEAD(fd,packet_len(0x1e4));
WFIFOW(fd,0)=0x1e4;
- WFIFOSET(fd,packet_len_table[0x1e4]);
+ WFIFOSET(fd,packet_len(0x1e4));
}
@@ -7514,10 +7453,10 @@ void clif_divorced(struct map_session_data *sd, char *name)
nullpo_retv(sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x205]);
+ WFIFOHEAD(fd,packet_len(0x205));
WFIFOW(fd,0)=0x205;
memcpy(WFIFOP(fd,2), name, NAME_LENGTH);
- WFIFOSET(fd, packet_len_table[0x205]);
+ WFIFOSET(fd, packet_len(0x205));
}
/*==========================================
@@ -7527,9 +7466,9 @@ void clif_divorced(struct map_session_data *sd, char *name)
void clif_parse_ReqAdopt(int fd, struct map_session_data *sd) {
nullpo_retv(sd);
- WFIFOHEAD(fd,packet_len_table[0x1f6]);
+ WFIFOHEAD(fd,packet_len(0x1f6));
WFIFOW(fd,0)=0x1f6;
- WFIFOSET(fd, packet_len_table[0x1f6]);
+ WFIFOSET(fd, packet_len(0x1f6));
}
/*==========================================
@@ -7539,9 +7478,9 @@ void clif_parse_ReqAdopt(int fd, struct map_session_data *sd) {
void clif_parse_ReqMarriage(int fd, struct map_session_data *sd) {
nullpo_retv(sd);
- WFIFOHEAD(fd,packet_len_table[0x1e2]);
+ WFIFOHEAD(fd,packet_len(0x1e2));
WFIFOW(fd,0)=0x1e2;
- WFIFOSET(fd, packet_len_table[0x1e2]);
+ WFIFOSET(fd, packet_len(0x1e2));
}
/*==========================================
@@ -7557,7 +7496,7 @@ void clif_sitting(struct map_session_data *sd)
WBUFW(buf, 0) = 0x8a;
WBUFL(buf, 2) = sd->bl.id;
WBUFB(buf,26) = 2;
- clif_send(buf, packet_len_table[0x8a], &sd->bl, AREA);
+ clif_send(buf, packet_len(0x8a), &sd->bl, AREA);
}
/*==========================================
@@ -7605,10 +7544,10 @@ int clif_GM_kickack(struct map_session_data *sd, int id)
nullpo_retr(0, sd);
fd = sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xcd]);
+ WFIFOHEAD(fd,packet_len(0xcd));
WFIFOW(fd,0) = 0xcd;
WFIFOL(fd,2) = id;
- WFIFOSET(fd, packet_len_table[0xcd]);
+ WFIFOSET(fd, packet_len(0xcd));
return 0;
}
@@ -7617,7 +7556,7 @@ void clif_parse_QuitGame(int fd,struct map_session_data *sd);
int clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd,int type)
{
int fd = tsd->fd;
- WFIFOHEAD(fd,packet_len_table[0x18b]);
+ WFIFOHEAD(fd,packet_len(0x18b));
if(type)
clif_GM_kickack(sd,tsd->status.account_id);
if (!fd) {
@@ -7627,7 +7566,7 @@ int clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd,int ty
WFIFOW(fd,0) = 0x18b;
WFIFOW(fd,2) = 0;
- WFIFOSET(fd,packet_len_table[0x18b]);
+ WFIFOSET(fd,packet_len(0x18b));
clif_setwaitclose(fd);
return 0;
}
@@ -7642,11 +7581,11 @@ int clif_GM_silence(struct map_session_data *sd, struct map_session_data *tsd, i
fd = tsd->fd;
if (fd <= 0)
return 0;
- WFIFOHEAD(fd,packet_len_table[0x14b]);
+ WFIFOHEAD(fd,packet_len(0x14b));
WFIFOW(fd,0) = 0x14b;
WFIFOB(fd,2) = 0;
memcpy(WFIFOP(fd,3), sd->status.name, NAME_LENGTH);
- WFIFOSET(fd, packet_len_table[0x14b]);
+ WFIFOSET(fd, packet_len(0x14b));
return 0;
}
@@ -7677,11 +7616,11 @@ int clif_wisexin(struct map_session_data *sd,int type,int flag)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xd1]);
+ WFIFOHEAD(fd,packet_len(0xd1));
WFIFOW(fd,0)=0xd1;
WFIFOB(fd,2)=type;
WFIFOB(fd,3)=flag;
- WFIFOSET(fd,packet_len_table[0xd1]);
+ WFIFOSET(fd,packet_len(0xd1));
return 0;
}
@@ -7696,11 +7635,11 @@ int clif_wisall(struct map_session_data *sd,int type,int flag)
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0xd2]);
+ WFIFOHEAD(fd,packet_len(0xd2));
WFIFOW(fd,0)=0xd2;
WFIFOB(fd,2)=type;
WFIFOB(fd,3)=flag;
- WFIFOSET(fd,packet_len_table[0xd2]);
+ WFIFOSET(fd,packet_len(0xd2));
return 0;
}
@@ -7716,13 +7655,13 @@ void clif_soundeffect(struct map_session_data *sd,struct block_list *bl,char *na
nullpo_retv(bl);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x1d3]);
+ WFIFOHEAD(fd,packet_len(0x1d3));
WFIFOW(fd,0)=0x1d3;
memcpy(WFIFOP(fd,2),name,NAME_LENGTH);
WFIFOB(fd,26)=type;
WFIFOL(fd,27)=0;
WFIFOL(fd,31)=bl->id;
- WFIFOSET(fd,packet_len_table[0x1d3]);
+ WFIFOSET(fd,packet_len(0x1d3));
return;
}
@@ -7730,7 +7669,7 @@ void clif_soundeffect(struct map_session_data *sd,struct block_list *bl,char *na
int clif_soundeffectall(struct block_list *bl, char *name, int type, int coverage)
{
unsigned char buf[40];
- malloc_set(buf, 0, packet_len_table[0x1d3]);
+ malloc_set(buf, 0, packet_len(0x1d3));
if(coverage < 0 || coverage > 22){
ShowError("clif_soundeffectall: undefined coverage.\n");
@@ -7744,7 +7683,7 @@ int clif_soundeffectall(struct block_list *bl, char *name, int type, int coverag
WBUFB(buf,26)=type;
WBUFL(buf,27)=0;
WBUFL(buf,31)=bl->id;
- clif_send(buf, packet_len_table[0x1d3], bl, coverage);
+ clif_send(buf, packet_len(0x1d3), bl, coverage);
return 0;
}
@@ -7756,17 +7695,17 @@ int clif_specialeffect(struct block_list *bl, int type, int flag)
nullpo_retr(0, bl);
- malloc_set(buf, 0, packet_len_table[0x1f3]);
+ malloc_set(buf, 0, packet_len(0x1f3));
WBUFW(buf,0) = 0x1f3;
WBUFL(buf,2) = bl->id;
WBUFL(buf,6) = type;
- clif_send(buf, packet_len_table[0x1f3], bl, flag);
+ clif_send(buf, packet_len(0x1f3), bl, flag);
if (disguised(bl)) {
WBUFL(buf,2) = -bl->id;
- clif_send(buf, packet_len_table[0x1f3], bl, SELF);
+ clif_send(buf, packet_len(0x1f3), bl, SELF);
}
return 0;
}
@@ -7912,11 +7851,11 @@ int clif_charnameack (int fd, struct block_list *bl)
// if no receipient specified just update nearby clients
if (fd == 0)
- clif_send(buf, packet_len_table[cmd], bl, AREA);
+ clif_send(buf, packet_len(cmd), bl, AREA);
else {
- WFIFOHEAD(fd, packet_len_table[cmd]);
- memcpy(WFIFOP(fd, 0), buf, packet_len_table[cmd]);
- WFIFOSET(fd, packet_len_table[cmd]);
+ WFIFOHEAD(fd, packet_len(cmd));
+ memcpy(WFIFOP(fd, 0), buf, packet_len(cmd));
+ WFIFOSET(fd, packet_len(cmd));
}
return 0;
@@ -7977,7 +7916,7 @@ int clif_charnameupdate (struct map_session_data *ssd)
}
// Update nearby clients
- clif_send(buf, packet_len_table[cmd], &ssd->bl, AREA);
+ clif_send(buf, packet_len(cmd), &ssd->bl, AREA);
return 0;
}
@@ -7991,7 +7930,7 @@ int clif_slide(struct block_list *bl, int x, int y){
WBUFW(buf, 6) = x;
WBUFW(buf, 8) = y;
- clif_send(buf, packet_len_table[0x1ff], bl, AREA);
+ clif_send(buf, packet_len(0x1ff), bl, AREA);
return 0;
}
@@ -8038,7 +7977,7 @@ int clif_party_xy_remove(struct map_session_data *sd)
WBUFL(buf,2)=sd->status.account_id;
WBUFW(buf,6)=-1;
WBUFW(buf,8)=-1;
- clif_send(buf,packet_len_table[0x107],&sd->bl,PARTY_SAMEMAP_WOS);
+ clif_send(buf,packet_len(0x107),&sd->bl,PARTY_SAMEMAP_WOS);
return 0;
}
@@ -8060,10 +7999,10 @@ int clif_party_xy_remove(struct map_session_data *sd)
void clif_gospel_info(struct map_session_data *sd, int type)
{
int fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x215]);
+ WFIFOHEAD(fd,packet_len(0x215));
WFIFOW(fd,0)=0x215;
WFIFOL(fd,2)=type;
- WFIFOSET(fd, packet_len_table[0x215]);
+ WFIFOSET(fd, packet_len(0x215));
}
/*==========================================
@@ -8074,13 +8013,13 @@ void clif_gospel_info(struct map_session_data *sd, int type)
void clif_feel_info(struct map_session_data *sd, unsigned char feel_level, unsigned char type)
{
int fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x20e]);
+ WFIFOHEAD(fd,packet_len(0x20e));
WFIFOW(fd,0)=0x20e;
memcpy(WFIFOP(fd,2),mapindex_id2name(sd->feel_map[feel_level].index), MAP_NAME_LENGTH);
WFIFOL(fd,26)=sd->bl.id;
WFIFOB(fd,30)=feel_level;
WFIFOB(fd,31)=type?1:0;
- WFIFOSET(fd, packet_len_table[0x20e]);
+ WFIFOSET(fd, packet_len(0x20e));
}
/*==========================================
@@ -8091,7 +8030,7 @@ void clif_feel_info(struct map_session_data *sd, unsigned char feel_level, unsig
void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type)
{
int fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x20e]);
+ WFIFOHEAD(fd,packet_len(0x20e));
WFIFOW(fd,0)=0x20e;
if (pcdb_checkid(class_))
strncpy(WFIFOP(fd,2),job_name(class_), NAME_LENGTH);
@@ -8102,7 +8041,7 @@ void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int cl
WFIFOL(fd,26)=sd->bl.id;
WFIFOB(fd,30)=hate_level;
WFIFOB(fd,31)=type?10:11; //Register/Info
- WFIFOSET(fd, packet_len_table[0x20e]);
+ WFIFOSET(fd, packet_len(0x20e));
}
/*==========================================
@@ -8112,13 +8051,13 @@ void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int cl
void clif_mission_info(struct map_session_data *sd, int mob_id, unsigned char progress)
{
int fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x20e]);
+ WFIFOHEAD(fd,packet_len(0x20e));
WFIFOW(fd,0)=0x20e;
strncpy(WFIFOP(fd,2),mob_db(mob_id)->jname, NAME_LENGTH);
WFIFOL(fd,26)=mob_id;
WFIFOB(fd,30)=progress; //Message to display
WFIFOB(fd,31)=20;
- WFIFOSET(fd, packet_len_table[0x20e]);
+ WFIFOSET(fd, packet_len(0x20e));
}
/*==========================================
@@ -8128,13 +8067,13 @@ void clif_mission_info(struct map_session_data *sd, int mob_id, unsigned char pr
void clif_feel_hate_reset(struct map_session_data *sd)
{
int fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x20e]);
+ WFIFOHEAD(fd,packet_len(0x20e));
WFIFOW(fd,0)=0x20e;
malloc_tsetdword(WFIFOP(fd,2), 0, NAME_LENGTH); //Blank name as all was reset.
WFIFOL(fd,26)=sd->bl.id;
WFIFOB(fd,30)=0; //Feel/hate level: irrelevant
WFIFOB(fd,31)=30;
- WFIFOSET(fd, packet_len_table[0x20e]);
+ WFIFOSET(fd, packet_len(0x20e));
}
// ---------------------
@@ -8510,10 +8449,10 @@ void clif_parse_TickSend(int fd, struct map_session_data *sd) {
sd->client_tick=RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
- WFIFOHEAD(fd, packet_len_table[0x7f]);
+ WFIFOHEAD(fd, packet_len(0x7f));
WFIFOW(fd,0)=0x7f;
WFIFOL(fd,2)=gettick();
- WFIFOSET(fd,packet_len_table[0x7f]);
+ WFIFOSET(fd,packet_len(0x7f));
flush_fifo(fd,0); // send immediatly so the client gets accurate "pings"
return;
}
@@ -8587,7 +8526,7 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) {
*------------------------------------------
*/
void clif_parse_QuitGame(int fd, struct map_session_data *sd) {
- WFIFOHEAD(fd,packet_len_table[0x18b]);
+ WFIFOHEAD(fd,packet_len(0x18b));
WFIFOW(fd,0) = 0x18b;
/* Rovert's prevent logout option fixed [Valaris] */
@@ -8599,7 +8538,7 @@ void clif_parse_QuitGame(int fd, struct map_session_data *sd) {
} else {
WFIFOW(fd,2)=1;
}
- WFIFOSET(fd,packet_len_table[0x18b]);
+ WFIFOSET(fd,packet_len(0x18b));
}
@@ -8631,21 +8570,21 @@ void check_fake_id(int fd, struct map_session_data *sd, int target_id) {
}
intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, message_to_gm);
// send this info cause the bot ask until get an answer, damn spam
- malloc_tsetdword(WPACKETP(0), 0, packet_len_table[0x95]);
+ malloc_tsetdword(WPACKETP(0), 0, packet_len(0x95));
WPACKETW(0) = 0x95;
WPACKETL(2) = server_char_id;
strncpy(WPACKETP(6), sd->status.name, 24);
- SENDPACKET(fd, packet_len_table[0x95]);
+ SENDPACKET(fd, packet_len(0x95));
// take fake player out of screen
WPACKETW(0) = 0x80;
WPACKETL(2) = server_char_id;
WPACKETB(6) = 0;
- SENDPACKET(fd, packet_len_table[0x80]);
+ SENDPACKET(fd, packet_len(0x80));
// take fake mob out of screen
WPACKETW(0) = 0x80;
WPACKETL(2) = server_fake_mob_id;
WPACKETB(6) = 0;
- SENDPACKET(fd, packet_len_table[0x80]);
+ SENDPACKET(fd, packet_len(0x80));
}
// if player asks for the fake mob (only bot and modified client can see a hiden mob)
@@ -8672,24 +8611,24 @@ void check_fake_id(int fd, struct map_session_data *sd, int target_id) {
}
intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, message_to_gm);
// send this info cause the bot ask until get an answer, damn spam
- malloc_tsetdword(WPACKETP(0), 0, packet_len_table[0x95]);
+ malloc_tsetdword(WPACKETP(0), 0, packet_len(0x95));
WPACKETW(0) = 0x95;
WPACKETL(2) = server_fake_mob_id;
fake_mob = fake_mob_list[(sd->bl.m + sd->fd + sd->status.char_id) % (sizeof(fake_mob_list) / sizeof(fake_mob_list[0]))]; // never same mob
if (!mobdb_checkid(fake_mob))
fake_mob = 1002; // poring (default)
strncpy(WPACKETP(6), mob_db[fake_mob].name, 24);
- SENDPACKET(fd, packet_len_table[0x95]);
+ SENDPACKET(fd, packet_len(0x95));
// take fake mob out of screen
WPACKETW(0) = 0x80;
WPACKETL(2) = server_fake_mob_id;
WPACKETB(6) = 0;
- SENDPACKET(fd, packet_len_table[0x80]);
+ SENDPACKET(fd, packet_len(0x80));
// take fake player out of screen
WPACKETW(0) = 0x80;
WPACKETL(2) = server_char_id;
WPACKETB(6) = 0;
- SENDPACKET(fd, packet_len_table[0x80]);
+ SENDPACKET(fd, packet_len(0x80));
}
*/
return;
@@ -8877,11 +8816,11 @@ void clif_changed_dir(struct block_list *bl, int type) {
WBUFW(buf,6) = bl->type==BL_PC?((TBL_PC*)bl)->head_dir:0;
WBUFB(buf,8) = unit_getdir(bl);
- clif_send(buf, packet_len_table[0x9c], bl, type);
+ clif_send(buf, packet_len(0x9c), bl, type);
if (disguised(bl)) {
WBUFL(buf,2) = -bl->id;
WBUFW(buf,6) = 0;
- clif_send(buf, packet_len_table[0x9c], bl, SELF);
+ clif_send(buf, packet_len(0x9c), bl, SELF);
}
return;
@@ -8927,7 +8866,7 @@ void clif_parse_Emotion(int fd, struct map_session_data *sd) {
WBUFW(buf,0) = 0xc0;
WBUFL(buf,2) = sd->bl.id;
WBUFB(buf,6) = RFIFOB(fd,2);
- clif_send(buf, packet_len_table[0xc0], &sd->bl, AREA);
+ clif_send(buf, packet_len(0xc0), &sd->bl, AREA);
} else
clif_skill_fail(sd, 1, 0, 1);
}
@@ -8937,10 +8876,10 @@ void clif_parse_Emotion(int fd, struct map_session_data *sd) {
*------------------------------------------
*/
void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) {
- WFIFOHEAD(fd,packet_len_table[0xc2]);
+ WFIFOHEAD(fd,packet_len(0xc2));
WFIFOW(fd,0) = 0xc2;
WFIFOL(fd,2) = map_getusers();
- WFIFOSET(fd,packet_len_table[0xc2]);
+ WFIFOSET(fd,packet_len(0xc2));
}
void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, unsigned int tick)
@@ -8995,7 +8934,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
WBUFW(buf, 0) = 0x8a;
WBUFL(buf, 2) = sd->bl.id;
WBUFB(buf,26) = 2;
- clif_send(buf, packet_len_table[0x8a], &sd->bl, SELF);
+ clif_send(buf, packet_len(0x8a), &sd->bl, SELF);
return;
}
@@ -9017,7 +8956,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
WBUFW(buf, 0) = 0x8a;
WBUFL(buf, 2) = sd->bl.id;
WBUFB(buf,26) = 3;
- clif_send(buf, packet_len_table[0x8a], &sd->bl, SELF);
+ clif_send(buf, packet_len(0x8a), &sd->bl, SELF);
return;
}
pc_setstand(sd);
@@ -9025,7 +8964,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
WBUFW(buf, 0) = 0x8a;
WBUFL(buf, 2) = sd->bl.id;
WBUFB(buf,26) = 3;
- clif_send(buf, packet_len_table[0x8a], &sd->bl, AREA);
+ clif_send(buf, packet_len(0x8a), &sd->bl, AREA);
break;
}
}
@@ -9092,11 +9031,11 @@ void clif_parse_Restart(int fd, struct map_session_data *sd) {
{ //Send to char-server for character selection.
chrif_charselectreq(sd, session[fd]->client_addr.sin_addr.s_addr);
} else {
- WFIFOHEAD(fd,packet_len_table[0x18b]);
+ WFIFOHEAD(fd,packet_len(0x18b));
WFIFOW(fd,0)=0x18b;
WFIFOW(fd,2)=1;
- WFIFOSET(fd,packet_len_table[0x018b]);
+ WFIFOSET(fd,packet_len(0x018b));
}
break;
}
@@ -9546,10 +9485,10 @@ void clif_parse_NpcBuyListSend(int fd,struct map_session_data *sd)
fail = npc_buylist(sd,n,item_list);
sd->npc_shopid = 0; //Clear shop data.
- WFIFOHEAD(fd,packet_len_table[0xca]);
+ WFIFOHEAD(fd,packet_len(0xca));
WFIFOW(fd,0)=0xca;
WFIFOB(fd,2)=fail;
- WFIFOSET(fd,packet_len_table[0xca]);
+ WFIFOSET(fd,packet_len(0xca));
}
/*==========================================
@@ -9572,10 +9511,10 @@ void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd)
sd->npc_shopid = 0; //Clear shop data.
- WFIFOHEAD(fd,packet_len_table[0xcb]);
+ WFIFOHEAD(fd,packet_len(0xcb));
WFIFOW(fd,0)=0xcb;
WFIFOB(fd,2)=fail;
- WFIFOSET(fd,packet_len_table[0xcb]);
+ WFIFOSET(fd,packet_len(0xcb));
}
/*==========================================
@@ -11136,12 +11075,12 @@ void clif_parse_GMReqNoChatCount(int fd, struct map_session_data *sd)
RFIFOHEAD(fd);
tid = RFIFOL(fd,2);
- WFIFOHEAD(fd,packet_len_table[0x1e0]);
+ WFIFOHEAD(fd,packet_len(0x1e0));
WFIFOW(fd,0) = 0x1e0;
WFIFOL(fd,2) = tid;
sprintf((char*)WFIFOP(fd,6),"%d",tid);
// memcpy(WFIFOP(fd,6), "TESTNAME", 24);
- WFIFOSET(fd, packet_len_table[0x1e0]);
+ WFIFOSET(fd, packet_len(0x1e0));
return;
}
@@ -11164,7 +11103,7 @@ void clif_parse_PMIgnore(int fd, struct map_session_data *sd) { // Rewritten by
char output[512];
char *nick; // S 00cf <nick>.24B <type>.B: 00 (/ex nick) deny speech from nick, 01 (/in nick) allow speech from nick
int i;
- WFIFOHEAD(fd,packet_len_table[0xd1]);
+ WFIFOHEAD(fd,packet_len(0xd1));
RFIFOHEAD(fd);
malloc_tsetdword(output, '\0', sizeof(output));
@@ -11183,7 +11122,7 @@ void clif_parse_PMIgnore(int fd, struct map_session_data *sd) { // Rewritten by
if (i == MAX_IGNORE_LIST) { //Full List
WFIFOB(fd,3) = 1; // fail
- WFIFOSET(fd, packet_len_table[0x0d1]);
+ WFIFOSET(fd, packet_len(0x0d1));
if (strcmp(wisp_server_name, nick) == 0)
{ // to found possible bot users who automaticaly ignore people.
sprintf(output, "Character '%s' (account: %d) has tried to block wisps from '%s' (wisp name of the server). Bot user?", sd->status.name, sd->status.account_id, wisp_server_name);
@@ -11194,7 +11133,7 @@ void clif_parse_PMIgnore(int fd, struct map_session_data *sd) { // Rewritten by
if(sd->ignore[i].name[0] != '\0')
{ //Name already exists.
WFIFOB(fd,3) = 0; // Aegis reports success.
- WFIFOSET(fd, packet_len_table[0x0d1]);
+ WFIFOSET(fd, packet_len(0x0d1));
if (strcmp(wisp_server_name, nick) == 0) { // to found possible bot users who automaticaly ignore people.
sprintf(output, "Character '%s' (account: %d) has tried AGAIN to block wisps from '%s' (wisp name of the server). Bot user?", sd->status.name, sd->status.account_id, wisp_server_name);
intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, output);
@@ -11204,7 +11143,7 @@ void clif_parse_PMIgnore(int fd, struct map_session_data *sd) { // Rewritten by
//Insert in position i
memcpy(sd->ignore[i].name, nick, NAME_LENGTH-1);
WFIFOB(fd,3) = 0; // success
- WFIFOSET(fd, packet_len_table[0x0d1]);
+ WFIFOSET(fd, packet_len(0x0d1));
if (strcmp(wisp_server_name, nick) == 0)
{ // to found possible bot users who automaticaly ignore people.
sprintf(output, "Character '%s' (account: %d) has tried to block wisps from '%s' (wisp name of the server). Bot user?", sd->status.name, sd->status.account_id, wisp_server_name);
@@ -11227,7 +11166,7 @@ void clif_parse_PMIgnore(int fd, struct map_session_data *sd) { // Rewritten by
if (i == MAX_IGNORE_LIST || sd->ignore[i].name[i] == '\0')
{ //Not found
WFIFOB(fd,3) = 1; // fail
- WFIFOSET(fd, packet_len_table[0x0d1]);
+ WFIFOSET(fd, packet_len(0x0d1));
return;
}
//Move everything one place down to overwrite removed entry.
@@ -11236,7 +11175,7 @@ void clif_parse_PMIgnore(int fd, struct map_session_data *sd) { // Rewritten by
malloc_tsetdword(sd->ignore[MAX_IGNORE_LIST-1].name, 0, sizeof(sd->ignore[0].name));
// success
WFIFOB(fd,3) = 0;
- WFIFOSET(fd, packet_len_table[0x0d1]);
+ WFIFOSET(fd, packet_len(0x0d1));
// for debug only
// for(i = 0; i < MAX_IGNORE_LIST && sd->ignore[i].name[0] != '\0'; i++) /
@@ -11247,7 +11186,7 @@ void clif_parse_PMIgnore(int fd, struct map_session_data *sd) { // Rewritten by
void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) { // Rewritten by [Yor]
//printf("Ignore all: state: %d\n", RFIFOB(fd,2));
RFIFOHEAD(fd);
- WFIFOHEAD(fd,packet_len_table[0xd2]);
+ WFIFOHEAD(fd,packet_len(0xd2));
// R 00d2 <type>.B <fail>.B: type: 0: deny, 1: allow, fail: 0: success, 1: fail
// S 00d0 <type>len.B: 00 (/exall) deny all speech, 01 (/inall) allow all speech
WFIFOW(fd,0) = 0x0d2;
@@ -11255,12 +11194,12 @@ void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) { // Rewritten
if (RFIFOB(fd,2) == 0) { //Deny all
if (sd->state.ignoreAll) {
WFIFOB(fd,3) = 1; // fail
- WFIFOSET(fd, packet_len_table[0x0d2]);
+ WFIFOSET(fd, packet_len(0x0d2));
return;
}
sd->state.ignoreAll = 1;
WFIFOB(fd,3) = 0; // success
- WFIFOSET(fd, packet_len_table[0x0d2]);
+ WFIFOSET(fd, packet_len(0x0d2));
return;
}
//Unblock everyone
@@ -11269,16 +11208,16 @@ void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) { // Rewritten
{ //Wipe the ignore list.
memset(sd->ignore, 0, sizeof(sd->ignore));
WFIFOB(fd,3) = 0;
- WFIFOSET(fd, packet_len_table[0x0d2]);
+ WFIFOSET(fd, packet_len(0x0d2));
return;
}
WFIFOB(fd,3) = 1; // fail
- WFIFOSET(fd, packet_len_table[0x0d2]);
+ WFIFOSET(fd, packet_len(0x0d2));
return;
}
sd->state.ignoreAll = 0;
WFIFOB(fd,3) = 0; // success
- WFIFOSET(fd, packet_len_table[0x0d2]);
+ WFIFOSET(fd, packet_len(0x0d2));
return;
}
@@ -11362,12 +11301,12 @@ void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int cha
if(i == MAX_FRIENDS || sd->status.friends[i].char_id == 0)
return; //Not found
- WFIFOHEAD(fd,packet_len_table[0x206]);
+ WFIFOHEAD(fd,packet_len(0x206));
WFIFOW(fd, 0) = 0x206;
WFIFOL(fd, 2) = sd->status.friends[i].account_id;
WFIFOL(fd, 6) = sd->status.friends[i].char_id;
WFIFOB(fd,10) = !online; //Yeah, a 1 here means "logged off", go figure...
- WFIFOSET(fd, packet_len_table[0x206]);
+ WFIFOSET(fd, packet_len(0x206));
}
//Subfunction called from clif_foreachclient to toggle friends on/off [Skotlex]
@@ -11415,7 +11354,7 @@ void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_dat
nullpo_retv(sd);
fd = sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x209]);
+ WFIFOHEAD(fd,packet_len(0x209));
WFIFOW(fd,0) = 0x209;
WFIFOW(fd,2) = type;
if (f_sd)
@@ -11424,7 +11363,7 @@ void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_dat
WFIFOW(fd,8) = f_sd->status.char_id;
memcpy(WFIFOP(fd, 12), f_sd->status.name,NAME_LENGTH);
}
- WFIFOSET(fd, packet_len_table[0x209]);
+ WFIFOSET(fd, packet_len(0x209));
}
void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) {
@@ -11461,12 +11400,12 @@ void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) {
}
f_fd = f_sd->fd;
- WFIFOHEAD(f_fd,packet_len_table[0x207]);
+ WFIFOHEAD(f_fd,packet_len(0x207));
WFIFOW(f_fd,0) = 0x207;
WFIFOL(f_fd,2) = sd->status.account_id;
WFIFOL(f_fd,6) = sd->status.char_id;
memcpy(WFIFOP(f_fd,10), sd->status.name, NAME_LENGTH);
- WFIFOSET(f_fd, packet_len_table[0x207]);
+ WFIFOSET(f_fd, packet_len(0x207));
return;
}
@@ -11553,11 +11492,11 @@ void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) {
malloc_set(&sd->status.friends[MAX_FRIENDS-1], 0, sizeof(sd->status.friends[MAX_FRIENDS-1]));
clif_displaymessage(fd, "Friend removed");
- WFIFOHEAD(fd,packet_len_table[0x20a]);
+ WFIFOHEAD(fd,packet_len(0x20a));
WFIFOW(fd,0) = 0x20a;
WFIFOL(fd,2) = account_id;
WFIFOL(fd,6) = char_id;
- WFIFOSET(fd, packet_len_table[0x20a]);
+ WFIFOSET(fd, packet_len(0x20a));
// clif_friendslist_send(sd); //This is not needed anymore.
return;
@@ -11583,14 +11522,14 @@ void clif_parse_GMKillAll(int fd,struct map_session_data *sd)
*/
void clif_parse_PVPInfo(int fd,struct map_session_data *sd)
{
- WFIFOHEAD(fd,packet_len_table[0x210]);
+ WFIFOHEAD(fd,packet_len(0x210));
WFIFOW(fd,0) = 0x210;
//WFIFOL(fd,2) = 0; // not sure what for yet
//WFIFOL(fd,6) = 0;
WFIFOL(fd,10) = sd->pvp_won; // times won
WFIFOL(fd,14) = sd->pvp_lost; // times lost
WFIFOL(fd,18) = sd->pvp_point;
- WFIFOSET(fd, packet_len_table[0x210]);
+ WFIFOSET(fd, packet_len(0x210));
return;
}
@@ -11604,7 +11543,7 @@ void clif_parse_Blacksmith(int fd,struct map_session_data *sd)
int i;
char *name;
- WFIFOHEAD(fd,packet_len_table[0x219]);
+ WFIFOHEAD(fd,packet_len(0x219));
WFIFOW(fd,0) = 0x219;
//Packet size limits this list to 10 elements. [Skotlex]
for (i = 0; i < 10 && i < MAX_FAME_LIST; i++) {
@@ -11624,17 +11563,17 @@ void clif_parse_Blacksmith(int fd,struct map_session_data *sd)
WFIFOL(fd, 242 + i * 4) = 0;
}
- WFIFOSET(fd, packet_len_table[0x219]);
+ WFIFOSET(fd, packet_len(0x219));
}
int clif_fame_blacksmith(struct map_session_data *sd, int points)
{
int fd = sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x21b]);
+ WFIFOHEAD(fd,packet_len(0x21b));
WFIFOW(fd,0) = 0x21b;
WFIFOL(fd,2) = points;
WFIFOL(fd,6) = sd->status.fame;
- WFIFOSET(fd, packet_len_table[0x21b]);
+ WFIFOSET(fd, packet_len(0x21b));
return 0;
}
@@ -11648,7 +11587,7 @@ void clif_parse_Alchemist(int fd,struct map_session_data *sd)
int i;
char *name;
- WFIFOHEAD(fd,packet_len_table[0x21a]);
+ WFIFOHEAD(fd,packet_len(0x21a));
WFIFOW(fd,0) = 0x21a;
//Packet size limits this list to 10 elements. [Skotlex]
for (i = 0; i < 10 && i < MAX_FAME_LIST; i++) {
@@ -11668,17 +11607,17 @@ void clif_parse_Alchemist(int fd,struct map_session_data *sd)
WFIFOL(fd, 242 + i * 4) = 0;
}
- WFIFOSET(fd, packet_len_table[0x21a]);
+ WFIFOSET(fd, packet_len(0x21a));
}
int clif_fame_alchemist(struct map_session_data *sd, int points)
{
int fd = sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x21c]);
+ WFIFOHEAD(fd,packet_len(0x21c));
WFIFOW(fd,0) = 0x21c;
WFIFOL(fd,2) = points;
WFIFOL(fd,6) = sd->status.fame;
- WFIFOSET(fd, packet_len_table[0x21c]);
+ WFIFOSET(fd, packet_len(0x21c));
return 0;
}
@@ -11692,7 +11631,7 @@ void clif_parse_Taekwon(int fd,struct map_session_data *sd)
int i;
char *name;
- WFIFOHEAD(fd,packet_len_table[0x226]);
+ WFIFOHEAD(fd,packet_len(0x226));
WFIFOW(fd,0) = 0x226;
//Packet size limits this list to 10 elements. [Skotlex]
for (i = 0; i < 10 && i < MAX_FAME_LIST; i++) {
@@ -11711,17 +11650,17 @@ void clif_parse_Taekwon(int fd,struct map_session_data *sd)
memcpy(WFIFOP(fd, 2 + 24 * i), "Unavailable", NAME_LENGTH);
WFIFOL(fd, 242 + i * 4) = 0;
}
- WFIFOSET(fd, packet_len_table[0x226]);
+ WFIFOSET(fd, packet_len(0x226));
}
int clif_fame_taekwon(struct map_session_data *sd, int points)
{
int fd = sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x224]);
+ WFIFOHEAD(fd,packet_len(0x224));
WFIFOW(fd,0) = 0x224;
WFIFOL(fd,2) = points;
WFIFOL(fd,6) = sd->status.fame;
- WFIFOSET(fd, packet_len_table[0x224]);
+ WFIFOSET(fd, packet_len(0x224));
return 0;
}
@@ -11734,13 +11673,13 @@ void clif_parse_RankingPk(int fd,struct map_session_data *sd)
{
int i;
- WFIFOHEAD(fd,packet_len_table[0x238]);
+ WFIFOHEAD(fd,packet_len(0x238));
WFIFOW(fd,0) = 0x238;
for(i=0;i<10;i++){
memcpy(WFIFOP(fd,i*24+2), "Unknown", NAME_LENGTH);
WFIFOL(fd,i*4+242) = 0;
}
- WFIFOSET(fd, packet_len_table[0x238]);
+ WFIFOSET(fd, packet_len(0x238));
return;
}
@@ -11773,9 +11712,9 @@ void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd)
*------------------------------------------
*/
void clif_parse_ReqFeel(int fd, struct map_session_data *sd, int skilllv) {
- WFIFOHEAD(fd,packet_len_table[0x253]);
+ WFIFOHEAD(fd,packet_len(0x253));
WFIFOW(fd,0)=0x253;
- WFIFOSET(fd, packet_len_table[0x253]);
+ WFIFOSET(fd, packet_len(0x253));
sd->menuskill_id=SG_FEEL;
sd->menuskill_lv=skilllv;
}
@@ -11792,9 +11731,9 @@ void clif_parse_AdoptRequest(int fd,struct map_session_data *sd) {
sd2 = map_id2sd(account_id);
if(sd2 && sd2->fd && sd2 != sd && sd2->status.party_id == sd->status.party_id) { //FIXME: No checks whatsoever are in place yet!
fd = sd2->fd;
- WFIFOHEAD(fd,packet_len_table[0x1f9]);
+ WFIFOHEAD(fd,packet_len(0x1f9));
WFIFOW(fd,0)=0x1f9;
- WFIFOSET(fd, packet_len_table[0x1f9]);
+ WFIFOSET(fd, packet_len(0x1f9));
}
}
/*==========================================
@@ -11940,10 +11879,10 @@ int clif_parse(int fd) {
ShowInfo("clif_parse: Disconnecting session #%d for not having latest client version (has version %d).\n", fd, packet_ver);
err = 5; // 05 = Game's EXE is not the latest version
}
- WFIFOHEAD(fd,packet_len_table[0x6a]);
+ WFIFOHEAD(fd,packet_len(0x6a));
WFIFOW(fd,0) = 0x6a;
WFIFOB(fd,2) = err;
- WFIFOSET(fd,packet_len_table[0x6a]);
+ WFIFOSET(fd,packet_len(0x6a));
packet_len = RFIFOREST(fd);
RFIFOSKIP(fd, packet_len);
clif_setwaitclose(fd);
@@ -12094,8 +12033,66 @@ static int packetdb_readdb(void)
int ln=0;
int cmd,i,j,k,packet_ver;
int max_cmd=-1;
+ int skip_ver = 0;
+ int warned = 0;
char *str[64],*p,*str2[64],*p2,w1[64],w2[64];
-
+ int packet_len_table[0x260] = {
+ 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,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ //#0x0040
+ 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, 55, 17, 3, 37, 46, -1, 23, -1, 3,108, 3, 2,
+#if PACKETVER < 2
+ 3, 28, 19, 11, 3, -1, 9, 5, 52, 51, 56, 58, 41, 2, 6, 6,
+#else // 78-7b 亀島以降 lv99エフェクト用
+ 3, 28, 19, 11, 3, -1, 9, 5, 54, 53, 58, 60, 41, 2, 6, 6,
+#endif
+ //#0x0080
+ 7, 3, 2, 2, 2, 5, 16, 12, 10, 7, 29, 2, -1, -1, -1, 0, // 0x8b changed to 2 (was 23)
+ 7, 22, 28, 2, 6, 30, -1, -1, 3, -1, -1, 5, 9, 17, 17, 6,
+ 23, 6, 6, -1, -1, -1, -1, 8, 7, 6, 7, 4, 7, 0, -1, 6,
+ 8, 8, 3, 3, -1, 6, 6, -1, 7, 6, 2, 5, 6, 44, 5, 3,
+ //#0x00C0
+ 7, 2, 6, 8, 6, 7, -1, -1, -1, -1, 3, 3, 6, 3, 2, 27, // 0xcd change to 3 (was 6)
+ 3, 4, 4, 2, -1, -1, 3, -1, 6, 14, 3, -1, 28, 29, -1, -1,
+ 30, 30, 26, 2, 6, 26, 3, 3, 8, 19, 5, 2, 3, 2, 2, 2,
+ 3, 2, 6, 8, 21, 8, 8, 2, 2, 26, 3, -1, 6, 27, 30, 10,
+ //#0x0100
+ 2, 6, 6, 30, 79, 31, 10, 10, -1, -1, 4, 6, 6, 2, 11, -1,
+ 10, 39, 4, 10, 31, 35, 10, 18, 2, 13, 15, 20, 68, 2, 3, 16,
+ 6, 14, -1, -1, 21, 8, 8, 8, 8, 8, 2, 2, 3, 4, 2, -1,
+ 6, 86, 6, -1, -1, 7, -1, 6, 3, 16, 4, 4, 4, 6, 24, 26,
+ //#0x0140
+ 22, 14, 6, 10, 23, 19, 6, 39, 8, 9, 6, 27, -1, 2, 6, 6,
+ 110, 6, -1, -1, -1, -1, -1, 6, -1, 54, 66, 54, 90, 42, 6, 42,
+ -1, -1, -1, -1, -1, 30, -1, 3, 14, 3, 30, 10, 43, 14,186,182,
+ 14, 30, 10, 3, -1, 6,106, -1, 4, 5, 4, -1, 6, 7, -1, -1,
+ //#0x0180
+ 6, 3,106, 10, 10, 34, 0, 6, 8, 4, 4, 4, 29, -1, 10, 6,
+#if PACKETVER < 1
+ 90, 86, 24, 6, 30,102, 8, 4, 8, 4, 14, 10, -1, 6, 2, 6,
+#else // 196 comodo以降 状態表示アイコン用
+ 90, 86, 24, 6, 30,102, 9, 4, 8, 4, 14, 10, -1, 6, 2, 6,
+#endif
+ 3, 3, 35, 5, 11, 26, -1, 4, 4, 6, 10, 12, 6, -1, 4, 4,
+ 11, 7, -1, 67, 12, 18,114, 6, 3, 6, 26, 26, 26, 26, 2, 3,
+ //#0x01C0, Set 0x1d5=-1
+ 2, 14, 10, -1, 22, 22, 4, 2, 13, 97, 3, 9, 9, 30, 6, 28,
+ 8, 14, 10, 35, 6, -1, 4, 11, 54, 53, 60, 2, -1, 47, 33, 6,
+ 30, 8, 34, 14, 2, 6, 26, 2, 28, 81, 6, 10, 26, 2, -1, -1,
+ -1, -1, 20, 10, 32, 9, 34, 14, 2, 6, 48, 56, -1, 4, 5, 10,
+ //#0x0200
+ 26, -1, 26, 10, 18, 26, 11, 34, 14, 36, 10, 0, 0, -1, 32, 10, // 0x20c change to 0 (was 19)
+ 22, 0, 26, 26, 42, 6, 6, 2, 2,282,282,10, 10, -1, -1, 66,
+ 10, -1, -1, 8, 10, 2,282, 18, 18, 15, 58, 57, 64, 5, 71, 5,
+ 12, 26, 9, 11, -1, -1, 10, 2, 282, 11, 4, 36, -1,-1, 4, 2,
+ //#0x0240
+ -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, 0
+ };
struct {
void (*func)(int, struct map_session_data *);
char *name;
@@ -12236,6 +12233,11 @@ static int packetdb_readdb(void)
{NULL,NULL}
};
+ // Set server packet lengths - packet_db[SERVER]
+ memset(packet_db,0,sizeof(packet_db));
+ for( i = 0; i < 0x260; ++i )
+ packet_len(i) = packet_len_table[i];
+
sprintf(line, "%s/packet_db.txt", db_path);
if( (fp=fopen(line,"r"))==NULL ){
ShowFatalError("can't read %s\n", line);
@@ -12250,11 +12252,35 @@ static int packetdb_readdb(void)
if (sscanf(line,"%[^:]: %[^\r\n]",w1,w2) == 2) {
if(strcmpi(w1,"packet_ver")==0) {
int prev_ver = packet_ver;
+ skip_ver = 0;
packet_ver = atoi(w2);
- if (packet_ver > MAX_PACKET_VER)
+ if ( packet_ver > MAX_PACKET_VER )
{ //Check to avoid overflowing. [Skotlex]
- ShowWarning("The packet_db table only has support up to version %d\n", MAX_PACKET_VER);
- break;
+ if( (warned&1) == 0 )
+ ShowWarning("The packet_db table only has support up to version %d.\n", MAX_PACKET_VER);
+ warned &= 1;
+ skip_ver = 1;
+ }
+ else if( packet_ver < 0 )
+ {
+ if( (warned&2) == 0 )
+ ShowWarning("Negative packet versions are not supported.\n");
+ warned &= 2;
+ skip_ver = 1;
+ }
+ else if( packet_ver == SERVER )
+ {
+ if( (warned&4) == 0 )
+ ShowWarning("Packet version %d is reserved for server use only.\n", SERVER);
+ warned &= 4;
+ skip_ver = 1;
+ }
+
+ if( skip_ver )
+ {
+ ShowWarning("Skipping packet version %d.\n", packet_ver);
+ packet_ver = prev_ver;
+ continue;
}
// copy from previous version into new version and continue
// - indicating all following packets should be read into the newer version
@@ -12276,6 +12302,9 @@ static int packetdb_readdb(void)
}
}
+ if( skip_ver != 0 )
+ continue; // Skipping current packet version
+
malloc_tsetdword(str,0,sizeof(str));
for(j=0,p=line;j<4 && p;j++){
str[j]=p;
diff --git a/src/map/clif.h b/src/map/clif.h
index c047c4d5e..6edf5eef5 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -48,6 +48,9 @@ enum {
DUEL_WOS
};
+// packet_db[SERVER] is reserver 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];
int clif_setip(char*);