bool GameObject::isVisibleForInState(Player const* u, bool inVisibleList) const { // Not in world if(!IsInWorld() || !u->IsInWorld()) return false; // Transport always visible at this step implementation if(IsTransport() && IsInMap(u)) return true; // quick check visibility false cases for non-GM-mode if(!u->isGameMaster()) { // despawned and then not visible for non-GM in GM-mode if(!isSpawned()) return false; // special invisibility cases /* TODO: implement trap stealth, take look at spell 2836 if(GetGOInfo()->type == GAMEOBJECT_TYPE_TRAP && GetGOInfo()->trap.stealthed && u->IsHostileTo(GetOwner())) { if(check stuff here) return false; }*/ // Smuggled Mana Cell required 10 invisibility type detection/state if(GetEntry()==187039 && ((u->m_detectInvisibilityMask | u->m_invisibilityMask) & (1<<10))==0) return false; } // check distance return IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false); }
bool DynamicObject::isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const { if(!IsInWorld() || !u->IsInWorld()) return false; // normal case return IsWithinDistInMap(viewPoint, World::GetMaxVisibleDistanceForObject() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false); }
bool Corpse::isVisibleForInState(Player const* player, WorldObject const* viewPoint, bool inVisibleList) const { if (m_type == CORPSE_BONES && player->GetSession()->IsAccountFlagged(ACC_HIDE_BONES)) return false; if (!IsInWorld() || !player->IsInWorld()) return false; return IsWithinDistInMap(viewPoint, viewPoint->GetMap()->GetVisibilityDistance(const_cast<Corpse*>(this), const_cast<Player*>(player)) + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false); }
bool DynamicObject::isVisibleForInState(Player const* player, WorldObject const* viewPoint, bool inVisibleList) const { if (!IsInWorld() || !player->IsInWorld()) return false; if (GetCasterGUID() == player->GetGUID()) return true; return IsWithinDistInMap(viewPoint, GetMap()->GetVisibilityDistance(const_cast<DynamicObject*>(this), const_cast<Player*>(player)) + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false); }
bool DynamicObject::isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const { if (!IsInWorld() || !u->IsInWorld()) return false; // always seen by owner if (GetCasterGuid() == u->GetObjectGuid()) return true; // normal case return IsWithinDistInMap(viewPoint, GetMap()->GetVisibilityDistance() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false); }
bool DynamicObject::isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const { if (!IsInWorld() || !u->IsInWorld()) return false; // always seen by owner if (GetCasterGuid() == u->GetObjectGuid()) return true; if (GetType() == DYNAMIC_OBJECT_RAID_MARKER) { Group const* group = u->GetGroup(); if (!group) return false; if (GetCasterGuid() != group->GetObjectGuid()) return false; } // normal case return IsWithinDistInMap(viewPoint, GetMap()->GetVisibilityDistance() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false); }
bool Corpse::isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const { return IsInWorld() && u->IsInWorld() && IsWithinDistInMap(viewPoint, GetMap()->GetVisibilityDistance() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false); }
bool DynamicObject::isVisibleForInState(Player const* u, bool inVisibleList) const { return IsInWorld() && u->IsInWorld() && !canNeverSee(u) && (IsWithinDistInMap(u->m_seer, World::GetMaxVisibleDistanceForObject() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false)); }
void Pet::Update(uint32 diff) { if (m_removed) // pet already removed, just wait in remove queue, no updates return; if (m_loading) return; switch (m_deathState) { case CORPSE: { if (getPetType() != HUNTER_PET || m_corpseRemoveTime <= time(NULL)) { Remove(PET_SAVE_NOT_IN_SLOT); //hunters' pets never get removed because of death, NEVER! return; } break; } case ALIVE: { // unsummon pet that lost owner Player* owner = GetOwner(); if (!owner || (!IsWithinDistInMap(owner, GetMap()->GetVisibilityRange()) && !isPossessed()) || (isControlled() && !owner->GetPetGUID())) //if (!owner || (!IsWithinDistInMap(owner, GetMap()->GetVisibilityDistance()) && (owner->GetCharmGUID() && (owner->GetCharmGUID() != GetGUID()))) || (isControlled() && !owner->GetPetGUID())) { Remove(PET_SAVE_NOT_IN_SLOT, true); return; } if (isControlled()) { if (owner->GetPetGUID() != GetGUID()) { sLog->outError("Pet %u is not pet of owner %s, removed", GetEntry(), m_owner->GetName()); Remove(getPetType() == HUNTER_PET?PET_SAVE_AS_DELETED:PET_SAVE_NOT_IN_SLOT); return; } } if (m_duration > 0) { if (uint32(m_duration) > diff) m_duration -= diff; else { Remove(getPetType() != SUMMON_PET ? PET_SAVE_AS_DELETED:PET_SAVE_NOT_IN_SLOT); return; } } //regenerate focus for hunter pets or energy for deathknight's ghoul if (m_regenTimer) { if (m_regenTimer > diff) m_regenTimer -= diff; else { switch (getPowerType()) { case POWER_FOCUS: Regenerate(POWER_FOCUS); m_regenTimer += PET_FOCUS_REGEN_INTERVAL - diff; if (!m_regenTimer) ++m_regenTimer; break; // in creature::update //case POWER_ENERGY: // Regenerate(POWER_ENERGY); // m_regenTimer += CREATURE_REGEN_INTERVAL - diff; // if (!m_regenTimer) ++m_regenTimer; // break; default: m_regenTimer = 0; break; } } } if (getPetType() != HUNTER_PET) break; if (m_happinessTimer <= diff) { LoseHappiness(); m_happinessTimer = 7500; } else m_happinessTimer -= diff; break; } default: break; } Creature::Update(diff); }
bool Corpse::isVisibleForInState(Player const* u, bool inVisibleList) const { return IsInWorld() && u->IsInWorld() && IsWithinDistInMap(u->m_seer, World::GetMaxVisibleDistanceForObject() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false); }
bool DynamicObject::isVisibleForInState(Player const* u, bool inVisibleList) const { return IsInWorld() && u->IsInWorld() && IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f)); }
bool GameObject::isVisibleForInState(Player const* u, bool inVisibleList) const { return IsInWorld() && u->IsInWorld() && ( IsTransport() && IsInMap(u) || isSpawned() && IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f)) ); }