From 007e6d5ba2df6e6b09f832609731bb8e1bf7413f Mon Sep 17 00:00:00 2001
From: ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>
Date: Sat, 25 Apr 2009 07:25:50 +0000
Subject: Correction to some status icons based on official information - Added
 SI_S_LIFEPOTION and SI_L_LIFEPOTION and their corresponding new status
 changes to deal with the fact that Small_Life_Potion and Med_Life_Potion each
 use a different status icon. - Left the duplicate SC_HPREGEN status in fof
 backwards compatibility, but removed its icon. - Corrected the status icon id
 for SC_INCCRI from 292 to 295. - Corrected the status icon id for
 SC_INCHEALRATE from 293 to 292. - Added status icons for SC_INCFLEE2,
 SC_SPCOST_RATE and SC_COMMONSC_RESIST. - Removed icon from SC_ARMOR_RESIST
 since officially it is a bonus, not a status, and thus doesn't (and can't)
 have an icon. - Renamed the status icon name of SC_ELEMENTALCHANGE from
 SI_ARMOR_RESIST to SI_ARMOR_PROPERTY.

git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13698 54d463be-8e91-2dee-dedb-b68131a5f0ec
---
 src/map/status.c | 38 +++++++++++++++++++++++++++-----------
 src/map/status.h | 19 +++++++++++--------
 2 files changed, 38 insertions(+), 19 deletions(-)

(limited to 'src/map')

diff --git a/src/map/status.c b/src/map/status.c
index 6c1a1029e..04e01b8ba 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -193,7 +193,7 @@ void initChangeTables(void)
 	set_sc( MG_ENERGYCOAT        , SC_ENERGYCOAT      , SI_ENERGYCOAT      , SCB_NONE );
 	set_sc( NPC_EMOTION          , SC_MODECHANGE      , SI_BLANK           , SCB_MODE );
 	add_sc( NPC_EMOTION_ON       , SC_MODECHANGE      );
-	set_sc( NPC_ATTRICHANGE      , SC_ELEMENTALCHANGE , SI_ARMOR_RESIST    , SCB_DEF_ELE );
+	set_sc( NPC_ATTRICHANGE      , SC_ELEMENTALCHANGE , SI_ARMOR_PROPERTY  , SCB_DEF_ELE );
 	add_sc( NPC_CHANGEWATER      , SC_ELEMENTALCHANGE );
 	add_sc( NPC_CHANGEGROUND     , SC_ELEMENTALCHANGE );
 	add_sc( NPC_CHANGEFIRE       , SC_ELEMENTALCHANGE );
@@ -472,11 +472,12 @@ void initChangeTables(void)
 	StatusIconChangeTable[SC_DEF_RATE] = SI_DEF_RATE;
 	StatusIconChangeTable[SC_MDEF_RATE] = SI_MDEF_RATE;
 	StatusIconChangeTable[SC_INCCRI] = SI_INCCRI;
+	StatusIconChangeTable[SC_INCFLEE2] = SI_PLUSAVOIDVALUE;
 	StatusIconChangeTable[SC_INCHEALRATE] = SI_INCHEALRATE;
-	StatusIconChangeTable[SC_HPREGEN] = SI_HPREGEN;
-	StatusIconChangeTable[SC_SPCOST_RATE] = SI_SPCOST_RATE;
-	StatusIconChangeTable[SC_COMMONSC_RESIST] = SI_COMMONSC_RESIST;
-	StatusIconChangeTable[SC_ARMOR_RESIST] = SI_ARMOR_RESIST;
+	StatusIconChangeTable[SC_S_LIFEPOTION] = SI_S_LIFEPOTION;
+	StatusIconChangeTable[SC_L_LIFEPOTION] = SI_L_LIFEPOTION;
+	StatusIconChangeTable[SC_SPCOST_RATE] = SI_ATKER_BLOOD;
+	StatusIconChangeTable[SC_COMMONSC_RESIST] = SI_TARGET_BLOOD;
 	// Mercenary Bonus Effects
 	StatusIconChangeTable[SC_MERC_FLEEUP] = SI_MERC_FLEEUP;
 	StatusIconChangeTable[SC_MERC_ATKUP] = SI_MERC_ATKUP;
@@ -5123,6 +5124,8 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
 			case SC_HPREGEN:
 			case SC_HPDRAIN:
 			case SC_SPREGEN:
+			case SC_S_LIFEPOTION:
+			case SC_L_LIFEPOTION:
 			case SC_BOSSMAPINFO:
 			case SC_STUN:
 			case SC_SLEEP:
@@ -5454,6 +5457,8 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
 		case SC_HPREGEN:
 		case SC_HPDRAIN:
 		case SC_SPREGEN:
+		case SC_S_LIFEPOTION:
+		case SC_L_LIFEPOTION:
 			if( val1 == 0 ) return 0;
 			// val1 = heal percent/amout
 			// val2 = seconds between heals
@@ -7059,17 +7064,28 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr data)
 		break;
 
 	case SC_HPREGEN:
-	case SC_SPREGEN:
+	case SC_S_LIFEPOTION:
+	case SC_L_LIFEPOTION:
 		if( sd && --(sce->val4) >= 0 )
 		{
 			// val1 < 0 = per max% | val1 > 0 = exact amount
-			int hp = 0, sp = 0;
-			if( type == SC_HPREGEN && status->hp < status->max_hp )
+			int hp = 0;
+			if( status->hp < status->max_hp )
 				hp = (sce->val1 < 0) ? (int)(sd->status.max_hp * -1 * sce->val1 / 100.) : sce->val1 ;
-			else if( type == SC_SPREGEN && status->sp < status->max_sp )
-				sp = (sce->val1 < 0) ? (int)(sd->status.max_sp * -1 * sce->val1 / 100.) : sce->val1 ;
+			status_heal(bl, hp, 0, 2);
+			sc_timer_next((sce->val2 * 1000) + tick, status_change_timer, bl->id, data);
+			return 0;
+		}
+		break;
 
-			status_heal(bl, hp, sp, 2);
+	case SC_SPREGEN:
+		if( sd && --(sce->val4) >= 0 )
+		{
+			// val1 < 0 = per max% | val1 > 0 = exact amount
+			int sp = 0;
+			if( status->sp < status->max_sp )
+				sp = (sce->val1 < 0) ? (int)(sd->status.max_sp * -1 * sce->val1 / 100.) : sce->val1 ;
+			status_heal(bl, 0, sp, 2);
 			sc_timer_next((sce->val2 * 1000) + tick, status_change_timer, bl->id, data);
 			return 0;
 		}
diff --git a/src/map/status.h b/src/map/status.h
index bae20055f..2893bbe5d 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -310,6 +310,8 @@ typedef enum sc_type {
 	SC_HPDRAIN,
 	SC_SKILLATKBONUS,
 	SC_ITEMSCRIPT,
+	SC_S_LIFEPOTION,
+	SC_L_LIFEPOTION,
 
 	SC_MAX, //Automatically updated max, used in for's to check we are within bounds.
 } sc_type;
@@ -485,15 +487,16 @@ enum si_type {
 	SI_CRITICALWOUND	= 286,
 	SI_DEF_RATE		= 290,
 	SI_MDEF_RATE	= 291,
-	SI_INCCRI		= 292,
-	SI_INCHEALRATE	= 293,
-	SI_HPREGEN		= 294,
-	// 295 Sword ?
-	// 296 4 chars up ?
+
+	SI_INCHEALRATE	= 292,
+	SI_S_LIFEPOTION = 293,
+	SI_L_LIFEPOTION = 294,
+	SI_INCCRI		= 295,
+	SI_PLUSAVOIDVALUE = 296,
 	SI_SPCOST_RATE  = 298,
-	// 300 Stars ?
-	SI_COMMONSC_RESIST	= 301,
-	SI_ARMOR_RESIST	= 302,
+	SI_ATKER_BLOOD = 300,
+	SI_TARGET_BLOOD = 301,
+	SI_ARMOR_PROPERTY = 302,
 };
 
 // JOINTBEAT stackable ailments
-- 
cgit v1.2.3-70-g09d2