From 76c925111d468da7841fb2c74869b160b7fa77d8 Mon Sep 17 00:00:00 2001 From: Alejandro Mujica Date: Sat, 13 Apr 2019 18:15:20 -0400 Subject: [PATCH] Important bug fixes Fixed an issue that would not let invisible creatures such as the Stalker to become idle, hence never returning visible. Fixed an issue with gamemasters not being able to see invisible creatures that were out of their screen. --- src/monster.cpp | 15 +++++++-------- src/player.cpp | 1 + src/protocolgame.cpp | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/monster.cpp b/src/monster.cpp index d052d71..d50b0fa 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -744,21 +744,20 @@ void Monster::setIdle(bool idle) void Monster::updateIdleStatus() { - bool idle = false; + bool idle = true; if (!isSummon()) { - if (conditions.empty() && targetList.empty()) { - idle = true; - } else if (!conditions.empty()) { - bool hasAggressiveCondition = false; + if (!targetList.empty()) { + // visible target + idle = false; + } else { for (Condition* condition : conditions) { if (condition->getType() >= CONDITION_ENERGY && condition->getType() <= CONDITION_ENERGY) { - hasAggressiveCondition = true; + // monsters with aggressive conditions never become idle + idle = false; break; } } - - idle = !hasAggressiveCondition; } } diff --git a/src/player.cpp b/src/player.cpp index c57a079..db34103 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -549,6 +549,7 @@ bool Player::canSeeCreature(const Creature* creature) const if (!creature->getPlayer() && !canSeeInvisibility() && creature->isInvisible()) { return false; } + return true; } diff --git a/src/protocolgame.cpp b/src/protocolgame.cpp index 48907fc..b6f604f 100644 --- a/src/protocolgame.cpp +++ b/src/protocolgame.cpp @@ -1786,7 +1786,7 @@ void ProtocolGame::AddCreature(NetworkMessage& msg, const Creature* creature, bo msg.addByte(std::ceil((static_cast(creature->getHealth()) / std::max(creature->getMaxHealth(), 1)) * 100)); msg.addByte(creature->getDirection()); - if (!creature->isInGhostMode() && !creature->isInvisible()) { + if (!creature->isInvisible() || !otherPlayer && player->canSeeInvisibility()) { AddOutfit(msg, creature->getCurrentOutfit()); } else { static Outfit_t outfit;