diff options
author | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-06-22 04:56:46 +0200 |
---|---|---|
committer | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-06-22 04:56:46 +0200 |
commit | 2129555fa2752cfa0b9e73151fad2897d426fe63 (patch) | |
tree | 97de594bc9920c1daf450541d7f4eeb2d967597b /src | |
parent | 484ac06f39d1b576284c137538f05347ba7aee0c (diff) | |
download | hercules-2129555fa2752cfa0b9e73151fad2897d426fe63.tar.gz hercules-2129555fa2752cfa0b9e73151fad2897d426fe63.tar.bz2 hercules-2129555fa2752cfa0b9e73151fad2897d426fe63.tar.xz hercules-2129555fa2752cfa0b9e73151fad2897d426fe63.zip |
Remove pet if intimacy drops to 0
Diffstat (limited to 'src')
-rw-r--r-- | src/map/pc.c | 2 | ||||
-rw-r--r-- | src/map/pet.c | 22 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index c1261c839..ca8e35073 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -8153,7 +8153,7 @@ static int pc_dead(struct map_session_data *sd, struct block_list *src) clif->send_petdata(sd, sd->pd, 1, pd->pet.intimate); } - if (sd->pd->target_id != 0) // Unlock all targets. + if (sd->pd != NULL && sd->pd->target_id != 0) // Unlock all targets. pet->unlocktarget(sd->pd); } diff --git a/src/map/pet.c b/src/map/pet.c index 1e87c6afa..3c75c23b5 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -145,18 +145,20 @@ static void pet_set_intimate(struct pet_data *pd, int value) struct map_session_data *sd = pd->msd; - status_calc_pc(sd, SCO_NONE); - - if (pd->pet.intimate == PET_INTIMACY_NONE) { /// Pet is lost. Delete the egg. + if (pd->pet.intimate == PET_INTIMACY_NONE) { // Pet is lost, delete it. int i; ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].card[0] == CARD0_PET - && pd->pet.pet_id == MakeDWord(sd->status.inventory[i].card[1], - sd->status.inventory[i].card[2])); + && pd->pet.pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])); if (i != sd->status.inventorySize) pc->delitem(sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_EGG); + + pet_stop_attack(pd); + unit->remove_map(&pd->bl, CLR_OUTSIGHT, ALC_MARK); } + + status_calc_pc(sd, SCO_NONE); } /** @@ -342,8 +344,8 @@ static int pet_hungry(int tid, int64 tick, int id, intptr_t data) pet_stop_attack(pd); pet->set_intimate(pd, pd->pet.intimate - pd->petDB->starving_decrement); - if (pd->pet.intimate == PET_INTIMACY_NONE) - pd->status.speed = pd->db->status.speed; + if (sd->pd == NULL) + return 0; status_calc_pet(pd, SCO_NONE); clif->send_petdata(sd, pd, 1, pd->pet.intimate); @@ -978,10 +980,8 @@ static int pet_food(struct map_session_data *sd, struct pet_data *pd) intimacy = intimacy * battle_config.pet_friendly_rate / 100; pet->set_intimate(pd, pd->pet.intimate + intimacy); - if (pd->pet.intimate == PET_INTIMACY_NONE) { - pet_stop_attack(pd); - pd->status.speed = pd->db->status.speed; - } + if (sd->pd == NULL) + return 0; status_calc_pet(pd, SCO_NONE); pet->set_hunger(pd, pd->pet.hungry + pd->petDB->fullness); |