diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-10-31 20:23:58 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-11-07 06:27:59 +0300 |
commit | 7a244c205f5f0225abe9f5dc47e4c236d82b5313 (patch) | |
tree | 8c6ef25af96c48bfeda292abbf705d9cdc567d38 /src/map/clif.c | |
parent | 6bf0cc3e848426169deb9cdbec0ee08f75000266 (diff) | |
download | hercules-7a244c205f5f0225abe9f5dc47e4c236d82b5313.tar.gz hercules-7a244c205f5f0225abe9f5dc47e4c236d82b5313.tar.bz2 hercules-7a244c205f5f0225abe9f5dc47e4c236d82b5313.tar.xz hercules-7a244c205f5f0225abe9f5dc47e4c236d82b5313.zip |
Update packet ZC_AUTOSPELLLIST.
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 67 |
1 files changed, 33 insertions, 34 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 985e0229f..5f3d5afd0 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -7503,44 +7503,43 @@ static void clif_pet_food(struct map_session_data *sd, int foodid, int fail) /// 01cd { <skill id>.L }*7 static void clif_autospell(struct map_session_data *sd, uint16 skill_lv) { - int fd; - nullpo_retv(sd); - fd=sd->fd; - WFIFOHEAD(fd,packet_len(0x1cd)); - WFIFOW(fd, 0)=0x1cd; + int fd = sd->fd; +#if PACKETVER_RE_NUM >= 20181031 + // reserve space for 7 skills + WFIFOHEAD(fd, sizeof(struct PACKET_ZC_AUTOSPELLLIST) + 4 * 7); +#else + WFIFOHEAD(fd, sizeof(struct PACKET_ZC_AUTOSPELLLIST)); +#endif + struct PACKET_ZC_AUTOSPELLLIST *p = WFIFOP(fd, 0); + memset(p, 0, sizeof(struct PACKET_ZC_AUTOSPELLLIST)); + p->packetType = autoSpellList; + int index = 0; - if(skill_lv>0 && pc->checkskill(sd,MG_NAPALMBEAT)>0) - WFIFOL(fd,2)= MG_NAPALMBEAT; - else - WFIFOL(fd,2)= 0x00000000; - if(skill_lv>1 && pc->checkskill(sd,MG_COLDBOLT)>0) - WFIFOL(fd,6)= MG_COLDBOLT; - else - WFIFOL(fd,6)= 0x00000000; - if(skill_lv>1 && pc->checkskill(sd,MG_FIREBOLT)>0) - WFIFOL(fd,10)= MG_FIREBOLT; - else - WFIFOL(fd,10)= 0x00000000; - if(skill_lv>1 && pc->checkskill(sd,MG_LIGHTNINGBOLT)>0) - WFIFOL(fd,14)= MG_LIGHTNINGBOLT; - else - WFIFOL(fd,14)= 0x00000000; - if(skill_lv>4 && pc->checkskill(sd,MG_SOULSTRIKE)>0) - WFIFOL(fd,18)= MG_SOULSTRIKE; - else - WFIFOL(fd,18)= 0x00000000; - if(skill_lv>7 && pc->checkskill(sd,MG_FIREBALL)>0) - WFIFOL(fd,22)= MG_FIREBALL; - else - WFIFOL(fd,22)= 0x00000000; - if(skill_lv>9 && pc->checkskill(sd,MG_FROSTDIVER)>0) - WFIFOL(fd,26)= MG_FROSTDIVER; - else - WFIFOL(fd,26)= 0x00000000; + if (skill_lv > 0 && pc->checkskill(sd, MG_NAPALMBEAT) > 0) + p->skills[index++] = MG_NAPALMBEAT; + if (skill_lv > 1 && pc->checkskill(sd, MG_COLDBOLT) > 0) + p->skills[index++] = MG_COLDBOLT; + if (skill_lv > 1 && pc->checkskill(sd, MG_FIREBOLT) > 0) + p->skills[index++] = MG_FIREBOLT; + if (skill_lv > 1 && pc->checkskill(sd, MG_LIGHTNINGBOLT) > 0) + p->skills[index++] = MG_LIGHTNINGBOLT; + if (skill_lv > 4 && pc->checkskill(sd, MG_SOULSTRIKE) > 0) + p->skills[index++] = MG_SOULSTRIKE; + if (skill_lv > 7 && pc->checkskill(sd, MG_FIREBALL) > 0) + p->skills[index++] = MG_FIREBALL; + if (skill_lv > 9 && pc->checkskill(sd, MG_FROSTDIVER) > 0) + p->skills[index++] = MG_FROSTDIVER; + +#if PACKETVER_RE_NUM >= 20181031 + const int len = sizeof(struct PACKET_ZC_AUTOSPELLLIST) + index * 4; + p->packetLength = len; +#else + const int len = sizeof(struct PACKET_ZC_AUTOSPELLLIST); +#endif + WFIFOSET(fd, len); - WFIFOSET(fd,packet_len(0x1cd)); sd->menuskill_id = SA_AUTOSPELL; sd->menuskill_val = skill_lv; } |