Implemented ZC_WARPLIST packet (#8600)
Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
This commit is contained in:
parent
70e8518a32
commit
fca803220b
@ -6151,37 +6151,71 @@ void clif_skill_poseffect(struct block_list *src,uint16 skill_id,int val,int x,i
|
|||||||
clif_send(buf,packet_len(0x117),src,AREA);
|
clif_send(buf,packet_len(0x117),src,AREA);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Presents a list of available warp destinations (ZC_WARPLIST).
|
/// Presents a list of available warp destinations.
|
||||||
/// 011c <skill id>.W { <map name>.16B }*4
|
/// 011c <skill id>.W { <map name>.16B }*4 (ZC_WARPLIST)
|
||||||
void clif_skill_warppoint( map_session_data* sd, uint16 skill_id, uint16 skill_lv, const char* map1, const char* map2, const char* map3, const char* map4 ){
|
/// 0abe <lenght>.W <skill id>.W { <map name>.16B }*? (ZC_WARPLIST2)
|
||||||
int fd;
|
void clif_skill_warppoint( map_session_data& sd, uint16 skill_id, uint16 skill_lv, std::vector<std::string>& maps ){
|
||||||
nullpo_retv(sd);
|
if(maps.empty())
|
||||||
fd = sd->fd;
|
return;
|
||||||
|
|
||||||
WFIFOHEAD(fd,packet_len(0x11c));
|
#if PACKETVER_MAIN_NUM >= 20170502 || PACKETVER_RE_NUM >= 20170419 || defined(PACKETVER_ZERO)
|
||||||
WFIFOW(fd,0) = 0x11c;
|
PACKET_ZC_WARPLIST* p = reinterpret_cast<PACKET_ZC_WARPLIST*>( packet_buffer );
|
||||||
WFIFOW(fd,2) = skill_id;
|
|
||||||
memset(WFIFOP(fd,4), 0x00, 4*MAP_NAME_LENGTH_EXT);
|
|
||||||
if( strcmp( "", map1 ) != 0 ){
|
|
||||||
mapindex_getmapname_ext( map1, WFIFOCP( fd, 4 ) );
|
|
||||||
}
|
|
||||||
if( strcmp( "", map2 ) != 0 ){
|
|
||||||
mapindex_getmapname_ext( map2, WFIFOCP( fd, 20 ) );
|
|
||||||
}
|
|
||||||
if( strcmp( "", map3 ) != 0 ){
|
|
||||||
mapindex_getmapname_ext( map3, WFIFOCP( fd, 36 ) );
|
|
||||||
}
|
|
||||||
if( strcmp( "", map4 ) != 0 ){
|
|
||||||
mapindex_getmapname_ext( map4, WFIFOCP( fd, 52 ) );
|
|
||||||
}
|
|
||||||
WFIFOSET(fd,packet_len(0x11c));
|
|
||||||
|
|
||||||
sd->menuskill_id = skill_id;
|
p->packetType = HEADER_ZC_WARPLIST;
|
||||||
|
p->packetLength = sizeof( *p );
|
||||||
|
p->skillId = skill_id;
|
||||||
|
|
||||||
|
size_t memoCount = 0;
|
||||||
|
for( std::string& map : maps ){
|
||||||
|
if( map.empty() ){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
PACKET_ZC_WARPLIST_sub& warp = p->maps[memoCount];
|
||||||
|
|
||||||
|
mapindex_getmapname_ext( map.c_str(), warp.map );
|
||||||
|
|
||||||
|
p->packetLength += static_cast<decltype(p->packetLength)>( sizeof( warp ) );
|
||||||
|
memoCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
clif_send( p, p->packetLength, &sd.bl, SELF );
|
||||||
|
#else
|
||||||
|
PACKET_ZC_WARPLIST p = {};
|
||||||
|
|
||||||
|
p.packetType = HEADER_ZC_WARPLIST;
|
||||||
|
p.skillId = skill_id;
|
||||||
|
|
||||||
|
size_t memoCount = 0, max = 4;
|
||||||
|
for( std::string& map : maps ){
|
||||||
|
if( map.empty() ){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
PACKET_ZC_WARPLIST_sub& warp = p.maps[memoCount];
|
||||||
|
|
||||||
|
mapindex_getmapname_ext( map.c_str(), warp.map );
|
||||||
|
|
||||||
|
if( memoCount++ == max ){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for( ; memoCount < max; memoCount++ ){
|
||||||
|
PACKET_ZC_WARPLIST_sub& warp = p.maps[memoCount];
|
||||||
|
|
||||||
|
strcpy( warp.map, "" );
|
||||||
|
}
|
||||||
|
|
||||||
|
clif_send( &p, sizeof( p ), &sd.bl, SELF );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sd.menuskill_id = skill_id;
|
||||||
if (skill_id == AL_WARP) {
|
if (skill_id == AL_WARP) {
|
||||||
sd->menuskill_val = (sd->ud.skillx<<16)|sd->ud.skilly; //Store warp position here.
|
sd.menuskill_val = (sd.ud.skillx<<16)|sd.ud.skilly; //Store warp position here.
|
||||||
sd->state.workinprogress = WIP_DISABLE_ALL;
|
sd.state.workinprogress = WIP_DISABLE_ALL;
|
||||||
} else
|
} else
|
||||||
sd->menuskill_val = skill_lv;
|
sd.menuskill_val = skill_lv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -944,7 +944,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,t_tick tick,
|
|||||||
bool clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,t_tick tick);
|
bool clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,t_tick tick);
|
||||||
void clif_skill_poseffect(struct block_list *src,uint16 skill_id,int val,int x,int y,t_tick tick);
|
void clif_skill_poseffect(struct block_list *src,uint16 skill_id,int val,int x,int y,t_tick tick);
|
||||||
void clif_skill_estimation(map_session_data *sd,struct block_list *dst);
|
void clif_skill_estimation(map_session_data *sd,struct block_list *dst);
|
||||||
void clif_skill_warppoint( map_session_data* sd, uint16 skill_id, uint16 skill_lv, const char* map1, const char* map2 = "", const char* map3 = "", const char* map4 = "" );
|
void clif_skill_warppoint( map_session_data& sd, uint16 skill_id, uint16 skill_lv, std::vector<std::string>& maps );
|
||||||
void clif_skill_memomessage( map_session_data& sd, e_ack_remember_warppoint_result result );
|
void clif_skill_memomessage( map_session_data& sd, e_ack_remember_warppoint_result result );
|
||||||
void clif_skill_teleportmessage( map_session_data& sd, e_notify_mapinfo_result result );
|
void clif_skill_teleportmessage( map_session_data& sd, e_notify_mapinfo_result result );
|
||||||
void clif_skill_produce_mix_list( map_session_data& sd, int skill_id, int trigger );
|
void clif_skill_produce_mix_list( map_session_data& sd, int skill_id, int trigger );
|
||||||
|
@ -136,7 +136,6 @@
|
|||||||
packet(0x0119,13);
|
packet(0x0119,13);
|
||||||
packet(0x011a,15);
|
packet(0x011a,15);
|
||||||
parseable_packet(0x011b,20,clif_parse_UseSkillMap,2,4);
|
parseable_packet(0x011b,20,clif_parse_UseSkillMap,2,4);
|
||||||
packet(0x011c,68);
|
|
||||||
parseable_packet(0x011d,2,clif_parse_RequestMemo,0);
|
parseable_packet(0x011d,2,clif_parse_RequestMemo,0);
|
||||||
packet(0x011f,16);
|
packet(0x011f,16);
|
||||||
packet( cartlistequipType, -1 );
|
packet( cartlistequipType, -1 );
|
||||||
|
@ -1389,6 +1389,12 @@ DEFINE_PACKET_HEADER(CZ_REQ_STYLE_CHANGE2, 0xafc)
|
|||||||
DEFINE_PACKET_HEADER(ZC_REMOVE_EFFECT, 0x0b0d)
|
DEFINE_PACKET_HEADER(ZC_REMOVE_EFFECT, 0x0b0d)
|
||||||
DEFINE_PACKET_HEADER(ZC_FEED_MER, 0x22f)
|
DEFINE_PACKET_HEADER(ZC_FEED_MER, 0x22f)
|
||||||
DEFINE_PACKET_HEADER(ZC_FEED_PET, 0x1a3)
|
DEFINE_PACKET_HEADER(ZC_FEED_PET, 0x1a3)
|
||||||
|
#if PACKETVER_MAIN_NUM >= 20170502 || PACKETVER_RE_NUM >= 20170419 || defined(PACKETVER_ZERO)
|
||||||
|
DEFINE_PACKET_HEADER(ZC_WARPLIST, 0xabe)
|
||||||
|
#else
|
||||||
|
DEFINE_PACKET_HEADER(ZC_WARPLIST, 0x11c)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
const int16 MAX_INVENTORY_ITEM_PACKET_NORMAL = ( ( INT16_MAX - ( sizeof( struct packet_itemlist_normal ) - ( sizeof( struct NORMALITEM_INFO ) * MAX_ITEMLIST) ) ) / sizeof( struct NORMALITEM_INFO ) );
|
const int16 MAX_INVENTORY_ITEM_PACKET_NORMAL = ( ( INT16_MAX - ( sizeof( struct packet_itemlist_normal ) - ( sizeof( struct NORMALITEM_INFO ) * MAX_ITEMLIST) ) ) / sizeof( struct NORMALITEM_INFO ) );
|
||||||
const int16 MAX_INVENTORY_ITEM_PACKET_EQUIP = ( ( INT16_MAX - ( sizeof( struct packet_itemlist_equip ) - ( sizeof( struct EQUIPITEM_INFO ) * MAX_ITEMLIST ) ) ) / sizeof( struct EQUIPITEM_INFO ) );
|
const int16 MAX_INVENTORY_ITEM_PACKET_EQUIP = ( ( INT16_MAX - ( sizeof( struct packet_itemlist_equip ) - ( sizeof( struct EQUIPITEM_INFO ) * MAX_ITEMLIST ) ) ) / sizeof( struct EQUIPITEM_INFO ) );
|
||||||
|
@ -9319,7 +9319,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
|
|||||||
|
|
||||||
case AL_TELEPORT:
|
case AL_TELEPORT:
|
||||||
case ALL_ODINS_RECALL:
|
case ALL_ODINS_RECALL:
|
||||||
if(sd)
|
if(sd != nullptr)
|
||||||
{
|
{
|
||||||
if (map_getmapflag(bl->m, MF_NOTELEPORT) && skill_lv <= 2) {
|
if (map_getmapflag(bl->m, MF_NOTELEPORT) && skill_lv <= 2) {
|
||||||
clif_skill_teleportmessage( *sd, NOTIFY_MAPINFO_CANT_TP );
|
clif_skill_teleportmessage( *sd, NOTIFY_MAPINFO_CANT_TP );
|
||||||
@ -9342,10 +9342,18 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
clif_skill_nodamage(src,bl,skill_id,skill_lv,1);
|
clif_skill_nodamage(src,bl,skill_id,skill_lv,1);
|
||||||
if( skill_lv == 1 && skill_id != ALL_ODINS_RECALL )
|
|
||||||
clif_skill_warppoint( sd, skill_id, skill_lv, "Random" );
|
std::vector<std::string> maps = {
|
||||||
else
|
"Random"
|
||||||
clif_skill_warppoint( sd, skill_id, skill_lv, "Random", sd->status.save_point.map );
|
};
|
||||||
|
|
||||||
|
if( skill_lv == 1 && skill_id != ALL_ODINS_RECALL ){
|
||||||
|
clif_skill_warppoint( *sd, skill_id, skill_lv, maps );
|
||||||
|
}else{
|
||||||
|
maps.push_back( sd->status.save_point.map );
|
||||||
|
|
||||||
|
clif_skill_warppoint( *sd, skill_id, skill_lv, maps );
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
unit_warp(bl,-1,-1,-1,CLR_TELEPORT);
|
unit_warp(bl,-1,-1,-1,CLR_TELEPORT);
|
||||||
break;
|
break;
|
||||||
@ -14037,13 +14045,24 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case AL_WARP:
|
case AL_WARP:
|
||||||
if(sd)
|
if(sd != nullptr) {
|
||||||
{
|
std::vector<std::string> maps( MAX_MEMOPOINTS + 1 );
|
||||||
clif_skill_warppoint(sd, skill_id, skill_lv, sd->status.save_point.map,
|
|
||||||
(skill_lv >= 2) ? sd->status.memo_point[0].map : "",
|
maps.push_back( sd->status.save_point.map );
|
||||||
(skill_lv >= 3) ? sd->status.memo_point[1].map : "",
|
|
||||||
(skill_lv >= 4) ? sd->status.memo_point[2].map : ""
|
if( skill_lv >= 2 ){
|
||||||
);
|
maps.push_back( sd->status.memo_point[0].map );
|
||||||
|
|
||||||
|
if( skill_lv >= 3 ){
|
||||||
|
maps.push_back( sd->status.memo_point[1].map );
|
||||||
|
|
||||||
|
if( skill_lv >= 4 ){
|
||||||
|
maps.push_back( sd->status.memo_point[2].map );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
clif_skill_warppoint( *sd, skill_id, skill_lv, maps );
|
||||||
}
|
}
|
||||||
if( sc && sc->getSCE(SC_CURSEDCIRCLE_ATKER) ) //Should only remove after the skill has been casted.
|
if( sc && sc->getSCE(SC_CURSEDCIRCLE_ATKER) ) //Should only remove after the skill has been casted.
|
||||||
status_change_end(src,SC_CURSEDCIRCLE_ATKER);
|
status_change_end(src,SC_CURSEDCIRCLE_ATKER);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user