From 1d6c226f2aae2410f9785709aefd88f1a17e6bca Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 1 Oct 2014 17:44:52 +0300 Subject: Move STR stat from net enum into attributes. --- src/being/attributes.h | 1 + src/net/ea/eaprotocol.h | 4 +--- src/net/ea/playerhandler.cpp | 4 ++-- src/net/eathena/attrs.h | 4 +--- src/net/eathena/charserverhandler.cpp | 5 ++++- src/net/eathena/generalhandler.cpp | 2 +- src/net/eathena/playerhandler.cpp | 11 ++++++++--- src/net/tmwa/attrs.h | 4 +--- src/net/tmwa/charserverhandler.cpp | 5 ++++- src/net/tmwa/generalhandler.cpp | 2 +- src/net/tmwa/playerhandler.cpp | 11 ++++++++--- 11 files changed, 32 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/being/attributes.h b/src/being/attributes.h index 2bcb3a332..6bd255f29 100644 --- a/src/being/attributes.h +++ b/src/being/attributes.h @@ -42,6 +42,7 @@ namespace Attributes SKILL_POINTS, CHAR_POINTS, CORR_POINTS, + STR = 13, AGI = 14, VIT = 15, INT = 16, diff --git a/src/net/ea/eaprotocol.h b/src/net/ea/eaprotocol.h index 00240d574..a34681309 100644 --- a/src/net/ea/eaprotocol.h +++ b/src/net/ea/eaprotocol.h @@ -25,9 +25,7 @@ enum { - EA_JOB = 0xa, - - EA_STR = 0xd + EA_JOB = 0xa }; enum diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 96b8e6b23..4bdc2bc8b 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -367,7 +367,7 @@ void PlayerHandler::setStat(const int type, skillDialog->update(); break; case 0x000d: - setStatComplex(EA_STR); + setStatComplex(Attributes::STR); break; case 0x000e: setStatComplex(Attributes::AGI); @@ -455,7 +455,7 @@ void PlayerHandler::setStat(const int type, PlayerInfo::setAttribute(Attributes::MAX_WEIGHT, base); break; case 0x0020: - statusWindow->setPointsNeeded(EA_STR, base); + statusWindow->setPointsNeeded(Attributes::STR, base); break; case 0x0021: statusWindow->setPointsNeeded(Attributes::AGI, base); diff --git a/src/net/eathena/attrs.h b/src/net/eathena/attrs.h index 77eeb5efd..a8db3fec5 100644 --- a/src/net/eathena/attrs.h +++ b/src/net/eathena/attrs.h @@ -27,9 +27,7 @@ namespace EAthena { enum { - JOB = 0xa, - - STR = 0xd + JOB = 0xa }; } // namespace EAthena diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index 0b48e8d80..6a0bd6509 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -198,7 +198,10 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, character->dummy = tempPlayer; for (int i = 0; i < 6; i++) - character->data.mStats[i + STR].base = msg.readUInt8("stat"); + { + character->data.mStats[i + Attributes::STR].base + = msg.readUInt8("stat"); + } tempPlayer->setSprite(SPRITE_SHOE, shoes); tempPlayer->setSprite(SPRITE_GLOVES, gloves); diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp index f94594933..0ddef128a 100644 --- a/src/net/eathena/generalhandler.cpp +++ b/src/net/eathena/generalhandler.cpp @@ -346,7 +346,7 @@ void GeneralHandler::gameStarted() const // protection against double addition attributes. statusWindow->clearAttributes(); - statusWindow->addAttribute(STR, _("Strength"), "str", true); + statusWindow->addAttribute(Attributes::STR, _("Strength"), "str", true); statusWindow->addAttribute(Attributes::AGI, _("Agility"), "agi", true); statusWindow->addAttribute(Attributes::VIT, _("Vitality"), "vit", true); statusWindow->addAttribute(Attributes::INT, diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp index 8e3b8f910..feb8b1046 100644 --- a/src/net/eathena/playerhandler.cpp +++ b/src/net/eathena/playerhandler.cpp @@ -154,7 +154,7 @@ void PlayerHandler::emote(const uint8_t emoteId) const void PlayerHandler::increaseAttribute(const int attr) const { - if (attr >= STR && attr <= Attributes::LUK) + if (attr >= Attributes::STR && attr <= Attributes::LUK) { createOutPacket(CMSG_STAT_UPDATE_REQUEST); outMsg.writeInt16(static_cast(attr)); @@ -291,11 +291,16 @@ void PlayerHandler::processPlayerStatUpdate5(Net::MessageIn &msg) msg.readInt16("char points")); unsigned int val = msg.readUInt8("str"); - PlayerInfo::setStatBase(STR, val); + PlayerInfo::setStatBase(Attributes::STR, val); if (statusWindow) - statusWindow->setPointsNeeded(STR, msg.readUInt8("str cost")); + { + statusWindow->setPointsNeeded(Attributes::STR, + msg.readUInt8("str cost")); + } else + { msg.readUInt8("str need"); + } val = msg.readUInt8("agi"); PlayerInfo::setStatBase(Attributes::AGI, val); diff --git a/src/net/tmwa/attrs.h b/src/net/tmwa/attrs.h index 6ab80ec16..060e44c71 100644 --- a/src/net/tmwa/attrs.h +++ b/src/net/tmwa/attrs.h @@ -27,9 +27,7 @@ namespace TmwAthena { enum { - JOB = 0xa, - - STR = 0xd + JOB = 0xa }; } // namespace TmwAthena diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index adf82cf34..b1d1fa055 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -197,7 +197,10 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, character->dummy = tempPlayer; for (int i = 0; i < 6; i++) - character->data.mStats[i + STR].base = msg.readUInt8("stat"); + { + character->data.mStats[i + Attributes::STR].base + = msg.readUInt8("stat"); + } if (withColors) { diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 04536cd94..a888cb106 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -305,7 +305,7 @@ void GeneralHandler::gameStarted() const statusWindow->clearAttributes(); // TRANSLATORS: player stat - statusWindow->addAttribute(STR, _("Strength"), "str", true); + statusWindow->addAttribute(Attributes::STR, _("Strength"), "str", true); // TRANSLATORS: player stat statusWindow->addAttribute(Attributes::AGI, _("Agility"), "agi", true); // TRANSLATORS: player stat diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 0899e9508..89ba976a9 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -161,7 +161,7 @@ void PlayerHandler::emote(const uint8_t emoteId) const void PlayerHandler::increaseAttribute(const int attr) const { - if (attr >= STR && attr <= Attributes::LUK) + if (attr >= Attributes::STR && attr <= Attributes::LUK) { createOutPacket(CMSG_STAT_UPDATE_REQUEST); outMsg.writeInt16(static_cast(attr)); @@ -359,11 +359,16 @@ void PlayerHandler::processPlayerStatUpdate5(Net::MessageIn &msg) msg.readInt16("char points")); unsigned int val = msg.readUInt8("str"); - PlayerInfo::setStatBase(STR, val); + PlayerInfo::setStatBase(Attributes::STR, val); if (statusWindow) - statusWindow->setPointsNeeded(STR, msg.readUInt8("str cost")); + { + statusWindow->setPointsNeeded(Attributes::STR, + msg.readUInt8("str cost")); + } else + { msg.readUInt8("str cost"); + } val = msg.readUInt8("agi"); PlayerInfo::setStatBase(Attributes::AGI, val); -- cgit v1.2.3-60-g2f50