summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2019-04-17 06:02:45 +0200
committerGitHub <noreply@github.com>2019-04-17 06:02:45 +0200
commit1351986ee45b6cbc444c0ae1b23eb2e03dbf75e7 (patch)
tree73f5ba51a9426d49e97ff7b0d503e0de2fefa2f7 /src
parent0013040c4ed763eb4359a56ee106449fea5f2a83 (diff)
parente700c49e7cb2c3de678c697b342768824d1df664 (diff)
downloadhercules-1351986ee45b6cbc444c0ae1b23eb2e03dbf75e7.tar.gz
hercules-1351986ee45b6cbc444c0ae1b23eb2e03dbf75e7.tar.bz2
hercules-1351986ee45b6cbc444c0ae1b23eb2e03dbf75e7.tar.xz
hercules-1351986ee45b6cbc444c0ae1b23eb2e03dbf75e7.zip
Merge pull request #2428 from hemagx/hercules_pet_fixes
Automatically migrate pets to the new system that keeps hatched eggs in the inventory
Diffstat (limited to 'src')
-rw-r--r--src/map/pet.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/map/pet.c b/src/map/pet.c
index 96fe63c51..ce26b6cb1 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -348,6 +348,21 @@ static int pet_return_egg(struct map_session_data *sd, struct pet_data *pd)
if (i != sd->status.inventorySize) {
sd->status.inventory[i].attribute &= ~ATTR_BROKEN;
sd->status.inventory[i].bound = IBT_NONE;
+ } else {
+ // The pet egg wasn't found: it was probably hatched with the old system that deleted the egg.
+ struct item tmp_item = {0};
+ int flag;
+
+ tmp_item.nameid = pd->petDB->EggID;
+ tmp_item.identify = 1;
+ tmp_item.card[0] = CARD0_PET;
+ tmp_item.card[1] = GetWord(pd->pet.pet_id, 0);
+ tmp_item.card[2] = GetWord(pd->pet.pet_id, 1);
+ tmp_item.card[3] = pd->pet.rename_flag;
+ if ((flag = pc->additem(sd, &tmp_item, 1, LOG_TYPE_EGG)) != 0) {
+ clif->additem(sd, 0, 0, flag);
+ map->addflooritem(&sd->bl, &tmp_item, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0, false);
+ }
}
#if PACKETVER >= 20180704
clif->inventoryList(sd);