diff options
-rw-r--r-- | src/being/localplayer.cpp | 29 | ||||
-rw-r--r-- | src/being/localplayer.h | 4 | ||||
-rw-r--r-- | src/net/eathena/packetsin.inc | 1 | ||||
-rw-r--r-- | src/net/eathena/playerrecv.cpp | 20 | ||||
-rw-r--r-- | src/net/eathena/playerrecv.h | 1 |
5 files changed, 43 insertions, 12 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 1a12a3808..94fa39a1f 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -1154,10 +1154,11 @@ void LocalPlayer::optionChanged(const std::string &value) } } -void LocalPlayer::addJobMessage(const int change) +void LocalPlayer::addJobMessage(const int64_t change) { if (change != 0 && mMessages.size() < 20) { + const std::string xpStr = toString(CAST_U64(change)); if (!mMessages.empty()) { MessagePair pair = mMessages.back(); @@ -1167,30 +1168,38 @@ void LocalPlayer::addJobMessage(const int change) pair.first.size() - strlen(_("xp")) - 1) { mMessages.pop_back(); - // TRANSLATORS: this is job experience - pair.first.append(strprintf(", %d %s", change, _("job"))); + pair.first.append(strprintf(", %s %s", + xpStr.c_str(), + // TRANSLATORS: this is job experience + _("job"))); mMessages.push_back(pair); } else { - // TRANSLATORS: this is job experience - addMessageToQueue(strprintf("%d %s", change, _("job"))); + addMessageToQueue(strprintf("%s %s", + xpStr.c_str(), + // TRANSLATORS: this is job experience + _("job"))); } } else { - // TRANSLATORS: this is job experience - addMessageToQueue(strprintf("%d %s", change, _("job"))); + addMessageToQueue(strprintf("%s %s", + xpStr.c_str(), + // TRANSLATORS: this is job experience + _("job"))); } } } -void LocalPlayer::addXpMessage(const int change) +void LocalPlayer::addXpMessage(const int64_t change) { if (change != 0 && mMessages.size() < 20) { - // TRANSLATORS: get xp message - addMessageToQueue(strprintf("%d %s", change, _("xp"))); + addMessageToQueue(strprintf("%s %s", + toString(CAST_U64(change)).c_str(), + // TRANSLATORS: get xp message + _("xp"))); } } diff --git a/src/being/localplayer.h b/src/being/localplayer.h index 897e4dc00..e7c38f21c 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -372,11 +372,11 @@ class LocalPlayer final : public Being, void stopAdvert(); - void addXpMessage(const int change); + void addXpMessage(const int64_t change); void addHomunXpMessage(const int change); - void addJobMessage(const int change); + void addJobMessage(const int64_t change); void addHpMessage(const int change); diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc index 69a09b082..b12e6c212 100644 --- a/src/net/eathena/packetsin.inc +++ b/src/net/eathena/packetsin.inc @@ -968,6 +968,7 @@ if (packetVersion >= 20170502) // 20170830 packet(SMSG_PLAYER_STAT_UPDATE_7, 0x0acb, 12, &PlayerRecv::processPlayerStatUpdate7, 20170830); +packet(SMSG_PLAYER_GET_EXP2, 0x0acc, 18, &PlayerRecv::processPlayerGetExp2, 20170830); // 0 // evol always packets diff --git a/src/net/eathena/playerrecv.cpp b/src/net/eathena/playerrecv.cpp index 03290d48d..6b90d8a8e 100644 --- a/src/net/eathena/playerrecv.cpp +++ b/src/net/eathena/playerrecv.cpp @@ -212,6 +212,26 @@ void PlayerRecv::processPlayerGetExp(Net::MessageIn &msg) // need show particle depend on isQuest flag, for now ignored } +void PlayerRecv::processPlayerGetExp2(Net::MessageIn &msg) +{ + if (localPlayer == nullptr) + return; + const BeingId id = msg.readBeingId("player id"); + const int64_t exp = msg.readInt64("exp amount"); + const int stat = msg.readInt16("exp type"); + const bool fromQuest = msg.readInt16("is from quest") != 0; + if (!fromQuest && id == localPlayer->getId()) + { + if (stat == 1) + localPlayer->addXpMessage(exp); + else if (stat == 2) + localPlayer->addJobMessage(exp); + else + UNIMPLEMENTEDPACKETFIELD(stat); + } + // need show particle depend on isQuest flag, for now ignored +} + void PlayerRecv::processWalkResponse(Net::MessageIn &msg) { BLOCK_START("PlayerRecv::processWalkResponse") diff --git a/src/net/eathena/playerrecv.h b/src/net/eathena/playerrecv.h index df3de2715..e9551ce98 100644 --- a/src/net/eathena/playerrecv.h +++ b/src/net/eathena/playerrecv.h @@ -36,6 +36,7 @@ namespace EAthena void processPlayerShowEquip(Net::MessageIn &msg); void processPlayerStatUpdate5(Net::MessageIn &msg); void processPlayerGetExp(Net::MessageIn &msg); + void processPlayerGetExp2(Net::MessageIn &msg); void processPvpInfo(Net::MessageIn &msg); void processPlayerHeal(Net::MessageIn &msg); void processPlayerSkillMessage(Net::MessageIn &msg); |