From 15976eb40c2689d53d537ab425447eca572d9e7e Mon Sep 17 00:00:00 2001 From: skotlex Date: Fri, 30 Jun 2006 13:53:13 +0000 Subject: - Moved item group enumeration from itemdb.h to map.h - Cleanup in itemheal related code, fixed the item heal group bonus not working on Groups beyond 7. - Fixed pet's loot not being moved to your inventory on logout. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7419 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/pc.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/map/pc.c') diff --git a/src/map/pc.c b/src/map/pc.c index 4f153252e..606d85f88 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2131,8 +2131,12 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) sd->subrace2[type2]+=val; break; case SP_ADD_ITEM_HEAL_RATE: - if(sd->state.lr_flag != 2) - sd->itemhealrate[type2 - 1] += val; + if(sd->state.lr_flag == 2) + break; + if (type2 < MAX_ITEMGROUP) + sd->itemhealrate[type2] += val; + else + ShowWarning("pc_bonus2: AddItemHealRate: Group %d is beyond limit (%d).\n", type2, MAX_ITEMGROUP); break; case SP_EXP_ADDRACE: if(sd->state.lr_flag != 2) @@ -5225,20 +5229,18 @@ void pc_heal(struct map_session_data *sd,unsigned int hp,unsigned int sp, int ty * HP/SP‰ñ•œ *------------------------------------------ */ -int pc_itemheal(struct map_session_data *sd,int hp,int sp) +int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp) { int bonus, type; - nullpo_retr(0, sd); - if(hp) { bonus = 100 + (sd->battle_status.vit<<1) + pc_checkskill(sd,SM_RECOVERY)*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*5; // A potion produced by an Alchemist in the Fame Top 10 gets +50% effect [DracoRPG] bonus += (potion_flag==2)?50:(potion_flag==3?100:0); - if ((type = itemdb_group(sd->itemid)) > 0 && type <= 7) - bonus = bonus * (100+sd->itemhealrate[type - 1]) / 100; + if ((type = itemdb_group(itemid)) > 0 && type < MAX_ITEMGROUP && sd->itemhealrate[type]) + bonus += bonus * sd->itemhealrate[type] / 100; if(bonus!=100) hp = hp * bonus / 100; } -- cgit v1.2.3-70-g09d2