summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c5
-rw-r--r--src/map/pet.c48
2 files changed, 13 insertions, 40 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index d6c320756..c79305fc3 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -6036,11 +6036,6 @@ int clif_catch_process(struct map_session_data *sd)
WFIFOHEAD(fd,packet_len(0x19e));
WFIFOW(fd,0)=0x19e;
WFIFOSET(fd,packet_len(0x19e));
- sd->menuskill_id = SA_TAMINGMONSTER;
- if (sd->ud.skillid == SA_TAMINGMONSTER)
- sd->menuskill_lv = 0; //Free catch
- else
- sd->menuskill_lv = sd->itemid; //Consume catch
return 0;
}
diff --git a/src/map/pet.c b/src/map/pet.c
index 22237279e..ef0ade4fd 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -539,47 +539,26 @@ int pet_catch_process1(struct map_session_data *sd,int target_class)
return 0;
}
-int pet_catch_process2(struct map_session_data *sd,int target_id)
+int pet_catch_process2(struct map_session_data* sd, int target_id)
{
- struct mob_data *md;
- int i=0,pet_catch_rate=0;
+ struct mob_data* md;
+ int i = 0, pet_catch_rate = 0;
nullpo_retr(1, sd);
- md=(struct mob_data*)map_id2bl(target_id);
- if(!md || md->bl.type != BL_MOB || md->bl.prev == NULL){
- //Abort capture.
- sd->catch_target_class = -1;
- sd->itemid = sd->itemindex = -1;
- return 1;
- }
-
- if (sd->menuskill_id != SA_TAMINGMONSTER)
- { //Exploit?
+ md = (struct mob_data*)map_id2bl(target_id);
+ if(!md || md->bl.type != BL_MOB || md->bl.prev == NULL)
+ { // Invalid inputs/state, abort capture.
clif_pet_roulette(sd,0);
sd->catch_target_class = -1;
+ sd->itemid = sd->itemindex = -1;
return 1;
}
-
- if (sd->menuskill_lv > 0)
- { //Consume the pet lure [Skotlex]
- i=pc_search_inventory(sd,sd->menuskill_lv);
- if (i < 0)
- { //they tried an exploit?
- clif_pet_roulette(sd,0);
- sd->catch_target_class = -1;
- return 1;
- }
- //Delete the item
- if (sd->itemid == sd->menuskill_lv)
- sd->itemid = sd->itemindex = -1;
- sd->menuskill_id = sd->menuskill_lv = 0;
- pc_delitem(sd,i,1,0);
- }
+
+ //FIXME: delete taming item here, if this was an item-invoked capture and the item was flagged as delay-consume
i = search_petDB_index(md->class_,PET_CLASS);
- //catch_target_class == 0 is used for universal lures. [Skotlex]
- //for now universal lures do not include bosses.
+ //catch_target_class == 0 is used for universal lures (except bosses for now). [Skotlex]
if (sd->catch_target_class == 0 && !(md->status.mode&MD_BOSS))
sd->catch_target_class = md->class_;
if(i < 0 || sd->catch_target_class != md->class_) {
@@ -594,19 +573,18 @@ int pet_catch_process2(struct map_session_data *sd,int target_id)
if(battle_config.pet_catch_rate != 100)
pet_catch_rate = (pet_catch_rate*battle_config.pet_catch_rate)/100;
- if(rand()%10000 < pet_catch_rate) {
+ if(rand()%10000 < pet_catch_rate)
+ {
unit_remove_map(&md->bl,0);
status_kill(&md->bl);
clif_pet_roulette(sd,1);
-// if(battle_config.etc_log)
-// printf("roulette success %d\n",target_id);
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);
}
else
{
- sd->catch_target_class = -1;
clif_pet_roulette(sd,0);
+ sd->catch_target_class = -1;
}
return 0;