Skip to content

Commit

Permalink
add walkthrough update when crossing PROTECTION_LEVEL (#3006)
Browse files Browse the repository at this point in the history
This will fix an issue where the client still thinks it's allowed to walk through a player that leveled up/down beyond the PROTECTION_LEVEL while being within your client's viewport.
  • Loading branch information
Erza committed May 3, 2020
1 parent 14fdc75 commit 273719e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/player.cpp
Expand Up @@ -1644,6 +1644,11 @@ void Player::addExperience(Creature* source, uint64_t exp, bool sendText/* = fal
g_game.changeSpeed(this, 0);
g_game.addCreatureHealth(this);

const uint32_t protectionLevel = static_cast<uint32_t>(g_config.getNumber(ConfigManager::PROTECTION_LEVEL));
if (prevLevel < protectionLevel && level >= protectionLevel) {
g_game.updateCreatureWalkthrough(this);
}

if (party) {
party->updateSharedExperience();
}
Expand Down Expand Up @@ -1720,6 +1725,11 @@ void Player::removeExperience(uint64_t exp, bool sendText/* = false*/)

g_game.changeSpeed(this, 0);
g_game.addCreatureHealth(this);

const uint32_t protectionLevel = static_cast<uint32_t>(g_config.getNumber(ConfigManager::PROTECTION_LEVEL));
if (oldLevel >= protectionLevel && level < protectionLevel) {
g_game.updateCreatureWalkthrough(this);
}

if (party) {
party->updateSharedExperience();
Expand Down

0 comments on commit 273719e

Please sign in to comment.