From 82df40f813bf90fd93bbff3aaf8cdb8a92473d27 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 24 Mar 2015 17:22:32 +0300 Subject: eathena: use exp packet to show exp and job messages. --- src/being/localplayer.cpp | 48 +++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) (limited to 'src/being/localplayer.cpp') diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index db37992f6..9da05d898 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -1055,18 +1055,8 @@ void LocalPlayer::optionChanged(const std::string &value) mShowServerPos = config.getBoolValue("showserverpos"); } -void LocalPlayer::statChanged(const int id, - const int oldVal1, - const int oldVal2) +void LocalPlayer::addJobMessage(const int change) { - if (!mShowJobExp || id != Attributes::JOB) - return; - - const std::pair exp = PlayerInfo::getStatExperience(id); - if (oldVal1 > exp.first || !oldVal2) - return; - - const int change = exp.first - oldVal1; if (change != 0 && mMessages.size() < 20) { if (!mMessages.empty()) @@ -1095,6 +1085,34 @@ void LocalPlayer::statChanged(const int id, } } +void LocalPlayer::addXpMessage(const int change) +{ + if (change != 0 && mMessages.size() < 20) + { + // TRANSLATORS: get xp message + addMessageToQueue(strprintf("%d %s", change, _("xp"))); + } +} + +void LocalPlayer::statChanged(const int id, + const int oldVal1, + const int oldVal2) +{ + if (!mShowJobExp || + id != Attributes::JOB || + serverFeatures->haveExpPacket()) + { + return; + } + + const std::pair exp = PlayerInfo::getStatExperience(id); + if (oldVal1 > exp.first || !oldVal2) + return; + + const int change = exp.first - oldVal1; + addJobMessage(change); +} + void LocalPlayer::attributeChanged(const int id, const int oldVal, const int newVal) @@ -1103,15 +1121,13 @@ void LocalPlayer::attributeChanged(const int id, { case Attributes::EXP: { + if (serverFeatures->haveExpPacket()) + break; if (oldVal > newVal) break; const int change = newVal - oldVal; - if (change != 0) - { - // TRANSLATORS: get xp message - addMessageToQueue(strprintf("%d %s", change, _("xp"))); - } + addXpMessage(change); break; } case Attributes::LEVEL: -- cgit v1.2.3-60-g2f50