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.
This commit is contained in:
Alejandro Mujica 2019-04-13 18:15:20 -04:00
parent 94399f1a79
commit 76c925111d
3 changed files with 9 additions and 9 deletions

View File

@ -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;
}
}

View File

@ -549,6 +549,7 @@ bool Player::canSeeCreature(const Creature* creature) const
if (!creature->getPlayer() && !canSeeInvisibility() && creature->isInvisible()) {
return false;
}
return true;
}

View File

@ -1786,7 +1786,7 @@ void ProtocolGame::AddCreature(NetworkMessage& msg, const Creature* creature, bo
msg.addByte(std::ceil((static_cast<double>(creature->getHealth()) / std::max<int32_t>(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;