Skip to content

Commit

Permalink
Merge pull request #2428 from hemagx/hercules_pet_fixes
Browse files Browse the repository at this point in the history
Automatically migrate pets to the new system that keeps hatched eggs in the inventory
  • Loading branch information
MishimaHaruna committed Apr 17, 2019
2 parents 0013040 + e700c49 commit 1351986
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/map/pet.c
Expand Up @@ -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);
Expand Down

0 comments on commit 1351986

Please sign in to comment.