MaxHP, MaxSP and Autotrade fixes
- Percentual bonuses to MaxHP and MaxSP will now always be rounded down (Aegis style) - Added a security check when calculating MaxHP and MaxSP so there can't be a number underflow (bugreport:9369) - When an auto-vendor gets logged out because of at_timeout, his store will be deleted and no longer restored after server restart (bugreport:9370)
This commit is contained in:
parent
b43b855d21
commit
cb7b9267c7
@ -2760,14 +2760,17 @@ static unsigned int status_calc_maxhpsp_pc(struct map_session_data* sd, unsigned
|
|||||||
if (isHP) { //Calculates MaxHP
|
if (isHP) { //Calculates MaxHP
|
||||||
max = job_info[idx].base_hp[level-1] * (1 + (max(stat,1) * 0.01)) * ((sd->class_&JOBL_UPPER)?1.25:1);
|
max = job_info[idx].base_hp[level-1] * (1 + (max(stat,1) * 0.01)) * ((sd->class_&JOBL_UPPER)?1.25:1);
|
||||||
max += status_get_hpbonus(&sd->bl,STATUS_BONUS_FIX);
|
max += status_get_hpbonus(&sd->bl,STATUS_BONUS_FIX);
|
||||||
max *= (1 + status_get_hpbonus(&sd->bl,STATUS_BONUS_RATE) * 0.01);
|
max += (int64)(max * status_get_hpbonus(&sd->bl,STATUS_BONUS_RATE) / 100); //Aegis accuracy
|
||||||
}
|
}
|
||||||
else { //Calculates MaxSP
|
else { //Calculates MaxSP
|
||||||
max = job_info[idx].base_sp[level-1] * (1 + (max(stat,1) * 0.01)) * ((sd->class_&JOBL_UPPER)?1.25:1);
|
max = job_info[idx].base_sp[level-1] * (1 + (max(stat,1) * 0.01)) * ((sd->class_&JOBL_UPPER)?1.25:1);
|
||||||
max += status_get_spbonus(&sd->bl,STATUS_BONUS_FIX);
|
max += status_get_spbonus(&sd->bl,STATUS_BONUS_FIX);
|
||||||
max *= (1 + status_get_spbonus(&sd->bl,STATUS_BONUS_RATE) * 0.01);
|
max += (int64)(max * status_get_spbonus(&sd->bl,STATUS_BONUS_RATE) / 100); //Aegis accuracy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Make sure it's not negative before casting to unsigned int
|
||||||
|
if(max < 1) max = 1;
|
||||||
|
|
||||||
return cap_value((unsigned int)max,1,UINT_MAX);
|
return cap_value((unsigned int)max,1,UINT_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10837,8 +10840,8 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
|
|||||||
case SC_AUTOTRADE:
|
case SC_AUTOTRADE:
|
||||||
if (tid == INVALID_TIMER)
|
if (tid == INVALID_TIMER)
|
||||||
break;
|
break;
|
||||||
// Note: vending/buying is closed by unit_remove_map, no
|
// Vending is not automatically closed for autovenders
|
||||||
// need to do it here.
|
vending_closevending(sd);
|
||||||
map_quit(sd);
|
map_quit(sd);
|
||||||
// Because map_quit calls status_change_end with tid -1
|
// Because map_quit calls status_change_end with tid -1
|
||||||
// from here it's not neccesary to continue
|
// from here it's not neccesary to continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user