summaryrefslogtreecommitdiff
path: root/src/map/pet.c
diff options
context:
space:
mode:
authorpanikon <panikon@zoho.com>2014-04-19 18:28:51 -0300
committerpanikon <panikon@zoho.com>2014-04-19 18:28:51 -0300
commitd57781cee04e99fa8be7c209a75b949a57eba59d (patch)
tree1727620e892958802e9319ac23d74de51e955e64 /src/map/pet.c
parent11d2525f4a7a358030caaa17fe82dc7bab8fe63f (diff)
downloadhercules-d57781cee04e99fa8be7c209a75b949a57eba59d.tar.gz
hercules-d57781cee04e99fa8be7c209a75b949a57eba59d.tar.bz2
hercules-d57781cee04e99fa8be7c209a75b949a57eba59d.tar.xz
hercules-d57781cee04e99fa8be7c209a75b949a57eba59d.zip
Fixed issue: 8150
* http://hercules.ws/board/tracker/issue-8150-cash-shop-updating-quantity-bug/ * Also fixed issue where when using ATitem to get more than one pet egg would result on getting only one egg * Changed packet 0x3880 structure now it also contains pet class and dropped flag from this packet, it was pointless
Diffstat (limited to 'src/map/pet.c')
-rw-r--r--src/map/pet.c37
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)