summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-04-11 05:42:53 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-04-11 05:42:53 +0000
commit53248bb933af457f6fc0d230c2ffcc5608ea6a3e (patch)
tree02f0b1318861c5226a1b31c0b6be7f8f25fe47d1 /src
parentf09b1841de457f5d47c41a1b2b0cc1baffba78ca (diff)
downloadhercules-53248bb933af457f6fc0d230c2ffcc5608ea6a3e.tar.gz
hercules-53248bb933af457f6fc0d230c2ffcc5608ea6a3e.tar.bz2
hercules-53248bb933af457f6fc0d230c2ffcc5608ea6a3e.tar.xz
hercules-53248bb933af457f6fc0d230c2ffcc5608ea6a3e.zip
Rollbacked clif.c from the changes of r15828, r15830 and r15833 (they were causing quite a few bugs and protimus wasn't available to fix). special thanks to keikun.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15849 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c536
1 files changed, 501 insertions, 35 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 469bec8db..3533c7eff 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -261,6 +261,7 @@ uint16 clif_getport(void)
return map_port;
}
+#if PACKETVER >= 20071106
static inline unsigned char clif_bl_type(struct block_list *bl) {
switch (bl->type) {
case BL_PC: return disguised(bl)?0x1:0x0; //PC_TYPE
@@ -276,6 +277,7 @@ static inline unsigned char clif_bl_type(struct block_list *bl) {
default: return 0x1; //NPC_TYPE
}
}
+#endif
/*==========================================
* sub process of clif_send
@@ -636,7 +638,11 @@ int clif_send(const uint8* buf, int len, struct block_list* bl, enum send_target
/// 02eb <start time>.L <position>.3B <x size>.B <y size>.B <font>.W (ZC_ACCEPT_ENTER2)
void clif_authok(struct map_session_data *sd)
{
+#if PACKETVER < 20080102
+ const int cmd = 0x73;
+#else
const int cmd = 0x2eb;
+#endif
int fd = sd->fd;
WFIFOHEAD(fd,packet_len(cmd));
@@ -645,7 +651,9 @@ void clif_authok(struct map_session_data *sd)
WFIFOPOS(fd, 6, sd->bl.x, sd->bl.y, sd->ud.dir);
WFIFOB(fd, 9) = 5; // ignored
WFIFOB(fd,10) = 5; // ignored
+#if PACKETVER >= 20080102
WFIFOW(fd,11) = sd->user_font; // FIXME: Font is currently not saved.
+#endif
WFIFOSET(fd,packet_len(cmd));
}
@@ -822,9 +830,9 @@ void clif_clearunit_area(struct block_list* bl, clr_type type)
WBUFL(buf,2) = -bl->id;
clif_send(buf, packet_len(0x80), bl, SELF);
}
-
}
+
/// Used to make monsters with player-sprites disappear after dying
/// like normal monsters, because the client does not remove those
/// automatically.
@@ -851,6 +859,10 @@ void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, un
return;
}
+#if PACKETVER < 4
+ *rhand = sd->status.weapon;
+ *lhand = sd->status.shield;
+#else
if (sd->equip_index[EQI_HAND_R] >= 0 &&
sd->inventory_data[sd->equip_index[EQI_HAND_R]])
{
@@ -873,6 +885,7 @@ void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, un
*lhand = id->nameid;
} else
*lhand = 0;
+#endif
}
//To make the assignation of the level based on limits clearer/easier. [Skotlex]
@@ -918,12 +931,31 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool
struct status_change* sc = status_get_sc(bl);
struct view_data* vd = status_get_viewdata(bl);
unsigned char *buf = WBUFP(buffer,0);
+#if PACKETVER < 20091103
+ bool type = !pcdb_checkid(vd->class_);
+#endif
+#if PACKETVER >= 7
unsigned short offset = 0;
-
+#endif
+#if PACKETVER >= 20091103
const char *name;
+#endif
sd = BL_CAST(BL_PC, bl);
-#if PACKETVER < 20101124
+#if PACKETVER < 20091103
+ if(type)
+ WBUFW(buf,0) = spawn?0x7c:0x78;
+ else
+#endif
+#if PACKETVER < 4
+ WBUFW(buf,0) = spawn?0x79:0x78;
+#elif PACKETVER < 7
+ WBUFW(buf,0) = spawn?0x1d9:0x1d8;
+#elif PACKETVER < 20080102
+ WBUFW(buf,0) = spawn?0x22b:0x22a;
+#elif PACKETVER < 20091103
+ WBUFW(buf,0) = spawn?0x2ed:0x2ee;
+#elif PACKETVER < 20101124
WBUFW(buf,0) = spawn?0x7f8:0x7f9;
#else
WBUFW(buf,0) = spawn?0x858:0x857;
@@ -950,6 +982,16 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool
WBUFW(buf, 6) = status_get_speed(bl);
WBUFW(buf, 8) = (sc)? sc->opt1 : 0;
WBUFW(buf,10) = (sc)? sc->opt2 : 0;
+#if PACKETVER < 20091103
+ if (type&&spawn) { //uses an older and different packet structure
+ WBUFW(buf,12) = (sc)? sc->option : 0;
+ WBUFW(buf,14) = vd->hair_style;
+ WBUFW(buf,16) = vd->weapon;
+ WBUFW(buf,18) = vd->head_bottom;
+ WBUFW(buf,20) = vd->class_; //Pet armor (ignored by client)
+ WBUFW(buf,22) = vd->shield;
+ } else {
+#endif
#if PACKETVER >= 20091103
WBUFL(buf,12) = (sc)? sc->option : 0;
offset+=2;
@@ -967,10 +1009,18 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool
WBUFW(buf,14) = vd->class_;
WBUFW(buf,16) = vd->hair_style;
WBUFW(buf,18) = vd->weapon;
+#if PACKETVER < 4
+ WBUFW(buf,20) = vd->head_bottom;
+ WBUFW(buf,22) = vd->shield;
+#else
WBUFW(buf,20) = vd->shield;
WBUFW(buf,22) = vd->head_bottom;
- WBUFW(buf,24) = vd->head_top;
- WBUFW(buf,26) = vd->head_mid;
+#endif
+#if PACKETVER < 20091103
+ }
+#endif
+ WBUFW(buf,24) = vd->head_top;
+ WBUFW(buf,26) = vd->head_mid;
if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS )
{ //The hell, why flags work like this?
@@ -982,7 +1032,16 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool
WBUFW(buf,28) = vd->hair_color;
WBUFW(buf,30) = vd->cloth_color;
WBUFW(buf,32) = (sd)? sd->head_dir : 0;
-
+#if PACKETVER < 20091103
+ if (type&&spawn) { //End of packet 0x7c
+ WBUFB(buf,34) = (sd)?sd->status.karma:0; // karma
+ WBUFB(buf,35) = vd->sex;
+ WBUFPOS(buf,36,bl->x,bl->y,unit_getdir(bl));
+ WBUFB(buf,39) = 0;
+ WBUFB(buf,40) = 0;
+ return packet_len(0x7c);
+ }
+#endif
#if PACKETVER >= 20110111
WBUFW(buf,34) = vd->robe;
offset+= 2;
@@ -1016,9 +1075,19 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool
buf = WBUFP(buffer,offset);
}
WBUFW(buf,51) = clif_setlevel(bl);
+#if PACKETVER < 20091103
+ if (type) //End for non-player packet
+ return packet_len(WBUFW(buffer,0));
+#endif
+#if PACKETVER >= 20080102
WBUFW(buf,53) = sd?sd->user_font:0;
+#endif
+#if PACKETVER >= 20091103
memcpy((char*)WBUFP(buf,55), name, NAME_LENGTH);
return WBUFW(buffer,2);
+#else
+ return packet_len(WBUFW(buffer,0));
+#endif
}
/*==========================================
@@ -1030,19 +1099,31 @@ static int clif_set_unit_walking(struct block_list* bl, struct unit_data* ud, un
struct status_change* sc = status_get_sc(bl);
struct view_data* vd = status_get_viewdata(bl);
unsigned char* buf = WBUFP(buffer,0);
+#if PACKETVER >= 7
unsigned short offset = 0;
+#endif
+#if PACKETVER >= 20091103
const char *name;
+#endif
sd = BL_CAST(BL_PC, bl);
-#if PACKETVER < 20101124
+#if PACKETVER < 4
+ WBUFW(buf, 0) = 0x7b;
+#elif PACKETVER < 7
+ WBUFW(buf, 0) = 0x1da;
+#elif PACKETVER < 20080102
+ WBUFW(buf, 0) = 0x22c;
+#elif PACKETVER < 20091103
+ WBUFW(buf, 0) = 0x2ec;
+#elif PACKETVER < 20101124
WBUFW(buf, 0) = 0x7f7;
#else
WBUFW(buf, 0) = 0x856;
#endif
+#if PACKETVER >= 20091103
name = status_get_name(bl);
-
#if PACKETVER < 20110111
WBUFW(buf, 2) = 69+strlen(name);
#else
@@ -1050,22 +1131,35 @@ static int clif_set_unit_walking(struct block_list* bl, struct unit_data* ud, un
#endif
offset+=2;
buf = WBUFP(buffer,offset);
+#endif
+#if PACKETVER >= 20071106
WBUFB(buf, 2) = clif_bl_type(bl);
offset++;
buf = WBUFP(buffer,offset);
+#endif
WBUFL(buf, 2) = bl->id;
WBUFW(buf, 6) = status_get_speed(bl);
WBUFW(buf, 8) = (sc)? sc->opt1 : 0;
WBUFW(buf,10) = (sc)? sc->opt2 : 0;
+#if PACKETVER < 7
+ WBUFW(buf,12) = (sc)? sc->option : 0;
+#else
WBUFL(buf,12) = (sc)? sc->option : 0;
offset+=2; //Shift the rest of elements by 2 bytes.
buf = WBUFP(buffer,offset);
+#endif
WBUFW(buf,14) = vd->class_;
WBUFW(buf,16) = vd->hair_style;
WBUFW(buf,18) = vd->weapon;
+#if PACKETVER < 4
+ WBUFW(buf,20) = vd->head_bottom;
+ WBUFL(buf,22) = gettick();
+ WBUFW(buf,26) = vd->shield;
+#else
WBUFW(buf,20) = vd->shield;
WBUFW(buf,22) = vd->head_bottom;
WBUFL(buf,24) = gettick();
+#endif
WBUFW(buf,28) = vd->head_top;
WBUFW(buf,30) = vd->head_mid;
WBUFW(buf,32) = vd->hair_color;
@@ -1079,27 +1173,43 @@ static int clif_set_unit_walking(struct block_list* bl, struct unit_data* ud, un
WBUFL(buf,38) = status_get_guild_id(bl);
WBUFW(buf,42) = status_get_emblem_id(bl);
WBUFW(buf,44) = (sd)? sd->status.manner : 0;
+#if PACKETVER < 7
+ WBUFW(buf,46) = (sc)? sc->opt3 : 0;
+#else
WBUFL(buf,46) = (sc)? sc->opt3 : 0;
offset+=2; //Shift the rest of elements by 2 bytes.
buf = WBUFP(buffer,offset);
+#endif
WBUFB(buf,48) = (sd)? sd->status.karma : 0;
WBUFB(buf,49) = vd->sex;
WBUFPOS2(buf,50,bl->x,bl->y,ud->to_x,ud->to_y,8,8);
WBUFB(buf,56) = (sd)? 5 : 0;
WBUFB(buf,57) = (sd)? 5 : 0;
WBUFW(buf,58) = clif_setlevel(bl);
+#if PACKETVER >= 20080102
WBUFW(buf,60) = sd?sd->user_font:0;
-
+#endif
+#if PACKETVER >= 20091103
memcpy((char*)WBUFP(buf,62), name, NAME_LENGTH);
return WBUFW(buffer,2);
+#else
+ return packet_len(WBUFW(buffer,0));
+#endif
}
//Modifies the buffer for disguise characters and sends it to self.
//Used for spawn/walk packets, where the ID offset changes for packetver >=9
static void clif_setdisguise(struct block_list *bl, unsigned char *buf,int len)
{
+#if PACKETVER >= 20091103
WBUFB(buf,4)= pcdb_checkid(status_get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE
WBUFL(buf,5)=-bl->id;
+#elif PACKETVER >= 20071106
+ WBUFB(buf,2)= pcdb_checkid(status_get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE
+ WBUFL(buf,3)=-bl->id;
+#else
+ WBUFL(buf,2)=-bl->id;
+#endif
clif_send(buf, len, bl, SELF);
}
@@ -1776,8 +1886,10 @@ void clif_sendfakenpc(struct map_session_data *sd, int npcid)
buf = WFIFOP(fd,0);
memset(WBUFP(buf,0), 0, packet_len(0x78));
WBUFW(buf,0)=0x78;
+#if PACKETVER >= 20071106
WBUFB(buf,2) = 0; // object type
buf = WFIFOP(fd,1);
+#endif
WBUFL(buf,2)=npcid;
WBUFW(buf,14)=111;
WBUFPOS(buf,46,sd->bl.x,sd->bl.y,sd->ud.dir);
@@ -1915,9 +2027,9 @@ void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, in
WFIFOB(fd,18)=id;
WFIFOL(fd,19)=color;
WFIFOSET(fd,packet_len(0x144));
-
}
+
/// Displays an illustration image.
/// 0145 <image name>.16B <type>.B (ZC_SHOW_IMAGE)
/// 01b3 <image name>.64B <type>.B (ZC_SHOW_IMAGE2)
@@ -2003,7 +2115,13 @@ static void clif_addcards(unsigned char* buf, struct item* item)
void clif_additem(struct map_session_data *sd, int n, int amount, int fail)
{
int fd;
+#if PACKETVER < 20061218
+ const int cmd = 0xa0;
+#elif PACKETVER < 20071002
+ const int cmd = 0x29a;
+#else
const int cmd = 0x2d4;
+#endif
nullpo_retv(sd);
fd = sd->fd;
@@ -2027,8 +2145,12 @@ void clif_additem(struct map_session_data *sd, int n, int amount, int fail)
WFIFOW(fd,19)=0;
WFIFOB(fd,21)=0;
WFIFOB(fd,22)=fail;
+#if PACKETVER >= 20061218
WFIFOL(fd,23)=0;
+#endif
+#if PACKETVER >= 20071002
WFIFOW(fd,27)=0; // unknown
+#endif
}
else
{
@@ -2049,8 +2171,12 @@ void clif_additem(struct map_session_data *sd, int n, int amount, int fail)
WFIFOW(fd,19)=pc_equippoint(sd,n);
WFIFOB(fd,21)=itemtype(sd->inventory_data[n]->type);
WFIFOB(fd,22)=fail;
+#if PACKETVER >= 20061218
WFIFOL(fd,23)=sd->status.inventory[n].expire_time;
+#endif
+#if PACKETVER >= 20071002
WFIFOW(fd,27)=0; // unknown
+#endif
}
WFIFOSET(fd,packet_len(cmd));
@@ -2087,6 +2213,9 @@ void clif_dropitem(struct map_session_data *sd,int n,int amount)
/// 7 = Consumed by Four Spirit Analysis (SO_EL_ANALYSIS) skill
void clif_delitem(struct map_session_data *sd,int n,int amount, short reason)
{
+#if PACKETVER < 20091117
+ clif_dropitem(sd,n,amount);
+#else
int fd;
nullpo_retv(sd);
@@ -2099,9 +2228,10 @@ void clif_delitem(struct map_session_data *sd,int n,int amount, short reason)
WFIFOW(fd,4)=n+2;
WFIFOW(fd,6)=amount;
WFIFOSET(fd,packet_len(0x7fa));
-
+#endif
}
+
// Simplifies inventory/cart/storage packets by handling the packet section relevant to items. [Skotlex]
// Equip is >= 0 for equippable items (holds the equip-point, is 0 for pet
// armor/egg) -1 for stackable items, -2 for stackable items where arrows must send in the equip-point.
@@ -2134,9 +2264,17 @@ void clif_inventorylist(struct map_session_data *sd)
int i,n,ne,arrow=-1;
unsigned char *buf;
unsigned char *bufe;
+
+#if PACKETVER < 5
+ const int s = 10; //Entry size.
+#elif PACKETVER < 20080102
+ const int s = 18;
+#else
const int s = 22;
-
-#if PACKETVER < 20100629
+#endif
+#if PACKETVER < 20071002
+ const int se = 20;
+#elif PACKETVER < 20100629
const int se = 26;
#else
const int se = 28;
@@ -2155,8 +2293,10 @@ void clif_inventorylist(struct map_session_data *sd)
WBUFW(bufe,ne*se+4)=i+2;
clif_item_sub(bufe, ne*se+6, &sd->status.inventory[i], sd->inventory_data[i], pc_equippoint(sd,i));
clif_addcards(WBUFP(bufe, ne*se+16), &sd->status.inventory[i]);
+#if PACKETVER >= 20071002
WBUFL(bufe,ne*se+24)=sd->status.inventory[i].expire_time;
WBUFW(bufe,ne*se+28)=0; //Unknown
+#endif
#if PACKETVER >= 20100629
if (sd->inventory_data[i]->equip&EQP_VISIBLE)
WBUFW(bufe,ne*se+30)= sd->inventory_data[i]->look;
@@ -2171,14 +2311,24 @@ void clif_inventorylist(struct map_session_data *sd)
clif_item_sub(buf, n*s+6, &sd->status.inventory[i], sd->inventory_data[i], -2);
if( sd->inventory_data[i]->equip == EQP_AMMO && sd->status.inventory[i].equip )
arrow=i;
- clif_addcards(WBUFP(buf, n*s+14), &sd->status.inventory[i]);
- WBUFL(buf,n*s+22)=sd->status.inventory[i].expire_time;
- n++;
- }
+#if PACKETVER >= 5
+ clif_addcards(WBUFP(buf, n*s+14), &sd->status.inventory[i]);
+#endif
+#if PACKETVER >= 20080102
+ WBUFL(buf,n*s+22)=sd->status.inventory[i].expire_time;
+#endif
+ n++;
}
+ }
if( n )
{
+#if PACKETVER < 5
+ WBUFW(buf,0)=0xa3;
+#elif PACKETVER < 20080102
+ WBUFW(buf,0)=0x1ee;
+#else
WBUFW(buf,0)=0x2e8;
+#endif
WBUFW(buf,2)=4+n*s;
clif_send(buf, WBUFW(buf,2), &sd->bl, SELF);
}
@@ -2187,7 +2337,11 @@ void clif_inventorylist(struct map_session_data *sd)
if( ne )
{
+#if PACKETVER < 20071002
+ WBUFW(bufe,0)=0xa4;
+#else
WBUFW(bufe,0)=0x2d0;
+#endif
WBUFW(bufe,2)=4+ne*se;
clif_send(bufe, WBUFW(bufe,2), &sd->bl, SELF);
}
@@ -2201,7 +2355,9 @@ void clif_equiplist(struct map_session_data *sd)
{
int i,n,fd = sd->fd;
unsigned char *buf;
-#if PACKETVER < 20100629
+#if PACKETVER < 20071002
+ const int cmd = 20;
+#elif PACKETVER < 20100629
const int cmd = 26;
#else
const int cmd = 28;
@@ -2220,8 +2376,10 @@ void clif_equiplist(struct map_session_data *sd)
WBUFW(buf,n*cmd+4)=i+2;
clif_item_sub(buf, n*cmd+6, &sd->status.inventory[i], sd->inventory_data[i], pc_equippoint(sd,i));
clif_addcards(WBUFP(buf, n*cmd+16), &sd->status.inventory[i]);
+#if PACKETVER >= 20071002
WBUFL(buf,n*cmd+24)=sd->status.inventory[i].expire_time;
WBUFW(buf,n*cmd+28)=0; //Unknown
+#endif
#if PACKETVER >= 20100629
if (sd->inventory_data[i]->equip&EQP_VISIBLE)
WBUFW(buf,n*cmd+30)= sd->inventory_data[i]->look;
@@ -2231,7 +2389,11 @@ void clif_equiplist(struct map_session_data *sd)
n++;
}
if (n) {
+#if PACKETVER < 20071002
+ WBUFW(buf,0)=0xa4;
+#else
WBUFW(buf,0)=0x2d0;
+#endif
WBUFW(buf,2)=4+n*cmd;
WFIFOSET(fd,WFIFOW(fd,2));
}
@@ -2243,8 +2405,16 @@ void clif_storagelist(struct map_session_data* sd, struct item* items, int items
int i,n,ne;
unsigned char *buf;
unsigned char *bufe;
+#if PACKETVER < 5
+ const int s = 10; //Entry size.
+#elif PACKETVER < 20080102
+ const int s = 18;
+#else
const int s = 22;
-#if PACKETVER < 20100629
+#endif
+#if PACKETVER < 20071002
+ const int cmd = 20;
+#elif PACKETVER < 20100629
const int cmd = 26;
#else
const int cmd = 28;
@@ -2263,28 +2433,44 @@ void clif_storagelist(struct map_session_data* sd, struct item* items, int items
WBUFW(bufe,ne*cmd+4)=i+1;
clif_item_sub(bufe, ne*cmd+6, &items[i], id, id->equip);
clif_addcards(WBUFP(bufe, ne*cmd+16), &items[i]);
+#if PACKETVER >= 20071002
WBUFL(bufe,ne*cmd+24)=items[i].expire_time;
WBUFW(bufe,ne*cmd+28)=0; //Unknown
+#endif
ne++;
}
else
{ //Stackable
WBUFW(buf,n*s+4)=i+1;
clif_item_sub(buf, n*s+6, &items[i], id,-1);
+#if PACKETVER >= 5
clif_addcards(WBUFP(buf,n*s+14), &items[i]);
+#endif
+#if PACKETVER >= 20080102
WBUFL(buf,n*s+22)=items[i].expire_time;
+#endif
n++;
}
}
if( n )
{
+#if PACKETVER < 5
+ WBUFW(buf,0)=0xa5;
+#elif PACKETVER < 20080102
+ WBUFW(buf,0)=0x1f0;
+#else
WBUFW(buf,0)=0x2ea;
+#endif
WBUFW(buf,2)=4+n*s;
clif_send(buf, WBUFW(buf,2), &sd->bl, SELF);
}
if( ne )
{
+#if PACKETVER < 20071002
+ WBUFW(bufe,0)=0xa6;
+#else
WBUFW(bufe,0)=0x2d1;
+#endif
WBUFW(bufe,2)=4+ne*cmd;
clif_send(bufe, WBUFW(bufe,2), &sd->bl, SELF);
}
@@ -2299,8 +2485,16 @@ void clif_cartlist(struct map_session_data *sd)
int i,n,ne;
unsigned char *buf;
unsigned char *bufe;
+#if PACKETVER < 5
+ const int s = 10; //Entry size.
+#elif PACKETVER < 20080102
+ const int s = 18;
+#else
const int s = 22;
-#if PACKETVER < 20100629
+#endif
+#if PACKETVER < 20071002
+ const int cmd = 20;
+#elif PACKETVER < 20100629
const int cmd = 26;
#else
const int cmd = 28;
@@ -2319,28 +2513,44 @@ void clif_cartlist(struct map_session_data *sd)
WBUFW(bufe,ne*cmd+4)=i+2;
clif_item_sub(bufe, ne*cmd+6, &sd->status.cart[i], id, id->equip);
clif_addcards(WBUFP(bufe, ne*cmd+16), &sd->status.cart[i]);
+#if PACKETVER >= 20071002
WBUFL(bufe,ne*cmd+24)=sd->status.cart[i].expire_time;
WBUFW(bufe,ne*cmd+28)=0; //Unknown
+#endif
ne++;
}
else
{ //Stackable
WBUFW(buf,n*s+4)=i+2;
clif_item_sub(buf, n*s+6, &sd->status.cart[i], id,-1);
+#if PACKETVER >= 5
clif_addcards(WBUFP(buf,n*s+14), &sd->status.cart[i]);
+#endif
+#if PACKETVER >= 20080102
WBUFL(buf,n*s+22)=sd->status.cart[i].expire_time;
+#endif
n++;
}
}
if( n )
{
+#if PACKETVER < 5
+ WBUFW(buf,0)=0x123;
+#elif PACKETVER < 20080102
+ WBUFW(buf,0)=0x1ef;
+#else
WBUFW(buf,0)=0x2e9;
+#endif
WBUFW(buf,2)=4+n*s;
clif_send(buf, WBUFW(buf,2), &sd->bl, SELF);
}
if( ne )
{
- WBUFW(bufe,0)=0x2d2;
+#if PACKETVER < 20071002
+ WBUFW(bufe,0)=0x122;
+#else
+ WBUFW(bufe,0)=0x2d2;
+#endif
WBUFW(bufe,2)=4+ne*cmd;
clif_send(bufe, WBUFW(bufe,2), &sd->bl, SELF);
}
@@ -2784,6 +2994,7 @@ void clif_changelook(struct block_list *bl,int type,int val)
vd->cloth_color = val;
break;
case LOOK_SHOES:
+#if PACKETVER > 3
if (sd) {
int n;
if((n = sd->equip_index[2]) >= 0 && sd->inventory_data[n]) {
@@ -2794,6 +3005,7 @@ void clif_changelook(struct block_list *bl,int type,int val)
}
val = 0;
}
+#endif
//Shoes? No packet uses this....
break;
case LOOK_BODY:
@@ -2813,6 +3025,13 @@ void clif_changelook(struct block_list *bl,int type,int val)
if( sc && sc->option&OPTION_INVISIBLE )
target = SELF;
+#if PACKETVER < 4
+ WBUFW(buf,0)=0xc3;
+ WBUFL(buf,2)=bl->id;
+ WBUFB(buf,6)=type;
+ WBUFB(buf,7)=val;
+ clif_send(buf,packet_len(0xc3),bl,target);
+#else
WBUFW(buf,0)=0x1d7;
WBUFL(buf,2)=bl->id;
if(type == LOOK_WEAPON || type == LOOK_SHIELD) {
@@ -2824,31 +3043,47 @@ void clif_changelook(struct block_list *bl,int type,int val)
WBUFL(buf,7)=val;
}
clif_send(buf,packet_len(0x1d7),bl,target);
+#endif
}
//Sends a change-base-look packet required for traps as they are triggered.
void clif_changetraplook(struct block_list *bl,int val)
{
unsigned char buf[32];
+#if PACKETVER < 4
+ WBUFW(buf,0)=0xc3;
+ WBUFL(buf,2)=bl->id;
+ WBUFB(buf,6)=LOOK_BASE;
+ WBUFB(buf,7)=val;
+ 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(0x1d7),bl,AREA);
+#endif
}
//For the stupid cloth-dye bug. Resends the given view data to the area specified by bl.
void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_target target)
{
unsigned char buf[32];
+#if PACKETVER < 4
+ WBUFW(buf,0)=0xc3;
+ WBUFL(buf,2)=id;
+ WBUFB(buf,6)=type;
+ WBUFB(buf,7)=val;
+ clif_send(buf,packet_len(0xc3),bl,target);
+#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(0x1d7),bl,target);
- return;
+#endif
}
@@ -3104,6 +3339,7 @@ void clif_changeoption(struct block_list* bl)
if (!sc) return; //How can an option change if there's no sc?
sd = BL_CAST(BL_PC, bl);
+#if PACKETVER >= 7
WBUFW(buf,0) = 0x229;
WBUFL(buf,2) = bl->id;
WBUFW(buf,6) = sc->opt1;
@@ -3119,6 +3355,23 @@ void clif_changeoption(struct block_list* bl)
clif_send(buf,packet_len(0x229),bl,SELF);
} else
clif_send(buf,packet_len(0x229),bl,AREA);
+#else
+ WBUFW(buf,0) = 0x119;
+ WBUFL(buf,2) = bl->id;
+ WBUFW(buf,6) = sc->opt1;
+ WBUFW(buf,8) = sc->opt2;
+ WBUFW(buf,10) = sc->option;
+ WBUFB(buf,12) = (sd)? sd->status.karma : 0;
+ if(disguised(bl)) {
+ clif_send(buf,packet_len(0x119),bl,AREA_WOS);
+ WBUFL(buf,2) = -bl->id;
+ clif_send(buf,packet_len(0x119),bl,SELF);
+ WBUFL(buf,2) = bl->id;
+ WBUFW(buf,10) = OPTION_INVISIBLE;
+ clif_send(buf,packet_len(0x119),bl,SELF);
+ } else
+ clif_send(buf,packet_len(0x119),bl,AREA);
+#endif
}
@@ -3166,7 +3419,15 @@ void clif_useitemack(struct map_session_data *sd,int index,int amount,bool ok)
WFIFOSET(fd,packet_len(0xa8));
}
else {
-
+#if PACKETVER < 3
+ int fd=sd->fd;
+ 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(0xa8));
+#else
unsigned char buf[32];
WBUFW(buf,0)=0x1c8;
@@ -3179,6 +3440,7 @@ void clif_useitemack(struct map_session_data *sd,int index,int amount,bool ok)
WBUFW(buf,10)=amount;
WBUFB(buf,12)=ok;
clif_send(buf,packet_len(0x1c8),&sd->bl,AREA);
+#endif
}
}
@@ -3414,6 +3676,13 @@ void clif_leavechat(struct chat_data* cd, struct map_session_data* sd, bool flag
void clif_traderequest(struct map_session_data* sd, const char* name)
{
int fd = sd->fd;
+
+#if PACKETVER < 6
+ WFIFOHEAD(fd,packet_len(0xe5));
+ WFIFOW(fd,0) = 0xe5;
+ safestrncpy((char*)WFIFOP(fd,2), name, NAME_LENGTH);
+ WFIFOSET(fd,packet_len(0xe5));
+#else
struct map_session_data* tsd = map_id2sd(sd->trade_partner);
if( !tsd ) return;
@@ -3423,6 +3692,7 @@ void clif_traderequest(struct map_session_data* sd, const char* name)
WFIFOL(fd,26) = tsd->status.char_id;
WFIFOW(fd,30) = tsd->status.base_level;
WFIFOSET(fd,packet_len(0x1f4));
+#endif
}
@@ -3440,7 +3710,7 @@ void clif_tradestart(struct map_session_data* sd, uint8 type)
{
int fd = sd->fd;
struct map_session_data* tsd = map_id2sd(sd->trade_partner);
- if (!tsd) {
+ if( PACKETVER < 6 || !tsd ) {
WFIFOHEAD(fd,packet_len(0xe7));
WFIFOW(fd,0) = 0xe7;
WFIFOB(fd,2) = type;
@@ -3634,6 +3904,18 @@ void clif_storageitemadded(struct map_session_data* sd, struct item* i, int inde
fd=sd->fd;
view = itemdb_viewid(i->nameid);
+#if PACKETVER < 5
+ WFIFOHEAD(fd,packet_len(0xf4));
+ WFIFOW(fd, 0) = 0xf4; // Storage item added
+ WFIFOW(fd, 2) = index+1; // index
+ WFIFOL(fd, 4) = amount; // amount
+ WFIFOW(fd, 8) = ( view > 0 ) ? view : i->nameid; // id
+ WFIFOB(fd,10) = i->identify; //identify flag
+ WFIFOB(fd,11) = i->attribute; // attribute
+ WFIFOB(fd,12) = i->refine; //refine
+ clif_addcards(WFIFOP(fd,13), i);
+ WFIFOSET(fd,packet_len(0xf4));
+#else
WFIFOHEAD(fd,packet_len(0x1c4));
WFIFOW(fd, 0) = 0x1c4; // Storage item added
WFIFOW(fd, 2) = index+1; // index
@@ -3645,6 +3927,7 @@ void clif_storageitemadded(struct map_session_data* sd, struct item* i, int inde
WFIFOB(fd,13) = i->refine; //refine
clif_addcards(WFIFOP(fd,14), i);
WFIFOSET(fd,packet_len(0x1c4));
+#endif
}
@@ -3838,7 +4121,11 @@ int clif_damage(struct block_list* src, struct block_list* dst, unsigned int tic
{
unsigned char buf[33];
struct status_change *sc;
+#if PACKETVER < 20071113
+ const int cmd = 0x8a;
+#else
const int cmd = 0x2e1;
+#endif
nullpo_ret(src);
nullpo_ret(dst);
@@ -3858,7 +4145,17 @@ int clif_damage(struct block_list* src, struct block_list* dst, unsigned int tic
WBUFL(buf,10)=tick;
WBUFL(buf,14)=sdelay;
WBUFL(buf,18)=ddelay;
-
+#if PACKETVER < 20071113
+ if (battle_config.hide_woe_damage && map_flag_gvg(src->m)) {
+ WBUFW(buf,22)=damage?div:0;
+ WBUFW(buf,27)=damage2?div:0;
+ } else {
+ WBUFW(buf,22)=min(damage, INT16_MAX);
+ WBUFW(buf,27)=damage2;
+ }
+ WBUFW(buf,24)=div;
+ WBUFB(buf,26)=type;
+#else
if (battle_config.hide_woe_damage && map_flag_gvg(src->m)) {
WBUFL(buf,22)=damage?div:0;
WBUFL(buf,29)=damage2?div:0;
@@ -3868,6 +4165,7 @@ int clif_damage(struct block_list* src, struct block_list* dst, unsigned int tic
}
WBUFW(buf,26)=div;
WBUFB(buf,28)=type;
+#endif
if(disguised(dst)) {
clif_send(buf,packet_len(cmd),dst,AREA_WOS);
WBUFL(buf,6) = -dst->id;
@@ -3879,8 +4177,13 @@ int clif_damage(struct block_list* src, struct block_list* dst, unsigned int tic
WBUFL(buf,2) = -src->id;
if (disguised(dst))
WBUFL(buf,6) = dst->id;
+#if PACKETVER < 20071113
+ if(damage > 0) WBUFW(buf,22) = -1;
+ if(damage2 > 0) WBUFW(buf,27) = -1;
+#else
if(damage > 0) WBUFL(buf,22) = -1;
if(damage2 > 0) WBUFL(buf,29) = -1;
+#endif
clif_send(buf,packet_len(cmd),src,SELF);
}
//Return adjusted can't walk delay for further processing.
@@ -4009,6 +4312,7 @@ static void clif_getareachar_skillunit(struct map_session_data *sd, struct skill
if( unit->group->state.guildaura )
return;
+#if PACKETVER >= 3
if(unit->group->unit_id==UNT_GRAFFITI) { // Graffiti [Valaris]
WFIFOHEAD(fd,packet_len(0x1c9));
WFIFOW(fd, 0)=0x1c9;
@@ -4023,6 +4327,7 @@ static void clif_getareachar_skillunit(struct map_session_data *sd, struct skill
WFIFOSET(fd,packet_len(0x1c9));
return;
}
+#endif
WFIFOHEAD(fd,packet_len(0x11f));
WFIFOW(fd, 0)=0x11f;
WFIFOL(fd, 2)=unit->bl.id;
@@ -4294,6 +4599,7 @@ void clif_addskill(struct map_session_data *sd, int id)
/// 0441 <skill id>.W
void clif_deleteskill(struct map_session_data *sd, int id)
{
+#if PACKETVER >= 20081217
int fd;
nullpo_retv(sd);
@@ -4304,6 +4610,9 @@ void clif_deleteskill(struct map_session_data *sd, int id)
WFIFOW(fd,0) = 0x441;
WFIFOW(fd,2) = id;
WFIFOSET(fd,packet_len(0x441));
+#else
+ clif_skillinfoblock(sd);
+#endif
}
@@ -4365,7 +4674,11 @@ void clif_skillinfo(struct map_session_data *sd,int skill, int inf)
/// 1 = no text
void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, int skill_num, int property, int casttime)
{
+#if PACKETVER < 20091124
+ const int cmd = 0x13e;
+#else
const int cmd = 0x7fb;
+#endif
unsigned char buf[32];
WBUFW(buf,0) = cmd;
@@ -4376,7 +4689,9 @@ void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x,
WBUFW(buf,14) = skill_num;
WBUFL(buf,16) = property<0?0:property; //Avoid sending negatives as element [Skotlex]
WBUFL(buf,20) = casttime;
+#if PACKETVER >= 20091124
WBUFB(buf,24) = 0; // isDisposable
+#endif
if (disguised(bl)) {
clif_send(buf,packet_len(cmd), bl, AREA_WOS);
@@ -4462,6 +4777,7 @@ void clif_skill_fail(struct map_session_data *sd,int skill_id,enum useskill_fail
/// 043d <skill ID>.W <tick>.L
void clif_skill_cooldown(struct map_session_data *sd, int skillid, unsigned int tick)
{
+#if PACKETVER>=20081112
int fd;
nullpo_retv(sd);
@@ -4472,6 +4788,7 @@ void clif_skill_cooldown(struct map_session_data *sd, int skillid, unsigned int
WFIFOW(fd,2) = skillid;
WFIFOL(fd,4) = tick;
WFIFOSET(fd,packet_len(0x43d));
+#endif
}
@@ -4493,6 +4810,38 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int
damage = damage*(sc->data[SC_HALLUCINATION]->val2) + rnd()%100;
}
+#if PACKETVER < 3
+ WBUFW(buf,0)=0x114;
+ WBUFW(buf,2)=skill_id;
+ WBUFL(buf,4)=src->id;
+ WBUFL(buf,8)=dst->id;
+ WBUFL(buf,12)=tick;
+ WBUFL(buf,16)=sdelay;
+ WBUFL(buf,20)=ddelay;
+ if (battle_config.hide_woe_damage && map_flag_gvg(src->m)) {
+ WBUFW(buf,24)=damage?div:0;
+ } else {
+ WBUFW(buf,24)=damage;
+ }
+ WBUFW(buf,26)=skill_lv;
+ WBUFW(buf,28)=div;
+ WBUFB(buf,30)=type;
+ if (disguised(dst)) {
+ clif_send(buf,packet_len(0x114),dst,AREA_WOS);
+ WBUFL(buf,8)=-dst->id;
+ clif_send(buf,packet_len(0x114),dst,SELF);
+ } else
+ clif_send(buf,packet_len(0x114),dst,AREA);
+
+ if(disguised(src)) {
+ WBUFL(buf,4)=-src->id;
+ if (disguised(dst))
+ WBUFL(buf,8)=dst->id;
+ if(damage > 0)
+ WBUFW(buf,24)=-1;
+ clif_send(buf,packet_len(0x114),src,SELF);
+ }
+#else
WBUFW(buf,0)=0x1de;
WBUFW(buf,2)=skill_id;
WBUFL(buf,4)=src->id;
@@ -4523,6 +4872,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int
WBUFL(buf,24)=-1;
clif_send(buf,packet_len(0x1de),src,SELF);
}
+#endif
//Because the damage delay must be synced with the client, here is where the can-walk tick must be updated. [Skotlex]
return clif_calc_walkdelay(dst,ddelay,type,damage,div);
@@ -4658,6 +5008,7 @@ void clif_skill_setunit(struct skill_unit *unit)
if( unit->group->state.guildaura )
return;
+#if PACKETVER >= 3
if(unit->group->unit_id==UNT_GRAFFITI) { // Graffiti [Valaris]
WBUFW(buf, 0)=0x1c9;
WBUFL(buf, 2)=unit->bl.id;
@@ -4671,6 +5022,7 @@ void clif_skill_setunit(struct skill_unit *unit)
clif_send(buf,packet_len(0x1c9),&unit->bl,AREA);
return;
}
+#endif
WBUFW(buf, 0)=0x11f;
WBUFL(buf, 2)=unit->bl.id;
WBUFL(buf, 6)=unit->group->src_id;
@@ -5197,6 +5549,14 @@ void clif_upgrademessage(int fd, int result, int item_id)
/// 0097 <packet len>.W <nick>.24B <isAdmin>.L <message>.?B (PACKETVER >= 20091104)
void clif_wis_message(int fd, const char* nick, const char* mes, int mes_len)
{
+#if PACKETVER < 20091104
+ WFIFOHEAD(fd, mes_len + NAME_LENGTH + 4);
+ WFIFOW(fd,0) = 0x97;
+ WFIFOW(fd,2) = mes_len + NAME_LENGTH + 4;
+ safestrncpy((char*)WFIFOP(fd,4), nick, NAME_LENGTH);
+ safestrncpy((char*)WFIFOP(fd,28), mes, mes_len);
+ WFIFOSET(fd,WFIFOW(fd,2));
+#else
WFIFOHEAD(fd, mes_len + NAME_LENGTH + 8);
WFIFOW(fd,0) = 0x97;
WFIFOW(fd,2) = mes_len + NAME_LENGTH + 8;
@@ -5205,6 +5565,7 @@ void clif_wis_message(int fd, const char* nick, const char* mes, int mes_len)
// TODO: WFIFOL(fd,28) = pc_get_group_level(ssd);
safestrncpy((char*)WFIFOP(fd,32), mes, mes_len);
WFIFOSET(fd,WFIFOW(fd,2));
+#endif
}
@@ -5486,6 +5847,22 @@ void clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail)
if(n<0 || n>=MAX_CART || sd->status.cart[n].nameid<=0)
return;
+#if PACKETVER < 5
+ WFIFOHEAD(fd,packet_len(0x124));
+ buf=WFIFOP(fd,0);
+ WBUFW(buf,0)=0x124;
+ WBUFW(buf,2)=n+2;
+ WBUFL(buf,4)=amount;
+ if((view = itemdb_viewid(sd->status.cart[n].nameid)) > 0)
+ WBUFW(buf,8)=view;
+ else
+ WBUFW(buf,8)=sd->status.cart[n].nameid;
+ WBUFB(buf,10)=sd->status.cart[n].identify;
+ 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(0x124));
+#else
WFIFOHEAD(fd,packet_len(0x1c5));
buf=WFIFOP(fd,0);
WBUFW(buf,0)=0x1c5;
@@ -5501,6 +5878,7 @@ void clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail)
WBUFB(buf,13)=sd->status.cart[n].refine;
clif_addcards(WBUFP(buf,14), &sd->status.cart[n]);
WFIFOSET(fd,packet_len(0x1c5));
+#endif
}
@@ -5874,11 +6252,26 @@ void clif_party_inviteack(struct map_session_data* sd, const char* nick, int res
nullpo_retv(sd);
fd=sd->fd;
+#if PACKETVER < 20070904
+ if( result == 7 ) {
+ clif_displaymessage(fd, msg_txt(3));
+ return;
+ }
+#endif
+
+#if PACKETVER < 20070821
+ WFIFOHEAD(fd,packet_len(0xfd));
+ WFIFOW(fd,0) = 0xfd;
+ safestrncpy((char*)WFIFOP(fd,2),nick,NAME_LENGTH);
+ WFIFOB(fd,26) = result;
+ WFIFOSET(fd,packet_len(0xfd));
+#else
WFIFOHEAD(fd,packet_len(0x2c5));
WFIFOW(fd,0) = 0x2c5;
safestrncpy((char*)WFIFOP(fd,2),nick,NAME_LENGTH);
WFIFOL(fd,26) = result;
WFIFOSET(fd,packet_len(0x2c5));
+#endif
}
@@ -5896,7 +6289,11 @@ void clif_party_inviteack(struct map_session_data* sd, const char* nick, int res
void clif_party_option(struct party_data *p,struct map_session_data *sd,int flag)
{
unsigned char buf[16];
+#if PACKETVER < 20090603
+ const int cmd = 0x101;
+#else
const int cmd = 0x7d8;
+#endif
nullpo_retv(p);
@@ -5909,8 +6306,10 @@ void clif_party_option(struct party_data *p,struct map_session_data *sd,int flag
if(!sd) return;
WBUFW(buf,0)=cmd;
WBUFL(buf,2)=((flag&0x01)?2:p->party.exp);
+#if PACKETVER >= 20090603
WBUFB(buf,6)=(p->party.item&1)?1:0;
WBUFB(buf,7)=(p->party.item&2)?1:0;
+#endif
if(flag==0)
clif_send(buf,packet_len(cmd),&sd->bl,PARTY);
else
@@ -6224,7 +6623,9 @@ void clif_send_petstatus(struct map_session_data *sd)
WFIFOW(fd,29)=pet->hungry;
WFIFOW(fd,31)=pet->intimate;
WFIFOW(fd,33)=pet->equip;
+#if PACKETVER >= 20081126
WFIFOW(fd,35)=pet->class_;
+#endif
WFIFOSET(fd,packet_len(0x1a2));
}
@@ -8519,13 +8920,18 @@ void clif_parse_WantToConnection(int fd, TBL_PC* sd)
pc_setnewpc(sd, account_id, char_id, login_id1, client_tick, sex, fd);
+#if PACKETVER < 20070521
+ WFIFOHEAD(fd,4);
+ WFIFOL(fd,0) = sd->bl.id;
+ WFIFOSET(fd,4);
+#else
WFIFOHEAD(fd,packet_len(0x283));
WFIFOW(fd,0) = 0x283;
WFIFOL(fd,2) = sd->bl.id;
WFIFOSET(fd,packet_len(0x283));
+#endif
chrif_authreq(sd);
- return;
}
@@ -8553,7 +8959,12 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
sd->state.warping = 0;
// look
+#if PACKETVER < 4
+ clif_changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon);
+ clif_changelook(&sd->bl,LOOK_SHIELD,sd->status.shield);
+#else
clif_changelook(&sd->bl,LOOK_WEAPON,0);
+#endif
if(sd->vd.cloth_color)
clif_refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF);
@@ -8745,8 +9156,10 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
if( sd->state.changemap )
{// restore information that gets lost on map-change
+#if PACKETVER >= 20070918
clif_partyinvitationstate(sd);
clif_equipcheckbox(sd);
+#endif
if( (battle_config.bg_flee_penalty != 100 || battle_config.gvg_flee_penalty != 100) &&
(map_flag_gvg(sd->state.pmap) || map_flag_gvg(sd->bl.m) || map[sd->state.pmap].flag.battleground || map[sd->bl.m].flag.battleground) )
status_calc_bl(&sd->bl, SCB_FLEE); //Refresh flee penalty
@@ -8849,7 +9262,11 @@ void clif_hotkeys_send(struct map_session_data *sd) {
#ifdef HOTKEY_SAVING
const int fd = sd->fd;
int i;
- const int cmd = 0x07d9;
+#if PACKETVER < 20090603
+ const int cmd = 0x2b9;
+#else
+ const int cmd = 0x7d9;
+#endif
if (!fd) return;
WFIFOHEAD(fd, 2+MAX_HOTKEYS*7);
WFIFOW(fd, 0) = cmd;
@@ -12307,7 +12724,11 @@ void clif_parse_FriendsListReply(int fd, struct map_session_data *sd)
account_id = RFIFOL(fd,2);
char_id = RFIFOL(fd,6);
+#if PACKETVER < 6
+ reply = RFIFOB(fd,10);
+#else
reply = RFIFOL(fd,10);
+#endif
if( sd->bl.id == account_id )
{// adding oneself as friend
@@ -13612,7 +14033,11 @@ void clif_parse_Auction_buysell(int fd, struct map_session_data* sd)
void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd)
{
int fd,i;
+#if PACKETVER < 20070711
+ const int offset = 8;
+#else
const int offset = 12;
+#endif
nullpo_retv(sd);
nullpo_retv(nd);
@@ -13623,7 +14048,9 @@ void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd)
WFIFOW(fd,0) = 0x287;
WFIFOW(fd,2) = offset+nd->u.shop.count*11;
WFIFOL(fd,4) = sd->cashPoints; // Cash Points
+#if PACKETVER >= 20070711
WFIFOL(fd,8) = sd->kafraPoints; // Kafra Points
+#endif
for( i = 0; i < nd->u.shop.count; i++ )
{
@@ -13657,8 +14084,12 @@ void clif_cashshop_ack(struct map_session_data* sd, int error)
WFIFOHEAD(fd, packet_len(0x289));
WFIFOW(fd,0) = 0x289;
WFIFOL(fd,2) = sd->cashPoints;
+#if PACKETVER < 20070711
+ WFIFOW(fd,6) = TOW(error);
+#else
WFIFOL(fd,6) = sd->kafraPoints;
WFIFOW(fd,10) = TOW(error);
+#endif
WFIFOSET(fd, packet_len(0x289));
}
@@ -14020,6 +14451,7 @@ void clif_quest_update_status(struct map_session_data * sd, int quest_id, bool a
/// 3 = purple
void clif_quest_show_event(struct map_session_data *sd, struct block_list *bl, short state, short color)
{
+#if PACKETVER >= 20090218
int fd = sd->fd;
WFIFOHEAD(fd, packet_len(0x446));
@@ -14030,6 +14462,7 @@ void clif_quest_show_event(struct map_session_data *sd, struct block_list *bl, s
WFIFOW(fd, 10) = state;
WFIFOW(fd, 12) = color;
WFIFOSET(fd, packet_len(0x446));
+#endif
}
@@ -14538,6 +14971,7 @@ void clif_instance_leave(int fd)
/// 02b8 <account id>.L <name id>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W <equip location>.W <item type>.B
void clif_party_show_picker(struct map_session_data * sd, struct item * item_data)
{
+#if PACKETVER >= 20071002
unsigned char buf[22];
struct item_data* id = itemdb_search(item_data->nameid);
@@ -14551,6 +14985,7 @@ void clif_party_show_picker(struct map_session_data * sd, struct item * item_dat
WBUFW(buf,19) = id->equip; // equip location
WBUFB(buf,21) = itemtype(id->type); // item type
clif_send(buf, packet_len(0x2b8), &sd->bl, PARTY_SAMEMAP_WOS);
+#endif
}
@@ -15587,8 +16022,20 @@ static int packetdb_readdb(void)
//#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,
+#if PACKETVER <= 20081217
+ 0, 0, 0, 0, 55, 17, 3, 37, 46, -1, 23, -1, 3,110, 3, 2,
+#else
0, 0, 0, 0, 55, 17, 3, 37, 46, -1, 23, -1, 3,114, 3, 2,
+#endif
+#if PACKETVER < 2
+ 3, 28, 19, 11, 3, -1, 9, 5, 52, 51, 56, 58, 41, 2, 6, 6,
+#elif PACKETVER < 20071106 // 78-7b 亀島以降 lv99エフェクト用
+ 3, 28, 19, 11, 3, -1, 9, 5, 54, 53, 58, 60, 41, 2, 6, 6,
+#elif PACKETVER <= 20081217 // change in 0x78 and 0x7c
+ 3, 28, 19, 11, 3, -1, 9, 5, 55, 53, 58, 60, 42, 2, 6, 6,
+#else
3, 28, 19, 11, 3, -1, 9, 5, 55, 53, 58, 60, 44, 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,
@@ -15615,10 +16062,16 @@ static int packetdb_readdb(void)
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,
- // 196 comodo以降 状態表示アイコン用
+#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,
- // 0x1a2 changed (35->37)
+#endif
+#if PACKETVER < 20081126
+ 3, 3, 35, 5, 11, 26, -1, 4, 4, 6, 10, 12, 6, -1, 4, 4,
+#else // 0x1a2 changed (35->37)
3, 3, 37, 5, 11, 26, -1, 4, 4, 6, 10, 12, 6, -1, 4, 4,
+#endif
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,
@@ -15628,8 +16081,11 @@ static int packetdb_readdb(void)
//#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,
- // 0x22c changed
+#if PACKETVER < 20071106
+ 10, -1, -1, 8, 10, 2,282, 18, 18, 15, 58, 57, 64, 5, 71, 5,
+#else // 0x22c changed
10, -1, -1, 8, 10, 2,282, 18, 18, 15, 58, 57, 65, 5, 71, 5,
+#endif
12, 26, 9, 11, -1, -1, 10, 2,282, 11, 4, 36, 6, -1, 4, 2,
//#0x0240
-1, -1, -1, -1, -1, 3, 4, 8, -1, 3, 70, 4, 8, 12, 4, 10,
@@ -15637,9 +16093,13 @@ static int packetdb_readdb(void)
6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
//#0x0280
+#if PACKETVER < 20070711
+ 0, 0, 0, 6, 14, 0, 0, -1, 6, 8, 18, 0, 0, 0, 0, 0,
+#else
0, 0, 0, 6, 14, 0, 0, -1, 10, 12, 18, 0, 0, 0, 0, 0, // 0x288, 0x289 increase by 4 (kafra points)
- 0, 4, 0, 70, 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,
+#endif
+ 0, 4, 0, 70, 10, 0, 0, 0, 8, 6, 27, 80, 0, -1, 0, 0,
+ 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
85, -1, -1,107, 6, -1, 7, 7, 22,191, 0, 0, 0, 0, 0, 0,
//#0x02C0
0, -1, 0, 0, 0, 30, 30, 0, 0, 3, 0, 65, 4, 71, 10, 0,
@@ -15743,13 +16203,19 @@ static int packetdb_readdb(void)
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
//#0x07C0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- // 0x7d9 changed
+#if PACKETVER < 20090617
+ 6, 2, -1, 4, 4, 4, 4, 8, 8,254, 6, 8, 6, 54, 30, 54,
+#else // 0x7d9 changed
6, 2, -1, 4, 4, 4, 4, 8, 8,268, 6, 8, 6, 54, 30, 54,
- 0, 15, 8, 6, -1, 8, 8, 32, -1, 5, 0, 0, 0, 0, 0, 0,
+#endif
+ 0, 15, 8, 0, 0, 8, 8, 32, -1, 5, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 14, -1, -1, -1, 8, 25, 0, 0, 26, 0,
//#0x0800
- // for Party booking ( PACKETVER >= 20091229 )
+#if PACKETVER < 20091229
+ -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 20,
+#else // for Party booking ( PACKETVER >= 20091229 )
-1, -1, 18, 4, 8, 6, 2, 4, 14, 50, 18, 6, 2, 3, 14, 20,
+#endif
3, -1, 8, -1, 86, 2, 6, 6, -1, -1, 4, 10, 10, 0, 0, 0,
0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, -1, -1, 3, 2, 66, 5, 2, 12, 6, 0, 0,