Skip to content

Commit

Permalink
Multi-client support for clif_equipitemack with packet identifier ZC_…
Browse files Browse the repository at this point in the history
…WEAR_EQUIP_ACK

Signed-off-by: Cydh Ramdh <house.bad@gmail.com>
  • Loading branch information
cydh committed Jan 14, 2015
1 parent fa75733 commit 817d6bf
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 41 deletions.
8 changes: 4 additions & 4 deletions db/packet_db.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ packet_ver: 5
0x00a7,8,useitem,2:4
0x00a8,7
0x00a9,6,equipitem,2:4
0x00aa,7
0x00aa,7,ZC_WEAR_EQUIP_ACK,2:4:6
0x00ab,4,unequipitem,2
0x00ac,7
//0x00ad,-1
Expand Down Expand Up @@ -1586,7 +1586,7 @@ packet_ver: 25
//0x083F,22

//2010-06-29aRagexeRE
0x00AA,9
0x00AA,9,ZC_WEAR_EQUIP_ACK,2:4:6:8
//0x07F1,18
//0x07F2,8
//0x07F3,6
Expand Down Expand Up @@ -1631,7 +1631,7 @@ packet_ver: 26
0x0857,-1
0x0858,-1
0x0859,-1
0x08d0,9
0x08d0,9,ZC_WEAR_EQUIP_ACK,2:4:6:8

//2011-10-05aRagexeRE
packet_ver: 27
Expand Down Expand Up @@ -1869,7 +1869,7 @@ packet_ver: 34
0x0996,-1 //store itemlist equip
0x0997,-1 //ZC_EQUIPWIN_MICROSCOPE_V5
0x0998,8,equipitem,2:4 // CZ_REQ_WEAR_EQUIP_V5
0x0999,11 // cz_wear_equipv5
0x0999,11,ZC_WEAR_EQUIP_ACK,2:4:8:10 // cz_wear_equipv5
0x099a,9 // take_off_equipv5
0x099b,8 //maptypeproperty2

Expand Down
63 changes: 37 additions & 26 deletions src/map/clif.c
Original file line number Diff line number Diff line change
Expand Up @@ -3390,36 +3390,46 @@ void clif_statusupack(struct map_session_data *sd,int type,int ok,int val)
/// 2 = failure due to low level
void clif_equipitemack(struct map_session_data *sd,int n,int pos,uint8 flag)
{
int fd, header, offs = 0;
#if PACKETVER < 20110824
header = 0xaa;
#elif PACKETVER < 20120925
header = 0x8d0;
#else
header = 0x999;
#endif
int fd = 0, cmd = 0, look = 0;
struct s_packet_db *info = NULL;

nullpo_retv(sd);

cmd = packet_db_ack[sd->packet_ver][ZC_WEAR_EQUIP_ACK];
if (!cmd || !(info = &packet_db[sd->packet_ver][cmd]) || !info->len)
return;

fd = sd->fd;
WFIFOHEAD(fd,packet_len(header));
WFIFOW(fd,offs+0) = header;
WFIFOW(fd,offs+2) = n+2;
#if PACKETVER >= 20120925
WFIFOL(fd,offs+4) = pos;
offs += 2;
#else
WFIFOW(fd,offs+4) = (int)pos;
#endif
#if PACKETVER < 20100629
WFIFOB(fd,offs+6) = flag;
#else

if (flag == ITEM_EQUIP_ACK_OK && sd->inventory_data[n]->equip&EQP_VISIBLE)
WFIFOW(fd,offs+6) = sd->inventory_data[n]->look;
else
WFIFOW(fd,offs+6) = 0;
WFIFOB(fd,offs+8) = flag;
#endif
WFIFOSET(fd,packet_len(header));
look = sd->inventory_data[n]->look;

WFIFOHEAD(fd, info->len);
WFIFOW(fd, 0) = cmd;
WFIFOW(fd, info->pos[0]) = n+2;
switch (cmd) {
case 0xaa:
WFIFOW(fd, info->pos[1]) = pos;
if (sd->packet_ver < date2version(20100629))
WFIFOW(fd, info->pos[2]) = (flag == ITEM_EQUIP_ACK_OK ? 1 : 0);
else {
WFIFOL(fd, info->pos[2]) = look;
WFIFOW(fd, info->pos[3]) = (flag == ITEM_EQUIP_ACK_OK ? 1 : 0);
}
break;
case 0x8d0:
if (flag == ITEM_EQUIP_ACK_FAILLEVEL)
flag = 1;
case 0x999:
if (cmd == 0x999)
WFIFOL(fd, info->pos[1]) = pos;
else
WFIFOW(fd, info->pos[1]) = pos;
WFIFOL(fd, info->pos[2]) = look;
WFIFOW(fd, info->pos[3]) = flag;
break;
}
WFIFOSET(fd, info->len);
}


Expand Down Expand Up @@ -18123,6 +18133,7 @@ void packetdb_readdb(void)
{ "ZC_CLEAR_DIALOG", ZC_CLEAR_DIALOG},
{ "ZC_C_MARKERINFO", ZC_C_MARKERINFO},
{ "ZC_NOTIFY_BIND_ON_EQUIP", ZC_NOTIFY_BIND_ON_EQUIP },
{ "ZC_WEAR_EQUIP_ACK", ZC_WEAR_EQUIP_ACK },
};
const char *filename[] = { "packet_db.txt", DBIMPORT"/packet_db.txt"};
int f;
Expand Down
14 changes: 3 additions & 11 deletions src/map/clif.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ enum e_packet_ack {
ZC_CLEAR_DIALOG,
ZC_C_MARKERINFO,
ZC_NOTIFY_BIND_ON_EQUIP,
ZC_WEAR_EQUIP_ACK,
//add other here
MAX_ACK_FUNC //auto upd len
};
Expand Down Expand Up @@ -365,23 +366,14 @@ enum useskill_fail_cause

enum clif_messages {
/* Constant values */
// clif_cart_additem_ack flags
ADDITEM_TO_CART_FAIL_WEIGHT = 0x0,
ADDITEM_TO_CART_FAIL_COUNT = 0x1,

// clif_equipitemack flag
#if PACKETVER < 20110824
ITEM_EQUIP_ACK_OK = 1,
ITEM_EQUIP_ACK_FAIL = 0,
ITEM_EQUIP_ACK_FAILLEVEL = 0,
#elif PACKETVER < 20120925
ITEM_EQUIP_ACK_OK = 0,
ITEM_EQUIP_ACK_FAIL = 1,
ITEM_EQUIP_ACK_FAILLEVEL = 1,
#else
// clif_equipitemack flags
ITEM_EQUIP_ACK_OK = 0,
ITEM_EQUIP_ACK_FAIL = 1,
ITEM_EQUIP_ACK_FAILLEVEL = 2,
#endif
/* -end- */

//! NOTE: These values below need client version validation
Expand Down

0 comments on commit 817d6bf

Please sign in to comment.