summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-07-06 13:06:12 -0600
committerJared Adams <jaxad0127@gmail.com>2009-07-06 13:06:12 -0600
commit851f67cd9975b090b051decb1deab6b0489d14c5 (patch)
tree05e4256f0ec5128cc0bee41b3992f3c8c0111926 /src/gui
parente0de8a124bf94b79d9d64e5406b21e8598a05d56 (diff)
downloadMana-851f67cd9975b090b051decb1deab6b0489d14c5.tar.gz
Mana-851f67cd9975b090b051decb1deab6b0489d14c5.tar.bz2
Mana-851f67cd9975b090b051decb1deab6b0489d14c5.tar.xz
Mana-851f67cd9975b090b051decb1deab6b0489d14c5.zip
Merge some player stats
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/status.cpp37
-rw-r--r--src/gui/status.h4
-rw-r--r--src/gui/statuswindow.cpp57
-rw-r--r--src/gui/statuswindow.h4
4 files changed, 48 insertions, 54 deletions
diff --git a/src/gui/status.cpp b/src/gui/status.cpp
index eca01725..ea5f63d0 100644
--- a/src/gui/status.cpp
+++ b/src/gui/status.cpp
@@ -38,9 +38,8 @@
#include "utils/mathutils.h"
#include "utils/stringutils.h"
-StatusWindow::StatusWindow(LocalPlayer *player):
- Window(player->getName()),
- mPlayer(player),
+StatusWindow::StatusWindow():
+ Window(player_node->getName()),
mCurrency(0)
{
setWindowName("Status");
@@ -171,14 +170,14 @@ void StatusWindow::update()
{
// Status Part
// -----------
- mLvlLabel->setCaption(strprintf(_("Level: %d"), mPlayer->getLevel()));
+ mLvlLabel->setCaption(strprintf(_("Level: %d"), player_node->getLevel()));
mLvlLabel->adjustSize();
- mJobLvlLabel->setCaption(strprintf(_("Job: %d"), mPlayer->mJobLevel));
+ mJobLvlLabel->setCaption(strprintf(_("Job: %d"), player_node->mJobLevel));
mJobLvlLabel->adjustSize();
- if (mCurrency != mPlayer->getMoney()) {
- mCurrency = mPlayer->getMoney();
+ if (mCurrency != player_node->getMoney()) {
+ mCurrency = player_node->getMoney();
mGpLabel->setCaption(strprintf(_("Money: %s"),
Units::formatCurrency(mCurrency).c_str()));
mGpLabel->adjustSize();
@@ -202,20 +201,20 @@ void StatusWindow::update()
N_("Dexterity"),
N_("Luck")
};
- int statusPoints = mPlayer->mStatsPointsToAttribute;
+ int statusPoints = player_node->getCharacterPoints();
// Update labels
for (int i = 0; i < 6; i++)
{
mStatsLabel[i]->setCaption(gettext(attrNames[i]));
- mStatsDisplayLabel[i]->setCaption(toString((int) mPlayer->mAttr[i]));
- mPointsLabel[i]->setCaption(toString((int) mPlayer->mAttrUp[i]));
+ mStatsDisplayLabel[i]->setCaption(toString((int) player_node->mAttr[i]));
+ mPointsLabel[i]->setCaption(toString((int) player_node->mAttrUp[i]));
mStatsLabel[i]->adjustSize();
mStatsDisplayLabel[i]->adjustSize();
mPointsLabel[i]->adjustSize();
- mStatsButton[i]->setEnabled(mPlayer->mAttrUp[i] <= statusPoints);
+ mStatsButton[i]->setEnabled(player_node->mAttrUp[i] <= statusPoints);
}
mRemainingStatsPointsLabel->setCaption(
strprintf(_("Remaining Status Points: %d"), statusPoints));
@@ -225,34 +224,34 @@ void StatusWindow::update()
// Attack TODO: Count equipped Weapons and items attack bonuses
mStatsAttackPoints->setCaption(
- toString(mPlayer->ATK + mPlayer->ATK_BONUS));
+ toString(player_node->ATK + player_node->ATK_BONUS));
mStatsAttackPoints->adjustSize();
// Defense TODO: Count equipped Armors and items defense bonuses
mStatsDefensePoints->setCaption(
- toString(mPlayer->DEF + mPlayer->DEF_BONUS));
+ toString(player_node->DEF + player_node->DEF_BONUS));
mStatsDefensePoints->adjustSize();
// Magic Attack TODO: Count equipped items M.Attack bonuses
mStatsMagicAttackPoints->setCaption(
- toString(mPlayer->MATK + mPlayer->MATK_BONUS));
+ toString(player_node->MATK + player_node->MATK_BONUS));
mStatsMagicAttackPoints->adjustSize();
// Magic Defense TODO: Count equipped items M.Defense bonuses
mStatsMagicDefensePoints->setCaption(
- toString(mPlayer->MDEF + mPlayer->MDEF_BONUS));
+ toString(player_node->MDEF + player_node->MDEF_BONUS));
mStatsMagicDefensePoints->adjustSize();
// Accuracy %
- mStatsAccuracyPoints->setCaption(toString(mPlayer->HIT));
+ mStatsAccuracyPoints->setCaption(toString(player_node->HIT));
mStatsAccuracyPoints->adjustSize();
// Evasion %
- mStatsEvadePoints->setCaption(toString(mPlayer->FLEE));
+ mStatsEvadePoints->setCaption(toString(player_node->FLEE));
mStatsEvadePoints->adjustSize();
// Reflex %
- mStatsReflexPoints->setCaption(toString(mPlayer->DEX / 4)); // + counter
+ mStatsReflexPoints->setCaption(toString(player_node->DEX / 4)); // + counter
mStatsReflexPoints->adjustSize();
}
@@ -400,7 +399,7 @@ static void updateProgressBar(ProgressBar *bar, int value, int max,
void StatusWindow::updateXPBar(ProgressBar *bar, bool percent)
{
updateProgressBar(bar,
- player_node->getXp(),
+ player_node->getLevelProgress(),
player_node->mXpForNextLevel,
percent);
}
diff --git a/src/gui/status.h b/src/gui/status.h
index 403a7d59..3e5df917 100644
--- a/src/gui/status.h
+++ b/src/gui/status.h
@@ -40,7 +40,7 @@ class StatusWindow : public Window, public gcn::ActionListener
/**
* Constructor.
*/
- StatusWindow(LocalPlayer *player);
+ StatusWindow();
/**
* Called when receiving actions from widget.
@@ -63,8 +63,6 @@ class StatusWindow : public Window, public gcn::ActionListener
static void updateJobBar(ProgressBar *bar, bool percent = true);
private:
- LocalPlayer *mPlayer;
-
/**
* Status Part
*/
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index edbf387b..5f29e5a5 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -30,9 +30,8 @@
#include "utils/stringutils.h"
-StatusWindow::StatusWindow(LocalPlayer *player):
- Window(player->getName()),
- mPlayer(player)
+StatusWindow::StatusWindow():
+ Window(player_node->getName())
{
setWindowName("Status");
setResizable(true);
@@ -198,13 +197,13 @@ void StatusWindow::update()
// Status Part
// -----------
mLvlLabel->setCaption( "Level: " +
- toString(mPlayer->getLevel()) +
+ toString(player_node->getLevel()) +
" (" +
- toString(mPlayer->getLevelProgress()) +
+ toString(player_node->getLevelProgress()) +
"%)");
mLvlLabel->adjustSize();
- mMoneyLabel->setCaption("Money: " + toString(mPlayer->getMoney()) + " GP");
+ mMoneyLabel->setCaption("Money: " + toString(player_node->getMoney()) + " GP");
mMoneyLabel->adjustSize();
updateHPBar(mHpBar, true);
@@ -219,16 +218,16 @@ void StatusWindow::update()
"Intelligence",
"Willpower"
};
- int characterPoints = mPlayer->getCharacterPoints();
- int correctionPoints = mPlayer->getCorrectionPoints();
+ int characterPoints = player_node->getCharacterPoints();
+ int correctionPoints = player_node->getCorrectionPoints();
// Update labels
for (int i = 0; i < 6; i++)
{
mStatsLabel[i]->setCaption(attrNames[i]);
mStatsDisplayLabel[i]->setCaption(
strprintf("%d / %d",
- mPlayer->getAttributeEffective(CHAR_ATTR_BEGIN + i),
- mPlayer->getAttributeBase(CHAR_ATTR_BEGIN + i)));
+ player_node->getAttributeEffective(CHAR_ATTR_BEGIN + i),
+ player_node->getAttributeBase(CHAR_ATTR_BEGIN + i)));
mStatsLabel[i]->adjustSize();
mStatsDisplayLabel[i]->adjustSize();
@@ -248,34 +247,34 @@ void StatusWindow::update()
// Attack TODO: Count equipped Weapons and items attack bonuses
mStatsAttackPoints->setCaption(
- toString(mPlayer->ATK + mPlayer->ATK_BONUS));
+ toString(player_node->ATK + player_node->ATK_BONUS));
mStatsAttackPoints->adjustSize();
// Defense TODO: Count equipped Armors and items defense bonuses
mStatsDefensePoints->setCaption(
- toString(mPlayer->DEF + mPlayer->DEF_BONUS));
+ toString(player_node->DEF + player_node->DEF_BONUS));
mStatsDefensePoints->adjustSize();
// Magic Attack TODO: Count equipped items M.Attack bonuses
mStatsMagicAttackPoints->setCaption(
- toString(mPlayer->MATK + mPlayer->MATK_BONUS));
+ toString(player_node->MATK + player_node->MATK_BONUS));
mStatsMagicAttackPoints->adjustSize();
// Magic Defense TODO: Count equipped items M.Defense bonuses
mStatsMagicDefensePoints->setCaption(
- toString(mPlayer->MDEF + mPlayer->MDEF_BONUS));
+ toString(player_node->MDEF + player_node->MDEF_BONUS));
mStatsMagicDefensePoints->adjustSize();
// Accuracy %
- mStatsAccuracyPoints->setCaption(toString(mPlayer->HIT));
+ mStatsAccuracyPoints->setCaption(toString(player_node->HIT));
mStatsAccuracyPoints->adjustSize();
// Evasion %
- mStatsEvadePoints->setCaption(toString(mPlayer->FLEE));
+ mStatsEvadePoints->setCaption(toString(player_node->FLEE));
mStatsEvadePoints->adjustSize();
// Reflex %
- mStatsReflexPoints->setCaption(toString(mPlayer->DEX / 4)); // + counter
+ mStatsReflexPoints->setCaption(toString(player_node->DEX / 4)); // + counter
mStatsReflexPoints->adjustSize();
*/
// Update Second column widgets position
@@ -298,52 +297,52 @@ void StatusWindow::action(const gcn::ActionEvent &event)
// Stats Part
if (eventId == "STR+")
{
- mPlayer->raiseAttribute(LocalPlayer::STR);
+ player_node->raiseAttribute(LocalPlayer::STR);
}
else if (eventId == "AGI+")
{
- mPlayer->raiseAttribute(LocalPlayer::AGI);
+ player_node->raiseAttribute(LocalPlayer::AGI);
}
else if (eventId == "DEX+")
{
- mPlayer->raiseAttribute(LocalPlayer::DEX);
+ player_node->raiseAttribute(LocalPlayer::DEX);
}
else if (eventId == "VIT+")
{
- mPlayer->raiseAttribute(LocalPlayer::VIT);
+ player_node->raiseAttribute(LocalPlayer::VIT);
}
else if (eventId == "INT+")
{
- mPlayer->raiseAttribute(LocalPlayer::INT);
+ player_node->raiseAttribute(LocalPlayer::INT);
}
else if (eventId == "WIL+")
{
- mPlayer->raiseAttribute(LocalPlayer::WIL);
+ player_node->raiseAttribute(LocalPlayer::WIL);
}
else if (eventId == "STR-")
{
- mPlayer->lowerAttribute(LocalPlayer::STR);
+ player_node->lowerAttribute(LocalPlayer::STR);
}
else if (eventId == "AGI-")
{
- mPlayer->lowerAttribute(LocalPlayer::AGI);
+ player_node->lowerAttribute(LocalPlayer::AGI);
}
else if (eventId == "DEX-")
{
- mPlayer->lowerAttribute(LocalPlayer::DEX);
+ player_node->lowerAttribute(LocalPlayer::DEX);
}
else if (eventId == "VIT-")
{
- mPlayer->lowerAttribute(LocalPlayer::VIT);
+ player_node->lowerAttribute(LocalPlayer::VIT);
}
else if (eventId == "INT-")
{
- mPlayer->lowerAttribute(LocalPlayer::INT);
+ player_node->lowerAttribute(LocalPlayer::INT);
}
else if (eventId == "WIL-")
{
- mPlayer->lowerAttribute(LocalPlayer::WIL);
+ player_node->lowerAttribute(LocalPlayer::WIL);
}
}
diff --git a/src/gui/statuswindow.h b/src/gui/statuswindow.h
index 1e2a5097..7b3b8ae0 100644
--- a/src/gui/statuswindow.h
+++ b/src/gui/statuswindow.h
@@ -42,7 +42,7 @@ class StatusWindow : public Window, public gcn::ActionListener
/**
* Constructor.
*/
- StatusWindow(LocalPlayer *player);
+ StatusWindow();
/**
* Called when receiving actions from widget.
@@ -62,8 +62,6 @@ class StatusWindow : public Window, public gcn::ActionListener
static void updateHPBar(ProgressBar *bar, bool showMax = false);
private:
- LocalPlayer *mPlayer;
-
/**
* Status Part
*/