diff options
author | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-02-23 15:59:40 +0000 |
---|---|---|
committer | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-02-23 15:59:40 +0000 |
commit | 125ff2ca6b79b278576f7ddbbd6ac99526b7a852 (patch) | |
tree | 71cbea2eb226f8d7b2b49f18f97e7a6b325264fa /src/map/pc.c | |
parent | 381cc32d022fad29f9b36002cee4da84e3fef350 (diff) | |
download | hercules-125ff2ca6b79b278576f7ddbbd6ac99526b7a852.tar.gz hercules-125ff2ca6b79b278576f7ddbbd6ac99526b7a852.tar.bz2 hercules-125ff2ca6b79b278576f7ddbbd6ac99526b7a852.tar.xz hercules-125ff2ca6b79b278576f7ddbbd6ac99526b7a852.zip |
* Added bAddItemHealRate
* Fixed a crash if adding an offline player to a party
* Fixed a crash with Warp
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1169 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 52c2b6a8f..20f5d8854 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1855,6 +1855,10 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) if(sd->state.lr_flag != 2) sd->subsize[type2]+=val; break; + case SP_ADD_ITEM_HEAL_RATE: + if(sd->state.lr_flag != 2) + sd->itemhealrate[type2 - 1] += val; + break; default: if(battle_config.error_log) @@ -2421,17 +2425,18 @@ int pc_isUseitem(struct map_session_data *sd,int n) */ int pc_useitem(struct map_session_data *sd,int n) { - int nameid,amount; + int amount; nullpo_retr(1, sd); if(n >=0 && n < MAX_INVENTORY) { - nameid = sd->status.inventory[n].nameid; + sd->itemid = sd->status.inventory[n].nameid; amount = sd->status.inventory[n].amount; if(sd->status.inventory[n].nameid <= 0 || sd->status.inventory[n].amount <= 0 || sd->sc_data[SC_BERSERK].timer!=-1 || sd->sc_data[SC_MARIONETTE].timer!=-1 || + (pc_issit(sd) && (sd->itemid == 605 || sd->itemid == 606)) || //added item_noequip.txt items check by Maya&[Lupus] (map[sd->bl.m].flag.pvp && (sd->inventory_data[n]->flag.no_equip&1) ) || // PVP (map[sd->bl.m].flag.gvg && (sd->inventory_data[n]->flag.no_equip>1) ) || // GVG @@ -2439,6 +2444,7 @@ int pc_useitem(struct map_session_data *sd,int n) clif_useitemack(sd,n,0,0); return 1; } + if(sd->inventory_data[n]) run_script(sd->inventory_data[n]->use_script,0,sd->bl.id,0); @@ -2902,7 +2908,7 @@ int pc_setpos(struct map_session_data *sd,char *mapname_org,int x,int y,int clrt status_change_end(&sd->bl, SC_HIDING, -1); if(sd->status.option&4) status_change_end(&sd->bl, SC_CLOAKING, -1); - if(sd->status.option&16386) + if(sd->status.option&16384) status_change_end(&sd->bl, SC_CHASEWALK, -1); if(sd->status.pet_id > 0 && sd->pd && sd->pet.intimate > 0) { @@ -4588,7 +4594,7 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage) status_change_end(&sd->bl, SC_HIDING, -1); if(sd->status.option&4) status_change_end(&sd->bl, SC_CLOAKING, -1); - if(sd->status.option&16386) + if(sd->status.option&16384) status_change_end(&sd->bl, SC_CHASEWALK, -1); if(sd->status.hp>0){ @@ -5124,7 +5130,7 @@ int pc_heal(struct map_session_data *sd,int hp,int sp) */ int pc_itemheal(struct map_session_data *sd,int hp,int sp) { - int bonus; + int bonus, type = 0; // if(battle_config.battle_log) // printf("heal %d %d\n",hp,sp); @@ -5147,19 +5153,33 @@ int pc_itemheal(struct map_session_data *sd,int hp,int sp) if(sp > 0) sp = 0; } + + if (sd->itemid >= 501 && sd->itemid <= 505) + type = 1; // potions + else if (sd->itemid >= 507 && sd->itemid <= 510) + type = 2; // herbs + else if (sd->itemid >= 512 && sd->itemid <= 516) + type = 3; // fruits + else if (sd->itemid == 517 || sd->itemid == 528) + type = 4; // meat + else if (sd->itemid == 529 || sd->itemid == 530) + type = 5; // candy + else if (sd->itemid >= 531 && sd->itemid <= 534) + type = 6; // juice + else if (sd->itemid == 544 || sd->itemid == 551) + type = 7; // sashimi + if(hp > 0) { - bonus = (sd->paramc[2]<<1) + 100 + pc_checkskill(sd,SM_RECOVERY)*10; - if(bonus != 100) - hp = hp * bonus / 100; - bonus = 100 + pc_checkskill(sd,AM_LEARNINGPOTION)*5; + bonus = (sd->paramc[2]<<1) + 100 + pc_checkskill(sd,SM_RECOVERY)*10 + + pc_checkskill(sd,AM_LEARNINGPOTION)*5; + if (type > 0) + bonus += sd->itemhealrate[type - 1]; if(bonus != 100) hp = hp * bonus / 100; } if(sp > 0) { - bonus = (sd->paramc[3]<<1) + 100 + pc_checkskill(sd,MG_SRECOVERY)*10; - if(bonus != 100) - sp = sp * bonus / 100; - bonus = 100 + pc_checkskill(sd,AM_LEARNINGPOTION)*5; + bonus = (sd->paramc[3]<<1) + 100 + pc_checkskill(sd,MG_SRECOVERY)*10 + + pc_checkskill(sd,AM_LEARNINGPOTION)*5; if(bonus != 100) sp = sp * bonus / 100; } |