summaryrefslogtreecommitdiff
path: root/src/gui/ministatus.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-01-19 18:46:30 +0200
committerAndrei Karas <akaras@inbox.ru>2011-01-19 18:46:30 +0200
commit4fb5f3455e1f817348c02e6f5c42e3979dd51d64 (patch)
treed5da0b09088964c68cc8391ced5113129ab89990 /src/gui/ministatus.cpp
parent2db104b657d0403f1b8ce2eb2dc8ada4ee9d7f73 (diff)
downloadmv-4fb5f3455e1f817348c02e6f5c42e3979dd51d64.tar.gz
mv-4fb5f3455e1f817348c02e6f5c42e3979dd51d64.tar.bz2
mv-4fb5f3455e1f817348c02e6f5c42e3979dd51d64.tar.xz
mv-4fb5f3455e1f817348c02e6f5c42e3979dd51d64.zip
Add job bar to ministatus window.
Diffstat (limited to 'src/gui/ministatus.cpp')
-rw-r--r--src/gui/ministatus.cpp48
1 files changed, 45 insertions, 3 deletions
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp
index 406ad7ddd..f892cdc8b 100644
--- a/src/gui/ministatus.cpp
+++ b/src/gui/ministatus.cpp
@@ -67,22 +67,50 @@ MiniStatusWindow::MiniStatusWindow():
mMpBar = 0;
}
+ int job = Net::getPlayerHandler()->getJobLocation()
+ && serverConfig.getValueBool("showJob", false);
+
mXpBar = new ProgressBar(0, 100, 20, Theme::PROG_EXP);
StatusWindow::updateXPBar(mXpBar);
+ if (job)
+ {
+ mJobBar = new ProgressBar(0, 100, 20, Theme::PROG_JOB);
+ StatusWindow::updateJobBar(mJobBar);
+ }
+ else
+ {
+ mJobBar = 0;
+ }
+
mStatusBar = new ProgressBar(100, 150, 20, Theme::PROG_EXP);
mHpBar->setPosition(0, 3);
if (mMpBar)
+ {
mMpBar->setPosition(mHpBar->getWidth() + 3, 3);
- mXpBar->setPosition(mMpBar ? mMpBar->getX() + mMpBar->getWidth() + 3 :
- mHpBar->getX() + mHpBar->getWidth() + 3, 3);
- mStatusBar->setPosition(mXpBar->getX() + mXpBar->getWidth() + 3, 3);
+ mXpBar->setPosition(mMpBar->getX() + mMpBar->getWidth() + 3, 3);
+ }
+ else
+ {
+ mXpBar->setPosition(mHpBar->getX() + mHpBar->getWidth() + 3, 3);
+ }
+ if (mJobBar)
+ {
+ mJobBar->setPosition(mXpBar->getX() + mXpBar->getWidth() + 3, 3);
+ mStatusBar->setPosition(mJobBar->getX() + mJobBar->getWidth() + 3, 3);
+ }
+ else
+ {
+ mStatusBar->setPosition(mXpBar->getX() + mXpBar->getWidth() + 3, 3);
+ }
add(mHpBar);
if (mMpBar)
add(mMpBar);
add(mXpBar);
+ if (mJobBar)
+ add(mJobBar);
add(mStatusBar);
setContentSize(mStatusBar->getX() + mStatusBar->getWidth(),
@@ -150,6 +178,7 @@ void MiniStatusWindow::event(Channels channel _UNUSED_,
else if (event.getName() == EVENT_UPDATESTAT)
{
StatusWindow::updateMPBar(mMpBar);
+ StatusWindow::updateJobBar(mJobBar);
}
}
@@ -212,6 +241,19 @@ void MiniStatusWindow::mouseMoved(gcn::MouseEvent &event)
PlayerInfo::getAttribute(MAX_MP)));
mStatusPopup->hide();
}
+ else if (event.getSource() == mJobBar)
+ {
+ std::pair<int, int> exp = PlayerInfo::getStatExperience(
+ Net::getPlayerHandler()->getJobLocation());
+
+ mTextPopup->show(x + getX(), y + getY(),
+ strprintf("%u/%u", exp.first,
+ exp.second),
+ strprintf("%s: %u", _("Need"),
+ exp.second
+ - exp.first));
+ mStatusPopup->hide();
+ }
else
{
mTextPopup->hide();