Fix several issues with pets (#4422)
* Fixes #4422. * Resolves an issue hatching eggs when trading and eggs not being deleted after the pet is lost. Thanks to @sader1992!
This commit is contained in:
parent
d9a4a8f6d0
commit
3058d10a4e
@ -8034,8 +8034,8 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
|
||||
struct pet_data *pd = sd->pd;
|
||||
if( !mapdata->flag[MF_NOEXPPENALTY] ) {
|
||||
pet_set_intimate(pd, pd->pet.intimate + pd->get_pet_db()->die);
|
||||
if( pd->pet.intimate < 0 )
|
||||
pd->pet.intimate = 0;
|
||||
if( pd->pet.intimate <= PET_INTIMATE_NONE )
|
||||
pet_set_intimate(pd, PET_INTIMATE_NONE);
|
||||
clif_send_petdata(sd,sd->pd,1,pd->pet.intimate);
|
||||
}
|
||||
if( sd->pd->target_id ) // Unlock all targets...
|
||||
|
@ -606,6 +606,9 @@ void pet_set_intimate(struct pet_data *pd, int value)
|
||||
|
||||
struct map_session_data *sd = pd->master;
|
||||
|
||||
if(pd->pet.intimate <= PET_INTIMATE_NONE)
|
||||
pc_delitem(sd, pet_egg_search(sd, pd->pet.pet_id), 1, 0, 0, LOG_TYPE_OTHER);
|
||||
|
||||
if (sd)
|
||||
status_calc_pc(sd,SCO_NONE);
|
||||
}
|
||||
@ -819,7 +822,7 @@ static TIMER_FUNC(pet_hungry){
|
||||
pet_set_intimate(pd, pd->pet.intimate + pet_db_ptr->hungry_intimacy_dec);
|
||||
|
||||
if( pd->pet.intimate <= PET_INTIMATE_NONE ) {
|
||||
pd->pet.intimate = PET_INTIMATE_NONE;
|
||||
pet_set_intimate(pd, PET_INTIMATE_NONE);
|
||||
pd->status.speed = pd->get_pet_walk_speed();
|
||||
}
|
||||
|
||||
@ -1148,6 +1151,15 @@ int pet_select_egg(struct map_session_data *sd,short egg_index)
|
||||
if(egg_index < 0 || egg_index >= MAX_INVENTORY)
|
||||
return 0; //Forged packet!
|
||||
|
||||
if(sd->trade_partner) //The player have trade in progress.
|
||||
return 0;
|
||||
|
||||
std::shared_ptr<s_pet_db> pet = pet_db_search(sd->inventory.u.items_inventory[egg_index].nameid, PET_EGG);
|
||||
if (!pet) {
|
||||
ShowError("pet does not exist, egg id %d\n", sd->inventory.u.items_inventory[egg_index].nameid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(sd->inventory.u.items_inventory[egg_index].card[0] == CARD0_PET)
|
||||
intif_request_petdata(sd->status.account_id, sd->status.char_id, MakeDWord(sd->inventory.u.items_inventory[egg_index].card[1], sd->inventory.u.items_inventory[egg_index].card[2]) );
|
||||
else
|
||||
@ -1524,7 +1536,7 @@ int pet_food(struct map_session_data *sd, struct pet_data *pd)
|
||||
if (pd->pet.hungry > PET_HUNGRY_SATISFIED) {
|
||||
pet_set_intimate(pd, pd->pet.intimate + pet_db_ptr->r_full);
|
||||
if (pd->pet.intimate <= PET_INTIMATE_NONE) {
|
||||
pd->pet.intimate = PET_INTIMATE_NONE;
|
||||
pet_set_intimate(pd, PET_INTIMATE_NONE);
|
||||
pet_stop_attack(pd);
|
||||
pd->status.speed = pd->get_pet_walk_speed();
|
||||
}
|
||||
@ -2210,7 +2222,7 @@ void pet_evolution(struct map_session_data *sd, int16 pet_id) {
|
||||
// Prepare the new pet
|
||||
sd->pd->pet.class_ = pet_id;
|
||||
sd->pd->pet.egg_id = new_data->EggID;
|
||||
sd->pd->pet.intimate = new_data->intimate;
|
||||
pet_set_intimate(sd->pd, new_data->intimate);
|
||||
if( !sd->pd->pet.rename_flag ){
|
||||
struct mob_db* mdb = mob_db( pet_id );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user