From 772cb2b111973c0c749e505ffd2685bb67e887bd Mon Sep 17 00:00:00 2001 From: malufett Date: Sat, 20 Dec 2014 00:08:03 +0800 Subject: Fixed Bug#8469 -http://hercules.ws/board/tracker/issue-8469-issue417-refine-weapon-may-caused-server-to-crash/?gopid=24287#entry24287 Signed-off-by: malufett --- src/map/status.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/map/status.c') diff --git a/src/map/status.c b/src/map/status.c index 54b4a4358..53672fccf 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -11469,8 +11469,9 @@ int status_get_weapon_atk(struct block_list *bl, struct weapon_atk *watk, int fl short index = sd->equip_index[EQI_HAND_R], refine; if ( index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_WEAPON && (refine = sd->status.inventory[index].refine) < 16 && refine ) { - int r = (rnd() % 100) % ((status->refine_info[watk->wlv].randombonus_max[refine + (4 - watk->wlv)] / 100)) + 1; - max += r / 10; + int r = status->refine_info[watk->wlv].randombonus_max[refine + (4 - watk->wlv)] / 100; + if ( r ) + max += (rnd() % 100) % (r / 10) + 1; } } @@ -11560,8 +11561,9 @@ void status_get_matk_sub(struct block_list *bl, int flag, unsigned short *matk_m short index = sd->equip_index[EQI_HAND_R], refine; if ( index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_WEAPON && (refine = sd->status.inventory[index].refine) < 16 && refine ) { - int r = (rnd() % 100) % ((status->refine_info[sd->inventory_data[index]->wlv].randombonus_max[refine + (4 - sd->inventory_data[index]->wlv)] / 100)) + 1; - st->matk_max += r / 10; + int r = status->refine_info[sd->inventory_data[index]->wlv].randombonus_max[refine + (4 - sd->inventory_data[index]->wlv)] / 100; + if ( r ) + st->matk_max += (rnd() % 100) % (r / 10) + 1; } } #endif -- cgit v1.2.3-60-g2f50