summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/intif.c4
-rw-r--r--src/map/pet.c37
-rw-r--r--src/map/pet.h2
3 files changed, 28 insertions, 15 deletions
diff --git a/src/map/intif.c b/src/map/intif.c
index 40ceda917..0f65daa6b 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -1316,7 +1316,7 @@ void intif_parse_GuildMasterChanged(int fd) {
// Request pet creation
void intif_parse_CreatePet(int fd) {
- pet->get_egg(RFIFOL(fd,2),RFIFOL(fd,7),RFIFOB(fd,6));
+ pet->get_egg(RFIFOL(fd,2), RFIFOL(fd,6), RFIFOB(fd,8));
}
// ACK pet data
@@ -2298,7 +2298,7 @@ void intif_defaults(void) {
-1,-1, 7, 7, 7,11, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3850 Auctions [Zephyrus] itembound[Akinari]
-1, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3860 Quests [Kevin] [Inkfish]
-1, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 3, 3, 0, //0x3870 Mercenaries [Zephyrus] / Elemental [pakpil]
- 11,-1, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3880
+ 12,-1, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3880
-1,-1, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3890 Homunculus [albator]
};
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)
diff --git a/src/map/pet.h b/src/map/pet.h
index 537a50c4b..4ec30b3fb 100644
--- a/src/map/pet.h
+++ b/src/map/pet.h
@@ -127,7 +127,7 @@ struct pet_interface {
int (*select_egg) (struct map_session_data *sd, short egg_index);
int (*catch_process1) (struct map_session_data *sd, int target_class);
int (*catch_process2) (struct map_session_data *sd, int target_id);
- int (*get_egg) (int account_id, int pet_id, int flag);
+ bool (*get_egg) (int account_id, short pet_class, int pet_id );
int (*unequipitem) (struct map_session_data *sd, struct pet_data *pd);
int (*food) (struct map_session_data *sd, struct pet_data *pd);
int (*ai_sub_hard_lootsearch) (struct block_list *bl, va_list ap);