diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-07-25 02:30:47 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-07-25 02:30:47 +0300 |
commit | c9795055ee1b6079ef9b0c0e3faf4bb79704bd98 (patch) | |
tree | 147357b76a80705cf0af7bc1ec69cf417ef94812 /src/gui | |
parent | 1e5a50f6c67cd20967e139320a6c00f54e15dfe2 (diff) | |
download | mv-c9795055ee1b6079ef9b0c0e3faf4bb79704bd98.tar.gz mv-c9795055ee1b6079ef9b0c0e3faf4bb79704bd98.tar.bz2 mv-c9795055ee1b6079ef9b0c0e3faf4bb79704bd98.tar.xz mv-c9795055ee1b6079ef9b0c0e3faf4bb79704bd98.zip |
Add into player attributes prefix PLAYER_.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/characterdisplay.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/charselectdialog.cpp | 12 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 6 | ||||
-rw-r--r-- | src/gui/windows/killstats.cpp | 39 | ||||
-rw-r--r-- | src/gui/windows/ministatuswindow.cpp | 32 | ||||
-rw-r--r-- | src/gui/windows/skilldialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/statuswindow.cpp | 59 |
7 files changed, 77 insertions, 75 deletions
diff --git a/src/gui/widgets/characterdisplay.cpp b/src/gui/widgets/characterdisplay.cpp index 560e1cb54..7aa9fe795 100644 --- a/src/gui/widgets/characterdisplay.cpp +++ b/src/gui/widgets/characterdisplay.cpp @@ -135,7 +135,7 @@ void CharacterDisplay::mouseMoved(MouseEvent &event A_UNUSED) // TRANSLATORS: character level strprintf(_("Level: %u"), CAST_U32( - mCharacter->data.mAttributes[Attributes::LEVEL])), + mCharacter->data.mAttributes[Attributes::PLAYER_LEVEL])), // TRANSLATORS: character money strprintf(_("Money: %s"), Units::formatCurrency( mCharacter->data.mAttributes[Attributes::MONEY]).c_str())); diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp index c71d0eb52..4f62ac9ba 100644 --- a/src/gui/windows/charselectdialog.cpp +++ b/src/gui/windows/charselectdialog.cpp @@ -244,17 +244,17 @@ void CharSelectDialog::action(const ActionEvent &event) _("Hp: %u/%u\nMp: %u/%u\nLevel: %u\n" "Experience: %u\nMoney: %s"), CAST_U32( - character->data.mAttributes[Attributes::HP]), + character->data.mAttributes[Attributes::PLAYER_HP]), CAST_U32( - character->data.mAttributes[Attributes::MAX_HP]), + character->data.mAttributes[Attributes::PLAYER_MAX_HP]), CAST_U32( - character->data.mAttributes[Attributes::MP]), + character->data.mAttributes[Attributes::PLAYER_MP]), CAST_U32( - character->data.mAttributes[Attributes::MAX_MP]), + character->data.mAttributes[Attributes::PLAYER_MAX_MP]), CAST_U32( - character->data.mAttributes[Attributes::LEVEL]), + character->data.mAttributes[Attributes::PLAYER_LEVEL]), CAST_U32( - character->data.mAttributes[Attributes::EXP]), + character->data.mAttributes[Attributes::PLAYER_EXP]), Units::formatCurrency( character->data.mAttributes[Attributes::MONEY]).c_str()); CREATEWIDGET(OkDialog, data->getName(), msg, diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index d6081f5c6..c9107b151 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -974,7 +974,7 @@ void ChatWindow::statChanged(const AttributesT id, if (!mShowBattleEvents || !config.getBoolValue("showJobExp")) return; - if (id != Attributes::JOB) + if (id != Attributes::PLAYER_JOB) return; const std::pair<int, int> exp = PlayerInfo::getStatExperience(id); @@ -1000,7 +1000,7 @@ void ChatWindow::attributeChanged(const AttributesT id, PRAGMA45(GCC diagnostic ignored "-Wswitch-enum") switch (id) { - case Attributes::EXP: + case Attributes::PLAYER_EXP: { if (oldVal > newVal) break; @@ -1013,7 +1013,7 @@ void ChatWindow::attributeChanged(const AttributesT id, } break; } - case Attributes::LEVEL: + case Attributes::PLAYER_LEVEL: battleChatLog(std::string("Level: ").append(toString(newVal)), ChatMsgType::BY_SERVER); break; diff --git a/src/gui/windows/killstats.cpp b/src/gui/windows/killstats.cpp index 0be2044ae..c745bc151 100644 --- a/src/gui/windows/killstats.cpp +++ b/src/gui/windows/killstats.cpp @@ -111,8 +111,8 @@ KillStats::KillStats() : if (setupWindow) setupWindow->registerWindowForReset(this); - const int xp(PlayerInfo::getAttribute(Attributes::EXP)); - int xpNextLevel(PlayerInfo::getAttribute(Attributes::EXP_NEEDED)); + const int xp(PlayerInfo::getAttribute(Attributes::PLAYER_EXP)); + int xpNextLevel(PlayerInfo::getAttribute(Attributes::PLAYER_EXP_NEEDED)); if (!xpNextLevel) xpNextLevel = 1; @@ -161,7 +161,7 @@ void KillStats::action(const ActionEvent &event) mKillCounter = 0; mExpCounter = 0; mLine3->setCaption(strprintf("1%% = %d exp, avg mob for 1%%: %s", - PlayerInfo::getAttribute(Attributes::EXP_NEEDED) / 100, "?")); + PlayerInfo::getAttribute(Attributes::PLAYER_EXP_NEEDED) / 100, "?")); // TRANSLATORS: kill stats window label mLine4->setCaption(strprintf(_("Kills: %s, total exp: %s"), "?", "?")); // TRANSLATORS: kill stats window label @@ -200,7 +200,7 @@ void KillStats::resetTimes() void KillStats::gainXp(int xp) { - const int expNeed = PlayerInfo::getAttribute(Attributes::EXP_NEEDED); + const int expNeed = PlayerInfo::getAttribute(Attributes::PLAYER_EXP_NEEDED); if (xp == expNeed) xp = 0; else if (!xp) @@ -229,7 +229,7 @@ void KillStats::gainXp(int xp) if (timeDiff <= 0.001) timeDiff = 1; - const int exp = PlayerInfo::getAttribute(Attributes::EXP); + const int exp = PlayerInfo::getAttribute(Attributes::PLAYER_EXP); // TRANSLATORS: kill stats window label mLine1->setCaption(strprintf(_("Level: %d at %f%%"), localPlayer->getLevel(), static_cast<double>(exp) @@ -292,7 +292,7 @@ void KillStats::recalcStats() // Need Update Exp Counter if (curTime - m1minExpTime > 60) { - const int newExp = PlayerInfo::getAttribute(Attributes::EXP); + const int newExp = PlayerInfo::getAttribute(Attributes::PLAYER_EXP); if (m1minExpTime != 0) m1minSpeed = newExp - m1minExpNum; else @@ -303,7 +303,7 @@ void KillStats::recalcStats() if (curTime != 0 && mLastHost == 0xFF6B66 && cur_time > 1) { - const int newExp = PlayerInfo::getAttribute(Attributes::EXP_NEEDED); + const int newExp = PlayerInfo::getAttribute(Attributes::PLAYER_EXP_NEEDED); if (m1minExpTime != 0) m1minSpeed = newExp - m1minExpNum; mStatsReUpdated = true; @@ -312,7 +312,7 @@ void KillStats::recalcStats() if (curTime - m5minExpTime > 60*5) { - const int newExp = PlayerInfo::getAttribute(Attributes::EXP); + const int newExp = PlayerInfo::getAttribute(Attributes::PLAYER_EXP); if (m5minExpTime != 0) m5minSpeed = newExp - m5minExpNum; else @@ -323,7 +323,7 @@ void KillStats::recalcStats() if (curTime - m15minExpTime > 60*15) { - const int newExp = PlayerInfo::getAttribute(Attributes::EXP); + const int newExp = PlayerInfo::getAttribute(Attributes::PLAYER_EXP); if (m15minExpTime != 0) m15minSpeed = newExp - m15minExpNum; else @@ -346,8 +346,8 @@ void KillStats::update() // TRANSLATORS: kill stats window label mExpTime1Label->setCaption(strprintf(_(" Time for next level: %s"), toString(static_cast<float>((PlayerInfo::getAttribute( - Attributes::EXP_NEEDED) - PlayerInfo::getAttribute( - Attributes::EXP)) / static_cast<float>(m1minSpeed))).c_str())); + Attributes::PLAYER_EXP_NEEDED) - PlayerInfo::getAttribute( + Attributes::PLAYER_EXP)) / static_cast<float>(m1minSpeed))).c_str())); } else { @@ -366,8 +366,8 @@ void KillStats::update() // TRANSLATORS: kill stats window label mExpTime5Label->setCaption(strprintf(_(" Time for next level: %s"), toString(static_cast<float>((PlayerInfo::getAttribute( - Attributes::EXP_NEEDED) - PlayerInfo::getAttribute( - Attributes::EXP)) / m5minSpeed * 5)).c_str())); + Attributes::PLAYER_EXP_NEEDED) - PlayerInfo::getAttribute( + Attributes::PLAYER_EXP)) / m5minSpeed * 5)).c_str())); } else { @@ -388,8 +388,8 @@ void KillStats::update() // TRANSLATORS: kill stats window label mExpTime15Label->setCaption(strprintf(_(" Time for next level: %s"), toString(static_cast<float>((PlayerInfo::getAttribute( - Attributes::EXP_NEEDED) - PlayerInfo::getAttribute( - Attributes::EXP)) / m15minSpeed * 15)).c_str())); + Attributes::PLAYER_EXP_NEEDED) - PlayerInfo::getAttribute( + Attributes::PLAYER_EXP)) / m15minSpeed * 15)).c_str())); } else { @@ -409,17 +409,18 @@ void KillStats::attributeChanged(const AttributesT id, PRAGMA45(GCC diagnostic ignored "-Wswitch-enum") switch (id) { - case Attributes::EXP: - case Attributes::EXP_NEEDED: + case Attributes::PLAYER_EXP: + case Attributes::PLAYER_EXP_NEEDED: gainXp(newVal - oldVal); break; - case Attributes::LEVEL: + case Attributes::PLAYER_LEVEL: mKillCounter = 0; mKillTCounter = 0; mExpCounter = 0; mExpTCounter = 0; mLine3->setCaption(strprintf("1%% = %d exp, avg mob for 1%%: %s", - PlayerInfo::getAttribute(Attributes::EXP_NEEDED) / 100, "?")); + PlayerInfo::getAttribute(Attributes::PLAYER_EXP_NEEDED) / 100, + "?")); mLine4->setCaption(strprintf( // TRANSLATORS: kill stats window label _("Kills: %s, total exp: %s"), "?", "?")); diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index 6bf43d216..b2d89adef 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -274,16 +274,16 @@ void MiniStatusWindow::attributeChanged(const AttributesT id, PRAGMA45(GCC diagnostic ignored "-Wswitch-enum") switch (id) { - case Attributes::HP: - case Attributes::MAX_HP: + case Attributes::PLAYER_HP: + case Attributes::PLAYER_MAX_HP: StatusWindow::updateHPBar(mHpBar); break; - case Attributes::MP: - case Attributes::MAX_MP: + case Attributes::PLAYER_MP: + case Attributes::PLAYER_MAX_MP: statusWindow->updateMPBar(mMpBar); break; - case Attributes::EXP: - case Attributes::EXP_NEEDED: + case Attributes::PLAYER_EXP: + case Attributes::PLAYER_EXP_NEEDED: StatusWindow::updateXPBar(mXpBar); break; case Attributes::TOTAL_WEIGHT: @@ -354,18 +354,18 @@ void MiniStatusWindow::mouseMoved(MouseEvent &event) { // TRANSLATORS: status bar label level = strprintf(_("Level: %d (GM %d)"), - PlayerInfo::getAttribute(Attributes::LEVEL), + PlayerInfo::getAttribute(Attributes::PLAYER_LEVEL), localPlayer->getGMLevel()); } else { // TRANSLATORS: status bar label level = strprintf(_("Level: %d"), - PlayerInfo::getAttribute(Attributes::LEVEL)); + PlayerInfo::getAttribute(Attributes::PLAYER_LEVEL)); } - const int exp = PlayerInfo::getAttribute(Attributes::EXP); - const int expNeed = PlayerInfo::getAttribute(Attributes::EXP_NEEDED); + const int exp = PlayerInfo::getAttribute(Attributes::PLAYER_EXP); + const int expNeed = PlayerInfo::getAttribute(Attributes::PLAYER_EXP_NEEDED); if (exp > expNeed) { textPopup->show(x + rect.x, y + rect.y, level, strprintf("%d/%d", @@ -383,25 +383,25 @@ void MiniStatusWindow::mouseMoved(MouseEvent &event) else if (event.getSource() == mHpBar) { textPopup->show(x + rect.x, y + rect.y, event.getSource()->getId(), - strprintf("%d/%d", PlayerInfo::getAttribute(Attributes::HP), - PlayerInfo::getAttribute(Attributes::MAX_HP))); + strprintf("%d/%d", PlayerInfo::getAttribute(Attributes::PLAYER_HP), + PlayerInfo::getAttribute(Attributes::PLAYER_MAX_HP))); mStatusPopup->hide(); } else if (event.getSource() == mMpBar) { textPopup->show(x + rect.x, y + rect.y, event.getSource()->getId(), - strprintf("%d/%d", PlayerInfo::getAttribute(Attributes::MP), - PlayerInfo::getAttribute(Attributes::MAX_MP))); + strprintf("%d/%d", PlayerInfo::getAttribute(Attributes::PLAYER_MP), + PlayerInfo::getAttribute(Attributes::PLAYER_MAX_MP))); mStatusPopup->hide(); } else if (event.getSource() == mJobBar) { const std::pair<int, int> exp = PlayerInfo::getStatExperience( - Attributes::JOB); + Attributes::PLAYER_JOB); // TRANSLATORS: job bar label const std::string level = strprintf(_("Job level: %d"), - PlayerInfo::getStatBase(Attributes::JOB)); + PlayerInfo::getStatBase(Attributes::PLAYER_JOB)); if (exp.first > exp.second) { diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 562b8471d..eed99542c 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -206,7 +206,7 @@ void SkillDialog::update() { // TRANSLATORS: skills dialog label mPointsLabel->setCaption(strprintf(_("Skill points available: %d"), - PlayerInfo::getAttribute(Attributes::SKILL_POINTS))); + PlayerInfo::getAttribute(Attributes::PLAYER_SKILL_POINTS))); mPointsLabel->adjustSize(); FOR_EACH (SkillMap::const_iterator, it, mSkills) diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index 60aab8ca3..b37896476 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -106,12 +106,12 @@ StatusWindow::StatusWindow() : localPlayer->getRaceName().c_str())); } - int max = PlayerInfo::getAttribute(Attributes::MAX_HP); + int max = PlayerInfo::getAttribute(Attributes::PLAYER_MAX_HP); if (!max) max = 1; mHpBar = new ProgressBar(this, - static_cast<float>(PlayerInfo::getAttribute(Attributes::HP)) + static_cast<float>(PlayerInfo::getAttribute(Attributes::PLAYER_HP)) / static_cast<float>(max), 80, 0, @@ -120,9 +120,9 @@ StatusWindow::StatusWindow() : mHpBar->setColor(getThemeColor(ThemeColorId::HP_BAR), getThemeColor(ThemeColorId::HP_BAR_OUTLINE)); - max = PlayerInfo::getAttribute(Attributes::EXP_NEEDED); + max = PlayerInfo::getAttribute(Attributes::PLAYER_EXP_NEEDED); mXpBar = new ProgressBar(this, - max ? static_cast<float>(PlayerInfo::getAttribute(Attributes::EXP)) + max ? static_cast<float>(PlayerInfo::getAttribute(Attributes::PLAYER_EXP)) / static_cast<float>(max) : static_cast<float>(0), 80, 0, @@ -133,13 +133,13 @@ StatusWindow::StatusWindow() : const bool job = serverConfig.getValueBool("showJob", true); - max = PlayerInfo::getAttribute(Attributes::MAX_MP); + max = PlayerInfo::getAttribute(Attributes::PLAYER_MAX_MP); // TRANSLATORS: status window label mMpLabel = new Label(this, _("MP:")); const bool useMagic = playerHandler->canUseMagic(); mMpBar = new ProgressBar(this, max ? static_cast<float>(PlayerInfo::getAttribute( - Attributes::MAX_MP)) / static_cast<float>(max) + Attributes::PLAYER_MAX_MP)) / static_cast<float>(max) : static_cast<float>(0), 80, 0, @@ -224,7 +224,7 @@ StatusWindow::StatusWindow() : mMoneyLabel->adjustSize(); // TRANSLATORS: status window label mCharacterPointsLabel->setCaption(strprintf(_("Character points: %d"), - PlayerInfo::getAttribute(Attributes::CHAR_POINTS))); + PlayerInfo::getAttribute(Attributes::PLAYER_CHAR_POINTS))); mCharacterPointsLabel->adjustSize(); updateLevelLabel(); @@ -259,14 +259,14 @@ void StatusWindow::updateLevelLabel() { // TRANSLATORS: status window label mLvlLabel->setCaption(strprintf(_("Level: %d (GM %d)"), - PlayerInfo::getAttribute(Attributes::LEVEL), + PlayerInfo::getAttribute(Attributes::PLAYER_LEVEL), localPlayer->getGMLevel())); } else { // TRANSLATORS: status window label mLvlLabel->setCaption(strprintf(_("Level: %d"), - PlayerInfo::getAttribute(Attributes::LEVEL))); + PlayerInfo::getAttribute(Attributes::PLAYER_LEVEL))); } mLvlLabel->adjustSize(); } @@ -279,7 +279,7 @@ void StatusWindow::statChanged(const AttributesT id, if (blocked) return; - if (id == Attributes::JOB) + if (id == Attributes::PLAYER_JOB) { if (mJobLvlLabel) { @@ -339,18 +339,18 @@ void StatusWindow::attributeChanged(const AttributesT id, PRAGMA45(GCC diagnostic ignored "-Wswitch-enum") switch (id) { - case Attributes::HP: - case Attributes::MAX_HP: + case Attributes::PLAYER_HP: + case Attributes::PLAYER_MAX_HP: updateHPBar(mHpBar, true); break; - case Attributes::MP: - case Attributes::MAX_MP: + case Attributes::PLAYER_MP: + case Attributes::PLAYER_MAX_MP: updateMPBar(mMpBar, true); break; - case Attributes::EXP: - case Attributes::EXP_NEEDED: + case Attributes::PLAYER_EXP: + case Attributes::PLAYER_EXP_NEEDED: updateXPBar(mXpBar, false); break; @@ -361,7 +361,7 @@ void StatusWindow::attributeChanged(const AttributesT id, mMoneyLabel->adjustSize(); break; - case Attributes::CHAR_POINTS: + case Attributes::PLAYER_CHAR_POINTS: mCharacterPointsLabel->setCaption(strprintf( // TRANSLATORS: status window label _("Character points: %d"), newVal)); @@ -377,7 +377,7 @@ void StatusWindow::attributeChanged(const AttributesT id, break; // ?? - case Attributes::CORR_POINTS: + case Attributes::PLAYER_CORR_POINTS: // Update all attributes for (Attrs::const_iterator it = mAttrs.begin(); it != mAttrs.end(); ++it) @@ -387,7 +387,7 @@ void StatusWindow::attributeChanged(const AttributesT id, } break; - case Attributes::LEVEL: + case Attributes::PLAYER_LEVEL: // TRANSLATORS: status window label mLvlLabel->setCaption(strprintf(_("Level: %d"), newVal)); mLvlLabel->adjustSize(); @@ -448,8 +448,8 @@ void StatusWindow::updateHPBar(ProgressBar *const bar, const bool showMax) if (!bar) return; - const int hp = PlayerInfo::getAttribute(Attributes::HP); - const int maxHp = PlayerInfo::getAttribute(Attributes::MAX_HP); + const int hp = PlayerInfo::getAttribute(Attributes::PLAYER_HP); + const int maxHp = PlayerInfo::getAttribute(Attributes::PLAYER_MAX_HP); if (showMax) bar->setText(toString(hp).append("/").append(toString(maxHp))); else @@ -467,8 +467,8 @@ void StatusWindow::updateMPBar(ProgressBar *const bar, if (!bar) return; - const int mp = PlayerInfo::getAttribute(Attributes::MP); - const int maxMp = PlayerInfo::getAttribute(Attributes::MAX_MP); + const int mp = PlayerInfo::getAttribute(Attributes::PLAYER_MP); + const int maxMp = PlayerInfo::getAttribute(Attributes::PLAYER_MAX_MP); if (showMax) bar->setText(toString(mp).append("/").append(toString(maxMp))); else @@ -531,8 +531,8 @@ void StatusWindow::updateXPBar(ProgressBar *const bar, const bool percent) if (!bar) return; - updateProgressBar(bar, PlayerInfo::getAttribute(Attributes::EXP), - PlayerInfo::getAttribute(Attributes::EXP_NEEDED), percent); + updateProgressBar(bar, PlayerInfo::getAttribute(Attributes::PLAYER_EXP), + PlayerInfo::getAttribute(Attributes::PLAYER_EXP_NEEDED), percent); } void StatusWindow::updateJobBar(ProgressBar *const bar, const bool percent) @@ -541,7 +541,7 @@ void StatusWindow::updateJobBar(ProgressBar *const bar, const bool percent) return; const std::pair<int, int> exp = PlayerInfo::getStatExperience( - Attributes::JOB); + Attributes::PLAYER_JOB); updateProgressBar(bar, exp.first, exp.second, percent); } @@ -791,7 +791,7 @@ std::string ChangeDisplay::update() mPoints->setCaption(_("Max")); } - mInc->setEnabled(PlayerInfo::getAttribute(Attributes::CHAR_POINTS) + mInc->setEnabled(PlayerInfo::getAttribute(Attributes::PLAYER_CHAR_POINTS) >= mNeeded && mNeeded > 0); return AttrDisplay::update(); @@ -816,8 +816,9 @@ void ChangeDisplay::action(const ActionEvent &event) } const int newpoints = PlayerInfo::getAttribute( - Attributes::CHAR_POINTS) - cnt; - PlayerInfo::setAttribute(Attributes::CHAR_POINTS, newpoints); + Attributes::PLAYER_CHAR_POINTS) - cnt; + PlayerInfo::setAttribute(Attributes::PLAYER_CHAR_POINTS, + newpoints); const int newbase = PlayerInfo::getStatBase(mId) + cnt; PlayerInfo::setStatBase(mId, newbase); |