Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: gain xp rate display with xp boost actived #2875

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/creatures/players/player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1837,11 +1837,14 @@ class Player final : public Creature, public Cylinder, public Bankable {
void setGrindingXpBoost(uint16_t value) {
grindingXpBoost = std::min<uint16_t>(std::numeric_limits<uint16_t>::max(), value);
}
uint16_t getXpBoostPercent() const {
uint16_t getXpBoostPercent(const bool display = false) {
if (display) {
return static_cast<uint16_t>(xpBoostPercent * (baseXpGain / 100));
}
return xpBoostPercent;
}
void setXpBoostPercent(uint16_t percent) {
xpBoostPercent = percent;
void setXpBoostPercent(const uint16_t percent) {
xpBoostPercent = std::min<uint16_t>(std::numeric_limits<uint16_t>::max(), percent);
}
uint16_t getStaminaXpBoost() const {
return staminaXpBoost;
Expand Down
4 changes: 2 additions & 2 deletions src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3489,7 +3489,7 @@ void ProtocolGame::sendCyclopediaCharacterGeneralStats() {
msg.addByte(player->getLevelPercent());
msg.add<uint16_t>(player->getBaseXpGain()); // BaseXPGainRate
msg.add<uint16_t>(player->getGrindingXpBoost()); // LowLevelBonus
msg.add<uint16_t>(player->getXpBoostPercent()); // XPBoost
msg.add<uint16_t>(player->getXpBoostPercent(true)); // XPBoost
msg.add<uint16_t>(player->getStaminaXpBoost()); // StaminaMultiplier(100=x1.0)
msg.add<uint16_t>(player->getXpBoostTime()); // xpBoostRemainingTime
msg.addByte(player->getXpBoostTime() > 0 ? 0x00 : 0x01); // canBuyXpBoost
Expand Down Expand Up @@ -7751,7 +7751,7 @@ void ProtocolGame::AddPlayerStats(NetworkMessage &msg) {
}

msg.add<uint16_t>(player->getGrindingXpBoost()); // low level bonus
msg.add<uint16_t>(player->getXpBoostPercent()); // xp boost
msg.add<uint16_t>(player->getXpBoostPercent(true)); // xp boost
msg.add<uint16_t>(player->getStaminaXpBoost()); // stamina multiplier (100 = 1.0x)

if (!oldProtocol) {
Expand Down
Loading