summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-07-10 21:44:19 +0300
committerAndrei Karas <akaras@inbox.ru>2018-07-15 20:36:27 +0300
commit8c62eb43def49ebd089b4287d78f9b64ea673090 (patch)
tree62cd6aa24949d5df1f2180496cab7916176cd981
parent9e5b380f10d3e821ad087d394a77f726eb700d6b (diff)
downloadhercules-8c62eb43def49ebd089b4287d78f9b64ea673090.tar.gz
hercules-8c62eb43def49ebd089b4287d78f9b64ea673090.tar.bz2
hercules-8c62eb43def49ebd089b4287d78f9b64ea673090.tar.xz
hercules-8c62eb43def49ebd089b4287d78f9b64ea673090.zip
Update packet ZC_REPAIRITEMLIST.
-rw-r--r--src/map/clif.c28
-rw-r--r--src/map/packets_struct.h17
2 files changed, 34 insertions, 11 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 2eb230c61..e1825203d 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -6280,32 +6280,38 @@ static void clif_item_repair_list(struct map_session_data *sd, struct map_sessio
{
int i,c;
int fd;
+ int len;
+ struct PACKET_ZC_REPAIRITEMLIST *p;
nullpo_retv(sd);
nullpo_retv(dstsd);
- fd=sd->fd;
+ fd = sd->fd;
- WFIFOHEAD(fd, MAX_INVENTORY * 13 + 4);
- WFIFOW(fd,0)=0x1fc;
+ len = MAX_INVENTORY * sizeof(struct PACKET_ZC_REPAIRITEMLIST_sub) + sizeof(struct PACKET_ZC_REPAIRITEMLIST);
+ WFIFOHEAD(fd, len);
+ p = WFIFOP(fd, 0);
+ p->packetType = 0x1fc;
for (i = c = 0; i < MAX_INVENTORY; i++) {
int nameid = dstsd->status.inventory[i].nameid;
if (nameid > 0 && (dstsd->status.inventory[i].attribute & ATTR_BROKEN) != 0) { // && skill_can_repair(sd,nameid)) {
- WFIFOW(fd,c*13+4) = i;
- WFIFOW(fd,c*13+6) = nameid;
- WFIFOB(fd,c*13+8) = dstsd->status.inventory[i].refine;
- clif->addcards((struct EQUIPSLOTINFO*)WFIFOP(fd, c * 13 + 9), &dstsd->status.inventory[i]);
+ p->items[c].index = i;
+ p->items[c].itemId = nameid;
+ p->items[c].refine = dstsd->status.inventory[i].refine;
+ clif->addcards(&p->items[c].slot, &dstsd->status.inventory[i]);
c++;
}
}
- if(c > 0) {
- WFIFOW(fd,2)=c*13+4;
- WFIFOSET(fd,WFIFOW(fd,2));
+ if (c > 0) {
+ len = c * sizeof(struct PACKET_ZC_REPAIRITEMLIST_sub) + sizeof(struct PACKET_ZC_REPAIRITEMLIST);
+ p->packetLength = len;
+ WFIFOSET(fd, len);
sd->menuskill_id = BS_REPAIRWEAPON;
sd->menuskill_val = dstsd->bl.id;
sd->menuskill_val2 = lv;
- }else
+ } else {
clif->skill_fail(sd, sd->ud.skill_id, USESKILL_FAIL_LEVEL, 0, 0);
+ }
}
/// Notifies the client about the result of a item repair request (ZC_ACK_ITEMREPAIR).
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index c5061a72d..1a2bcec76 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -2425,6 +2425,23 @@ struct PACKET_ZC_MAKINGARROW_LIST {
struct PACKET_ZC_MAKINGARROW_LIST_sub items[];
} __attribute__((packed));
+struct PACKET_ZC_REPAIRITEMLIST_sub {
+ int16 index;
+#if PACKETVER_RE_NUM >= 20180704
+ uint32 itemId;
+#else
+ uint16 itemId;
+#endif
+ uint8 refine; // unused?
+ struct EQUIPSLOTINFO slot; // unused?
+} __attribute__((packed));
+
+struct PACKET_ZC_REPAIRITEMLIST {
+ int16 packetType;
+ int16 packetLength;
+ struct PACKET_ZC_REPAIRITEMLIST_sub items[];
+} __attribute__((packed));
+
#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
#pragma pack(pop)
#endif // not NetBSD < 6 / Solaris