From e6eef288f86dcc16aa2b5ba20c9079ead78f17e2 Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Wed, 1 Oct 2014 17:00:39 +0300
Subject: Move ATK stat from net enum into attributes.

---
 src/being/attributes.h             |  3 ++-
 src/being/playerinfo.cpp           | 14 +++++---------
 src/net/ea/eaprotocol.h            |  4 +---
 src/net/ea/playerhandler.cpp       | 11 ++---------
 src/net/ea/playerhandler.h         |  2 --
 src/net/eathena/attrs.h            |  4 +---
 src/net/eathena/generalhandler.cpp |  2 +-
 src/net/eathena/playerhandler.cpp  |  4 ++--
 src/net/playerhandler.h            |  2 --
 src/net/tmwa/attrs.h               |  4 +---
 src/net/tmwa/generalhandler.cpp    |  2 +-
 src/net/tmwa/playerhandler.cpp     |  4 ++--
 12 files changed, 18 insertions(+), 38 deletions(-)

diff --git a/src/being/attributes.h b/src/being/attributes.h
index e7d6498b8..3cb0e05f0 100644
--- a/src/being/attributes.h
+++ b/src/being/attributes.h
@@ -53,7 +53,8 @@ namespace Attributes
         HIT,
         MDEF,
         MATK,
-        DEF
+        DEF,
+        ATK
     };
 }  // namespace Attributes
 
diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp
index 359069471..4f7b714cf 100644
--- a/src/being/playerinfo.cpp
+++ b/src/being/playerinfo.cpp
@@ -370,17 +370,13 @@ void setTrading(const bool trading)
 
 void updateAttrs()
 {
-    const Net::PlayerHandler *const handler = playerHandler;
-    if (!handler)
-        return;
-    const int attr = handler->getAttackLocation();
     const int attackDelay = getStatBase(Attributes::ATTACK_DELAY);
-    if (attr != -1 && attackDelay)
+    if (attackDelay)
     {
-        setStatBase(Attributes::ATTACK_SPEED, getStatBase(attr) * 1000
-            / attackDelay, false);
-        setStatMod(Attributes::ATTACK_SPEED, getStatMod(attr) * 1000
-            / attackDelay, true);
+        setStatBase(Attributes::ATTACK_SPEED,
+            getStatBase(Attributes::ATK) * 1000 / attackDelay, false);
+        setStatMod(Attributes::ATTACK_SPEED,
+            getStatMod(Attributes::ATK) * 1000 / attackDelay, true);
     }
     else
     {
diff --git a/src/net/ea/eaprotocol.h b/src/net/ea/eaprotocol.h
index b1df70a20..98ed935f9 100644
--- a/src/net/ea/eaprotocol.h
+++ b/src/net/ea/eaprotocol.h
@@ -32,9 +32,7 @@ enum
     EA_VIT,
     EA_INT,
     EA_DEX,
-    EA_LUK,
-
-    EA_ATK
+    EA_LUK
 };
 
 enum
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index c12da7bfc..cc2de72c7 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -222,8 +222,6 @@ void PlayerHandler::processPlayerStatUpdate3(Net::MessageIn &msg) const
     const int bonus = msg.readInt32("bonus");
 
     setStat(type, base, bonus, false);
-    if (type == EA_ATK || type == Attributes::ATTACK_DELAY)
-        PlayerInfo::updateAttrs();
     BLOCK_END("PlayerHandler::processPlayerStatUpdate3")
 }
 
@@ -286,11 +284,6 @@ int PlayerHandler::getJobLocation() const
     return EA_JOB;
 }
 
-int PlayerHandler::getAttackLocation() const
-{
-    return EA_ATK;
-}
-
 #define setStatComplex(stat) \
     PlayerInfo::setStatBase(stat, base, notify); \
     if (mod != -1) \
@@ -480,11 +473,11 @@ void PlayerHandler::setStat(const int type,
             statusWindow->setPointsNeeded(EA_LUK, base);
             break;
         case 0x0029:
-            PlayerInfo::setStatBase(EA_ATK, base);
+            PlayerInfo::setStatBase(Attributes::ATK, base);
             PlayerInfo::updateAttrs();
             break;
         case 0x002a:
-            PlayerInfo::setStatMod(EA_ATK, base);
+            PlayerInfo::setStatMod(Attributes::ATK, base);
             PlayerInfo::updateAttrs();
             break;
         case 0x002b:
diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h
index a2e126bc2..cfde84a6e 100644
--- a/src/net/ea/playerhandler.h
+++ b/src/net/ea/playerhandler.h
@@ -55,8 +55,6 @@ class PlayerHandler notfinal : public Net::PlayerHandler
 
         int getJobLocation() const override final A_WARN_UNUSED;
 
-        int getAttackLocation() const override final A_WARN_UNUSED;
-
     protected:
         virtual void setStat(const int type,
                              const int base,
diff --git a/src/net/eathena/attrs.h b/src/net/eathena/attrs.h
index db866c0bc..049aff97f 100644
--- a/src/net/eathena/attrs.h
+++ b/src/net/eathena/attrs.h
@@ -34,9 +34,7 @@ namespace EAthena
         VIT,
         INT,
         DEX,
-        LUK,
-
-        ATK
+        LUK
     };
 }  // namespace EAthena
 
diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp
index 83b55e3bd..bebf22842 100644
--- a/src/net/eathena/generalhandler.cpp
+++ b/src/net/eathena/generalhandler.cpp
@@ -353,7 +353,7 @@ void GeneralHandler::gameStarted() const
     statusWindow->addAttribute(DEX, _("Dexterity"), "dex", true);
     statusWindow->addAttribute(LUK, _("Luck"), "luk", true);
 
-    statusWindow->addAttribute(ATK, _("Attack"));
+    statusWindow->addAttribute(Attributes::ATK, _("Attack"));
     statusWindow->addAttribute(Attributes::DEF, _("Defense"));
     statusWindow->addAttribute(Attributes::MATK, _("M.Attack"));
     statusWindow->addAttribute(Attributes::MDEF, _("M.Defense"));
diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp
index c1412819b..6fca5bb08 100644
--- a/src/net/eathena/playerhandler.cpp
+++ b/src/net/eathena/playerhandler.cpp
@@ -332,8 +332,8 @@ void PlayerHandler::processPlayerStatUpdate5(Net::MessageIn &msg)
     else
         msg.readUInt8("luk cost");
 
-    PlayerInfo::setStatBase(ATK, msg.readInt16("left atk"), false);
-    PlayerInfo::setStatMod(ATK, msg.readInt16("right atk"));
+    PlayerInfo::setStatBase(Attributes::ATK, msg.readInt16("left atk"), false);
+    PlayerInfo::setStatMod(Attributes::ATK, msg.readInt16("right atk"));
     PlayerInfo::updateAttrs();
 
     val = msg.readInt16("right matk");
diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h
index fa4df6da3..347f92e67 100644
--- a/src/net/playerhandler.h
+++ b/src/net/playerhandler.h
@@ -71,8 +71,6 @@ class PlayerHandler notfinal
 
         virtual int getJobLocation() const A_WARN_UNUSED = 0;
 
-        virtual int getAttackLocation() const A_WARN_UNUSED = 0;
-
         virtual Vector getDefaultWalkSpeed() const A_WARN_UNUSED = 0;
 
         virtual void requestOnlineList() const = 0;
diff --git a/src/net/tmwa/attrs.h b/src/net/tmwa/attrs.h
index bd5a0cae4..7009e6400 100644
--- a/src/net/tmwa/attrs.h
+++ b/src/net/tmwa/attrs.h
@@ -34,9 +34,7 @@ namespace TmwAthena
         VIT,
         INT,
         DEX,
-        LUK,
-
-        ATK
+        LUK
     };
 }  // namespace TmwAthena
 
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index ecc320219..5107e873d 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -318,7 +318,7 @@ void GeneralHandler::gameStarted() const
     statusWindow->addAttribute(LUK, _("Luck"), "luk", true);
 
     // TRANSLATORS: player stat
-    statusWindow->addAttribute(ATK, _("Attack"));
+    statusWindow->addAttribute(Attributes::ATK, _("Attack"));
     // TRANSLATORS: player stat
     statusWindow->addAttribute(Attributes::DEF, _("Defense"));
     // TRANSLATORS: player stat
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index 504484217..f94dabfc2 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -400,8 +400,8 @@ void PlayerHandler::processPlayerStatUpdate5(Net::MessageIn &msg)
     else
         msg.readUInt8("luk cost");
 
-    PlayerInfo::setStatBase(ATK, msg.readInt16("atk"), false);
-    PlayerInfo::setStatMod(ATK, msg.readInt16("atk+"));
+    PlayerInfo::setStatBase(Attributes::ATK, msg.readInt16("atk"), false);
+    PlayerInfo::setStatMod(Attributes::ATK, msg.readInt16("atk+"));
     PlayerInfo::updateAttrs();
 
     val = msg.readInt16("matk");
-- 
cgit v1.2.3-70-g09d2