From 624ddd306ebbd1cfdfd5bf85832ee969e15a619c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 1 Oct 2014 18:38:46 +0300 Subject: Move JOB stat from net enum into attributes. --- src/being/attributes.h | 7 ++++--- src/being/localplayer.cpp | 2 +- src/gui/windows/chatwindow.cpp | 2 +- src/gui/windows/ministatuswindow.cpp | 7 +++---- src/gui/windows/statuswindow.cpp | 8 ++++---- src/net/ea/eaprotocol.h | 5 ----- src/net/ea/playerhandler.cpp | 15 +++++---------- src/net/ea/playerhandler.h | 2 -- src/net/eathena/attrs.h | 4 ---- src/net/eathena/charserverhandler.cpp | 2 +- src/net/playerhandler.h | 2 -- src/net/tmwa/attrs.h | 4 ---- src/net/tmwa/charserverhandler.cpp | 2 +- 13 files changed, 20 insertions(+), 42 deletions(-) diff --git a/src/being/attributes.h b/src/being/attributes.h index 6bd255f29..74ae7529e 100644 --- a/src/being/attributes.h +++ b/src/being/attributes.h @@ -39,15 +39,16 @@ namespace Attributes MONEY, TOTAL_WEIGHT, MAX_WEIGHT, - SKILL_POINTS, - CHAR_POINTS, - CORR_POINTS, + JOB = 10, STR = 13, AGI = 14, VIT = 15, INT = 16, DEX = 17, LUK = 18, + SKILL_POINTS, + CHAR_POINTS, + CORR_POINTS, ATTACK_DELAY = 100, ATTACK_RANGE = 101, WALK_SPEED = 102, diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 3f775b321..b747c78bd 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -1037,7 +1037,7 @@ void LocalPlayer::statChanged(const int id, const int oldVal1, const int oldVal2) { - if (!mShowJobExp || id != playerHandler->getJobLocation()) + if (!mShowJobExp || id != Attributes::JOB) return; const std::pair exp = PlayerInfo::getStatExperience(id); diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 7b497e747..559c87704 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -920,7 +920,7 @@ void ChatWindow::statChanged(const int id, if (!mShowBattleEvents || !config.getBoolValue("showJobExp")) return; - if (id != playerHandler->getJobLocation()) + if (id != Attributes::JOB) return; const std::pair exp = PlayerInfo::getStatExperience(id); diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index dcf60d021..40d4c1124 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -121,7 +121,7 @@ MiniStatusWindow::MiniStatusWindow() : if (gameHandler->canUseMagicBar() && statusWindow) statusWindow->updateMPBar(mMpBar); - const int job = playerHandler->getJobLocation() + const int job = Attributes::JOB && serverConfig.getValueBool("showJob", true); StatusWindow::updateXPBar(mXpBar); @@ -382,12 +382,11 @@ void MiniStatusWindow::mouseMoved(MouseEvent &event) else if (event.getSource() == mJobBar) { const std::pair exp = PlayerInfo::getStatExperience( - playerHandler->getJobLocation()); + Attributes::JOB); // TRANSLATORS: job bar label const std::string level = strprintf(_("Job level: %d"), - PlayerInfo::getStatBase( - playerHandler->getJobLocation())); + PlayerInfo::getStatBase(Attributes::JOB)); if (exp.first > exp.second) { diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index b2825c1e7..227528b20 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -128,8 +128,8 @@ StatusWindow::StatusWindow() : getThemeColor(Theme::XP_BAR_OUTLINE)); const bool magicBar = gameHandler->canUseMagicBar(); - const int job = playerHandler->getJobLocation() - && serverConfig.getValueBool("showJob", true); + const int job = Attributes::JOB + && serverConfig.getValueBool("showJob", true); if (magicBar) { @@ -264,7 +264,7 @@ void StatusWindow::statChanged(const int id, if (blocked) return; - if (id == playerHandler->getJobLocation()) + if (id == Attributes::JOB) { if (mJobLvlLabel) { @@ -522,7 +522,7 @@ void StatusWindow::updateJobBar(ProgressBar *const bar, const bool percent) return; const std::pair exp = PlayerInfo::getStatExperience( - playerHandler->getJobLocation()); + Attributes::JOB); updateProgressBar(bar, exp.first, exp.second, percent); } diff --git a/src/net/ea/eaprotocol.h b/src/net/ea/eaprotocol.h index a34681309..589e7bdcd 100644 --- a/src/net/ea/eaprotocol.h +++ b/src/net/ea/eaprotocol.h @@ -23,11 +23,6 @@ #ifndef NET_EA_EAPROTOCOL_H #define NET_EA_EAPROTOCOL_H -enum -{ - EA_JOB = 0xa -}; - enum { EA_SPRITE_BASE = 0, diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 4bdc2bc8b..8a2b2bf30 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -279,11 +279,6 @@ bool PlayerHandler::canUseMagic() const return PlayerInfo::getStatEffective(Attributes::MATK) > 0; } -int PlayerHandler::getJobLocation() const -{ - return EA_JOB; -} - #define setStatComplex(stat) \ PlayerInfo::setStatBase(stat, base, notify); \ if (mod != -1) \ @@ -306,8 +301,8 @@ void PlayerHandler::setStat(const int type, PlayerInfo::setAttribute(Attributes::EXP, base); break; case 0x0002: - PlayerInfo::setStatExperience(EA_JOB, base, - PlayerInfo::getStatExperience(EA_JOB).second); + PlayerInfo::setStatExperience(Attributes::JOB, base, + PlayerInfo::getStatExperience(Attributes::JOB).second); break; case 0x0003: PlayerInfo::setStatBase(Attributes::KARMA, base); @@ -406,8 +401,8 @@ void PlayerHandler::setStat(const int type, PlayerInfo::setAttribute(Attributes::EXP_NEEDED, base); break; case 0x0017: - PlayerInfo::setStatExperience(EA_JOB, - PlayerInfo::getStatExperience(EA_JOB).first, base); + PlayerInfo::setStatExperience(Attributes::JOB, + PlayerInfo::getStatExperience(Attributes::JOB).first, base); break; case 0x0018: if (!weightNotice && config.getBoolValue("weightMsg")) @@ -517,7 +512,7 @@ void PlayerHandler::setStat(const int type, PlayerInfo::updateAttrs(); break; case 0x0037: - PlayerInfo::setStatBase(EA_JOB, base); + PlayerInfo::setStatBase(Attributes::JOB, base); break; default: diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h index cfde84a6e..8c530b29d 100644 --- a/src/net/ea/playerhandler.h +++ b/src/net/ea/playerhandler.h @@ -53,8 +53,6 @@ class PlayerHandler notfinal : public Net::PlayerHandler Vector getDefaultWalkSpeed() const override final A_WARN_UNUSED; - int getJobLocation() 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 a8db3fec5..0c3edfada 100644 --- a/src/net/eathena/attrs.h +++ b/src/net/eathena/attrs.h @@ -25,10 +25,6 @@ namespace EAthena { - enum - { - JOB = 0xa - }; } // namespace EAthena #endif // NET_EATHENA_ATTRS_H diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index 6a0bd6509..9dbdb7cad 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -148,7 +148,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, PlayerInfoBackend &data = character->data; data.mAttributes[Attributes::EXP] = msg.readInt32("exp"); data.mAttributes[Attributes::MONEY] = msg.readInt32("money"); - Stat &jobStat = data.mStats[JOB]; + Stat &jobStat = data.mStats[Attributes::JOB]; jobStat.exp = msg.readInt32("job"); const int temp = msg.readInt32("job level"); diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h index 347f92e67..c5b87e2ae 100644 --- a/src/net/playerhandler.h +++ b/src/net/playerhandler.h @@ -69,8 +69,6 @@ class PlayerHandler notfinal virtual bool canCorrectAttributes() const = 0; - virtual int getJobLocation() 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 060e44c71..869dba3ed 100644 --- a/src/net/tmwa/attrs.h +++ b/src/net/tmwa/attrs.h @@ -25,10 +25,6 @@ namespace TmwAthena { - enum - { - JOB = 0xa - }; } // namespace TmwAthena #endif // NET_TMWA_ATTRS_H diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index b1d1fa055..7d5f7a299 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -146,7 +146,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, PlayerInfoBackend &data = character->data; data.mAttributes[Attributes::EXP] = msg.readInt32("exp"); data.mAttributes[Attributes::MONEY] = msg.readInt32("money"); - Stat &jobStat = data.mStats[static_cast(JOB)]; + Stat &jobStat = data.mStats[static_cast(Attributes::JOB)]; jobStat.exp = msg.readInt32("job"); const int temp = msg.readInt32("job level"); -- cgit v1.2.3-70-g09d2