diff options
Diffstat (limited to 'src/map/pet.c')
-rw-r--r-- | src/map/pet.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/map/pet.c b/src/map/pet.c index e544905c0..dd9f1ebbf 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -23,6 +23,7 @@ #include "config/core.h" // DBPATH #include "pet.h" +#include "map/achievement.h" #include "map/atcommand.h" // msg_txt() #include "map/battle.h" #include "map/chrif.h" @@ -93,10 +94,10 @@ static void pet_set_intimate(struct pet_data *pd, int value) if (value <= 0) { int i; - ARR_FIND(0, MAX_INVENTORY, i, sd->status.inventory[i].card[0] == CARD0_PET && + ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].card[0] == CARD0_PET && pd->pet.pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])); - if (i != MAX_INVENTORY) { + if (i != sd->status.inventorySize) { pc->delitem(sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_EGG); } } @@ -341,14 +342,17 @@ static int pet_return_egg(struct map_session_data *sd, struct pet_data *pd) pet->lootitem_drop(pd,sd); // Pet Evolution - ARR_FIND(0, MAX_INVENTORY, i, sd->status.inventory[i].card[0] == CARD0_PET && + ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].card[0] == CARD0_PET && pd->pet.pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])); - if (i != MAX_INVENTORY) { - sd->status.inventory[i].identify = 1; + if (i != sd->status.inventorySize) { + sd->status.inventory[i].attribute &= ~ATTR_BROKEN; sd->status.inventory[i].bound = IBT_NONE; } - +#if PACKETVER >= 20180704 + clif->inventoryList(sd); + clif->send_petdata(sd, pd, 6, 0); +#endif pd->pet.incubate = 1; unit->free(&pd->bl,CLR_OUTSIGHT); @@ -462,6 +466,9 @@ static int pet_birth_process(struct map_session_data *sd, struct s_pet *petinfo) clif->spawn(&sd->pd->bl); clif->send_petdata(sd,sd->pd, 0,0); clif->send_petdata(sd,sd->pd, 5,battle_config.pet_hair_style); +#if PACKETVER >= 20180704 + clif->send_petdata(sd, sd->pd, 6, 1); +#endif clif->send_petdata(NULL, sd->pd, 3, sd->pd->vd.head_bottom); clif->send_petstatus(sd); } @@ -485,10 +492,10 @@ static int pet_recv_petdata(int account_id, struct s_pet *p, int flag) if(p->incubate == 1) { int i; // Get Egg Index - ARR_FIND(0, MAX_INVENTORY, i, sd->status.inventory[i].card[0] == CARD0_PET && + ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].card[0] == CARD0_PET && p->pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])); - if(i == MAX_INVENTORY) { + if(i == sd->status.inventorySize) { ShowError("pet_recv_petdata: Hatching pet (%d:%s) aborted, couldn't find egg in inventory for removal!\n",p->pet_id, p->name); sd->status.pet_id = 0; return 1; @@ -496,8 +503,8 @@ static int pet_recv_petdata(int account_id, struct s_pet *p, int flag) if (!pet->birth_process(sd,p)) { - // Pet Evolution, Hide the egg by setting identify to 0 [Dastgir/Hercules] - sd->status.inventory[i].identify = 0; + // Pet Evolution, Hide the egg by setting broken attribute (0x2) [Asheraf] + sd->status.inventory[i].attribute |= ATTR_BROKEN; // bind the egg to the character to avoid moving it via forged packets [Asheraf] sd->status.inventory[i].bound = IBT_CHARACTER; } @@ -520,7 +527,7 @@ static int pet_select_egg(struct map_session_data *sd, int egg_index) { nullpo_ret(sd); - if(egg_index < 0 || egg_index >= MAX_INVENTORY) + if (egg_index < 0 || egg_index >= sd->status.inventorySize) return 0; //Forged packet! if(sd->status.inventory[egg_index].card[0] == CARD0_PET) @@ -576,8 +583,8 @@ static int pet_catch_process2(struct map_session_data *sd, int target_id) pet_catch_rate = (pet->db[i].capture + (sd->status.base_level - md->level)*30 + sd->battle_status.luk*20)*(200 - get_percentage(md->status.hp, md->status.max_hp))/100; if(pet_catch_rate < 1) pet_catch_rate = 1; - if(battle_config.pet_catch_rate != 100) - pet_catch_rate = (pet_catch_rate*battle_config.pet_catch_rate)/100; + if(battle->bc->pet_catch_rate != 100) + pet_catch_rate = (pet_catch_rate*battle->bc->pet_catch_rate)/100; if(rnd()%10000 < pet_catch_rate) { @@ -586,6 +593,8 @@ static int pet_catch_process2(struct map_session_data *sd, int target_id) clif->pet_roulette(sd,1); intif->create_pet(sd->status.account_id,sd->status.char_id,pet->db[i].class_,mob->db(pet->db[i].class_)->lv, pet->db[i].EggID,0,pet->db[i].intimate,100,0,1,pet->db[i].jname); + + achievement->validate_taming(sd, pet->db[i].class_); } else { |