From 444835e777fbe49959ee8fe99746955018ec45eb Mon Sep 17 00:00:00 2001
From: malufett <malufett.eat.my.binaries@gmail.com>
Date: Thu, 11 Jul 2013 20:56:11 +0800
Subject: Fixed Bug#7498 -Where RE equip atk doesn't properly update status
 window and negative equip atk should now affect atk.

Signed-off-by: malufett <malufett.eat.my.binaries@gmail.com>
---
 src/map/battle.c | 4 ++--
 src/map/pc.c     | 3 +--
 src/map/pc.h     | 3 +--
 src/map/status.c | 4 ++++
 src/map/status.h | 3 +++
 5 files changed, 11 insertions(+), 6 deletions(-)

(limited to 'src')

diff --git a/src/map/battle.c b/src/map/battle.c
index 135247734..2016efa3b 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -444,8 +444,8 @@ int battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, uin
 		if( flag&2 && sd->bonus.arrow_atk )
 			damage += sd->bonus.arrow_atk;
 
-		if( sd->bonus.eatk > 0 )
-			eatk = sd->bonus.eatk;
+		if( sd->battle_status.equip_atk != 0 )
+			eatk = sd->base_status.equip_atk;
 	}
 
 	if( sc && sc->count ){
diff --git a/src/map/pc.c b/src/map/pc.c
index 87e80c264..28d74cfd1 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -2091,8 +2091,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
 		case SP_BASE_ATK:
 			if(sd->state.lr_flag != 2) {
 #ifdef RENEWAL
-				sd->bonus.eatk += val;
-				clif->updatestatus(sd,SP_ATK2);
+				status->equip_atk += val;
 #else
 				bonus = status->batk + val;
 				status->batk = cap_value(bonus, 0, USHRT_MAX);
diff --git a/src/map/pc.h b/src/map/pc.h
index 7f0e8cf46..58dd85083 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -327,7 +327,6 @@ struct map_session_data {
 		int fixcastrate,varcastrate;
 		int add_fixcast,add_varcast;
 		int ematk; // matk bonus from equipment
-		int eatk; // atk bonus from equipment
 	} bonus;
 	// zeroed vars end here.
 	int castrate,delayrate,hprate,sprate,dsprate;
@@ -655,7 +654,7 @@ enum equip_pos {
 // clientside display macros (values to the left/right of the "+")
 #ifdef RENEWAL
 	#define pc_leftside_atk(sd) ((sd)->battle_status.batk)
-	#define pc_rightside_atk(sd) ((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->bonus.eatk )
+	#define pc_rightside_atk(sd) ((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2 + (sd)->battle_status.equip_atk )
 	#define pc_leftside_def(sd) ((sd)->battle_status.def2)
 	#define pc_rightside_def(sd) ((sd)->battle_status.def)
 	#define pc_leftside_mdef(sd) ((sd)->battle_status.mdef2)
diff --git a/src/map/status.c b/src/map/status.c
index 20d88e296..0d8bedc5e 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -4045,6 +4045,10 @@ void status_calc_bl_(struct block_list* bl, enum scb_flag flag, bool first)
 			clif->updatestatus(sd,SP_HP);
 		if(b_status.sp != status->sp)
 			clif->updatestatus(sd,SP_SP);
+#ifdef RENEWAL
+		if(b_status.equip_atk != status->equip_atk)
+			clif->updatestatus(sd,SP_ATK2);
+#endif
 	} else if( bl->type == BL_HOM ) {
 		TBL_HOM* hd = BL_CAST(BL_HOM, bl);
 		if( hd->master && memcmp(&b_status, status, sizeof(struct status_data)) != 0 )
diff --git a/src/map/status.h b/src/map/status.h
index 11a78dc9f..5f8a515f6 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -1632,6 +1632,9 @@ struct status_data {
 		size, race;
 
 	struct weapon_atk rhw, lhw; //Right Hand/Left Hand Weapon.
+#ifdef RENEWAL
+	int equip_atk;
+#endif
 };
 
 //Additional regen data that only players have.
-- 
cgit v1.2.3-70-g09d2