diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-07-19 21:06:49 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-07-28 04:41:40 +0300 |
commit | ec38bb9ec92453cbfa9ee0a237d0382a02cf35d1 (patch) | |
tree | 253268cc125de7fbdf763d35cc68e2745b0c82f0 /src/map | |
parent | b8d48b6f16745132c9be894d7ee12ded9be30d29 (diff) | |
download | hercules-ec38bb9ec92453cbfa9ee0a237d0382a02cf35d1.tar.gz hercules-ec38bb9ec92453cbfa9ee0a237d0382a02cf35d1.tar.bz2 hercules-ec38bb9ec92453cbfa9ee0a237d0382a02cf35d1.tar.xz hercules-ec38bb9ec92453cbfa9ee0a237d0382a02cf35d1.zip |
Update packet ZC_WARPLIST.
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 46 | ||||
-rw-r--r-- | src/map/packets.h | 4 | ||||
-rw-r--r-- | src/map/packets_struct.h | 21 |
3 files changed, 55 insertions, 16 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 0897802fc..69bc6a730 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -5498,28 +5498,46 @@ static void clif_skill_poseffect(struct block_list *src, uint16 skill_id, int va static void clif_skill_warppoint(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4) { int fd; + int len; + int mapsCount = 0; + struct PACKET_ZC_WARPLIST *p; nullpo_retv(sd); fd = sd->fd; +#if PACKETVER_MAIN_NUM >= 20170502 || PACKETVER_RE_NUM >= 20170419 || defined(PACKETVER_ZERO) + len = sizeof(struct PACKET_ZC_WARPLIST) + sizeof(struct PACKET_ZC_WARPLIST_sub) * mapsCount; +#else + len = sizeof(struct PACKET_ZC_WARPLIST); +#endif - WFIFOHEAD(fd,packet_len(0x11c)); - WFIFOW(fd,0) = 0x11c; - WFIFOW(fd,2) = skill_id; - memset(WFIFOP(fd,4), 0x00, 4*MAP_NAME_LENGTH_EXT); - if (map1 == (unsigned short)-1) strcpy(WFIFOP(fd,4), "Random"); - else // normal map name - if (map1 > 0) mapindex->getmapname_ext(mapindex_id2name(map1), WFIFOP(fd,4)); - if (map2 > 0) mapindex->getmapname_ext(mapindex_id2name(map2), WFIFOP(fd,20)); - if (map3 > 0) mapindex->getmapname_ext(mapindex_id2name(map3), WFIFOP(fd,36)); - if (map4 > 0) mapindex->getmapname_ext(mapindex_id2name(map4), WFIFOP(fd,52)); - WFIFOSET(fd,packet_len(0x11c)); + WFIFOHEAD(fd, len); + p = WFIFOP(fd, 0); + memset(p, 0, len); + p->packetType = skilWarpPointType; + p->skillId = skill_id; + if (map1 == (unsigned short)-1) { + strcpy(p->maps[mapsCount++].map, "Random"); + } else { // normal map name + if (map1 > 0) mapindex->getmapname_ext(mapindex_id2name(map1), p->maps[mapsCount++].map); + } + if (map2 > 0) mapindex->getmapname_ext(mapindex_id2name(map2), p->maps[mapsCount++].map); + if (map3 > 0) mapindex->getmapname_ext(mapindex_id2name(map3), p->maps[mapsCount++].map); + if (map4 > 0) mapindex->getmapname_ext(mapindex_id2name(map4), p->maps[mapsCount++].map); + +#if PACKETVER_MAIN_NUM >= 20170502 || PACKETVER_RE_NUM >= 20170419 || defined(PACKETVER_ZERO) + len = sizeof(struct PACKET_ZC_WARPLIST) + sizeof(struct PACKET_ZC_WARPLIST_sub) * mapsCount; + p->packetLength = len; +#endif + + WFIFOSET(fd, len); sd->menuskill_id = skill_id; - if (skill_id == AL_WARP){ - sd->menuskill_val = (sd->ud.skillx<<16)|sd->ud.skilly; //Store warp position here. + if (skill_id == AL_WARP) { + sd->menuskill_val = (sd->ud.skillx << 16) | sd->ud.skilly; //Store warp position here. sd->state.workinprogress = 3; - }else + } else { sd->menuskill_val = skill_lv; + } } /// Memo message (ZC_ACK_REMEMBER_WARPPOINT). diff --git a/src/map/packets.h b/src/map/packets.h index 38b08a6a1..6fb637185 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -219,7 +219,7 @@ packet(0x0118,2,clif->pStopAttack,0); packet(0x0119,13); packet(0x011a,15); packet(0x011b,20,clif->pUseSkillMap,2,4); -packet(0x011c,68); +packet(0x011c,68); // ZC_WARPLIST packet(0x011d,2,clif->pRequestMemo,0); packet(0x011e,3); packet(0x011f,16); @@ -3732,7 +3732,7 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0ac6,156); packet(0x0ac7,156); // ZC_NPCACK_SERVERMOVE // changed packet sizes - packet(0x0abe,-1); + packet(0x0abe,-1); // ZC_WARPLIST packet(0x0abf,-1); #endif diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index ab48025dc..30595534f 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -412,6 +412,11 @@ enum packet_headers { #else reqNameAllType = 0x195, #endif +#if PACKETVER_MAIN_NUM >= 20170502 || PACKETVER_RE_NUM >= 20170419 || defined(PACKETVER_ZERO) + skilWarpPointType = 0xabe, +#else + skilWarpPointType = 0x11c, +#endif }; #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute @@ -2660,6 +2665,22 @@ struct PACKET_ZC_OVERWEIGHT_PERCENT { uint32 percent; } __attribute__((packed)); +struct PACKET_ZC_WARPLIST_sub { + char map[MAP_NAME_LENGTH_EXT]; +} __attribute__((packed)); + +struct PACKET_ZC_WARPLIST { + int16 packetType; +#if PACKETVER_MAIN_NUM >= 20170502 || PACKETVER_RE_NUM >= 20170419 || defined(PACKETVER_ZERO) + int16 packetLength; + uint16 skillId; + struct PACKET_ZC_WARPLIST_sub maps[]; +#else + uint16 skillId; + struct PACKET_ZC_WARPLIST_sub maps[4]; +#endif +} __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 |