From 675463a45fcbfb05482a4f9398a6cfd9c052043b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 23 Jan 2011 05:21:34 +0200 Subject: Recover job level from job experience. --- src/gui/statuswindow.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 853ea1789..ed29be119 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -324,8 +324,18 @@ void StatusWindow::event(Channels channel _UNUSED_, { if (mJobLvlLabel) { - mJobLvlLabel->setCaption(strprintf(_("Job: %d"), - PlayerInfo::getStatBase(id))); + int lvl = PlayerInfo::getStatBase(id); + if (!lvl) + { + // possible server corrupted and dont send job level, + // then we fixing it :) + std::pair exp + = PlayerInfo::getStatExperience(id); + lvl = (exp.second - 20000) / 150; + PlayerInfo::setStatBase(id, lvl); + } + + mJobLvlLabel->setCaption(strprintf(_("Job: %d"), lvl)); mJobLvlLabel->adjustSize(); updateProgressBar(mJobBar, id, false); -- cgit v1.2.3-70-g09d2