Pet autofeed config fix (#6249)

Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
This commit is contained in:
Balfear 2021-09-10 23:56:26 +03:00 committed by GitHub
parent 893bfabe91
commit 54431dd0ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 15 deletions

View File

@ -8184,6 +8184,28 @@ void clif_pet_food( struct map_session_data *sd, int foodid,int fail ){
clif_send( &p, sizeof( p ), &sd->bl, SELF );
}
/// Send pet auto feed info.
void clif_pet_autofeed_status(struct map_session_data* sd, bool force) {
#if PACKETVER >= 20141008
nullpo_retv(sd);
if (force || battle_config.pet_autofeed_always) {
// Always send ON or OFF
if (sd->pd && battle_config.feature_pet_autofeed) {
clif_configuration(sd, CONFIG_PET_AUTOFEED, sd->pd->pet.autofeed);
}
else {
clif_configuration(sd, CONFIG_PET_AUTOFEED, false);
}
}
else {
// Only send when enabled
if (sd->pd && battle_config.feature_pet_autofeed && sd->pd->pet.autofeed) {
clif_configuration(sd, CONFIG_PET_AUTOFEED, true);
}
}
#endif
}
/// Presents a list of skills that can be auto-spelled (ZC_AUTOSPELLLIST).
/// 01cd { <skill id>.L }*7
@ -10752,21 +10774,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
clif_partyinvitationstate(sd);
clif_equipcheckbox(sd);
#endif
#if PACKETVER >= 20141008
if( battle_config.pet_autofeed_always ){
// Always send ON or OFF
if( sd->pd && battle_config.feature_pet_autofeed ){
clif_configuration( sd, CONFIG_PET_AUTOFEED, sd->pd->pet.autofeed );
}else{
clif_configuration( sd, CONFIG_PET_AUTOFEED, false );
}
}else{
// Only send when enabled
if( sd->pd && battle_config.feature_pet_autofeed && sd->pd->pet.autofeed ){
clif_configuration( sd, CONFIG_PET_AUTOFEED, true );
}
}
#endif
clif_pet_autofeed_status(sd,false);
#if PACKETVER >= 20170920
if( battle_config.homunculus_autofeed_always ){
// Always send ON or OFF

View File

@ -876,6 +876,7 @@ void clif_send_petdata(struct map_session_data* sd, struct pet_data* pd, int typ
#define clif_pet_performance(pd, param) clif_send_petdata(NULL, pd, 4, param)
void clif_pet_emotion(struct pet_data *pd,int param);
void clif_pet_food(struct map_session_data *sd,int foodid,int fail);
void clif_pet_autofeed_status(struct map_session_data* sd, bool force);
//friends list
int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap);

View File

@ -1115,6 +1115,7 @@ int pet_birth_process(struct map_session_data *sd, struct s_pet *pet)
#endif
clif_pet_equip_area(sd->pd);
clif_send_petstatus(sd);
clif_pet_autofeed_status(sd,true);
}
Assert((sd->status.pet_id == 0 || sd->pd == 0) || sd->pd->master == sd);