Converted ZC_CHANGE_DIRECTION to struct (#8584)

Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
This commit is contained in:
AoShinHo 2024-08-27 14:04:38 -03:00 committed by GitHub
parent e0d1250645
commit 5138ae74fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 32 additions and 20 deletions

View File

@ -627,7 +627,7 @@ void buyingstore_reopen( map_session_data* sd ){
{
// Make buyer look perfect
pc_setdir(sd, at->dir, at->head_dir);
clif_changed_dir(&sd->bl, AREA_WOS);
clif_changed_dir(sd->bl, AREA_WOS);
if( at->sit ) {
pc_setsit(sd);
skill_sit(sd, 1);

View File

@ -9787,7 +9787,7 @@ void clif_refresh(map_session_data *sd)
if( pc_isdead(sd) ) // When you refresh, resend the death packet.
clif_clearunit_single( sd->bl.id, CLR_DEAD, *sd );
else
clif_changed_dir(&sd->bl, SELF);
clif_changed_dir(sd->bl, SELF);
clif_efst_status_change_sub(&sd->bl,&sd->bl,SELF);
//Issue #2143
@ -11025,7 +11025,7 @@ void clif_parse_LoadEndAck(int fd,map_session_data *sd)
else {
skill_usave_trigger(sd);
if (battle_config.spawn_direction)
clif_changed_dir(&sd->bl, SELF);
clif_changed_dir(sd->bl, SELF);
}
// Trigger skill effects if you appear standing on them
@ -11438,21 +11438,26 @@ void clif_parse_MapMove(int fd, map_session_data *sd)
/// 5 = southeast
/// 6 = east
/// 7 = northeast
void clif_changed_dir(struct block_list *bl, enum send_target target)
{
unsigned char buf[64];
void clif_changed_dir(block_list& bl, enum send_target target){
WBUFW(buf,0) = 0x9c;
WBUFL(buf,2) = bl->id;
WBUFW(buf,6) = bl->type==BL_PC?((TBL_PC*)bl)->head_dir:0;
WBUFB(buf,8) = unit_getdir(bl);
PACKET_ZC_CHANGE_DIRECTION p{};
clif_send(buf, packet_len(0x9c), bl, target);
p.packetType = HEADER_ZC_CHANGE_DIRECTION;
p.srcId = bl.id;
if( bl.type == BL_PC ){
p.headDir = reinterpret_cast<map_session_data*>(&bl)->head_dir;
}else{
p.headDir = 0;
}
p.dir = unit_getdir(&bl);
if (disguised(bl)) {
WBUFL(buf,2) = disguised_bl_id(bl->id);
WBUFW(buf,6) = 0;
clif_send(buf, packet_len(0x9c), bl, SELF);
clif_send(&p, sizeof(p), &bl, target);
if (disguised(&bl)) {
p.srcId = disguised_bl_id(bl.id);
p.headDir = 0;
clif_send(&p, sizeof(p), &bl, SELF);
}
}
@ -11470,7 +11475,7 @@ void clif_parse_ChangeDir(int fd, map_session_data *sd)
dir = RFIFOB(fd,info->pos[1]);
pc_setdir(sd, dir, headdir);
clif_changed_dir(&sd->bl, AREA_WOS);
clif_changed_dir(sd->bl, AREA_WOS);
}

View File

@ -1007,7 +1007,7 @@ void clif_mvp_effect(map_session_data *sd);
void clif_mvp_item(map_session_data *sd, t_itemid nameid);
void clif_mvp_exp(map_session_data *sd, t_exp exp);
void clif_mvp_noitem(map_session_data* sd);
void clif_changed_dir(struct block_list *bl, enum send_target target);
void clif_changed_dir(block_list& bl, enum send_target target);
// vending
void clif_openvendingreq( map_session_data& sd, uint16 num );

View File

@ -49,7 +49,6 @@
parseable_packet(0x0099,-1,clif_parse_Broadcast,2,4);
packet(0x009a,-1);
parseable_packet(0x009b,5,clif_parse_ChangeDir,2,4);
packet(0x009c,9);
packet( HEADER_ZC_ITEM_ENTRY, sizeof( struct PACKET_ZC_ITEM_ENTRY ) );
packet(0x009e,17);
parseable_packet(0x009f,6,clif_parse_TakeItem,2);

View File

@ -635,6 +635,14 @@ struct PACKET_ZC_NOTIFY_PLAYERMOVE {
} __attribute__((packed));
DEFINE_PACKET_HEADER(ZC_NOTIFY_PLAYERMOVE, 0x87);
struct PACKET_ZC_CHANGE_DIRECTION{
int16 packetType;
uint32 srcId;
uint16 headDir;
uint8 dir;
} __attribute__((packed));
DEFINE_PACKET_HEADER(ZC_CHANGE_DIRECTION, 0x9c)
struct PACKET_ZC_NPCACK_MAPMOVE {
int16 packetType;
char mapName[MAP_NAME_LENGTH_EXT];

View File

@ -1166,7 +1166,7 @@ bool unit_setdir(block_list *bl, uint8 dir, bool send_update)
}
if (send_update)
clif_changed_dir(bl, AREA);
clif_changed_dir(*bl, AREA);
return true;
}

View File

@ -562,7 +562,7 @@ void vending_reopen( map_session_data& sd )
if( (fail = vending_openvending(sd, at->title, data, count, at)) == 0 ) {
// Make vendor look perfect
pc_setdir(&sd, at->dir, at->head_dir);
clif_changed_dir(&sd.bl, AREA_WOS);
clif_changed_dir(sd.bl, AREA_WOS);
if( at->sit ) {
pc_setsit(&sd);
skill_sit(&sd, 1);