* Fixed bonus_script doesn't remove Status Icon when timer is over (bugreport:9341)

* Some little code stylization

Signed-off-by: Cydh Ramdh <house.bad@gmail.com>
This commit is contained in:
Cydh Ramdh 2014-10-19 20:59:44 +07:00
parent a52b010668
commit 03dc02d4d6
4 changed files with 38 additions and 32 deletions

View File

@ -11018,11 +11018,13 @@ int pc_bonus_script_timer(int tid, unsigned int tick, int id, intptr_t data) {
return 0;
}
if (i > MAX_PC_BONUS_SCRIPT|| !(&sd->bonus_script[i]) || !sd->bonus_script[i].script) {
if (i >= MAX_PC_BONUS_SCRIPT || !(&sd->bonus_script[i]) || !sd->bonus_script[i].script) {
ShowDebug("pc_bonus_script_timer: Invalid index %d\n",i);
return 0;
}
if (sd->bonus_script[i].icon != SI_BLANK)
clif_status_load(&sd->bl, sd->bonus_script[i].icon, 0);
pc_bonus_script_remove(&sd->bonus_script[i]);
status_calc_pc(sd,SCO_NONE);
return 0;
@ -11067,7 +11069,8 @@ void pc_bonus_script_clear(struct map_session_data *sd, uint16 flag) {
(flag&BSF_REM_DEBUFF && sd->bonus_script[i].type == 2)) //Remove bonus script based on debuff type
)))
{
clif_status_change(&sd->bl,sd->bonus_script[i].icon,0,0,0,0,0);
if (sd->bonus_script[i].icon != SI_BLANK)
clif_status_load(&sd->bl, sd->bonus_script[i].icon, 0);
pc_bonus_script_remove(&sd->bonus_script[i]);
count++;
}
@ -11092,7 +11095,8 @@ void pc_bonus_script_clear_all(struct map_session_data *sd, bool permanent) {
continue;
if (!permanent && sd->bonus_script[i].flag&BSF_PERMANENT)
continue;
clif_status_change(&sd->bl,sd->bonus_script[i].icon,0,0,0,0,0);
if (sd->bonus_script[i].icon != SI_BLANK)
clif_status_load(&sd->bl, sd->bonus_script[i].icon, 0);
pc_bonus_script_remove(&sd->bonus_script[i]);
count++;
}

View File

@ -346,6 +346,7 @@ struct map_session_data {
short sp_gain_race_attack[RC_MAX];
short hp_gain_race_attack[RC_MAX];
// zeroed arrays end here.
// zeroed structures start here
struct s_autospell autospell[MAX_PC_BONUS], autospell2[MAX_PC_BONUS], autospell3[MAX_PC_BONUS];
struct s_addeffect addeff[MAX_PC_BONUS], addeff2[MAX_PC_BONUS];
@ -354,7 +355,7 @@ struct map_session_data {
struct s_skill_bonus { //skillatk raises bonus dmg% of skills, skillheal increases heal%, skillblown increases bonus blewcount for some skills.
unsigned short id;
short val;
} skillatk[MAX_PC_BONUS], skillusesprate[MAX_PC_BONUS], skillusesp[MAX_PC_BONUS], skillheal[5], skillheal2[5], skillblown[MAX_PC_BONUS], skillcast[MAX_PC_BONUS], skillcooldown[MAX_PC_BONUS], skillfixcast[MAX_PC_BONUS], skillvarcast[MAX_PC_BONUS], skillfixcastrate[MAX_PC_BONUS];
} skillatk[MAX_PC_BONUS], skillusesprate[MAX_PC_BONUS], skillusesp[MAX_PC_BONUS], skillheal[MAX_PC_BONUS], skillheal2[MAX_PC_BONUS], skillblown[MAX_PC_BONUS], skillcast[MAX_PC_BONUS], skillcooldown[MAX_PC_BONUS], skillfixcast[MAX_PC_BONUS], skillvarcast[MAX_PC_BONUS], skillfixcastrate[MAX_PC_BONUS];
struct s_regen {
short value;
int rate;
@ -377,9 +378,11 @@ struct map_session_data {
int rate, tick;
} def_set_race[RC_MAX], mdef_set_race[RC_MAX];
// zeroed structures end here
// manually zeroed structures start here.
struct s_autobonus autobonus[MAX_PC_BONUS], autobonus2[MAX_PC_BONUS], autobonus3[MAX_PC_BONUS]; //Auto script on attack, when attacked, on skill usage
// manually zeroed structures end here.
// zeroed vars start here.
struct s_bonus {
int hp, sp;
@ -421,7 +424,6 @@ struct map_session_data {
int ematk; // matk bonus from equipment
int eatk; // atk bonus from equipment
} bonus;
// zeroed vars end here.
int castrate,delayrate,hprate,sprate,dsprate;

View File

@ -2864,9 +2864,9 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt)
+ sizeof(sd->critaddrace)
+ sizeof(sd->expaddrace)
+ sizeof(sd->expaddclass)
+ sizeof(sd->ignore_def_by_race)
+ sizeof(sd->ignore_mdef_by_race)
+ sizeof(sd->ignore_mdef_by_class)
+ sizeof(sd->ignore_def_by_race)
+ sizeof(sd->sp_gain_race)
+ sizeof(sd->sp_gain_race_attack)
+ sizeof(sd->hp_gain_race_attack)
@ -2920,22 +2920,22 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt)
+ sizeof(sd->skillusesp)
+ sizeof(sd->skillheal)
+ sizeof(sd->skillheal2)
+ sizeof(sd->skillblown)
+ sizeof(sd->skillcast)
+ sizeof(sd->skillcooldown)
+ sizeof(sd->skillfixcast)
+ sizeof(sd->skillvarcast)
+ sizeof(sd->skillfixcastrate)
+ sizeof(sd->hp_loss)
+ sizeof(sd->sp_loss)
+ sizeof(sd->hp_regen)
+ sizeof(sd->sp_regen)
+ sizeof(sd->skillblown)
+ sizeof(sd->skillcast)
+ sizeof(sd->add_def)
+ sizeof(sd->add_mdef)
+ sizeof(sd->add_mdmg)
+ sizeof(sd->add_drop)
+ sizeof(sd->itemhealrate)
+ sizeof(sd->subele2)
+ sizeof(sd->skillcooldown)
+ sizeof(sd->skillfixcast)
+ sizeof(sd->skillvarcast)
+ sizeof(sd->skillfixcastrate)
+ sizeof(sd->def_set_race)
+ sizeof(sd->mdef_set_race)
);