@@ -5417,32 +5417,31 @@ static void clif_skillinfo(struct map_session_data *sd, int skill_id, int inf)
54175417/// 1 = no text
54185418static void clif_useskill(struct block_list *bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, uint16 skill_lv, int casttime)
54195419{
5420- #if PACKETVER < 20091124
5421- const int cmd = 0x13e;
5422- #else
5423- const int cmd = 0x7fb;
5424- #endif
5425- unsigned char buf[32];
5426- int property = skill->get_ele(skill_id, skill_lv);
5420+ nullpo_retv(bl);
54275421
5428- WBUFW(buf,0) = cmd;
5429- WBUFL(buf,2) = src_id;
5430- WBUFL(buf,6) = dst_id;
5431- WBUFW(buf,10) = dst_x;
5432- WBUFW(buf,12) = dst_y;
5433- WBUFW(buf,14) = skill_id;
5434- WBUFL(buf,16) = property<0?0:property; //Avoid sending negatives as element [Skotlex]
5435- WBUFL(buf,20) = casttime;
5436- #if PACKETVER >= 20091124
5437- WBUFB(buf,24) = 0; // isDisposable
5422+ const int element = skill->get_ele(skill_id, skill_lv);
5423+ struct PACKET_ZC_USESKILL_ACK p;
5424+ p.packetType = HEADER_ZC_USESKILL_ACK;
5425+ p.srcId = src_id;
5426+ p.dstId = dst_id;
5427+ p.x = dst_x;
5428+ p.y = dst_y;
5429+ p.skillId = skill_id;
5430+ p.element = element < 0 ? 0 : element; //Avoid sending negatives as element [Skotlex]
5431+ p.delayTime = casttime;
5432+ #if PACKETVER_MAIN_NUM >= 20091124 || PACKETVER_RE_NUM >= 20091124 || defined(PACKETVER_ZERO)
5433+ p.disposable = 0;
5434+ #endif
5435+ #if PACKETVER_ZERO_NUM >= 20190130
5436+ p.unknown = 0;
54385437#endif
54395438
54405439 if (clif->isdisguised(bl)) {
5441- clif->send(buf,packet_len(cmd ), bl, AREA_WOS);
5442- WBUFL(buf,2) = -src_id;
5443- clif->send(buf,packet_len(cmd ), bl, SELF);
5440+ clif->send(&p, sizeof(p ), bl, AREA_WOS);
5441+ p.srcId = -src_id;
5442+ clif->send(&p, sizeof(p ), bl, SELF);
54445443 } else {
5445- clif->send(buf,packet_len(cmd ), bl, AREA);
5444+ clif->send(&p, sizeof(p ), bl, AREA);
54465445 }
54475446#if PACKETVER >= 20151223
54485447 if ((skill->get_inf2(skill_id) & INF2_SHOW_SKILL_SCALE) != 0)
0 commit comments