summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-11 19:28:57 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-11 19:28:57 +0300
commit87c59212f8590a8dd72fac3e320fcb2ada781355 (patch)
tree198d627c44f1164140659827a5c782d30bec375b /src/gui
parent02e91411eb9961e95f856bd717d6ca0d8ec0e435 (diff)
downloadplus-87c59212f8590a8dd72fac3e320fcb2ada781355.tar.gz
plus-87c59212f8590a8dd72fac3e320fcb2ada781355.tar.bz2
plus-87c59212f8590a8dd72fac3e320fcb2ada781355.tar.xz
plus-87c59212f8590a8dd72fac3e320fcb2ada781355.zip
Move player attributes into separate file.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/characterdisplay.cpp6
-rw-r--r--src/gui/windows/charselectdialog.cpp16
-rw-r--r--src/gui/windows/chatwindow.cpp5
-rw-r--r--src/gui/windows/inventorywindow.cpp9
-rw-r--r--src/gui/windows/killstats.cpp39
-rw-r--r--src/gui/windows/ministatuswindow.cpp41
-rw-r--r--src/gui/windows/shopwindow.cpp9
-rw-r--r--src/gui/windows/skilldialog.cpp3
-rw-r--r--src/gui/windows/statuswindow.cpp77
-rw-r--r--src/gui/windows/tradewindow.cpp3
10 files changed, 110 insertions, 98 deletions
diff --git a/src/gui/widgets/characterdisplay.cpp b/src/gui/widgets/characterdisplay.cpp
index 941249560..85480db3a 100644
--- a/src/gui/widgets/characterdisplay.cpp
+++ b/src/gui/widgets/characterdisplay.cpp
@@ -24,6 +24,8 @@
#include "units.h"
+#include "being/attributes.h"
+
#include "gui/gui.h"
#include "gui/windows/charselectdialog.h"
@@ -133,9 +135,9 @@ void CharacterDisplay::mouseMoved(MouseEvent &event A_UNUSED)
{
mPopup->show(mouseX, mouseY, name, strprintf(_("Level: %u"),
static_cast<uint32_t>(
- mCharacter->data.mAttributes[PlayerInfo::LEVEL])),
+ mCharacter->data.mAttributes[Attributes::LEVEL])),
strprintf(_("Money: %s"), Units::formatCurrency(
- mCharacter->data.mAttributes[PlayerInfo::MONEY]).c_str()));
+ mCharacter->data.mAttributes[Attributes::MONEY]).c_str()));
}
else
{
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index 4754d01e5..33c46d4cd 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -30,6 +30,8 @@
#include "input/keydata.h"
+#include "being/attributes.h"
+
#include "gui/windows/charcreatedialog.h"
#include "gui/windows/confirmdialog.h"
#include "gui/windows/logindialog.h"
@@ -257,19 +259,19 @@ void CharSelectDialog::action(const ActionEvent &event)
_("Hp: %u/%u\nMp: %u/%u\nLevel: %u\n"
"Experience: %u\nMoney: %s"),
static_cast<uint32_t>(
- character->data.mAttributes[PlayerInfo::HP]),
+ character->data.mAttributes[Attributes::HP]),
static_cast<uint32_t>(
- character->data.mAttributes[PlayerInfo::MAX_HP]),
+ character->data.mAttributes[Attributes::MAX_HP]),
static_cast<uint32_t>(
- character->data.mAttributes[PlayerInfo::MP]),
+ character->data.mAttributes[Attributes::MP]),
static_cast<uint32_t>(
- character->data.mAttributes[PlayerInfo::MAX_MP]),
+ character->data.mAttributes[Attributes::MAX_MP]),
static_cast<uint32_t>(
- character->data.mAttributes[PlayerInfo::LEVEL]),
+ character->data.mAttributes[Attributes::LEVEL]),
static_cast<uint32_t>(
- character->data.mAttributes[PlayerInfo::EXP]),
+ character->data.mAttributes[Attributes::EXP]),
Units::formatCurrency(
- character->data.mAttributes[PlayerInfo::MONEY]).c_str());
+ character->data.mAttributes[Attributes::MONEY]).c_str());
new OkDialog(data->getName(), msg, DIALOG_SILENCE);
}
}
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 316b276f3..e0f4d3c51 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -31,6 +31,7 @@
#include "party.h"
#include "spellshortcut.h"
+#include "being/attributes.h"
#include "being/localplayer.h"
#include "being/playerinfo.h"
#include "being/playerrelations.h"
@@ -983,7 +984,7 @@ void ChatWindow::attributeChanged(const int id,
{
switch (id)
{
- case PlayerInfo::EXP:
+ case Attributes::EXP:
{
if (oldVal > newVal)
break;
@@ -995,7 +996,7 @@ void ChatWindow::attributeChanged(const int id,
}
break;
}
- case PlayerInfo::LEVEL:
+ case Attributes::LEVEL:
battleChatLog(std::string("Level: ").append(toString(newVal)));
break;
default:
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp
index 2122fce2f..cf48e4fd1 100644
--- a/src/gui/windows/inventorywindow.cpp
+++ b/src/gui/windows/inventorywindow.cpp
@@ -26,6 +26,7 @@
#include "item.h"
#include "units.h"
+#include "being/attributes.h"
#include "being/playerinfo.h"
#include "events/keyevent.h"
@@ -566,7 +567,7 @@ void InventoryWindow::mouseMoved(MouseEvent &event)
const Rect &rect = mDimension;
mTextPopup->show(rect.x + x, rect.y + y, strprintf(_("Money: %s"),
Units::formatCurrency(PlayerInfo::getAttribute(
- PlayerInfo::MONEY)).c_str()));
+ Attributes::MONEY)).c_str()));
}
else
{
@@ -694,8 +695,8 @@ void InventoryWindow::updateWeight()
if (!isMainInventory() || !mWeightBar)
return;
- const int total = PlayerInfo::getAttribute(PlayerInfo::TOTAL_WEIGHT);
- const int max = PlayerInfo::getAttribute(PlayerInfo::MAX_WEIGHT);
+ const int total = PlayerInfo::getAttribute(Attributes::TOTAL_WEIGHT);
+ const int max = PlayerInfo::getAttribute(Attributes::MAX_WEIGHT);
if (max <= 0)
return;
@@ -814,6 +815,6 @@ void InventoryWindow::attributeChanged(const int id,
const int oldVal A_UNUSED,
const int newVal A_UNUSED)
{
- if (id == PlayerInfo::TOTAL_WEIGHT || id == PlayerInfo::MAX_WEIGHT)
+ if (id == Attributes::TOTAL_WEIGHT || id == Attributes::MAX_WEIGHT)
updateWeight();
}
diff --git a/src/gui/windows/killstats.cpp b/src/gui/windows/killstats.cpp
index 832892fac..e9dd50d5d 100644
--- a/src/gui/windows/killstats.cpp
+++ b/src/gui/windows/killstats.cpp
@@ -30,6 +30,7 @@
#include "client.h"
#include "game.h"
+#include "being/attributes.h"
#include "being/localplayer.h"
#include "being/playerinfo.h"
@@ -109,8 +110,8 @@ KillStats::KillStats() :
setStickyButtonLock(true);
setDefaultSize(250, 250, 350, 300);
- const int xp(PlayerInfo::getAttribute(PlayerInfo::EXP));
- int xpNextLevel(PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED));
+ const int xp(PlayerInfo::getAttribute(Attributes::EXP));
+ int xpNextLevel(PlayerInfo::getAttribute(Attributes::EXP_NEEDED));
if (!xpNextLevel)
xpNextLevel = 1;
@@ -160,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(PlayerInfo::EXP_NEEDED) / 100, "?"));
+ PlayerInfo::getAttribute(Attributes::EXP_NEEDED) / 100, "?"));
// TRANSLATORS: kill stats window label
mLine4->setCaption(strprintf(_("Kills: %s, total exp: %s"), "?", "?"));
// TRANSLATORS: kill stats window label
@@ -199,7 +200,7 @@ void KillStats::resetTimes()
void KillStats::gainXp(int xp)
{
- const int expNeed = PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED);
+ const int expNeed = PlayerInfo::getAttribute(Attributes::EXP_NEEDED);
if (xp == expNeed)
xp = 0;
else if (!xp)
@@ -227,7 +228,7 @@ void KillStats::gainXp(int xp)
if (timeDiff <= 0.001)
timeDiff = 1;
- const int exp = PlayerInfo::getAttribute(PlayerInfo::EXP);
+ const int exp = PlayerInfo::getAttribute(Attributes::EXP);
// TRANSLATORS: kill stats window label
mLine1->setCaption(strprintf(_("Level: %d at %f%%"),
player_node->getLevel(), static_cast<double>(exp)
@@ -290,7 +291,7 @@ void KillStats::recalcStats()
// Need Update Exp Counter
if (curTime - m1minExpTime > 60)
{
- const int newExp = PlayerInfo::getAttribute(PlayerInfo::EXP);
+ const int newExp = PlayerInfo::getAttribute(Attributes::EXP);
if (m1minExpTime != 0)
m1minSpeed = newExp - m1minExpNum;
else
@@ -301,7 +302,7 @@ void KillStats::recalcStats()
if (curTime != 0 && mLastHost == 0xFF6B66 && cur_time > 1)
{
- const int newExp = PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED);
+ const int newExp = PlayerInfo::getAttribute(Attributes::EXP_NEEDED);
if (m1minExpTime != 0)
m1minSpeed = newExp - m1minExpNum;
mStatsReUpdated = true;
@@ -310,7 +311,7 @@ void KillStats::recalcStats()
if (curTime - m5minExpTime > 60*5)
{
- const int newExp = PlayerInfo::getAttribute(PlayerInfo::EXP);
+ const int newExp = PlayerInfo::getAttribute(Attributes::EXP);
if (m5minExpTime != 0)
m5minSpeed = newExp - m5minExpNum;
else
@@ -321,7 +322,7 @@ void KillStats::recalcStats()
if (curTime - m15minExpTime > 60*15)
{
- const int newExp = PlayerInfo::getAttribute(PlayerInfo::EXP);
+ const int newExp = PlayerInfo::getAttribute(Attributes::EXP);
if (m15minExpTime != 0)
m15minSpeed = newExp - m15minExpNum;
else
@@ -345,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(
- PlayerInfo::EXP_NEEDED) - PlayerInfo::getAttribute(
- PlayerInfo::EXP)) / m1minSpeed)).c_str()));
+ Attributes::EXP_NEEDED) - PlayerInfo::getAttribute(
+ Attributes::EXP)) / m1minSpeed)).c_str()));
}
else
{
@@ -365,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(
- PlayerInfo::EXP_NEEDED) - PlayerInfo::getAttribute(
- PlayerInfo::EXP)) / m5minSpeed * 5)).c_str()));
+ Attributes::EXP_NEEDED) - PlayerInfo::getAttribute(
+ Attributes::EXP)) / m5minSpeed * 5)).c_str()));
}
else
{
@@ -387,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(
- PlayerInfo::EXP_NEEDED) - PlayerInfo::getAttribute(
- PlayerInfo::EXP)) / m15minSpeed * 15)).c_str()));
+ Attributes::EXP_NEEDED) - PlayerInfo::getAttribute(
+ Attributes::EXP)) / m15minSpeed * 15)).c_str()));
}
else
{
@@ -495,17 +496,17 @@ void KillStats::attributeChanged(const int id,
{
switch (id)
{
- case PlayerInfo::EXP:
- case PlayerInfo::EXP_NEEDED:
+ case Attributes::EXP:
+ case Attributes::EXP_NEEDED:
gainXp(newVal - oldVal);
break;
- case PlayerInfo::LEVEL:
+ case Attributes::LEVEL:
mKillCounter = 0;
mKillTCounter = 0;
mExpCounter = 0;
mExpTCounter = 0;
mLine3->setCaption(strprintf("1%% = %d exp, avg mob for 1%%: %s",
- PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED) / 100, "?"));
+ PlayerInfo::getAttribute(Attributes::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 720c1375c..1a8f463e5 100644
--- a/src/gui/windows/ministatuswindow.cpp
+++ b/src/gui/windows/ministatuswindow.cpp
@@ -25,6 +25,7 @@
#include "animatedsprite.h"
#include "configuration.h"
+#include "being/attributes.h"
#include "being/localplayer.h"
#include "being/playerinfo.h"
@@ -267,23 +268,23 @@ void MiniStatusWindow::attributeChanged(const int id,
{
switch (id)
{
- case PlayerInfo::HP:
- case PlayerInfo::MAX_HP:
+ case Attributes::HP:
+ case Attributes::MAX_HP:
StatusWindow::updateHPBar(mHpBar);
break;
- case PlayerInfo::MP:
- case PlayerInfo::MAX_MP:
+ case Attributes::MP:
+ case Attributes::MAX_MP:
statusWindow->updateMPBar(mMpBar);
break;
- case PlayerInfo::EXP:
- case PlayerInfo::EXP_NEEDED:
+ case Attributes::EXP:
+ case Attributes::EXP_NEEDED:
StatusWindow::updateXPBar(mXpBar);
break;
- case PlayerInfo::TOTAL_WEIGHT:
- case PlayerInfo::MAX_WEIGHT:
+ case Attributes::TOTAL_WEIGHT:
+ case Attributes::MAX_WEIGHT:
StatusWindow::updateWeightBar(mWeightBar);
break;
- case PlayerInfo::MONEY:
+ case Attributes::MONEY:
StatusWindow::updateMoneyBar(mMoneyBar);
break;
default:
@@ -339,18 +340,18 @@ void MiniStatusWindow::mouseMoved(MouseEvent &event)
{
// TRANSLATORS: status bar label
level = strprintf(_("Level: %d (GM %d)"),
- PlayerInfo::getAttribute(PlayerInfo::LEVEL),
+ PlayerInfo::getAttribute(Attributes::LEVEL),
player_node->getGMLevel());
}
else
{
// TRANSLATORS: status bar label
level = strprintf(_("Level: %d"),
- PlayerInfo::getAttribute(PlayerInfo::LEVEL));
+ PlayerInfo::getAttribute(Attributes::LEVEL));
}
- const int exp = PlayerInfo::getAttribute(PlayerInfo::EXP);
- const int expNeed = PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED);
+ const int exp = PlayerInfo::getAttribute(Attributes::EXP);
+ const int expNeed = PlayerInfo::getAttribute(Attributes::EXP_NEEDED);
if (exp > expNeed)
{
mTextPopup->show(x + rect.x, y + rect.y, level, strprintf("%d/%d",
@@ -368,15 +369,15 @@ void MiniStatusWindow::mouseMoved(MouseEvent &event)
else if (event.getSource() == mHpBar)
{
mTextPopup->show(x + rect.x, y + rect.y, event.getSource()->getId(),
- strprintf("%d/%d", PlayerInfo::getAttribute(PlayerInfo::HP),
- PlayerInfo::getAttribute(PlayerInfo::MAX_HP)));
+ strprintf("%d/%d", PlayerInfo::getAttribute(Attributes::HP),
+ PlayerInfo::getAttribute(Attributes::MAX_HP)));
mStatusPopup->hide();
}
else if (event.getSource() == mMpBar)
{
mTextPopup->show(x + rect.x, y + rect.y, event.getSource()->getId(),
- strprintf("%d/%d", PlayerInfo::getAttribute(PlayerInfo::MP),
- PlayerInfo::getAttribute(PlayerInfo::MAX_MP)));
+ strprintf("%d/%d", PlayerInfo::getAttribute(Attributes::MP),
+ PlayerInfo::getAttribute(Attributes::MAX_MP)));
mStatusPopup->hide();
}
else if (event.getSource() == mJobBar)
@@ -407,8 +408,8 @@ void MiniStatusWindow::mouseMoved(MouseEvent &event)
{
mTextPopup->show(x + rect.x, y + rect.y, event.getSource()->getId(),
strprintf("%d/%d", PlayerInfo::getAttribute(
- PlayerInfo::TOTAL_WEIGHT),
- PlayerInfo::getAttribute(PlayerInfo::MAX_WEIGHT)));
+ Attributes::TOTAL_WEIGHT),
+ PlayerInfo::getAttribute(Attributes::MAX_WEIGHT)));
mStatusPopup->hide();
}
else if (event.getSource() == mInvSlotsBar)
@@ -428,7 +429,7 @@ void MiniStatusWindow::mouseMoved(MouseEvent &event)
{
mTextPopup->show(x + rect.x, y + rect.y,
event.getSource()->getId(),
- toString(PlayerInfo::getAttribute(PlayerInfo::MONEY)));
+ toString(PlayerInfo::getAttribute(Attributes::MONEY)));
}
else
{
diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp
index b44dcc19e..edd3efbc7 100644
--- a/src/gui/windows/shopwindow.cpp
+++ b/src/gui/windows/shopwindow.cpp
@@ -48,6 +48,7 @@
#include "soundconsts.h"
#include "soundmanager.h"
+#include "being/attributes.h"
#include "being/localplayer.h"
#include "being/playerinfo.h"
#include "being/playerrelations.h"
@@ -593,9 +594,9 @@ void ShopWindow::giveList(const std::string &nick, const int mode)
{
int amount = item->getQuantity();
if (item->getPrice() * amount > PlayerInfo::getAttribute(
- PlayerInfo::MONEY))
+ Attributes::MONEY))
{
- amount = PlayerInfo::getAttribute(PlayerInfo::MONEY)
+ amount = PlayerInfo::getAttribute(Attributes::MONEY)
/ item->getPrice();
}
@@ -655,9 +656,9 @@ void ShopWindow::showList(const std::string &nick, std::string data)
return;
if (buyDialog)
- buyDialog->setMoney(PlayerInfo::getAttribute(PlayerInfo::MONEY));
+ buyDialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY));
if (sellDialog)
- sellDialog->setMoney(PlayerInfo::getAttribute(PlayerInfo::MONEY));
+ sellDialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY));
for (unsigned f = 0; f < data.length(); f += 9)
{
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index 0051dd1e7..b082e65d4 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -27,6 +27,7 @@
#include "effectmanager.h"
#include "itemshortcut.h"
+#include "being/attributes.h"
#include "being/localplayer.h"
#include "gui/font.h"
@@ -408,7 +409,7 @@ void SkillDialog::update()
{
// TRANSLATORS: skills dialog label
mPointsLabel->setCaption(strprintf(_("Skill points available: %d"),
- PlayerInfo::getAttribute(PlayerInfo::SKILL_POINTS)));
+ PlayerInfo::getAttribute(Attributes::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 e76658b05..ae0c4fe80 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -30,6 +30,7 @@
#include "gui/windows/chatwindow.h"
+#include "being/attributes.h"
#include "being/localplayer.h"
#include "being/playerinfo.h"
@@ -188,19 +189,19 @@ StatusWindow::StatusWindow() :
player_node->getRaceName().c_str()));
}
- int max = PlayerInfo::getAttribute(PlayerInfo::MAX_HP);
+ int max = PlayerInfo::getAttribute(Attributes::MAX_HP);
if (!max)
max = 1;
mHpBar = new ProgressBar(this, static_cast<float>(PlayerInfo::getAttribute(
- PlayerInfo::HP)) / static_cast<float>(max), 80, 0, Theme::PROG_HP,
+ Attributes::HP)) / static_cast<float>(max), 80, 0, Theme::PROG_HP,
"hpprogressbar.xml", "hpprogressbar_fill.xml");
mHpBar->setColor(getThemeColor(Theme::HP_BAR),
getThemeColor(Theme::HP_BAR_OUTLINE));
- max = PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED);
+ max = PlayerInfo::getAttribute(Attributes::EXP_NEEDED);
mXpBar = new ProgressBar(this, max ?
- static_cast<float>(PlayerInfo::getAttribute(PlayerInfo::EXP))
+ static_cast<float>(PlayerInfo::getAttribute(Attributes::EXP))
/ static_cast<float>(max) : static_cast<float>(0), 80, 0,
Theme::PROG_EXP, "xpprogressbar.xml", "xpprogressbar_fill.xml");
mXpBar->setColor(getThemeColor(Theme::XP_BAR),
@@ -212,12 +213,12 @@ StatusWindow::StatusWindow() :
if (magicBar)
{
- max = PlayerInfo::getAttribute(PlayerInfo::MAX_MP);
+ max = PlayerInfo::getAttribute(Attributes::MAX_MP);
// TRANSLATORS: status window label
mMpLabel = new Label(this, _("MP:"));
const bool useMagic = Net::getPlayerHandler()->canUseMagic();
mMpBar = new ProgressBar(this, max ? static_cast<float>(
- PlayerInfo::getAttribute(PlayerInfo::MAX_MP))
+ PlayerInfo::getAttribute(Attributes::MAX_MP))
/ static_cast<float>(max) : static_cast<float>(0),
80, 0, useMagic ? Theme::PROG_MP : Theme::PROG_NO_MP,
useMagic ? "mpprogressbar.xml" : "nompprogressbar.xml",
@@ -312,25 +313,25 @@ StatusWindow::StatusWindow() :
// TRANSLATORS: status window label
mMoneyLabel->setCaption(strprintf(_("Money: %s"), Units::formatCurrency(
- PlayerInfo::getAttribute(PlayerInfo::MONEY)).c_str()));
+ PlayerInfo::getAttribute(Attributes::MONEY)).c_str()));
mMoneyLabel->adjustSize();
// TRANSLATORS: status window label
mCharacterPointsLabel->setCaption(strprintf(_("Character points: %d"),
- PlayerInfo::getAttribute(PlayerInfo::CHAR_POINTS)));
+ PlayerInfo::getAttribute(Attributes::CHAR_POINTS)));
mCharacterPointsLabel->adjustSize();
if (player_node && player_node->isGM())
{
// TRANSLATORS: status window label
mLvlLabel->setCaption(strprintf(_("Level: %d (GM %d)"),
- PlayerInfo::getAttribute(PlayerInfo::LEVEL),
+ PlayerInfo::getAttribute(Attributes::LEVEL),
player_node->getGMLevel()));
}
else
{
// TRANSLATORS: status window label
mLvlLabel->setCaption(strprintf(_("Level: %d"),
- PlayerInfo::getAttribute(PlayerInfo::LEVEL)));
+ PlayerInfo::getAttribute(Attributes::LEVEL)));
}
mLvlLabel->adjustSize();
}
@@ -401,29 +402,29 @@ void StatusWindow::attributeChanged(const int id,
{
switch (id)
{
- case PlayerInfo::HP:
- case PlayerInfo::MAX_HP:
+ case Attributes::HP:
+ case Attributes::MAX_HP:
updateHPBar(mHpBar, true);
break;
- case PlayerInfo::MP:
- case PlayerInfo::MAX_MP:
+ case Attributes::MP:
+ case Attributes::MAX_MP:
updateMPBar(mMpBar, true);
break;
- case PlayerInfo::EXP:
- case PlayerInfo::EXP_NEEDED:
+ case Attributes::EXP:
+ case Attributes::EXP_NEEDED:
updateXPBar(mXpBar, false);
break;
- case PlayerInfo::MONEY:
+ case Attributes::MONEY:
// TRANSLATORS: status window label
mMoneyLabel->setCaption(strprintf(_("Money: %s"),
Units::formatCurrency(newVal).c_str()));
mMoneyLabel->adjustSize();
break;
- case PlayerInfo::CHAR_POINTS:
+ case Attributes::CHAR_POINTS:
mCharacterPointsLabel->setCaption(strprintf(
// TRANSLATORS: status window label
_("Character points: %d"), newVal));
@@ -438,7 +439,7 @@ void StatusWindow::attributeChanged(const int id,
}
break;
- case PlayerInfo::CORR_POINTS:
+ case Attributes::CORR_POINTS:
mCorrectionPointsLabel->setCaption(strprintf(
// TRANSLATORS: status window label
_("Correction points: %d"), newVal));
@@ -452,7 +453,7 @@ void StatusWindow::attributeChanged(const int id,
}
break;
- case PlayerInfo::LEVEL:
+ case Attributes::LEVEL:
// TRANSLATORS: status window label
mLvlLabel->setCaption(strprintf(_("Level: %d"), newVal));
mLvlLabel->adjustSize();
@@ -510,8 +511,8 @@ void StatusWindow::updateHPBar(ProgressBar *const bar, const bool showMax)
if (!bar)
return;
- const int hp = PlayerInfo::getAttribute(PlayerInfo::HP);
- const int maxHp = PlayerInfo::getAttribute(PlayerInfo::MAX_HP);
+ const int hp = PlayerInfo::getAttribute(Attributes::HP);
+ const int maxHp = PlayerInfo::getAttribute(Attributes::MAX_HP);
if (showMax)
bar->setText(toString(hp).append("/").append(toString(maxHp)));
else
@@ -529,8 +530,8 @@ void StatusWindow::updateMPBar(ProgressBar *const bar,
if (!bar)
return;
- const int mp = PlayerInfo::getAttribute(PlayerInfo::MP);
- const int maxMp = PlayerInfo::getAttribute(PlayerInfo::MAX_MP);
+ const int mp = PlayerInfo::getAttribute(Attributes::MP);
+ const int maxMp = PlayerInfo::getAttribute(Attributes::MAX_MP);
if (showMax)
bar->setText(toString(mp).append("/").append(toString(maxMp)));
else
@@ -591,8 +592,8 @@ void StatusWindow::updateXPBar(ProgressBar *const bar, const bool percent)
if (!bar)
return;
- updateProgressBar(bar, PlayerInfo::getAttribute(PlayerInfo::EXP),
- PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED), percent);
+ updateProgressBar(bar, PlayerInfo::getAttribute(Attributes::EXP),
+ PlayerInfo::getAttribute(Attributes::EXP_NEEDED), percent);
}
void StatusWindow::updateJobBar(ProgressBar *const bar, const bool percent)
@@ -617,7 +618,7 @@ void StatusWindow::updateWeightBar(ProgressBar *const bar)
if (!bar)
return;
- if (PlayerInfo::getAttribute(PlayerInfo::MAX_WEIGHT) == 0)
+ if (PlayerInfo::getAttribute(Attributes::MAX_WEIGHT) == 0)
{
// TRANSLATORS: status bar label
bar->setText(_("Max"));
@@ -626,8 +627,8 @@ void StatusWindow::updateWeightBar(ProgressBar *const bar)
else
{
const int totalWeight = PlayerInfo::getAttribute(
- PlayerInfo::TOTAL_WEIGHT);
- const int maxWeight = PlayerInfo::getAttribute(PlayerInfo::MAX_WEIGHT);
+ Attributes::TOTAL_WEIGHT);
+ const int maxWeight = PlayerInfo::getAttribute(Attributes::MAX_WEIGHT);
float progress = 1.0F;
if (maxWeight)
{
@@ -645,7 +646,7 @@ void StatusWindow::updateMoneyBar(ProgressBar *const bar)
if (!bar)
return;
- const int money = PlayerInfo::getAttribute(PlayerInfo::MONEY);
+ const int money = PlayerInfo::getAttribute(Attributes::MONEY);
bar->setText(Units::formatCurrency(money));
if (money > 0)
{
@@ -858,9 +859,9 @@ std::string ChangeDisplay::update()
}
if (mDec)
- mDec->setEnabled(PlayerInfo::getAttribute(PlayerInfo::CORR_POINTS));
+ mDec->setEnabled(PlayerInfo::getAttribute(Attributes::CORR_POINTS));
- mInc->setEnabled(PlayerInfo::getAttribute(PlayerInfo::CHAR_POINTS)
+ mInc->setEnabled(PlayerInfo::getAttribute(Attributes::CHAR_POINTS)
>= mNeeded && mNeeded > 0);
return AttrDisplay::update();
@@ -878,12 +879,12 @@ void ChangeDisplay::action(const ActionEvent &event)
event.getSource() == mDec)
{
const int newcorrpoints = PlayerInfo::getAttribute(
- PlayerInfo::CORR_POINTS);
- PlayerInfo::setAttribute(PlayerInfo::CORR_POINTS, newcorrpoints - 1);
+ Attributes::CORR_POINTS);
+ PlayerInfo::setAttribute(Attributes::CORR_POINTS, newcorrpoints - 1);
const int newpoints = PlayerInfo::getAttribute(
- PlayerInfo::CHAR_POINTS) + 1;
- PlayerInfo::setAttribute(PlayerInfo::CHAR_POINTS, newpoints);
+ Attributes::CHAR_POINTS) + 1;
+ PlayerInfo::setAttribute(Attributes::CHAR_POINTS, newpoints);
const int newbase = PlayerInfo::getStatBase(mId) - 1;
PlayerInfo::setStatBase(mId, newbase);
@@ -901,8 +902,8 @@ void ChangeDisplay::action(const ActionEvent &event)
}
const int newpoints = PlayerInfo::getAttribute(
- PlayerInfo::CHAR_POINTS) - cnt;
- PlayerInfo::setAttribute(PlayerInfo::CHAR_POINTS, newpoints);
+ Attributes::CHAR_POINTS) - cnt;
+ PlayerInfo::setAttribute(Attributes::CHAR_POINTS, newpoints);
const int newbase = PlayerInfo::getStatBase(mId) + cnt;
PlayerInfo::setStatBase(mId, newbase);
diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp
index f05cf1cac..985ebdfad 100644
--- a/src/gui/windows/tradewindow.cpp
+++ b/src/gui/windows/tradewindow.cpp
@@ -27,6 +27,7 @@
#include "item.h"
#include "units.h"
+#include "being/attributes.h"
#include "being/localplayer.h"
#include "being/playerinfo.h"
#include "being/playerrelations.h"
@@ -379,7 +380,7 @@ void TradeWindow::action(const ActionEvent &event)
return;
int v = atoi(mMoneyField->getText().c_str());
- const int curMoney = PlayerInfo::getAttribute(PlayerInfo::MONEY);
+ const int curMoney = PlayerInfo::getAttribute(Attributes::MONEY);
if (v > curMoney)
{
if (localChatTab)