From f92b392439cd5f2b517e9c829d9f518e1f5b392a Mon Sep 17 00:00:00 2001 From: Haru Date: Tue, 2 Dec 2014 10:58:21 +0100 Subject: Removed petheal command - Follow-up to 8bb0078 Signed-off-by: Haru --- src/map/pet.c | 49 +++--------------------------------------------- src/map/pet.h | 1 - src/map/script.c | 57 +++++++------------------------------------------------- src/map/unit.c | 5 +---- 4 files changed, 11 insertions(+), 101 deletions(-) (limited to 'src/map') diff --git a/src/map/pet.c b/src/map/pet.c index 0378ea0c3..71dd39401 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -688,10 +688,7 @@ int pet_equipitem(struct map_session_data *sd,int index) { //Skotlex: start support timers if need int64 tick = timer->gettick(); if (pd->s_skill && pd->s_skill->timer == INVALID_TIMER) { - if (pd->s_skill->id) - pd->s_skill->timer=timer->add(tick+pd->s_skill->delay*1000, pet->skill_support_timer, sd->bl.id, 0); - else - pd->s_skill->timer=timer->add(tick+pd->s_skill->delay*1000, pet->heal_timer, sd->bl.id, 0); + pd->s_skill->timer=timer->add(tick+pd->s_skill->delay*1000, pet->skill_support_timer, sd->bl.id, 0); } if (pd->bonus && pd->bonus->timer == INVALID_TIMER) pd->bonus->timer=timer->add(tick+pd->bonus->delay*1000, pet->skill_bonus_timer, sd->bl.id, 0); @@ -725,12 +722,8 @@ int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd) { pd->state.skillbonus = 0; status_calc_pc(sd,SCO_NONE); } - if( pd->s_skill && pd->s_skill->timer != INVALID_TIMER ) - { - if( pd->s_skill->id ) - timer->delete(pd->s_skill->timer, pet->skill_support_timer); - else - timer->delete(pd->s_skill->timer, pet->heal_timer); + if (pd->s_skill && pd->s_skill->timer != INVALID_TIMER) { + timer->delete(pd->s_skill->timer, pet->skill_support_timer); pd->s_skill->timer = INVALID_TIMER; } if( pd->bonus && pd->bonus->timer != INVALID_TIMER ) @@ -1117,40 +1110,6 @@ int pet_recovery_timer(int tid, int64 tick, int id, intptr_t data) { return 0; } -int pet_heal_timer(int tid, int64 tick, int id, intptr_t data) { - struct map_session_data *sd=map->id2sd(id); - struct status_data *st; - struct pet_data *pd; - unsigned int rate = 100; - - if(sd==NULL || sd->pd == NULL || sd->pd->s_skill == NULL) - return 1; - - pd=sd->pd; - - if(pd->s_skill->timer != tid) { - ShowError("pet_heal_timer %d != %d\n",pd->s_skill->timer,tid); - return 0; - } - - st = status->get_status_data(&sd->bl); - - if(pc_isdead(sd) || - (rate = get_percentage(st->sp, st->max_sp)) > pd->s_skill->sp || - (rate = get_percentage(st->hp, st->max_hp)) > pd->s_skill->hp || - (rate = (pd->ud.skilltimer != INVALID_TIMER)) //Another skill is in effect - ) { //Wait (how long? 1 sec for every 10% of remaining) - pd->s_skill->timer=timer->add(timer->gettick()+(rate>10?rate:10)*100,pet->heal_timer,sd->bl.id,0); - return 0; - } - pet_stop_attack(pd); - pet_stop_walking(pd,1); - clif->skill_nodamage(&pd->bl,&sd->bl,AL_HEAL,pd->s_skill->lv,1); - status->heal(&sd->bl, pd->s_skill->lv,0, 0); - pd->s_skill->timer=timer->add(tick+pd->s_skill->delay*1000,pet->heal_timer,sd->bl.id,0); - return 0; -} - /*========================================== * pet support skills [Skotlex] *------------------------------------------*/ @@ -1361,7 +1320,6 @@ int do_init_pet(bool minimal) { timer->add_func_list(pet->delay_item_drop,"pet_delay_item_drop"); timer->add_func_list(pet->skill_support_timer, "pet_skill_support_timer"); // [Skotlex] timer->add_func_list(pet->recovery_timer,"pet_recovery_timer"); // [Valaris] - timer->add_func_list(pet->heal_timer,"pet_heal_timer"); // [Valaris] timer->add_interval(timer->gettick()+MIN_PETTHINKTIME,pet->ai_hard,0,0,MIN_PETTHINKTIME); return 0; @@ -1433,7 +1391,6 @@ void pet_defaults(void) { pet->lootitem_drop = pet_lootitem_drop; pet->skill_bonus_timer = pet_skill_bonus_timer; pet->recovery_timer = pet_recovery_timer; - pet->heal_timer = pet_heal_timer; pet->skill_support_timer = pet_skill_support_timer; pet->read_db = read_petdb; } diff --git a/src/map/pet.h b/src/map/pet.h index 286109126..cffcf7dd0 100644 --- a/src/map/pet.h +++ b/src/map/pet.h @@ -149,7 +149,6 @@ struct pet_interface { int (*lootitem_drop) (struct pet_data *pd, struct map_session_data *sd); int (*skill_bonus_timer) (int tid, int64 tick, int id, intptr_t data); int (*recovery_timer) (int tid, int64 tick, int id, intptr_t data); - int (*heal_timer) (int tid, int64 tick, int id, intptr_t data); int (*skill_support_timer) (int tid, int64 tick, int id, intptr_t data); int (*read_db) (); }; diff --git a/src/map/script.c b/src/map/script.c index 7a1ef6e4b..93c9865e5 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -12737,46 +12737,6 @@ BUILDIN(petrecovery) return true; } -/*========================================== - * pet healing [Valaris] //Rewritten by [Skotlex] - *------------------------------------------*/ -BUILDIN(petheal) -{ - struct pet_data *pd; - TBL_PC *sd=script->rid2sd(st); - - if(sd==NULL || sd->pd==NULL) - return true; - - pd=sd->pd; - if (pd->s_skill) - { //Clear previous skill - if (pd->s_skill->timer != INVALID_TIMER) - { - if (pd->s_skill->id) - timer->delete(pd->s_skill->timer, pet->skill_support_timer); - else - timer->delete(pd->s_skill->timer, pet->heal_timer); - } - } else //init memory - pd->s_skill = (struct pet_skill_support *) aMalloc(sizeof(struct pet_skill_support)); - - pd->s_skill->id=0; //This id identifies that it IS petheal rather than pet_skillsupport - //Use the lv as the amount to heal - pd->s_skill->lv=script_getnum(st,2); - pd->s_skill->delay=script_getnum(st,3); - pd->s_skill->hp=script_getnum(st,4); - pd->s_skill->sp=script_getnum(st,5); - - //Use delay as initial offset to avoid skill/heal exploits - if (battle_config.pet_equip_required && pd->pet.equip == 0) - pd->s_skill->timer = INVALID_TIMER; - else - pd->s_skill->timer = timer->add(timer->gettick()+pd->s_skill->delay*1000,pet->heal_timer,sd->bl.id,0); - - return true; -} - /*========================================== * pet attack skills [Valaris] //Rewritten by [Skotlex] *------------------------------------------*/ @@ -12840,17 +12800,15 @@ BUILDIN(petskillsupport) { return true; pd=sd->pd; - if (pd->s_skill) - { //Clear previous skill - if (pd->s_skill->timer != INVALID_TIMER) - { - if (pd->s_skill->id) - timer->delete(pd->s_skill->timer, pet->skill_support_timer); - else - timer->delete(pd->s_skill->timer, pet->heal_timer); + if (pd->s_skill) { + //Clear previous skill + if (pd->s_skill->timer != INVALID_TIMER) { + timer->delete(pd->s_skill->timer, pet->skill_support_timer); } - } else //init memory + } else { + //init memory pd->s_skill = (struct pet_skill_support *) aMalloc(sizeof(struct pet_skill_support)); + } pd->s_skill->id=( script_isstringtype(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) ); pd->s_skill->lv=script_getnum(st,3); @@ -19235,7 +19193,6 @@ void script_parse_builtin(void) { BUILDIN_DEF(petskillbonus,"iiii"), // [Valaris] BUILDIN_DEF(petrecovery,"ii"), // [Valaris] BUILDIN_DEF(petloot,"i"), // [Valaris] - BUILDIN_DEF_DEPRECATED(petheal,"iiii"), // Deprecated 2014-10-27 [Haru] BUILDIN_DEF(petskillattack,"viii"), // [Skotlex] BUILDIN_DEF(petskillattack2,"viiii"), // [Valaris] BUILDIN_DEF(petskillsupport,"viiii"), // [Skotlex] diff --git a/src/map/unit.c b/src/map/unit.c index 8bac548e2..3962e771e 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -2673,10 +2673,7 @@ int unit_free(struct block_list *bl, clr_type clrtype) { if( pd->s_skill ) { if (pd->s_skill->timer != INVALID_TIMER) { - if (pd->s_skill->id) - timer->delete(pd->s_skill->timer, pet->skill_support_timer); - else - timer->delete(pd->s_skill->timer, pet->heal_timer); + timer->delete(pd->s_skill->timer, pet->skill_support_timer); } aFree(pd->s_skill); pd->s_skill = NULL; -- cgit v1.2.3-70-g09d2