summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/clif.c21
-rw-r--r--src/map/clif.h2
-rw-r--r--src/map/packets_struct.h14
3 files changed, 27 insertions, 10 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index dc528ae33..7ce9ef53a 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -5227,9 +5227,10 @@ static void clif_skillcastcancel(struct block_list *bl)
/// if(result!=0) doesn't display any of the previous messages
/// Note: when this packet is received an unknown flag is always set to 0,
/// suggesting this is an ACK packet for the UseSkill packets and should be sent on success too [FlavioJS]
-static void clif_skill_fail(struct map_session_data *sd, uint16 skill_id, enum useskill_fail_cause cause, int btype, int item_id)
+static void clif_skill_fail(struct map_session_data *sd, uint16 skill_id, enum useskill_fail_cause cause, int btype, int32 item_id)
{
int fd;
+ struct PACKET_ZC_ACK_TOUSESKILL p;
if (!sd) {
//Since this is the most common nullpo....
@@ -5252,14 +5253,16 @@ static void clif_skill_fail(struct map_session_data *sd, uint16 skill_id, enum u
if (skill_id == TF_POISON && battle_config.display_skill_fail & 8)
return;
- WFIFOHEAD(fd, packet_len(0x110));
- WFIFOW(fd, 0) = 0x110;
- WFIFOW(fd, 2) = skill_id;
- WFIFOW(fd, 4) = btype;
- WFIFOW(fd, 6) = item_id;
- WFIFOB(fd, 8) = 0;// success
- WFIFOB(fd, 9) = cause;
- WFIFOSET(fd, packet_len(0x110));
+ WFIFOHEAD(fd, sizeof(p));
+ p.packetType = 0x110;
+ p.skillId = skill_id;
+ p.btype = btype;
+ p.itemId = item_id;
+ p.flag = 0; // 0 - failed
+ p.cause = cause;
+
+ memcpy(WFIFOP(fd, 0), &p, sizeof(p));
+ WFIFOSET(fd, sizeof(p));
}
/// Skill cooldown display icon (ZC_SKILL_POSTDELAY).
diff --git a/src/map/clif.h b/src/map/clif.h
index 8439d4451..149533ab9 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -807,7 +807,7 @@ struct clif_interface {
int (*insight) (struct block_list *bl,va_list ap);
int (*outsight) (struct block_list *bl,va_list ap);
void (*skillcastcancel) (struct block_list* bl);
- void (*skill_fail) (struct map_session_data *sd, uint16 skill_id, enum useskill_fail_cause cause, int btype, int item_id);
+ void (*skill_fail) (struct map_session_data *sd, uint16 skill_id, enum useskill_fail_cause cause, int btype, int32 item_id);
void (*skill_cooldown) (struct map_session_data *sd, uint16 skill_id, unsigned int duration);
void (*skill_memomessage) (struct map_session_data* sd, int type);
void (*skill_mapinfomessage) (struct map_session_data *sd, int type);
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index ffa3d02d3..900c9d5bb 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -1869,6 +1869,20 @@ struct PACKET_ZC_MVP_GETTING_ITEM {
#endif
} __attribute__((packed));
+struct PACKET_ZC_ACK_TOUSESKILL {
+ int16 packetType;
+ uint16 skillId;
+#if PACKETVER_RE_NUM >= 20180704
+ int32 btype;
+ uint32 itemId;
+#else
+ int16 btype;
+ uint16 itemId;
+#endif
+ uint8 flag;
+ uint8 cause;
+} __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