TrinityCore
Loading...
Searching...
No Matches
Map.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITY_MAP_H
19#define TRINITY_MAP_H
20
21#include "Define.h"
22
23#include "Cell.h"
24#include "DatabaseEnvFwd.h"
25#include "DynamicTree.h"
26#include "GridDefines.h"
27#include "GridRefManager.h"
29#include "MapDefines.h"
30#include "MapReference.h"
31#include "MapRefManager.h"
32#include "MPSCQueue.h"
33#include "ObjectGuid.h"
35#include "SharedDefines.h"
36#include "SpawnData.h"
37#include "Timer.h"
38#include "WorldStateDefines.h"
39#include <bitset>
40#include <list>
41#include <map>
42#include <memory>
43#include <set>
44#include <unordered_set>
45
46class Battleground;
47class BattlegroundMap;
48class CreatureGroup;
49class GameObjectModel;
50class Group;
51class InstanceLock;
52class InstanceMap;
53class InstanceScript;
55class Object;
56class PhaseShift;
57class Player;
58class SpawnedPoolData;
59class TempSummon;
60class TerrainInfo;
61class Unit;
62class Weather;
63class WorldObject;
64class WorldPacket;
67struct MapEntry;
68struct Position;
69struct ScriptAction;
70struct ScriptInfo;
75class Transport;
76enum Difficulty : uint8;
77enum WeatherState : uint32;
78enum class ItemContext : uint8;
79
80namespace Trinity { struct ObjectUpdater; }
81namespace VMAP { enum class ModelIgnoreFlags : uint32; }
82
84{
87 TRANSFER_ABORT_MAX_PLAYERS = 2, // Transfer Aborted: instance is full
88 TRANSFER_ABORT_NOT_FOUND = 3, // Transfer Aborted: instance not found
89 TRANSFER_ABORT_TOO_MANY_INSTANCES = 4, // You have entered too many instances recently.
90 TRANSFER_ABORT_ZONE_IN_COMBAT = 6, // Unable to zone in while an encounter is in progress.
91 TRANSFER_ABORT_INSUF_EXPAN_LVL = 7, // You must have <TBC, WotLK> expansion installed to access this area.
92 TRANSFER_ABORT_DIFFICULTY = 8, // <Normal, Heroic, Epic> difficulty mode is not available for %s.
93 TRANSFER_ABORT_UNIQUE_MESSAGE = 9, // Until you've escaped TLK's grasp, you cannot leave this place!
94 TRANSFER_ABORT_TOO_MANY_REALM_INSTANCES = 10, // Additional instances cannot be launched, please try again later.
95 TRANSFER_ABORT_NEED_GROUP = 11, // Transfer Aborted: you must be in a raid group to enter this instance
96 TRANSFER_ABORT_NOT_FOUND_2 = 12, // Transfer Aborted: instance not found
97 TRANSFER_ABORT_NOT_FOUND_3 = 13, // Transfer Aborted: instance not found
98 TRANSFER_ABORT_NOT_FOUND_4 = 14, // Transfer Aborted: instance not found
99 TRANSFER_ABORT_REALM_ONLY = 15, // All players in the party must be from the same realm to enter %s.
100 TRANSFER_ABORT_MAP_NOT_ALLOWED = 16, // Map cannot be entered at this time.
101 TRANSFER_ABORT_LOCKED_TO_DIFFERENT_INSTANCE = 18, // You are already locked to %s
102 TRANSFER_ABORT_ALREADY_COMPLETED_ENCOUNTER = 19, // You are ineligible to participate in at least one encounter in this instance because you are already locked to an instance in which it has been defeated.
103 TRANSFER_ABORT_DIFFICULTY_NOT_FOUND = 22, // client writes to console "Unable to resolve requested difficultyID %u to actual difficulty for map %d"
104 TRANSFER_ABORT_XREALM_ZONE_DOWN = 24, // Transfer Aborted: cross-realm zone is down
105 TRANSFER_ABORT_SOLO_PLAYER_SWITCH_DIFFICULTY = 26, // This instance is already in progress. You may only switch difficulties from inside the instance.
106 TRANSFER_ABORT_NOT_CROSS_FACTION_COMPATIBLE = 33, // This instance isn't available for cross-faction groups
107};
108
110{
111 TransferAbortParams(TransferAbortReason reason, uint8 arg = 0, int32 mapDifficultyXConditionId = 0)
112 : Reason(reason), Arg(arg), MapDifficultyXConditionId(mapDifficultyXConditionId)
113 {
114 }
115
119
120 operator bool() const { return Reason != TRANSFER_ABORT_NONE; }
121};
122
124{
129};
130
132{
134
136
137 std::unique_ptr<Weather> DefaultWeather;
140
142 {
146 };
147 std::vector<LightOverride> LightOverrides;
148};
149
150#define MIN_UNLOAD_DELAY 1 // immediate unload
151#define MAP_INVALID_ZONE 0xFFFFFFFF
152
153struct RespawnInfo; // forward declaration
155{
156 bool operator()(RespawnInfo const* a, RespawnInfo const* b) const;
157};
158using ZoneDynamicInfoMap = std::unordered_map<uint32 /*zoneId*/, ZoneDynamicInfo>;
160using RespawnInfoMap = std::unordered_map<ObjectGuid::LowType, RespawnInfo*>;
162{
168};
169inline bool CompareRespawnInfo::operator()(RespawnInfo const* a, RespawnInfo const* b) const
170{
171 if (a == b)
172 return false;
173 if (a->respawnTime != b->respawnTime)
174 return (a->respawnTime > b->respawnTime);
175 if (a->spawnId != b->spawnId)
176 return a->spawnId < b->spawnId;
177 ASSERT(a->type != b->type, "Duplicate respawn entry for spawnId (%u," UI64FMTD ") found!", a->type, a->spawnId);
178 return a->type < b->type;
179}
180
183
185{
186 friend class MapReference;
187 public:
188 Map(uint32 id, time_t, uint32 InstanceId, Difficulty SpawnMode);
189 virtual ~Map();
190
191 MapEntry const* GetEntry() const { return i_mapEntry; }
192
193 // currently unused for normal maps
194 bool CanUnload(uint32 diff)
195 {
196 if (!m_unloadTimer)
197 return false;
198
199 if (m_unloadTimer <= diff)
200 return true;
201
202 m_unloadTimer -= diff;
203 return false;
204 }
205
206 virtual bool AddPlayerToMap(Player* player, bool initPlayer = true);
207 virtual void RemovePlayerFromMap(Player*, bool);
208
209 template<class T> bool AddToMap(T *);
210 template<class T> void RemoveFromMap(T *, bool);
211
213 virtual void Update(uint32);
214
215 float GetVisibilityRange() const { return m_VisibleDistance; }
216 //function for setting up visibility distance for maps on per-type/per-Id basis
217 virtual void InitVisibilityDistance();
218
219 void PlayerRelocation(Player*, float x, float y, float z, float orientation);
220 void CreatureRelocation(Creature* creature, float x, float y, float z, float ang, bool respawnRelocationOnFail = true);
221 void GameObjectRelocation(GameObject* go, float x, float y, float z, float orientation, bool respawnRelocationOnFail = true);
222 void DynamicObjectRelocation(DynamicObject* go, float x, float y, float z, float orientation);
223 void AreaTriggerRelocation(AreaTrigger* at, float x, float y, float z, float orientation);
224
225 template<class T, class CONTAINER>
226 void Visit(Cell const& cell, TypeContainerVisitor<T, CONTAINER>& visitor);
227
228 bool IsRemovalGrid(float x, float y) const
229 {
231 return !getNGrid(p.x_coord, p.y_coord) || getNGrid(p.x_coord, p.y_coord)->GetGridState() == GRID_STATE_REMOVAL;
232 }
233 bool IsRemovalGrid(Position const& pos) const { return IsRemovalGrid(pos.GetPositionX(), pos.GetPositionY()); }
234
235 bool IsGridLoaded(uint32 gridId) const { return IsGridLoaded(GridCoord(gridId % MAX_NUMBER_OF_GRIDS, gridId / MAX_NUMBER_OF_GRIDS)); }
236 bool IsGridLoaded(float x, float y) const { return IsGridLoaded(Trinity::ComputeGridCoord(x, y)); }
237 bool IsGridLoaded(Position const& pos) const { return IsGridLoaded(pos.GetPositionX(), pos.GetPositionY()); }
238
239 bool GetUnloadLock(GridCoord const& p) const { return getNGrid(p.x_coord, p.y_coord)->getUnloadLock(); }
240 void SetUnloadLock(GridCoord const& p, bool on) { getNGrid(p.x_coord, p.y_coord)->setUnloadExplicitLock(on); }
241 void LoadGrid(float x, float y);
242 void LoadGridForActiveObject(float x, float y, WorldObject const* object);
243 void LoadAllCells();
244 bool UnloadGrid(NGridType& ngrid, bool pForce);
245 void GridMarkNoUnload(uint32 x, uint32 y);
246 void GridUnmarkNoUnload(uint32 x, uint32 y);
247 void UnloadAll();
248
249 void ResetGridExpiry(NGridType &grid, float factor = 1) const
250 {
251 grid.ResetTimeTracker(time_t(float(i_gridExpiry)*factor));
252 }
253
254 time_t GetGridExpiry() const { return i_gridExpiry; }
255
256 static void InitStateMachine();
257 static void DeleteStateMachine();
258
259 TerrainInfo* GetTerrain() const { return m_terrain.get(); }
260
261 void GetFullTerrainStatusForPosition(PhaseShift const& phaseShift, float x, float y, float z, PositionFullTerrainStatus& data, map_liquidHeaderTypeFlags reqLiquidType = map_liquidHeaderTypeFlags::AllLiquids, float collisionHeight = 2.03128f); // DEFAULT_COLLISION_HEIGHT in Object.h
262 ZLiquidStatus GetLiquidStatus(PhaseShift const& phaseShift, float x, float y, float z, map_liquidHeaderTypeFlags ReqLiquidType, LiquidData* data = nullptr, float collisionHeight = 2.03128f); // DEFAULT_COLLISION_HEIGHT in Object.h
263
264 bool GetAreaInfo(PhaseShift const& phaseShift, float x, float y, float z, uint32& mogpflags, int32& adtId, int32& rootId, int32& groupId);
265 uint32 GetAreaId(PhaseShift const& phaseShift, float x, float y, float z);
266 uint32 GetAreaId(PhaseShift const& phaseShift, Position const& pos) { return GetAreaId(phaseShift, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); }
267 uint32 GetZoneId(PhaseShift const& phaseShift, float x, float y, float z);
268 uint32 GetZoneId(PhaseShift const& phaseShift, Position const& pos) { return GetZoneId(phaseShift, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); }
269 void GetZoneAndAreaId(PhaseShift const& phaseShift, uint32& zoneid, uint32& areaid, float x, float y, float z);
270 void GetZoneAndAreaId(PhaseShift const& phaseShift, uint32& zoneid, uint32& areaid, Position const& pos) { GetZoneAndAreaId(phaseShift, zoneid, areaid, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); }
271
272 float GetMinHeight(PhaseShift const& phaseShift, float x, float y);
273 float GetGridHeight(PhaseShift const& phaseShift, float x, float y);
274 float GetStaticHeight(PhaseShift const& phaseShift, float x, float y, float z, bool checkVMap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH);
275 float GetStaticHeight(PhaseShift const& phaseShift, Position const& pos, bool checkVMap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) { return GetStaticHeight(phaseShift, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), checkVMap, maxSearchDist); }
276 float GetHeight(PhaseShift const& phaseShift, float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) { return std::max<float>(GetStaticHeight(phaseShift, x, y, z, vmap, maxSearchDist), GetGameObjectFloor(phaseShift, x, y, z, maxSearchDist)); }
277 float GetHeight(PhaseShift const& phaseShift, Position const& pos, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) { return GetHeight(phaseShift, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), vmap, maxSearchDist); }
278
279 float GetWaterLevel(PhaseShift const& phaseShift, float x, float y);
280 bool IsInWater(PhaseShift const& phaseShift, float x, float y, float z, LiquidData* data = nullptr);
281 bool IsUnderWater(PhaseShift const& phaseShift, float x, float y, float z);
282
283 float GetWaterOrGroundLevel(PhaseShift const& phaseShift, float x, float y, float z, float* ground = nullptr, bool swim = false, float collisionHeight = 2.03128f); // DEFAULT_COLLISION_HEIGHT in Object.h
284
285 void MoveAllCreaturesInMoveList();
286 void MoveAllGameObjectsInMoveList();
287 void MoveAllDynamicObjectsInMoveList();
288 void MoveAllAreaTriggersInMoveList();
289 void RemoveAllObjectsInRemoveList();
290 virtual void RemoveAllPlayers();
291
292 // used only in MoveAllCreaturesInMoveList and ObjectGridUnloader
293 bool CreatureRespawnRelocation(Creature* c, bool diffGridOnly);
294 bool GameObjectRespawnRelocation(GameObject* go, bool diffGridOnly);
295
296 // assert print helper
297 template <typename T>
298 static bool CheckGridIntegrity(T* object, bool moved, char const* objType);
299
300 uint32 GetInstanceId() const { return i_InstanceId; }
301
302 static TransferAbortParams PlayerCannotEnter(uint32 mapid, Player* player);
303 virtual TransferAbortParams CannotEnter(Player* /*player*/) { return { TRANSFER_ABORT_NONE }; }
304 char const* GetMapName() const;
305
306 // have meaning only for instanced map (that have set real difficulty)
307 Difficulty GetDifficultyID() const { return Difficulty(i_spawnMode); }
308 MapDifficultyEntry const* GetMapDifficulty() const;
309 ItemContext GetDifficultyLootItemContext() const;
310
311 uint32 GetId() const;
312 bool Instanceable() const;
313 bool IsDungeon() const;
314 bool IsNonRaidDungeon() const;
315 bool IsRaid() const;
316 bool IsHeroic() const;
317 bool Is25ManRaid() const;
318 bool IsBattleground() const;
319 bool IsBattleArena() const;
320 bool IsBattlegroundOrArena() const;
321 bool IsScenario() const;
322 bool IsGarrison() const;
323 bool GetEntrancePos(int32& mapid, float& x, float& y);
324
325 void AddObjectToRemoveList(WorldObject* obj);
326 void AddObjectToSwitchList(WorldObject* obj, bool on);
327 virtual void DelayedUpdate(uint32 diff);
328
329 void resetMarkedCells() { marked_cells.reset(); }
330 bool isCellMarked(uint32 pCellId) { return marked_cells.test(pCellId); }
331 void markCell(uint32 pCellId) { marked_cells.set(pCellId); }
332
333 bool HavePlayers() const { return !m_mapRefManager.isEmpty(); }
334 uint32 GetPlayersCountExceptGMs() const;
335 bool ActiveObjectsNearGrid(NGridType const& ngrid) const;
336
337 void AddWorldObject(WorldObject* obj) { i_worldObjects.insert(obj); }
338 void RemoveWorldObject(WorldObject* obj) { i_worldObjects.erase(obj); }
339
340 void SendToPlayers(WorldPacket const* data) const;
341
343 PlayerList const& GetPlayers() const { return m_mapRefManager; }
344
345 template <typename T>
346 void DoOnPlayers(T&& fn)
347 {
348 for (MapReference const& ref : GetPlayers())
349 if (Player* player = ref.GetSource())
350 fn(player);
351 }
352
353 //per-map script storage
354 void ScriptsStart(std::map<uint32, std::multimap<uint32, ScriptInfo>> const& scripts, uint32 id, Object* source, Object* target);
355 void ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* source, Object* target);
356
357 // must called with AddToWorld
358 void AddToActive(WorldObject* obj);
359
360 // must called with RemoveFromWorld
361 void RemoveFromActive(WorldObject* obj);
362
363 template<class T> void SwitchGridContainers(T* obj, bool on);
364 std::unordered_map<ObjectGuid::LowType /*leaderSpawnId*/, CreatureGroup*> CreatureGroupHolder;
365
366 void UpdateIteratorBack(Player* player);
367
368 TempSummon* SummonCreature(uint32 entry, Position const& pos, SummonPropertiesEntry const* properties = nullptr, uint32 duration = 0, WorldObject* summoner = nullptr, uint32 spellId = 0, uint32 vehId = 0, ObjectGuid privateObjectOwner = ObjectGuid::Empty, SmoothPhasingInfo const* smoothPhasingInfo = nullptr);
369 void SummonCreatureGroup(uint8 group, std::list<TempSummon*>* list = nullptr);
370 AreaTrigger* GetAreaTrigger(ObjectGuid const& guid);
371 SceneObject* GetSceneObject(ObjectGuid const& guid);
372 Conversation* GetConversation(ObjectGuid const& guid);
373 Player* GetPlayer(ObjectGuid const& guid);
374 Corpse* GetCorpse(ObjectGuid const& guid);
375 Creature* GetCreature(ObjectGuid const& guid);
376 DynamicObject* GetDynamicObject(ObjectGuid const& guid);
377 GameObject* GetGameObject(ObjectGuid const& guid);
378 Pet* GetPet(ObjectGuid const& guid);
379 Transport* GetTransport(ObjectGuid const& guid);
380 Creature* GetCreatureBySpawnId(ObjectGuid::LowType spawnId) const;
381 GameObject* GetGameObjectBySpawnId(ObjectGuid::LowType spawnId) const;
382 AreaTrigger* GetAreaTriggerBySpawnId(ObjectGuid::LowType spawnId) const;
384 {
385 switch (type)
386 {
388 return reinterpret_cast<WorldObject*>(GetCreatureBySpawnId(spawnId));
390 return reinterpret_cast<WorldObject*>(GetGameObjectBySpawnId(spawnId));
392 return reinterpret_cast<WorldObject*>(GetAreaTriggerBySpawnId(spawnId));
393 default:
394 return nullptr;
395 }
396 }
397
399
400 typedef std::unordered_multimap<ObjectGuid::LowType, Creature*> CreatureBySpawnIdContainer;
401 CreatureBySpawnIdContainer& GetCreatureBySpawnIdStore() { return _creatureBySpawnIdStore; }
402 CreatureBySpawnIdContainer const& GetCreatureBySpawnIdStore() const { return _creatureBySpawnIdStore; }
403
404 typedef std::unordered_multimap<ObjectGuid::LowType, GameObject*> GameObjectBySpawnIdContainer;
405 GameObjectBySpawnIdContainer& GetGameObjectBySpawnIdStore() { return _gameobjectBySpawnIdStore; }
406 GameObjectBySpawnIdContainer const& GetGameObjectBySpawnIdStore() const { return _gameobjectBySpawnIdStore; }
407
408 typedef std::unordered_multimap<ObjectGuid::LowType, AreaTrigger*> AreaTriggerBySpawnIdContainer;
409 AreaTriggerBySpawnIdContainer& GetAreaTriggerBySpawnIdStore() { return _areaTriggerBySpawnIdStore; }
410 AreaTriggerBySpawnIdContainer const& GetAreaTriggerBySpawnIdStore() const { return _areaTriggerBySpawnIdStore; }
411
412 std::unordered_set<Corpse*> const* GetCorpsesInCell(uint32 cellId) const
413 {
414 auto itr = _corpsesByCell.find(cellId);
415 if (itr != _corpsesByCell.end())
416 return &itr->second;
417
418 return nullptr;
419 }
420
421 Corpse* GetCorpseByPlayer(ObjectGuid const& ownerGuid) const
422 {
423 auto itr = _corpsesByPlayer.find(ownerGuid);
424 if (itr != _corpsesByPlayer.end())
425 return itr->second;
426
427 return nullptr;
428 }
429
430 InstanceMap* ToInstanceMap() { if (IsDungeon()) return reinterpret_cast<InstanceMap*>(this); else return nullptr; }
431 InstanceMap const* ToInstanceMap() const { if (IsDungeon()) return reinterpret_cast<InstanceMap const*>(this); return nullptr; }
432
433 BattlegroundMap* ToBattlegroundMap() { if (IsBattlegroundOrArena()) return reinterpret_cast<BattlegroundMap*>(this); else return nullptr; }
434 BattlegroundMap const* ToBattlegroundMap() const { if (IsBattlegroundOrArena()) return reinterpret_cast<BattlegroundMap const*>(this); return nullptr; }
435
436 bool isInLineOfSight(PhaseShift const& phaseShift, float x1, float y1, float z1, float x2, float y2, float z2, LineOfSightChecks checks, VMAP::ModelIgnoreFlags ignoreFlags) const;
437 void Balance() { _dynamicTree.balance(); }
438 void RemoveGameObjectModel(GameObjectModel const& model) { _dynamicTree.remove(model); }
439 void InsertGameObjectModel(GameObjectModel const& model) { _dynamicTree.insert(model); }
440 bool ContainsGameObjectModel(GameObjectModel const& model) const { return _dynamicTree.contains(model);}
441 float GetGameObjectFloor(PhaseShift const& phaseShift, float x, float y, float z, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const
442 {
443 return _dynamicTree.getHeight(x, y, z, maxSearchDist, phaseShift);
444 }
445 bool getObjectHitPos(PhaseShift const& phaseShift, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist);
446
447 virtual ObjectGuid::LowType GetOwnerGuildId(uint32 /*team*/ = TEAM_OTHER) const { return UI64LIT(0); }
448 /*
449 RESPAWN TIMES
450 */
451 time_t GetLinkedRespawnTime(ObjectGuid guid) const;
453 {
454 if (auto map = GetRespawnMapForType(type))
455 {
456 auto it = map->find(spawnId);
457 return (it == map->end()) ? 0 : it->second->respawnTime;
458 }
459 return 0;
460 }
461 time_t GetCreatureRespawnTime(ObjectGuid::LowType spawnId) const { return GetRespawnTime(SPAWN_TYPE_CREATURE, spawnId); }
462 time_t GetGORespawnTime(ObjectGuid::LowType spawnId) const { return GetRespawnTime(SPAWN_TYPE_GAMEOBJECT, spawnId); }
463
464 void UpdatePlayerZoneStats(uint32 oldZone, uint32 newZone);
465
466 void SaveRespawnTime(SpawnObjectType type, ObjectGuid::LowType spawnId, uint32 entry, time_t respawnTime, uint32 gridId, CharacterDatabaseTransaction dbTrans = nullptr, bool startup = false);
467 void SaveRespawnInfoDB(RespawnInfo const& info, CharacterDatabaseTransaction dbTrans = nullptr);
468 void LoadRespawnTimes();
469 void DeleteRespawnTimes() { UnloadAllRespawnInfos(); DeleteRespawnTimesInDB(); }
470 void DeleteRespawnTimesInDB();
471
472 void LoadCorpseData();
473 void DeleteCorpseData();
474 void AddCorpse(Corpse* corpse);
475 void RemoveCorpse(Corpse* corpse);
476 Corpse* ConvertCorpseToBones(ObjectGuid const& ownerGuid, bool insignia = false);
477 void RemoveOldCorpses();
478
479 void SendInitTransports(Player* player);
480 void SendRemoveTransports(Player* player);
481 void SendUpdateTransportVisibility(Player* player);
482 void SendZoneDynamicInfo(uint32 zoneId, Player* player) const;
483 void SendZoneWeather(uint32 zoneId, Player* player) const;
484 void SendZoneWeather(ZoneDynamicInfo const& zoneDynamicInfo, Player* player) const;
485
486 void SetZoneMusic(uint32 zoneId, uint32 musicId);
487 Weather* GetOrGenerateZoneDefaultWeather(uint32 zoneId);
488 WeatherState GetZoneWeather(uint32 zoneId) const;
489 void SetZoneWeather(uint32 zoneId, WeatherState weatherId, float intensity);
490 void SetZoneOverrideLight(uint32 zoneId, uint32 areaLightId, uint32 overrideLightId, Milliseconds transitionTime);
491
492 void UpdateAreaDependentAuras();
493
494 template<HighGuid high>
496 {
497 static_assert(ObjectGuidTraits<high>::SequenceSource.HasFlag(ObjectGuidSequenceSource::Map), "Only map specific guid can be generated in Map context");
498 return GetGuidSequenceGenerator(high).Generate();
499 }
500
501 template<HighGuid high>
503 {
504 static_assert(ObjectGuidTraits<high>::SequenceSource.HasFlag(ObjectGuidSequenceSource::Map), "Only map specific guid can be retrieved in Map context");
505 return GetGuidSequenceGenerator(high).GetNextAfterMaxUsed();
506 }
507
509 {
510 _updateObjects.insert(obj);
511 }
512
514 {
515 _updateObjects.erase(obj);
516 }
517
519 {
520 return m_activeNonPlayers.size();
521 }
522
523 virtual std::string GetDebugInfo() const;
524
525 private:
526
527 void SetTimer(uint32 t) { i_gridExpiry = t < MIN_GRID_DELAY ? MIN_GRID_DELAY : t; }
528
529 void SendInitSelf(Player* player);
530
531 template <typename T>
532 bool MapObjectCellRelocation(T* object, Cell new_cell, char const* objType);
533
534 bool CreatureCellRelocation(Creature* creature, Cell new_cell);
535 bool GameObjectCellRelocation(GameObject* go, Cell new_cell);
536 bool DynamicObjectCellRelocation(DynamicObject* go, Cell new_cell);
537 bool AreaTriggerCellRelocation(AreaTrigger* at, Cell new_cell);
538
539 template<class T> void InitializeObject(T* obj);
540 void AddCreatureToMoveList(Creature* c, float x, float y, float z, float ang);
541 void RemoveCreatureFromMoveList(Creature* c);
542 void AddGameObjectToMoveList(GameObject* go, float x, float y, float z, float ang);
543 void RemoveGameObjectFromMoveList(GameObject* go);
544 void AddDynamicObjectToMoveList(DynamicObject* go, float x, float y, float z, float ang);
545 void RemoveDynamicObjectFromMoveList(DynamicObject* go);
546 void AddAreaTriggerToMoveList(AreaTrigger* at, float x, float y, float z, float ang);
547 void RemoveAreaTriggerFromMoveList(AreaTrigger* at);
548
550 std::vector<Creature*> _creaturesToMove;
551
553 std::vector<GameObject*> _gameObjectsToMove;
554
556 std::vector<DynamicObject*> _dynamicObjectsToMove;
557
559 std::vector<AreaTrigger*> _areaTriggersToMove;
560
561 bool IsGridLoaded(GridCoord const&) const;
562 void EnsureGridCreated(GridCoord const&);
563 bool EnsureGridLoaded(Cell const&);
564 void EnsureGridLoadedForActiveObject(Cell const&, WorldObject const* object);
565
566 void buildNGridLinkage(NGridType* pNGridType) { pNGridType->link(this); }
567
569 {
570 ASSERT(x < MAX_NUMBER_OF_GRIDS && y < MAX_NUMBER_OF_GRIDS, "x = %u, y = %u", x, y);
571 return i_grids[x][y];
572 }
573
574 bool isGridObjectDataLoaded(uint32 x, uint32 y) const { return getNGrid(x, y)->isGridObjectDataLoaded(); }
575 void setGridObjectDataLoaded(bool pLoaded, uint32 x, uint32 y) { getNGrid(x, y)->setGridObjectDataLoaded(pLoaded); }
576
577 void setNGrid(NGridType* grid, uint32 x, uint32 y);
578 void ScriptsProcess();
579
580 void SendObjectUpdates();
581
582 protected:
583 virtual void LoadGridObjects(NGridType* grid, Cell const& cell);
584
591
594
596
597 typedef std::set<WorldObject*> ActiveNonPlayers;
599 ActiveNonPlayers::iterator m_activeNonPlayersIter;
600
601 // Objects that must update even in inactive grids without activating them
602 typedef std::set<Transport*> TransportsContainer;
604 TransportsContainer::iterator _transportsUpdateIter;
605
606 private:
607 Player* _GetScriptPlayerSourceOrTarget(Object* source, Object* target, ScriptInfo const* scriptInfo) const;
608 Creature* _GetScriptCreatureSourceOrTarget(Object* source, Object* target, ScriptInfo const* scriptInfo, bool bReverse = false) const;
609 GameObject* _GetScriptGameObjectSourceOrTarget(Object* source, Object* target, ScriptInfo const* scriptInfo, bool bReverse = false) const;
610 Unit* _GetScriptUnit(Object* obj, bool isSource, ScriptInfo const* scriptInfo) const;
611 Player* _GetScriptPlayer(Object* obj, bool isSource, ScriptInfo const* scriptInfo) const;
612 Creature* _GetScriptCreature(Object* obj, bool isSource, ScriptInfo const* scriptInfo) const;
613 WorldObject* _GetScriptWorldObject(Object* obj, bool isSource, ScriptInfo const* scriptInfo) const;
614 void _ScriptProcessDoor(Object* source, Object* target, ScriptInfo const* scriptInfo) const;
615 GameObject* _FindGameObject(WorldObject* pWorldObject, ObjectGuid::LowType guid) const;
616
618
619 std::shared_ptr<TerrainInfo> m_terrain;
620
622 std::bitset<TOTAL_NUMBER_OF_CELLS_PER_MAP*TOTAL_NUMBER_OF_CELLS_PER_MAP> marked_cells;
623
624 //these functions used to process player/mob aggro reactions and
625 //visibility calculations. Highly optimized for massive calculations
626 void ProcessRelocationNotifies(const uint32 diff);
627
629 std::set<WorldObject*> i_objectsToRemove;
630 std::map<WorldObject*, bool> i_objectsToSwitch;
631 std::set<WorldObject*> i_worldObjects;
632
633 typedef std::multimap<time_t, ScriptAction> ScriptScheduleMap;
635
636 public:
637 void ProcessRespawns();
638 void ApplyDynamicModeRespawnScaling(WorldObject const* obj, ObjectGuid::LowType spawnId, uint32& respawnDelay, uint32 mode) const;
639
640 private:
641 // if return value is true, we can respawn
642 // if return value is false, reschedule the respawn to new value of info->respawnTime iff nonzero, delete otherwise
643 // if return value is false and info->respawnTime is nonzero, it is guaranteed to be greater than time(NULL)
644 bool CheckRespawn(RespawnInfo* info);
645 void DoRespawn(SpawnObjectType type, ObjectGuid::LowType spawnId, uint32 gridId);
646 bool AddRespawnInfo(RespawnInfo const& info);
647 void UnloadAllRespawnInfos();
648 RespawnInfo* GetRespawnInfo(SpawnObjectType type, ObjectGuid::LowType spawnId) const;
649 void Respawn(RespawnInfo* info, CharacterDatabaseTransaction dbTrans = nullptr);
650 void DeleteRespawnInfo(RespawnInfo* info, CharacterDatabaseTransaction dbTrans = nullptr);
651 void DeleteRespawnInfoFromDB(SpawnObjectType type, ObjectGuid::LowType spawnId, CharacterDatabaseTransaction dbTrans = nullptr);
652
653 public:
654 void GetRespawnInfo(std::vector<RespawnInfo const*>& respawnData, SpawnObjectTypeMask types) const;
656 {
657 if (RespawnInfo* info = GetRespawnInfo(type, spawnId))
658 Respawn(info, dbTrans);
659 }
660 void RemoveRespawnTime(SpawnObjectType type, ObjectGuid::LowType spawnId, CharacterDatabaseTransaction dbTrans = nullptr, bool alwaysDeleteFromDB = false)
661 {
662 if (RespawnInfo* info = GetRespawnInfo(type, spawnId))
663 DeleteRespawnInfo(info, dbTrans);
664 // Some callers might need to make sure the database doesn't contain any respawn time
665 else if (alwaysDeleteFromDB)
666 DeleteRespawnInfoFromDB(type, spawnId, dbTrans);
667 }
668 size_t DespawnAll(SpawnObjectType type, ObjectGuid::LowType spawnId);
669
670 bool ShouldBeSpawnedOnGridLoad(SpawnObjectType type, ObjectGuid::LowType spawnId) const;
671 template <typename T> bool ShouldBeSpawnedOnGridLoad(ObjectGuid::LowType spawnId) const { return ShouldBeSpawnedOnGridLoad(SpawnData::TypeFor<T>, spawnId); }
672
673 SpawnGroupTemplateData const* GetSpawnGroupData(uint32 groupId) const;
674
675 bool IsSpawnGroupActive(uint32 groupId) const;
676
677 // Enable the spawn group, which causes all creatures in it to respawn (unless they have a respawn timer)
678 // The force flag can be used to force spawning additional copies even if old copies are still around from a previous spawn
679 bool SpawnGroupSpawn(uint32 groupId, bool ignoreRespawn = false, bool force = false, std::vector<WorldObject*>* spawnedObjects = nullptr);
680
681 // Despawn all creatures in the spawn group if spawned, optionally delete their respawn timer, and disable the group
682 bool SpawnGroupDespawn(uint32 groupId, bool deleteRespawnTimes = false, size_t* count = nullptr);
683
684 // Disable the spawn group, which prevents any creatures in the group from respawning until re-enabled
685 // This will not affect any already-present creatures in the group
686 void SetSpawnGroupInactive(uint32 groupId) { SetSpawnGroupActive(groupId, false); }
687
688 SpawnedPoolData& GetPoolData() { return *_poolData; }
689 SpawnedPoolData const& GetPoolData() const { return *_poolData; }
690
691 typedef std::function<void(Map*)> FarSpellCallback;
692 void AddFarSpellCallback(FarSpellCallback&& callback);
693
694 void UpdateSpawnGroupConditions();
695
696 private:
697 // Type specific code for add/remove to/from grid
698 template<class T>
699 void AddToGrid(T* object, Cell const& cell);
700
701 template<class T>
702 void DeleteFromWorld(T*);
703
705 {
706 m_activeNonPlayers.insert(obj);
707 }
708
710 {
711 // Map::Update for active object in proccess
712 if (m_activeNonPlayersIter != m_activeNonPlayers.end())
713 {
714 ActiveNonPlayers::iterator itr = m_activeNonPlayers.find(obj);
715 if (itr == m_activeNonPlayers.end())
716 return;
717 if (itr == m_activeNonPlayersIter)
718 ++m_activeNonPlayersIter;
719 m_activeNonPlayers.erase(itr);
720 }
721 else
722 m_activeNonPlayers.erase(obj);
723 }
724
725 std::unique_ptr<RespawnListContainer> _respawnTimes;
729 {
730 switch (type)
731 {
732 default:
733 ABORT();
735 return &_creatureRespawnTimesBySpawnId;
737 return &_gameObjectRespawnTimesBySpawnId;
739 return nullptr;
740 }
741 }
743 {
744 switch (type)
745 {
746 default:
747 ABORT();
749 return &_creatureRespawnTimesBySpawnId;
751 return &_gameObjectRespawnTimesBySpawnId;
753 return nullptr;
754 }
755 }
756
757 void SetSpawnGroupActive(uint32 groupId, bool state);
758 std::unordered_set<uint32> _toggledSpawnGroupIds;
759
761 std::unordered_map<uint32, uint32> _zonePlayerCountMap;
762
765
766 ObjectGuidGenerator& GetGuidSequenceGenerator(HighGuid high);
767
768 std::map<HighGuid, std::unique_ptr<ObjectGuidGenerator>> _guidGenerators;
769 std::unique_ptr<SpawnedPoolData> _poolData;
774 std::unordered_map<uint32/*cellId*/, std::unordered_set<Corpse*>> _corpsesByCell;
775 std::unordered_map<ObjectGuid, Corpse*> _corpsesByPlayer;
776 std::unordered_set<Corpse*> _corpseBones;
777
778 std::unordered_set<Object*> _updateObjects;
779
781
782 /*********************************************************/
783 /*** Phasing ***/
784 /*********************************************************/
785 public:
786 MultiPersonalPhaseTracker& GetMultiPersonalPhaseTracker() { return _multiPersonalPhaseTracker; }
787 void UpdatePersonalPhasesForPlayer(Player const* player);
788
789 private:
791
792 /*********************************************************/
793 /*** WorldStates ***/
794 /*********************************************************/
795 public:
796 int32 GetWorldStateValue(int32 worldStateId) const;
797 void SetWorldStateValue(int32 worldStateId, int32 value, bool hidden);
798 WorldStateValueContainer const& GetWorldStateValues() const { return _worldStateValues; }
799
800 private:
802};
803
805{
806 Manual,
808 Expire
809};
810
812{
813 Success,
814 NotEmpty,
816};
817
819{
820 public:
821 InstanceMap(uint32 id, time_t, uint32 InstanceId, Difficulty SpawnMode, TeamId InstanceTeam, InstanceLock* instanceLock);
822 ~InstanceMap();
823 bool AddPlayerToMap(Player* player, bool initPlayer = true) override;
824 void RemovePlayerFromMap(Player*, bool) override;
825 void Update(uint32) override;
826 void CreateInstanceData();
828 uint32 GetScriptId() const { return i_script_id; }
829 std::string const& GetScriptName() const;
830 InstanceScript* GetInstanceScript() { return i_data; }
831 InstanceScript const* GetInstanceScript() const { return i_data; }
832 InstanceScenario* GetInstanceScenario() { return i_scenario; }
833 InstanceScenario const* GetInstanceScenario() const { return i_scenario; }
834 void SetInstanceScenario(InstanceScenario* scenario) { i_scenario = scenario; }
835 InstanceLock const* GetInstanceLock() const { return i_instanceLock; }
836 void UpdateInstanceLock(UpdateBossStateSaveDataEvent const& updateSaveDataEvent);
837 void UpdateInstanceLock(UpdateAdditionalSaveDataEvent const& updateSaveDataEvent);
838 void CreateInstanceLockForPlayer(Player* player);
839 TransferAbortParams CannotEnter(Player* player) override;
840
841 uint32 GetMaxPlayers() const;
842 TeamId GetTeamIdInInstance() const;
843 Team GetTeamInInstance() const { return GetTeamIdInInstance() == TEAM_ALLIANCE ? ALLIANCE : HORDE; }
844
845 virtual void InitVisibilityDistance() override;
846
847 Group* GetOwningGroup() const { return i_owningGroupRef.getTarget(); }
848 void TrySetOwningGroup(Group* group);
849
850 std::string GetDebugInfo() const override;
851 private:
858};
859
861{
862 public:
863 BattlegroundMap(uint32 id, time_t, uint32 InstanceId, Difficulty spawnMode);
865
866 bool AddPlayerToMap(Player* player, bool initPlayer = true) override;
867 void RemovePlayerFromMap(Player*, bool) override;
868 TransferAbortParams CannotEnter(Player* player) override;
869 void SetUnload();
870 //void UnloadAll(bool pForce);
871 void RemoveAllPlayers() override;
872
873 virtual void InitVisibilityDistance() override;
874 Battleground* GetBG() { return m_bg; }
875 void SetBG(Battleground* bg) { m_bg = bg; }
876 private:
878};
879
880template<class T, class CONTAINER>
881inline void Map::Visit(Cell const& cell, TypeContainerVisitor<T, CONTAINER>& visitor)
882{
883 const uint32 x = cell.GridX();
884 const uint32 y = cell.GridY();
885 const uint32 cell_x = cell.CellX();
886 const uint32 cell_y = cell.CellY();
887
888 if (!cell.NoCreate() || IsGridLoaded(GridCoord(x, y)))
889 {
890 EnsureGridLoaded(cell);
891 getNGrid(x, y)->VisitGrid(cell_x, cell_y, visitor);
892 }
893}
894#endif
Difficulty
Definition: DBCEnums.h:732
ItemContext
Definition: DBCEnums.h:922
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
Definition: DatabaseEnvFwd.h:72
#define UI64FMTD
Definition: Define.h:127
#define TC_GAME_API
Definition: Define.h:124
uint8_t uint8
Definition: Define.h:145
int32_t int32
Definition: Define.h:139
#define UI64LIT(N)
Definition: Define.h:128
uint32_t uint32
Definition: Define.h:143
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:29
std::string GetDebugInfo()
Definition: Errors.cpp:157
#define ABORT
Definition: Errors.h:74
#define ASSERT
Definition: Errors.h:68
#define DEFAULT_HEIGHT_SEARCH
Definition: GridDefines.h:63
#define MIN_GRID_DELAY
Definition: GridDefines.h:45
CoordPair< MAX_NUMBER_OF_GRIDS > GridCoord
Definition: GridDefines.h:187
#define MAX_NUMBER_OF_GRIDS
Definition: GridDefines.h:38
std::conditional_t< IntrusiveLink !=nullptr, Trinity::Impl::MPSCQueueIntrusive< T, IntrusiveLink >, Trinity::Impl::MPSCQueueNonIntrusive< T > > MPSCQueue
Definition: MPSCQueue.h:173
ZLiquidStatus
Definition: MapDefines.h:125
map_liquidHeaderTypeFlags
Definition: MapDefines.h:97
InstanceResetMethod
Definition: Map.h:805
std::unordered_map< ObjectGuid::LowType, RespawnInfo * > RespawnInfoMap
Definition: Map.h:160
InstanceResetResult
Definition: Map.h:812
std::unordered_map< uint32, ZoneDynamicInfo > ZoneDynamicInfoMap
Definition: Map.h:158
TypeUnorderedMapContainer< AllMapStoredObjectTypes, ObjectGuid > MapStoredObjectTypesContainer
Definition: Map.h:182
TransferAbortReason
Definition: Map.h:84
@ TRANSFER_ABORT_TOO_MANY_INSTANCES
Definition: Map.h:89
@ TRANSFER_ABORT_NOT_CROSS_FACTION_COMPATIBLE
Definition: Map.h:106
@ TRANSFER_ABORT_XREALM_ZONE_DOWN
Definition: Map.h:104
@ TRANSFER_ABORT_NOT_FOUND_2
Definition: Map.h:96
@ TRANSFER_ABORT_DIFFICULTY
Definition: Map.h:92
@ TRANSFER_ABORT_UNIQUE_MESSAGE
Definition: Map.h:93
@ TRANSFER_ABORT_MAP_NOT_ALLOWED
Definition: Map.h:100
@ TRANSFER_ABORT_INSUF_EXPAN_LVL
Definition: Map.h:91
@ TRANSFER_ABORT_TOO_MANY_REALM_INSTANCES
Definition: Map.h:94
@ TRANSFER_ABORT_MAX_PLAYERS
Definition: Map.h:87
@ TRANSFER_ABORT_NOT_FOUND_4
Definition: Map.h:98
@ TRANSFER_ABORT_ZONE_IN_COMBAT
Definition: Map.h:90
@ TRANSFER_ABORT_DIFFICULTY_NOT_FOUND
Definition: Map.h:103
@ TRANSFER_ABORT_NONE
Definition: Map.h:85
@ TRANSFER_ABORT_ALREADY_COMPLETED_ENCOUNTER
Definition: Map.h:102
@ TRANSFER_ABORT_SOLO_PLAYER_SWITCH_DIFFICULTY
Definition: Map.h:105
@ TRANSFER_ABORT_NOT_FOUND
Definition: Map.h:88
@ TRANSFER_ABORT_LOCKED_TO_DIFFERENT_INSTANCE
Definition: Map.h:101
@ TRANSFER_ABORT_NEED_GROUP
Definition: Map.h:95
@ TRANSFER_ABORT_NOT_FOUND_3
Definition: Map.h:97
@ TRANSFER_ABORT_REALM_ONLY
Definition: Map.h:99
@ TRANSFER_ABORT_ERROR
Definition: Map.h:86
@ GRID_STATE_REMOVAL
Definition: NGrid.h:58
HighGuid
Definition: ObjectGuid.h:71
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
TeamId
Definition: SharedDefines.h:1109
@ TEAM_ALLIANCE
Definition: SharedDefines.h:1110
Team
Definition: SharedDefines.h:1116
@ TEAM_OTHER
Definition: SharedDefines.h:1124
@ ALLIANCE
Definition: SharedDefines.h:1118
@ HORDE
Definition: SharedDefines.h:1117
LineOfSightChecks
Definition: SharedDefines.h:6805
SpawnObjectTypeMask
Definition: SpawnData.h:42
SpawnObjectType
Definition: SpawnData.h:33
@ SPAWN_TYPE_GAMEOBJECT
Definition: SpawnData.h:35
@ SPAWN_TYPE_AREATRIGGER
Definition: SpawnData.h:36
@ SPAWN_TYPE_CREATURE
Definition: SpawnData.h:34
std::unordered_map< int32, int32 > WorldStateValueContainer
Definition: WorldStateDefines.h:35
Definition: AreaTrigger.h:43
Definition: Map.h:861
Battleground * GetBG()
Definition: Map.h:874
Battleground * m_bg
Definition: Map.h:877
void SetBG(Battleground *bg)
Definition: Map.h:875
Definition: Battleground.h:256
Definition: Conversation.h:30
Definition: Corpse.h:53
Definition: CreatureGroups.h:69
Definition: Creature.h:70
Definition: DynamicTree.h:39
Definition: DynamicObject.h:37
Definition: GameObjectModel.h:62
Definition: GameObject.h:125
Definition: GridRefManager.h:28
Definition: GroupInstanceReference.h:27
Definition: Group.h:175
Definition: InstanceLockMgr.h:84
Definition: Map.h:819
Optional< SystemTimePoint > i_instanceExpireEvent
Definition: Map.h:852
InstanceLock * i_instanceLock
Definition: Map.h:856
InstanceScript const * GetInstanceScript() const
Definition: Map.h:831
InstanceScenario * GetInstanceScenario()
Definition: Map.h:832
InstanceScenario * i_scenario
Definition: Map.h:855
uint32 GetScriptId() const
Definition: Map.h:828
Team GetTeamInInstance() const
Definition: Map.h:843
InstanceLock const * GetInstanceLock() const
Definition: Map.h:835
GroupInstanceReference i_owningGroupRef
Definition: Map.h:857
InstanceScript * i_data
Definition: Map.h:853
void SetInstanceScenario(InstanceScenario *scenario)
Definition: Map.h:834
InstanceScenario const * GetInstanceScenario() const
Definition: Map.h:833
uint32 i_script_id
Definition: Map.h:854
Group * GetOwningGroup() const
Definition: Map.h:847
InstanceScript * GetInstanceScript()
Definition: Map.h:830
Definition: InstanceScenario.h:26
Definition: InstanceScript.h:186
Definition: MapRefManager.h:26
Definition: MapReference.h:27
Definition: Map.h:185
MapEntry const * i_mapEntry
Definition: Map.h:585
bool _creatureToMoveLock
Definition: Map.h:549
std::map< WorldObject *, bool > i_objectsToSwitch
Definition: Map.h:630
WorldObject * GetWorldObjectBySpawnId(SpawnObjectType type, ObjectGuid::LowType spawnId) const
Definition: Map.h:383
std::unordered_map< uint32, uint32 > _zonePlayerCountMap
Definition: Map.h:761
std::vector< Creature * > _creaturesToMove
Definition: Map.h:550
CreatureBySpawnIdContainer const & GetCreatureBySpawnIdStore() const
Definition: Map.h:402
bool IsRemovalGrid(Position const &pos) const
Definition: Map.h:233
RespawnInfoMap const * GetRespawnMapForType(SpawnObjectType type) const
Definition: Map.h:742
float GetStaticHeight(PhaseShift const &phaseShift, Position const &pos, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH)
Definition: Map.h:275
void SetSpawnGroupInactive(uint32 groupId)
Definition: Map.h:686
std::unordered_set< Corpse * > const * GetCorpsesInCell(uint32 cellId) const
Definition: Map.h:412
std::unordered_multimap< ObjectGuid::LowType, Creature * > CreatureBySpawnIdContainer
Definition: Map.h:400
std::unordered_map< ObjectGuid, Corpse * > _corpsesByPlayer
Definition: Map.h:775
bool ShouldBeSpawnedOnGridLoad(ObjectGuid::LowType spawnId) const
Definition: Map.h:671
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:398
TransportsContainer::iterator _transportsUpdateIter
Definition: Map.h:604
virtual void RemovePlayerFromMap(Player *, bool)
Definition: Map.cpp:905
InstanceMap const * ToInstanceMap() const
Definition: Map.h:431
virtual bool AddPlayerToMap(Player *player, bool initPlayer=true)
Definition: Map.cpp:431
uint32 GetAreaId(PhaseShift const &phaseShift, Position const &pos)
Definition: Map.h:266
void RemoveFromActiveHelper(WorldObject *obj)
Definition: Map.h:709
void GetZoneAndAreaId(PhaseShift const &phaseShift, uint32 &zoneid, uint32 &areaid, Position const &pos)
Definition: Map.h:270
std::function< void(Map *)> FarSpellCallback
Definition: Map.h:691
bool GetUnloadLock(GridCoord const &p) const
Definition: Map.h:239
void RemoveGameObjectModel(GameObjectModel const &model)
Definition: Map.h:438
RespawnInfoMap * GetRespawnMapForType(SpawnObjectType type)
Definition: Map.h:728
virtual TransferAbortParams CannotEnter(Player *)
Definition: Map.h:303
void DeleteRespawnTimes()
Definition: Map.h:469
void RemoveUpdateObject(Object *obj)
Definition: Map.h:513
RespawnInfoMap _gameObjectRespawnTimesBySpawnId
Definition: Map.h:727
uint32 m_unloadTimer
Definition: Map.h:588
bool IsGridLoaded(Position const &pos) const
Definition: Map.h:237
MapRefManager PlayerList
Definition: Map.h:342
AreaTriggerBySpawnIdContainer & GetAreaTriggerBySpawnIdStore()
Definition: Map.h:409
void SetTimer(uint32 t)
Definition: Map.h:527
std::bitset< TOTAL_NUMBER_OF_CELLS_PER_MAP *TOTAL_NUMBER_OF_CELLS_PER_MAP > marked_cells
Definition: Map.h:622
uint32 GetZoneId(PhaseShift const &phaseShift, Position const &pos)
Definition: Map.h:268
SpawnedPoolData const & GetPoolData() const
Definition: Map.h:689
virtual ObjectGuid::LowType GetOwnerGuildId(uint32=TEAM_OTHER) const
Definition: Map.h:447
BattlegroundMap const * ToBattlegroundMap() const
Definition: Map.h:434
bool CanUnload(uint32 diff)
Definition: Map.h:194
WorldStateValueContainer _worldStateValues
Definition: Map.h:801
IntervalTimer _weatherUpdateTimer
Definition: Map.h:764
void RemoveRespawnTime(SpawnObjectType type, ObjectGuid::LowType spawnId, CharacterDatabaseTransaction dbTrans=nullptr, bool alwaysDeleteFromDB=false)
Definition: Map.h:660
bool _dynamicObjectsToMoveLock
Definition: Map.h:555
NGridType * getNGrid(uint32 x, uint32 y) const
Definition: Map.h:568
std::shared_ptr< TerrainInfo > m_terrain
Definition: Map.h:619
void AddToActiveHelper(WorldObject *obj)
Definition: Map.h:704
bool _gameObjectsToMoveLock
Definition: Map.h:552
bool ContainsGameObjectModel(GameObjectModel const &model) const
Definition: Map.h:440
uint32 _respawnCheckTimer
Definition: Map.h:760
WorldStateValueContainer const & GetWorldStateValues() const
Definition: Map.h:798
bool HavePlayers() const
Definition: Map.h:333
bool IsRemovalGrid(float x, float y) const
Definition: Map.h:228
std::unordered_map< uint32, std::unordered_set< Corpse * > > _corpsesByCell
Definition: Map.h:774
MapRefManager m_mapRefManager
Definition: Map.h:592
void resetMarkedCells()
Definition: Map.h:329
void Visit(Cell const &cell, TypeContainerVisitor< T, CONTAINER > &visitor)
Definition: Map.h:881
ScriptScheduleMap m_scriptSchedule
Definition: Map.h:634
ObjectGuid::LowType GetMaxLowGuid()
Definition: Map.h:502
void AddWorldObject(WorldObject *obj)
Definition: Map.h:337
void ResetGridExpiry(NGridType &grid, float factor=1) const
Definition: Map.h:249
DynamicMapTree _dynamicTree
Definition: Map.h:590
void Respawn(SpawnObjectType type, ObjectGuid::LowType spawnId, CharacterDatabaseTransaction dbTrans=nullptr)
Definition: Map.h:655
std::vector< GameObject * > _gameObjectsToMove
Definition: Map.h:553
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:495
std::unordered_map< ObjectGuid::LowType, CreatureGroup * > CreatureGroupHolder
Definition: Map.h:364
void DoOnPlayers(T &&fn)
Definition: Map.h:346
AreaTriggerBySpawnIdContainer _areaTriggerBySpawnIdStore
Definition: Map.h:773
time_t i_gridExpiry
Definition: Map.h:617
int32 m_VisibilityNotifyPeriod
Definition: Map.h:595
std::unordered_set< Corpse * > _corpseBones
Definition: Map.h:776
MPSCQueue< FarSpellCallback > _farSpellCallbacks
Definition: Map.h:780
Difficulty i_spawnMode
Definition: Map.h:586
time_t GetGORespawnTime(ObjectGuid::LowType spawnId) const
Definition: Map.h:462
bool i_scriptLock
Definition: Map.h:628
virtual void RemoveAllPlayers()
Definition: Map.cpp:1627
std::unordered_set< uint32 > _toggledSpawnGroupIds
Definition: Map.h:758
bool isCellMarked(uint32 pCellId)
Definition: Map.h:330
time_t GetCreatureRespawnTime(ObjectGuid::LowType spawnId) const
Definition: Map.h:461
MultiPersonalPhaseTracker & GetMultiPersonalPhaseTracker()
Definition: Map.h:786
BattlegroundMap * ToBattlegroundMap()
Definition: Map.h:433
MultiPersonalPhaseTracker _multiPersonalPhaseTracker
Definition: Map.h:790
virtual std::string GetDebugInfo() const
Definition: Map.cpp:3918
MapRefManager::iterator m_mapRefIter
Definition: Map.h:593
std::multimap< time_t, ScriptAction > ScriptScheduleMap
Definition: Map.h:633
std::unique_ptr< RespawnListContainer > _respawnTimes
Definition: Map.h:725
time_t GetRespawnTime(SpawnObjectType type, ObjectGuid::LowType spawnId) const
Definition: Map.h:452
void Balance()
Definition: Map.h:437
virtual void Update(uint32)
Definition: Map.cpp:664
ZoneDynamicInfoMap _zoneDynamicInfo
Definition: Map.h:763
bool _areaTriggersToMoveLock
Definition: Map.h:558
std::vector< AreaTrigger * > _areaTriggersToMove
Definition: Map.h:559
void RemoveWorldObject(WorldObject *obj)
Definition: Map.h:338
std::set< WorldObject * > i_worldObjects
Definition: Map.h:631
Difficulty GetDifficultyID() const
Definition: Map.h:307
ActiveNonPlayers m_activeNonPlayers
Definition: Map.h:598
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
Definition: Map.h:405
void InsertGameObjectModel(GameObjectModel const &model)
Definition: Map.h:439
void SetUnloadLock(GridCoord const &p, bool on)
Definition: Map.h:240
std::set< Transport * > TransportsContainer
Definition: Map.h:602
std::unordered_set< Object * > _updateObjects
Definition: Map.h:778
void buildNGridLinkage(NGridType *pNGridType)
Definition: Map.h:566
MapEntry const * GetEntry() const
Definition: Map.h:191
std::set< WorldObject * > i_objectsToRemove
Definition: Map.h:629
MapStoredObjectTypesContainer _objectsStore
Definition: Map.h:770
bool IsGridLoaded(float x, float y) const
Definition: Map.h:236
std::unordered_multimap< ObjectGuid::LowType, AreaTrigger * > AreaTriggerBySpawnIdContainer
Definition: Map.h:408
friend class MapReference
Definition: Map.h:186
float m_VisibleDistance
Definition: Map.h:589
float GetVisibilityRange() const
Definition: Map.h:215
float GetHeight(PhaseShift const &phaseShift, float x, float y, float z, bool vmap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH)
Definition: Map.h:276
InstanceMap * ToInstanceMap()
Definition: Map.h:430
Corpse * GetCorpseByPlayer(ObjectGuid const &ownerGuid) const
Definition: Map.h:421
bool IsGridLoaded(uint32 gridId) const
Definition: Map.h:235
std::set< WorldObject * > ActiveNonPlayers
Definition: Map.h:597
void markCell(uint32 pCellId)
Definition: Map.h:331
float GetHeight(PhaseShift const &phaseShift, Position const &pos, bool vmap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH)
Definition: Map.h:277
AreaTriggerBySpawnIdContainer const & GetAreaTriggerBySpawnIdStore() const
Definition: Map.h:410
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore()
Definition: Map.h:401
virtual void InitVisibilityDistance()
Definition: Map.cpp:185
void setGridObjectDataLoaded(bool pLoaded, uint32 x, uint32 y)
Definition: Map.h:575
bool EnsureGridLoaded(Cell const &)
Definition: Map.cpp:371
std::vector< DynamicObject * > _dynamicObjectsToMove
Definition: Map.h:556
uint32 GetInstanceId() const
Definition: Map.h:300
TransportsContainer _transports
Definition: Map.h:603
PlayerList const & GetPlayers() const
Definition: Map.h:343
GameObjectBySpawnIdContainer const & GetGameObjectBySpawnIdStore() const
Definition: Map.h:406
SpawnedPoolData & GetPoolData()
Definition: Map.h:688
void AddUpdateObject(Object *obj)
Definition: Map.h:508
RespawnInfoMap _creatureRespawnTimesBySpawnId
Definition: Map.h:726
CreatureBySpawnIdContainer _creatureBySpawnIdStore
Definition: Map.h:771
uint32 i_InstanceId
Definition: Map.h:587
ActiveNonPlayers::iterator m_activeNonPlayersIter
Definition: Map.h:599
time_t GetGridExpiry() const
Definition: Map.h:254
std::unordered_multimap< ObjectGuid::LowType, GameObject * > GameObjectBySpawnIdContainer
Definition: Map.h:404
std::map< HighGuid, std::unique_ptr< ObjectGuidGenerator > > _guidGenerators
Definition: Map.h:768
bool isGridObjectDataLoaded(uint32 x, uint32 y) const
Definition: Map.h:574
TerrainInfo * GetTerrain() const
Definition: Map.h:259
float GetGameObjectFloor(PhaseShift const &phaseShift, float x, float y, float z, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
Definition: Map.h:441
GameObjectBySpawnIdContainer _gameobjectBySpawnIdStore
Definition: Map.h:772
std::unique_ptr< SpawnedPoolData > _poolData
Definition: Map.h:769
size_t GetActiveNonPlayersCount() const
Definition: Map.h:518
Definition: NGrid.h:70
void ResetTimeTracker(time_t interval)
Definition: NGrid.h:109
void VisitGrid(const uint32 x, const uint32 y, TypeContainerVisitor< T, TypeMapContainer< TT > > &visitor)
Definition: NGrid.h:145
void link(GridRefManager< NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES > > *pTo)
Definition: NGrid.h:96
Definition: ObjectGuid.h:390
Definition: ObjectGuid.h:258
static ObjectGuid const Empty
Definition: ObjectGuid.h:264
uint64 LowType
Definition: ObjectGuid.h:268
Definition: Object.h:148
Definition: Pet.h:46
Definition: PhaseShift.h:55
Definition: Player.h:1125
Definition: SceneObject.h:33
Definition: PoolMgr.h:55
Definition: TemporarySummon.h:44
Definition: TerrainMgr.h:38
Definition: Transport.h:30
Definition: TypeContainerVisitor.h:84
Definition: TypeContainer.h:149
Definition: Unit.h:739
Weather for one zone.
Definition: Weather.h:66
Definition: Object.h:483
Definition: WorldPacket.h:26
WeatherState
Definition: Weather.h:46
Definition: AsioHacksFwd.h:53
GridCoord ComputeGridCoord(float x, float y)
Definition: GridDefines.h:204
Definition: DynamicTree.h:34
ModelIgnoreFlags
Definition: ModelIgnoreFlags.h:26
Definition: Cell.h:47
uint32 GridX() const
Definition: Cell.h:73
bool NoCreate() const
Definition: Cell.h:75
uint32 GridY() const
Definition: Cell.h:74
uint32 CellX() const
Definition: Cell.h:71
uint32 CellY() const
Definition: Cell.h:72
Definition: Map.h:155
bool operator()(RespawnInfo const *a, RespawnInfo const *b) const
Definition: Map.h:169
Definition: GridDefines.h:106
uint32 x_coord
Definition: GridDefines.h:171
uint32 y_coord
Definition: GridDefines.h:172
Definition: DB2Structure.h:1405
Definition: Timer.h:63
Definition: MapDefines.h:137
Definition: DB2Structure.h:2684
Definition: DB2Structure.h:2591
Definition: PersonalPhaseTracker.h:69
Definition: ObjectGuid.h:163
Definition: MapDefines.h:145
Definition: Position.h:28
float GetPositionZ() const
Definition: Position.h:79
float GetPositionX() const
Definition: Position.h:77
float GetPositionY() const
Definition: Position.h:78
Definition: Map.h:162
uint32 gridId
Definition: Map.h:167
ObjectGuid::LowType spawnId
Definition: Map.h:164
time_t respawnTime
Definition: Map.h:166
uint32 entry
Definition: Map.h:165
SpawnObjectType type
Definition: Map.h:163
Definition: Map.cpp:81
Definition: Map.h:124
ObjectGuid targetGUID
Definition: Map.h:126
ObjectGuid ownerGUID
Definition: Map.h:127
ObjectGuid sourceGUID
Definition: Map.h:125
ScriptInfo const * script
‍owner of source if source is item
Definition: Map.h:128
Definition: ObjectMgr.h:223
Definition: SmoothPhasing.h:27
Definition: SpawnData.h:66
Definition: DB2Structure.h:3833
Definition: Map.h:110
int32 MapDifficultyXConditionId
Definition: Map.h:118
TransferAbortReason Reason
Definition: Map.h:116
uint8 Arg
Definition: Map.h:117
TransferAbortParams(TransferAbortReason reason, uint8 arg=0, int32 mapDifficultyXConditionId=0)
Definition: Map.h:111
Definition: InstanceScript.h:171
Definition: InstanceScript.h:164
Definition: Map.h:142
uint32 TransitionMilliseconds
Definition: Map.h:145
uint32 AreaLightId
Definition: Map.h:143
uint32 OverrideLightId
Definition: Map.h:144
Definition: Map.h:132
ZoneDynamicInfo()
Definition: Map.cpp:76
std::vector< LightOverride > LightOverrides
Definition: Map.h:147
uint32 MusicId
Definition: Map.h:135
WeatherState WeatherId
Definition: Map.h:138
std::unique_ptr< Weather > DefaultWeather
Definition: Map.h:137
float Intensity
Definition: Map.h:139
eventMap Update(1s)