diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index 0d14e1b54b..5a79412aa0 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -3192,7 +3192,7 @@ ACMD_FUNC(petfriendly) { } pet_set_intimate(pd, friendly); - clif_send_petstatus(sd); + clif_send_petstatus( *sd, *pd ); clif_displaymessage(fd, msg_txt(sd,182)); // Pet intimacy changed. return 0; } @@ -3226,7 +3226,7 @@ ACMD_FUNC(pethungry) } pd->pet.hungry = hungry; - clif_send_petstatus(sd); + clif_send_petstatus( *sd, *pd ); clif_displaymessage(fd, msg_txt(sd,185)); // Pet hunger changed. return 0; @@ -3251,7 +3251,7 @@ ACMD_FUNC(petrename) pd->pet.rename_flag = 0; intif_save_petdata(sd->status.account_id, &pd->pet); - clif_send_petstatus(sd); + clif_send_petstatus( *sd, *pd ); clif_displaymessage(fd, msg_txt(sd,187)); // You can now rename your pet. return 0; diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 18d1942110..db23c33c97 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -8266,30 +8266,23 @@ void clif_send_petdata(map_session_data* sd, struct pet_data* pd, int type, int } -/// Pet's base data (ZC_PROPERTY_PET). -/// 01a2 .24B .B .W .W .W .W .W -void clif_send_petstatus(map_session_data *sd) -{ - int fd; - struct s_pet *pet; +/// Pet's base data. +/// 01a2 .24B .B .W .W .W .W .W (ZC_PROPERTY_PET) +void clif_send_petstatus( map_session_data& sd, pet_data& pd ){ + PACKET_ZC_PROPERTY_PET packet{}; - nullpo_retv(sd); - nullpo_retv(sd->pd); - - fd=sd->fd; - pet = &sd->pd->pet; - WFIFOHEAD(fd,packet_len(0x1a2)); - WFIFOW(fd,0)=0x1a2; - safestrncpy(WFIFOCP(fd,2),pet->name,NAME_LENGTH); - WFIFOB(fd,26)=battle_config.pet_rename?0:pet->rename_flag; - WFIFOW(fd,27)=pet->level; - WFIFOW(fd,29)=pet->hungry; - WFIFOW(fd,31)=pet->intimate; - WFIFOW(fd,33)=pet->equip; + packet.PacketType = HEADER_ZC_PROPERTY_PET; + safestrncpy( packet.szName, pd.pet.name, NAME_LENGTH ); + packet.bModified = battle_config.pet_rename ? 0 : pd.pet.rename_flag; + packet.nLevel = pd.pet.level; + packet.nFullness = pd.pet.hungry; + packet.nRelationship = pd.pet.intimate; + packet.ITID = static_cast( pd.pet.equip ); #if PACKETVER >= 20081126 - WFIFOW(fd,35)=pet->class_; + packet.job = pd.pet.class_; #endif - WFIFOSET(fd,packet_len(0x1a2)); + + clif_send( &packet, sizeof( packet ), &sd.bl, SELF ); } @@ -10802,7 +10795,7 @@ void clif_parse_LoadEndAck(int fd,map_session_data *sd) return; clif_spawn(&sd->pd->bl); clif_send_petdata(sd,sd->pd,0,0); - clif_send_petstatus(sd); + clif_send_petstatus( *sd, *sd->pd ); // skill_unit_move(&sd->pd->bl,gettick(),1); } } diff --git a/src/map/clif.hpp b/src/map/clif.hpp index 46b601fdd1..f14859ebf7 100644 --- a/src/map/clif.hpp +++ b/src/map/clif.hpp @@ -1090,7 +1090,7 @@ void clif_upgrademessage( map_session_data* sd, int result, t_itemid item_id ); void clif_catch_process( map_session_data& sd ); void clif_pet_roulette( map_session_data& sd, bool success ); void clif_sendegg(map_session_data *sd); -void clif_send_petstatus(map_session_data *sd); +void clif_send_petstatus( map_session_data& sd, pet_data& pd ); void clif_send_petdata(map_session_data* sd, struct pet_data* pd, int type, int param); #define clif_pet_equip(sd, pd) clif_send_petdata(sd, pd, 3, (pd)->vd.head_bottom) #define clif_pet_equip_area(pd) clif_send_petdata(nullptr, pd, 3, (pd)->vd.head_bottom) diff --git a/src/map/clif_packetdb.hpp b/src/map/clif_packetdb.hpp index 7cad53b1a8..79fe375baa 100644 --- a/src/map/clif_packetdb.hpp +++ b/src/map/clif_packetdb.hpp @@ -248,7 +248,6 @@ parseable_packet(0x019d,6,clif_parse_GMHide,2); parseable_packet(0x019f,6,clif_parse_CatchPet,2); parseable_packet(0x01a1,3,clif_parse_PetMenu,2); - packet(0x01a2,35); packet(0x01a3,5); packet(0x01a4,11); parseable_packet(0x01a5,26,clif_parse_ChangePetName,2); @@ -1251,7 +1250,6 @@ // 2008-11-26aSakexe #if PACKETVER >= 20081126 - packet(0x01a2,37); packet(0x0441,4); #endif @@ -1330,7 +1328,6 @@ // 2008-12-17aRagexeRE #if PACKETVER >= 20081217 - packet(0x01a2,37); //packet(0x0441,4); //packet(0x0443,8); #endif diff --git a/src/map/pet.cpp b/src/map/pet.cpp index 3a4c14a9fb..2577542ff6 100644 --- a/src/map/pet.cpp +++ b/src/map/pet.cpp @@ -1115,7 +1115,7 @@ int pet_birth_process(map_session_data *sd, struct s_pet *pet) clif_send_petdata(sd, sd->pd, 6, 1); #endif clif_pet_equip_area(sd->pd); - clif_send_petstatus(sd); + clif_send_petstatus( *sd, *sd->pd ); clif_pet_autofeed_status(sd,true); } @@ -1173,7 +1173,7 @@ int pet_recv_petdata(uint32 account_id,struct s_pet *p,int flag) clif_send_petdata(sd,sd->pd,0,0); clif_send_petdata(sd,sd->pd,5,battle_config.pet_hair_style); clif_pet_equip_area(sd->pd); - clif_send_petstatus(sd); + clif_send_petstatus( *sd, *sd->pd ); } } @@ -1406,7 +1406,7 @@ int pet_menu(map_session_data *sd,int menunum) switch(menunum) { case 0: - clif_send_petstatus(sd); + clif_send_petstatus( *sd, *sd->pd ); break; case 1: pet_food(sd, sd->pd); @@ -1469,7 +1469,7 @@ int pet_change_name_ack(map_session_data *sd, char* name, int flag) if ( !flag || !strlen(name) ) { clif_displaymessage(sd->fd, msg_txt(sd,280)); // You cannot use this name for your pet. - clif_send_petstatus(sd); //Send status so client knows pet name change got rejected. + clif_send_petstatus( *sd, *pd ); //Send status so client knows pet name change got rejected. return 0; } @@ -1477,7 +1477,7 @@ int pet_change_name_ack(map_session_data *sd, char* name, int flag) clif_name_area(&pd->bl); pd->pet.rename_flag = 1; clif_pet_equip_area(pd); - clif_send_petstatus(sd); + clif_send_petstatus( *sd, *pd ); int index = pet_egg_search( sd, pd->pet.pet_id ); @@ -2323,7 +2323,7 @@ void pet_evolution(map_session_data *sd, int16 pet_id) { clif_send_petdata(sd, sd->pd, 0, 0); clif_send_petdata(sd, sd->pd, 5, battle_config.pet_hair_style); clif_pet_equip_area(sd->pd); - clif_send_petstatus(sd); + clif_send_petstatus( *sd, *sd->pd ); clif_emotion(&sd->bl, ET_BEST); clif_specialeffect(&sd->pd->bl, EF_HO_UP, AREA); diff --git a/src/map/script.cpp b/src/map/script.cpp index c40a1befc3..cb6a254da9 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -19582,7 +19582,7 @@ BUILDIN_FUNC(setunitdata) clif_send_homdata( *hd, SP_ACK ); break; case BL_PET: - clif_send_petstatus(pd->master); + clif_send_petstatus( *pd->master, *pd ); break; case BL_MER: clif_mercenary_info(map_charid2sd(mc->mercenary.char_id)); diff --git a/src/map/status.cpp b/src/map/status.cpp index 4417682578..2dcd7a2f56 100644 --- a/src/map/status.cpp +++ b/src/map/status.cpp @@ -3014,7 +3014,7 @@ void status_calc_pet_(struct pet_data *pd, uint8 opt) status_calc_misc(&pd->bl, &pd->status, lv); if (!(opt&SCO_FIRST)) // Not done the first time because the pet is not visible yet - clif_send_petstatus(sd); + clif_send_petstatus( *sd, *pd ); } } else if (opt&SCO_FIRST) { status_calc_misc(&pd->bl, &pd->status, pd->db->lv);