From 9429dc4f5b5b6102a8b575de25ce5d8e7170551f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 27 Sep 2017 22:35:38 +0300 Subject: Change player job level, exp from stat object to attribute. --- src/gui/windows/ministatuswindow.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'src/gui/windows/ministatuswindow.cpp') diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index fcaff8759..c97fa1cd4 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -407,24 +407,36 @@ void MiniStatusWindow::mouseMoved(MouseEvent &event) } else if (event.getSource() == mJobBar) { - const std::pair exp = PlayerInfo::getStatExperience( + const int64_t exp = PlayerInfo::getAttribute64( + Attributes::PLAYER_JOB_EXP); + const int64_t expNeed = PlayerInfo::getAttribute64( + Attributes::PLAYER_JOB_EXP_NEEDED); + const int32_t jobLevel = PlayerInfo::getAttribute( Attributes::PLAYER_JOB); + const std::string expStr = toString(CAST_U64(exp)); + const std::string expNeedStr = toString(CAST_U64(expNeed)); + const std::string jobLevelStr = toString(CAST_U64(jobLevel)); + const std::string expLeftStr = toString(CAST_U64(expNeed - exp)); // TRANSLATORS: job bar label const std::string level = strprintf(_("Job level: %d"), - PlayerInfo::getStatBase(Attributes::PLAYER_JOB)); + jobLevel); - if (exp.first > exp.second) + if (exp > expNeed) { - textPopup->show(x + rect.x, y + rect.y, level, - strprintf("%d/%d", exp.first, exp.second)); + textPopup->show(x + rect.x, + y + rect.y, + level, + strprintf("%s/%s", expStr.c_str(), expNeedStr.c_str())); } else { - textPopup->show(x + rect.x, y + rect.y, level, - strprintf("%d/%d", exp.first, exp.second), + textPopup->show(x + rect.x, + y + rect.y, + level, + strprintf("%s/%s", expStr.c_str(), expNeedStr.c_str()), // TRANSLATORS: status bar label - strprintf("%s: %d", _("Need"), exp.second - exp.first)); + strprintf("%s: %s", _("Need"), expLeftStr.c_str())); } mStatusPopup->hide(); } -- cgit v1.2.3-70-g09d2