diff options
Diffstat (limited to 'src/map/pet.c')
-rw-r--r-- | src/map/pet.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/src/map/pet.c b/src/map/pet.c index c04d9267a..b5870a858 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -537,25 +537,38 @@ int pet_catch_process2(struct map_session_data* sd, int target_id) { return 0; } -///This function is invoked when a new pet has been created, and at no other time! -int pet_get_egg(int account_id,int pet_id,int flag) { +/** + * Is invoked _only_ when a new pet has been created is a product of packet 0x3880 + * see mapif_pet_created@int_pet.c for more information + * Handles new pet data from inter-server and prepares item information + * to add pet egg + * + * pet_id - Should contain pet id otherwise means failure + * returns true on success + **/ +bool pet_get_egg(int account_id, short pet_class, int pet_id ) { struct map_session_data *sd; struct item tmp_item; - int i=0,ret=0; + int i = 0, ret = 0; - if(flag) - return 0; - - sd = map->id2sd(account_id); - if(sd == NULL) - return 0; + if( pet_id == 0 || pet_class == 0 ) + return false; - i = pet->search_petDB_index(sd->catch_target_class,PET_CLASS); + sd = map->id2sd(account_id); + if( sd == NULL ) + return false; + + // i = pet->search_petDB_index(sd->catch_target_class,PET_CLASS); + // issue: 8150 + // Before this change in cases where more than one pet egg were requested in a short + // period of time it wasn't possible to know which kind of egg was being requested after + // the first request. [Panikon] + i = pet->search_petDB_index(pet_class,PET_CLASS); sd->catch_target_class = -1; if(i < 0) { intif->delete_petdata(pet_id); - return 0; + return false; } memset(&tmp_item,0,sizeof(tmp_item)); @@ -570,7 +583,7 @@ int pet_get_egg(int account_id,int pet_id,int flag) { map->addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } - return 1; + return true; } int pet_menu(struct map_session_data *sd,int menunum) |