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); }
void DoCommitmentNasties(void) { int i; zone_lock(lz_world); for (i = 0; i < 60 - getTax(); i++) { UInt32 loc = GetRandomNumber(MapMul()); welem_t world = getWorld(GetRandomNumber(MapMul())); int x = loc % getMapWidth(); int y = loc % getMapHeight(); if ((IsTransport(world)) && (GetRandomNumber(100) > getUpkeep(ue_traffic))) Build_Destroy(x, y); if ((IsWaterPipe(world) || IsPowerLine(world) || IsPowerWater(world)) && (GetRandomNumber(100) > getUpkeep(ue_power))) Build_Destroy(x, y); } zone_unlock(lz_world); }
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)) ); }