summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-07-30 20:40:06 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-07-30 20:40:06 +0000
commite8a9dd12348aa0e504a5e0b24122a5b268128fda (patch)
tree69ca6b9e01f2574464feb054ae89b8e314d55331 /src
parentabc7dd378cdad5c3f067f21b422f51ba7c06c585 (diff)
downloadhercules-e8a9dd12348aa0e504a5e0b24122a5b268128fda.tar.gz
hercules-e8a9dd12348aa0e504a5e0b24122a5b268128fda.tar.bz2
hercules-e8a9dd12348aa0e504a5e0b24122a5b268128fda.tar.xz
hercules-e8a9dd12348aa0e504a5e0b24122a5b268128fda.zip
* Corrected pet taming code; items are consumed immediately and only 1x
- TODO: add proper code for people who want delayed consumption git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10930 54d463be-8e91-2dee-dedb-b68131a5f0ec
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;