65#include <boost/heap/fibonacci_heap.hpp>
68#define DEFAULT_GRID_EXPIRY 300
69#define MAX_GRID_LOAD_TIME 50
70#define MAX_CREATURE_ATTACK_RADIUS (45.0f * sWorld->getRate(RATE_CREATURE_AGGRO))
80struct RespawnListContainer : boost::heap::fibonacci_heap<RespawnInfoWithHandle*, boost::heap::compare<CompareRespawnInfo>>
88 RespawnListContainer::handle_type
handle;
136_creatureToMoveLock(false), _gameObjectsToMoveLock(false), _dynamicObjectsToMoveLock(false), _areaTriggersToMoveLock(false),
137i_mapEntry(
sMapStore.LookupEntry(id)), i_spawnMode(SpawnMode), i_InstanceId(InstanceId),
140m_activeNonPlayersIter(m_activeNonPlayers.end()), _transportsUpdateIter(_transports.end()),
141i_gridExpiry(expiry), m_terrain(
sTerrainMgr.LoadTerrain(id)), m_forceEnabledNavMeshFilterFlags(0), m_forceDisabledNavMeshFilterFlags(0),
142i_scriptLock(false), _respawnTimes(
std::make_unique<
RespawnListContainer>()), _respawnCheckTimer(0), _vignetteUpdateTimer(5200, 5200)
183 if constexpr (WorldTypeMapContainer::TypeExists<T> && GridTypeMapContainer::TypeExists<T>)
186 if (obj->IsStoredInWorldObjectGridContainer())
191 else if constexpr (WorldTypeMapContainer::TypeExists<T>)
193 else if constexpr (GridTypeMapContainer::TypeExists<T>)
196 if constexpr (std::is_base_of_v<MapObject, T>)
197 obj->SetCurrentCell(cell);
396 Cell cell(cellCoord);
443 int32 oldValue = itr->second;
444 if (oldValue == value && !inserted)
450 if (worldStateTemplate)
451 sScriptMgr->OnWorldStateValueChange(worldStateTemplate, oldValue, value,
this);
456 updateWorldState.
Value = value;
457 updateWorldState.
Hidden = hidden;
458 updateWorldState.
Write();
462 if (worldStateTemplate && !worldStateTemplate->
AreaIds.empty())
464 bool isInAllowedArea = std::any_of(worldStateTemplate->
AreaIds.begin(), worldStateTemplate->
AreaIds.end(),
465 [playerAreaId = mapReference.GetSource()->GetAreaId()](
uint32 requiredAreaId) { return DB2Manager::IsInArea(playerAreaId, requiredAreaId); });
466 if (!isInAllowedArea)
470 mapReference.GetSource()->SendDirectMessage(updateWorldState.
GetRawPacket());
480 vignetteUpdate.
Write();
484 ref.GetSource()->SendDirectMessage(vignetteUpdate.
GetRawPacket());
494 vignetteUpdate.
Write();
499 if (ref.GetSource()->GetZoneId() == vignette->
ZoneID)
500 ref.GetSource()->SendDirectMessage(vignetteUpdate.
GetRawPacket());
525 if (obj->IsInWorld())
528 obj->UpdateObjectVisibility(
true);
539 TC_LOG_ERROR(
"maps",
"Map::Add: Object {} has invalid coordinates X:{} Y:{} grid cell [{}:{}]", obj->GetGUID().ToString(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.
x_coord, cellCoord.
y_coord);
544 obj->setActive(
true);
546 Cell cell(cellCoord);
547 if (obj->isActiveObject())
552 TC_LOG_DEBUG(
"maps",
"Object {} enters grid[{}, {}]", obj->GetGUID().ToString(), cell.
GridX(), cell.
GridY());
560 if (obj->isActiveObject())
565 obj->SetIsNewObject(
true);
566 obj->UpdateObjectVisibilityOnCreate();
567 obj->SetIsNewObject(
false);
594 if (itr->GetSource()->GetTransport() != obj && itr->GetSource()->
InSamePhase(obj))
598 itr->GetSource()->m_visibleTransports.insert(obj->
GetGUID());
601 itr->GetSource()->SendDirectMessage(&packet);
637 Visit(cell, gridVisitor);
638 Visit(cell, worldVisitor);
646 if (oldZone == newZone)
652 ASSERT(oldZoneCount,
"A player left zone %u (went to %u) - but there were no players in the zone!", oldZone, newZone);
670 session->
Update(t_diff, updater);
714 std::vector<Unit*> toVisit;
718 toVisit.push_back(unit);
719 for (
Unit* unit : toVisit)
724 std::unordered_set<Unit*> toVisit;
725 for (std::pair<uint32, AuraApplication*> pair : player->
GetAppliedAuras())
727 if (
Unit* caster = pair.second->GetBase()->GetCaster())
729 toVisit.insert(caster);
731 for (
Unit* unit : toVisit)
736 std::vector<Unit*> toVisit;
743 toVisit.push_back(unit);
745 for (
Unit* unit : toVisit)
773 if (vignette->NeedUpdate)
776 vignette->FillPacket(vignetteUpdate.
Updated);
777 vignetteUpdate.
Write();
780 ref.GetSource()->SendDirectMessage(vignetteUpdate.
GetRawPacket());
782 vignette->NeedUpdate =
false;
802 zoneInfo.second.DefaultWeather.reset();
833 iter->GetSource()->ResetAllNotifies();
873 Visit(cell, grid_object_relocation);
874 Visit(cell, world_object_relocation);
910 Visit(cell, grid_notifier);
911 Visit(cell, world_notifier);
927 bool const inWorld = player->
IsInWorld();
947 obj->RemoveFromWorld();
948 if (obj->isActiveObject())
954 obj->UpdateObjectVisibilityOnDestroy();
956 obj->RemoveFromGrid();
981 if (itr->GetSource()->GetTransport() != obj && itr->GetSource()->m_visibleTransports.count(obj->
GetGUID()))
983 itr->GetSource()->SendDirectMessage(&packet);
984 itr->GetSource()->m_visibleTransports.erase(obj->
GetGUID());
991 TransportsContainer::iterator itr =
_transports.find(obj);
1007template <
typename T>
1010 Cell const& cur_cell =
object->GetCurrentCell();
1011 Cell xy_cell(object->GetPositionX(), object->GetPositionY());
1012 if (xy_cell != cur_cell)
1014 TC_LOG_DEBUG(
"maps",
"{} {} X: {} Y: {} ({}) is in grid[{}, {}]cell[{}, {}] instead of grid[{}, {}]cell[{}, {}]",
1015 objType, object->GetGUID().ToString(),
1016 object->GetPositionX(), object->GetPositionY(), (moved ?
"final" :
"original"),
1030 Cell new_cell(x, y);
1032 player->
Relocate(x, y, z, orientation);
1038 TC_LOG_DEBUG(
"maps",
"Player {} relocation grid[{}, {}]cell[{}, {}]->grid[{}, {}]cell[{}, {}]", player->
GetName(), old_cell.
GridX(), old_cell.
GridY(), old_cell.
CellX(), old_cell.
CellY(), new_cell.
GridX(), new_cell.
GridY(), new_cell.
CellX(), new_cell.
CellY());
1056 Cell new_cell(x, y);
1066 TC_LOG_DEBUG(
"maps",
"Creature {} added to moving list from grid[{}, {}]cell[{}, {}] to grid[{}, {}]cell[{}, {}].", creature->
GetGUID().
ToString(), old_cell.
GridX(), old_cell.
GridY(), old_cell.
CellX(), old_cell.
CellY(), new_cell.
GridX(), new_cell.
GridY(), new_cell.
CellX(), new_cell.
CellY());
1087 Cell new_cell(x, y);
1098 TC_LOG_DEBUG(
"maps",
"GameObject {} added to moving list from grid[{}, {}]cell[{}, {}] to grid[{}, {}]cell[{}, {}].", go->
GetGUID().
ToString(), old_cell.
GridX(), old_cell.
GridY(), old_cell.
CellX(), old_cell.
CellY(), new_cell.
GridX(), new_cell.
GridY(), new_cell.
CellX(), new_cell.
CellY());
1105 go->
Relocate(x, y, z, orientation);
1116 Cell new_cell(x, y);
1127 TC_LOG_DEBUG(
"maps",
"GameObject {} added to moving list from grid[{}, {}]cell[{}, {}] to grid[{}, {}]cell[{}, {}].", dynObj->
GetGUID().
ToString(), old_cell.
GridX(), old_cell.
GridY(), old_cell.
CellX(), old_cell.
CellY(), new_cell.
GridX(), new_cell.
GridY(), new_cell.
CellX(), new_cell.
CellY());
1134 dynObj->
Relocate(x, y, z, orientation);
1146 Cell new_cell(x, y);
1157 TC_LOG_DEBUG(
"maps",
"AreaTrigger ({}) added to moving list from grid[{}, {}]cell[{}, {}] to grid[{}, {}]cell[{}, {}].", at->
GetGUID().
ToString(), old_cell.
GridX(), old_cell.
GridY(), old_cell.
CellX(), old_cell.
CellY(), new_cell.
GridX(), new_cell.
GridY(), new_cell.
CellX(), new_cell.
CellY());
1164 at->
Relocate(x, y, z, orientation);
1356 if (dynObj->
FindMap() !=
this)
1428template <
typename T>
1431 Cell const& old_cell =
object->GetCurrentCell();
1438 TC_LOG_DEBUG(
"maps",
"{} {} moved in grid[{}, {}] from cell[{}, {}] to cell[{}, {}].", objType, object->GetGUID().ToString(), old_cell.
GridX(), old_cell.
GridY(), old_cell.
CellX(), old_cell.
CellY(), new_cell.
CellX(), new_cell.
CellY());
1441 object->RemoveFromGrid();
1447 TC_LOG_DEBUG(
"maps",
"{} {} moved in same grid[{}, {}]cell[{}, {}].", objType, object->GetGUID().ToString(), old_cell.
GridX(), old_cell.
GridY(), old_cell.
CellX(), old_cell.
CellY());
1455 if (object->isActiveObject())
1460 TC_LOG_DEBUG(
"maps",
"Active {} {} moved from grid[{}, {}]cell[{}, {}] to grid[{}, {}]cell[{}, {}].", objType, object->GetGUID().ToString(), old_cell.
GridX(), old_cell.
GridY(), old_cell.
CellX(), old_cell.
CellY(), new_cell.
GridX(), new_cell.
GridY(), new_cell.
CellX(), new_cell.
CellY());
1463 object->RemoveFromGrid();
1470 if (c->GetCharmerOrOwnerGUID().IsPlayer())
1477 TC_LOG_DEBUG(
"maps",
"{} {} moved from grid[{}, {}]cell[{}, {}] to grid[{}, {}]cell[{}, {}].", objType, object->GetGUID().ToString(), old_cell.
GridX(), old_cell.
GridY(), old_cell.
CellX(), old_cell.
CellY(), new_cell.
GridX(), new_cell.
GridY(), new_cell.
CellX(), new_cell.
CellY());
1480 object->RemoveFromGrid();
1489 TC_LOG_DEBUG(
"maps",
"{} {} attempted to move from grid[{}, {}]cell[{}, {}] to unloaded grid[{}, {}]cell[{}, {}].", objType, object->GetGUID().ToString(), old_cell.
GridX(), old_cell.
GridY(), old_cell.
CellX(), old_cell.
CellY(), new_cell.
GridX(), new_cell.
GridY(), new_cell.
CellX(), new_cell.
CellY());
1516 float resp_x, resp_y, resp_z, resp_o;
1518 Cell resp_cell(resp_x, resp_y);
1528 TC_LOG_DEBUG(
"maps",
"Creature {} moved from grid[{}, {}]cell[{}, {}] to respawn grid[{}, {}]cell[{}, {}].", c->
GetGUID().
ToString(), c->
GetCurrentCell().
GridX(), c->
GetCurrentCell().
GridY(), c->
GetCurrentCell().
CellX(), c->
GetCurrentCell().
CellY(), resp_cell.
GridX(), resp_cell.
GridY(), resp_cell.
CellX(), resp_cell.
CellY());
1534 c->
Relocate(resp_x, resp_y, resp_z, resp_o);
1547 float resp_x, resp_y, resp_z, resp_o;
1549 Cell resp_cell(resp_x, resp_y);
1556 TC_LOG_DEBUG(
"maps",
"GameObject {} moved from grid[{}, {}]cell[{}, {}] to respawn grid[{}, {}]cell[{}, {}].", go->
GetGUID().
ToString(), go->
GetCurrentCell().
GridX(), go->
GetCurrentCell().
GridY(), go->
GetCurrentCell().
CellX(), go->
GetCurrentCell().
CellY(), resp_cell.
GridX(), resp_cell.
GridY(), resp_cell.
CellX(), resp_cell.
CellY());
1562 go->
Relocate(resp_x, resp_y, resp_z, resp_o);
1635 TC_LOG_DEBUG(
"maps",
"Unloading grid[{}, {}] for map {} finished", x, y,
GetId());
1645 Player* player = itr->GetSource();
1649 TC_LOG_ERROR(
"maps",
"Map::UnloadAll: player {} is still in map {} during unload, this should not happen!", player->
GetName(),
GetId());
1674 RemoveFromMap<Transport>(transport,
true);
1679 for (
Corpse* corpse : cellCorpsePair.second)
1695 m_terrain->GetFullTerrainStatusForPosition(phaseShift,
GetId(), x, y, z, data, reqLiquidType, collisionHeight, &
_dynamicTree);
1699 float collisionHeight)
1701 return m_terrain->GetLiquidStatus(phaseShift,
GetId(), x, y, z, ReqLiquidType, data, collisionHeight);
1731 return m_terrain->GetStaticHeight(phaseShift,
GetId(), x, y, z, checkVMap, maxSearchDist);
1757 && !
VMAP::VMapFactory::createOrGetVMapManager()->
isInLineOfSight(
PhasingHandler::GetTerrainMapId(phaseShift,
GetId(),
m_terrain.get(), x1, y1), x1, y1, z1, x2, y2, z2, ignoreFlags))
1765bool Map::getObjectHitPos(
PhaseShift const& phaseShift,
float x1,
float y1,
float z1,
float x2,
float y2,
float z2,
float& rx,
float& ry,
float& rz,
float modifyDist)
1767 G3D::Vector3 startPos(x1, y1, z1);
1768 G3D::Vector3 dstPos(x2, y2, z2);
1770 G3D::Vector3 resultPos;
1813 uint32 instanceIdToCheck =
sMapMgr->FindInstanceIdForPlayer(mapid, player);
1814 if (
Map* boundMap =
sMapMgr->FindMap(mapid, instanceIdToCheck))
1840 transport->BuildCreateUpdateBlockForPlayer(&data, player);
1849 for (
WorldObject* passenger : transport->GetPassengers())
1850 if (player != passenger && player->
HaveAtClient(passenger))
1851 passenger->BuildCreateUpdateBlockForPlayer(&data, player);
1869 transport->BuildCreateUpdateBlockForPlayer(&transData, player);
1890 transport->BuildOutOfRangeUpdateBlock(&transData);
1909 if (!transport->IsInWorld())
1917 transport->BuildCreateUpdateBlockForPlayer(&transData, player);
1923 transport->BuildOutOfRangeUpdateBlock(&transData);
1940 TC_LOG_ERROR(
"maps",
"map::setNGrid() Invalid grid coordinates found: {}, {}!", x, y);
1959 for (UpdateDataMapType::iterator iter = update_players.begin(); iter != update_players.end(); ++iter)
1961 iter->second.BuildPacket(&packet);
1962 iter->first->SendDirectMessage(&packet);
1984 bool alreadyExists =
false;
1993 for (
auto it = range.first; it != range.second; ++it)
2001 alreadyExists =
true;
2009 alreadyExists =
true;
2029 if (linkedTime == std::numeric_limits<time_t>::max())
2030 respawnTime = linkedTime;
2031 else if (
sObjectMgr->GetLinkedRespawnGuid(thisGUID) == thisGUID)
2032 respawnTime = now +
WEEK;
2034 respawnTime = std::max<time_t>(now, linkedTime) +
urand(5, 15);
2053 std::vector<WorldObject*> toUnload;
2058 toUnload.push_back(pair.second);
2062 toUnload.push_back(pair.second);
2071 return toUnload.size();
2089 auto it = bySpawnIdMap->find(info.
spawnId);
2090 if (it != bySpawnIdMap->end())
2098 ASSERT(bySpawnIdMap->find(info.
spawnId) == bySpawnIdMap->end(),
"Insertion of respawn info with id (%u," UI64FMTD ") into spawn id map failed - state desync.",
uint32(info.
type), info.
spawnId);
2105 bySpawnIdMap->emplace(ri->
spawnId, ri);
2111 data.reserve(data.size() + map.size());
2112 for (
auto const& pair : map)
2113 data.push_back(pair.second);
2129 auto it = map->find(spawnId);
2130 if (it == map->end())
2154 auto range = spawnMap->equal_range(info->
spawnId);
2155 auto it = std::find_if(range.first, range.second, [info](RespawnInfoMap::value_type
const& pair) { return (pair.second == info); });
2157 spawnMap->erase(it);
2192 if (!obj->
LoadFromDB(spawnId,
this,
true,
true))
2214 if (now < next->respawnTime)
2252 ASSERT(now < next->respawnTime);
2290 uint32 const playerCount = it->second;
2294 if (adjustFactor >= 1.0)
2297 if (respawnDelay <= timeMinimum)
2300 respawnDelay = std::max<uint32>(ceil(respawnDelay * adjustFactor), timeMinimum);
2318 if (!
GetPoolData().IsSpawnedObject(type, spawnId))
2337 TC_LOG_ERROR(
"maps",
"Tried to spawn non-existing (or system) spawn group {} on map {}. Blocked.", groupId,
GetId());
2343 std::vector<SpawnData const*> toSpawn;
2344 for (
auto& pair :
sObjectMgr->GetSpawnMetadataForGroup(groupId))
2353 if (force || ignoreRespawn)
2376 if (std::find(data->spawnDifficulties.begin(), data->spawnDifficulties.end(),
GetDifficultyID()) == data->spawnDifficulties.end())
2389 if (!creature->
LoadFromDB(data->spawnId,
this,
true, force))
2391 else if (spawnedObjects)
2392 spawnedObjects->push_back(creature);
2398 if (!gameobject->
LoadFromDB(data->spawnId,
this,
true))
2400 else if (spawnedObjects)
2401 spawnedObjects->push_back(gameobject);
2407 if (!areaTrigger->
LoadFromDB(data->spawnId,
this,
true,
false))
2409 else if (spawnedObjects)
2410 spawnedObjects->push_back(areaTrigger);
2426 TC_LOG_ERROR(
"maps",
"Tried to despawn non-existing (or system) spawn group {} on map {}. Blocked.", groupId,
GetId());
2430 for (
auto const& pair :
sObjectMgr->GetSpawnMetadataForGroup(groupId))
2434 if (deleteRespawnTimes)
2449 TC_LOG_ERROR(
"maps",
"Tried to set non-existing (or system) spawn group {} to {} on map {}. Blocked.", groupId, state ?
"active" :
"inactive",
GetId());
2463 TC_LOG_ERROR(
"maps",
"Tried to query state of non-existing spawn group {} on map {}.", groupId,
GetId());
2474 std::vector<uint32>
const* spawnGroups =
sObjectMgr->GetSpawnGroupsForMap(
GetId());
2478 for (
uint32 spawnGroupId : *spawnGroups)
2490 std::vector<uint32>
const* spawnGroups =
sObjectMgr->GetSpawnGroupsForMap(
GetId());
2494 for (
uint32 spawnGroupId : *spawnGroups)
2510 if (isActive == shouldBeActive)
2552 GridInfo* info = i->GetSource()->getGridInfoRef();
2581 else if (itr->second != on)
2593 bool on = itr->second;
2601 SwitchGridContainers<Creature>(obj->
ToCreature(), on);
2651 TC_LOG_ERROR(
"maps",
"Non-grid object (TypeId: {}) is in grid object remove list, ignored.", obj->
GetTypeId());
2665 if (!itr->GetSource()->IsGameMaster())
2673 itr->GetSource()->SendDirectMessage(data);
2685 cell_min.
dec_x(cell_range);
2686 cell_min.
dec_y(cell_range);
2687 cell_max.
inc_x(cell_range);
2688 cell_max.
inc_y(cell_range);
2692 Player* player = iter->GetSource();
2723 respawnLocation.emplace();
2724 creature->GetRespawnPosition(respawnLocation->m_positionX, respawnLocation->m_positionY, respawnLocation->m_positionZ);
2730 respawnLocation.emplace();
2731 gameObject->GetRespawnPosition(respawnLocation->m_positionX, respawnLocation->m_positionY, respawnLocation->m_positionZ);
2738 if (respawnLocation)
2746 TC_LOG_ERROR(
"maps",
"Active object {} added to grid[{}, {}] but spawn grid[{}, {}] was not loaded.",
2762 respawnLocation.emplace();
2763 creature->GetRespawnPosition(respawnLocation->m_positionX, respawnLocation->m_positionY, respawnLocation->m_positionZ);
2769 respawnLocation.emplace();
2770 gameObject->GetRespawnPosition(respawnLocation->m_positionX, respawnLocation->m_positionY, respawnLocation->m_positionZ);
2777 if (respawnLocation)
2785 TC_LOG_ERROR(
"maps",
"Active object {} removed from to grid[{}, {}] but spawn grid[{}, {}] was not loaded.",
2811 :
Map(id, expiry, InstanceId, SpawnMode),
2812 i_data(nullptr), i_script_id(0), i_scenario(nullptr), i_instanceLock(instanceLock), i_lfgDungeonsId(lfgDungeonsId)
2897 if (!entries.MapDifficulty->IsUsingEncounterLocks())
2907 pendingRaidLock.
WarningOnly = entries.Map->IsFlexLocking();
2909 if (!entries.Map->IsFlexLocking())
2998 if (!lockData->
Data.empty())
3029 ref.GetSource()->SendResetFailedNotify(
GetId());
3040 raidInstanceMessage.
Write();
3043 ref.GetSource()->SendDirectMessage(raidInstanceMessage.
GetRawPacket());
3052 pendingRaidLock.
Write();
3056 ref.GetSource()->SendDirectMessage(pendingRaidLock.
GetRawPacket());
3094 if (entries.IsInstanceIdBound())
3100 Player* player = mapReference.GetSource();
3106 std::string
const* oldData =
nullptr;
3107 uint32 playerCompletedEncounters = 0;
3114 bool isNewLock = !playerLock || playerLock->
IsNew() || playerLock->
IsExpired();
3144 if (entries.IsInstanceIdBound())
3146 instanceCompletedEncounters,
nullptr, {}));
3150 Player* player = mapReference.GetSource();
3156 std::string
const* oldData =
nullptr;
3160 bool isNewLock = !playerLock || playerLock->
IsNew() || playerLock->
IsExpired();
3164 instanceCompletedEncounters,
nullptr, {}));
3185 bool isNewLock = !playerLock || playerLock->
IsNew() || playerLock->
IsExpired();
3369 :
Map(id, expiry, InstanceId, spawnMode), m_bg(nullptr), _battlegroundScript(nullptr), _scriptId(0)
3458 if (
Player* player = itr->GetSource())
3459 if (!player->IsBeingTeleportedFar())
3460 player->TeleportTo(player->GetBattlegroundEntryPoint());
3526 if (bounds.first == bounds.second)
3529 std::unordered_multimap<ObjectGuid::LowType, Creature*>::const_iterator creatureItr = std::find_if(bounds.first, bounds.second, [](Map::CreatureBySpawnIdContainer::value_type
const& pair)
3531 return pair.second->IsAlive();
3534 return creatureItr != bounds.second ? creatureItr->second : bounds.first->second;
3540 if (bounds.first == bounds.second)
3543 std::unordered_multimap<ObjectGuid::LowType, GameObject*>::const_iterator creatureItr = std::find_if(bounds.first, bounds.second, [](Map::GameObjectBySpawnIdContainer::value_type
const& pair)
3545 return pair.second->isSpawned();
3548 return creatureItr != bounds.second ? creatureItr->second : bounds.first->second;
3554 if (bounds.first == bounds.second)
3557 return bounds.first->second;
3571 TC_LOG_ERROR(
"maps",
"Map {} attempt to save respawn time for nonexistant spawnid ({},{}).",
GetId(), type, spawnId);
3593 TC_LOG_ERROR(
"maps",
"Attempt to load saved respawn {} for ({},{}) failed - duplicate respawn? Skipped.", respawnTime,
uint32(type), spawnId);
3625 Field* fields = result->Fetch();
3628 time_t respawnTime = fields[2].
GetInt64();
3635 TC_LOG_ERROR(
"maps",
"Loading saved respawn time of {} for spawnid ({},{}) - spawn does not exist, ignoring", respawnTime,
uint32(type), spawnId);
3639 TC_LOG_ERROR(
"maps",
"Loading saved respawn time of {} for spawnid ({},{}) - invalid spawn type, ignoring", respawnTime,
uint32(type), spawnId);
3642 }
while (result->NextRow());
3685 std::unordered_map<ObjectGuid::LowType, std::unordered_set<uint32>> phases;
3686 std::unordered_map<ObjectGuid::LowType, std::vector<UF::ChrCustomizationChoice>> customizations;
3698 Field* fields = phaseResult->Fetch();
3702 phases[guid].insert(phaseId);
3704 }
while (phaseResult->NextRow());
3717 Field* fields = customizationResult->Fetch();
3719 std::vector<UF::ChrCustomizationChoice>& customizationsForCorpse = customizations[guid];
3721 customizationsForCorpse.emplace_back();
3726 }
while (customizationResult->NextRow());
3731 Field* fields = result->Fetch();
3736 TC_LOG_ERROR(
"misc",
"Corpse (guid: {}) have wrong corpse type ({}), not loading.", guid, type);
3741 if (!corpse->
LoadCorpseFromDB(GenerateLowGuid<HighGuid::Corpse>(), fields))
3747 for (
uint32 phaseId : phases[guid])
3754 }
while (result->NextRow());
3858 std::vector<ObjectGuid> corpses;
3862 if (p.second->IsExpired(now))
3863 corpses.push_back(p.first);
3868 std::vector<Corpse*> expiredBones;
3870 if (bones->IsExpired(now))
3871 expiredBones.push_back(bones);
3873 for (
Corpse* bones : expiredBones)
3886 if (
uint32 music = itr->second.MusicId)
3922 zoneDynamicInfo.
DefaultWeather->SendWeatherUpdateToPlayer(player);
3939 if (
Player* player = itr->GetSource())
3954 info.
DefaultWeather = std::make_unique<Weather>(zoneId, weatherData);
3965 if (zoneDynamicInfo)
3990 if (
Player* player = itr->GetSource())
3991 if (player->GetZoneId() == zoneId)
4002 return lightOverride.AreaLightId == areaLightId;
4006 if (overrideLightId)
4021 overrideLight.
Write();
4024 if (
Player* player = itr->GetSource())
4025 if (player->GetZoneId() == zoneId)
4026 player->SendDirectMessage(overrideLight.
GetRawPacket());
4035 if (
Player* player = itr->GetSource())
4037 if (player->IsInWorld())
4039 player->UpdateAreaDependentAuras(player->GetAreaId());
4040 player->UpdateZoneDependentAuras(player->GetZoneId());
4048 std::stringstream sstr;
4049 sstr << std::boolalpha
4057 std::stringstream sstr;
@ CHAR_SEL_CORPSE_CUSTOMIZATIONS
@ CHAR_DEL_CORPSES_FROM_MAP
@ CONDITION_SOURCE_TYPE_SPAWN_GROUP
DB2Storage< DifficultyEntry > sDifficultyStore("Difficulty.db2", &DifficultyLoadInfo::Instance)
DB2Storage< MapEntry > sMapStore("Map.db2", &MapLoadInfo::Instance)
@ DIFFICULTY_LFR_15TH_ANNIVERSARY
@ DIFFICULTY_MYTHIC_KEYSTONE
@ DIFFICULTY_3_MAN_SCENARIO_HC
@ DIFFICULTY_TIMEWALKING_RAID
@ DIFFICULTY_NORMAL_WARFRONT
@ DIFFICULTY_NORMAL_ISLAND
@ DIFFICULTY_FLAG_DISPLAY_MYTHIC
@ DIFFICULTY_FLAG_DISPLAY_HEROIC
@ IgnoreInstanceFarmLimit
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
std::shared_ptr< PreparedResultSet > PreparedQueryResult
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
std::unordered_set< uint32 > params[2]
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
#define ASSERT_NOTNULL(pointer)
NGrid< MAX_NUMBER_OF_CELLS, Player, WorldTypeMapContainer, GridTypeMapContainer > NGridType
#define MAX_NUMBER_OF_CELLS
#define TOTAL_NUMBER_OF_CELLS_PER_MAP
CoordPair< MAX_NUMBER_OF_GRIDS > GridCoord
#define MAX_NUMBER_OF_GRIDS
#define CENTER_GRID_CELL_ID
#define SIZE_OF_GRID_CELL
#define CENTER_GRID_OFFSET
#define TC_LOG_DEBUG(filterType__, message__,...)
#define TC_LOG_ERROR(filterType__, message__,...)
#define TC_LOG_WARN(filterType__, message__,...)
@ MAP_OBJECT_CELL_MOVE_INACTIVE
@ MAP_OBJECT_CELL_MOVE_ACTIVE
@ MAP_OBJECT_CELL_MOVE_NONE
static void PushRespawnInfoFrom(std::vector< RespawnInfo const * > &data, RespawnInfoMap const &map)
GridState * si_GridStates[MAX_GRID_STATE]
std::unordered_map< ObjectGuid::LowType, RespawnInfo * > RespawnInfoMap
@ TRANSFER_ABORT_TOO_MANY_INSTANCES
@ TRANSFER_ABORT_DIFFICULTY
@ TRANSFER_ABORT_MAP_NOT_ALLOWED
@ TRANSFER_ABORT_MAX_PLAYERS
@ TRANSFER_ABORT_ZONE_IN_COMBAT
@ TRANSFER_ABORT_LOCKED_TO_DIFFERENT_INSTANCE
@ TRANSFER_ABORT_NEED_GROUP
#define TC_METRIC_VALUE(category, value,...)
#define TC_METRIC_TAG(name, value)
#define DEFAULT_VISIBILITY_NOTIFY_PERIOD
#define MAX_VISIBILITY_DISTANCE
#define DEFAULT_VISIBILITY_DISTANCE
std::unordered_map< Player *, UpdateData > UpdateDataMapType
std::optional< T > Optional
Optional helper class to wrap optional values within.
uint32 urand(uint32 min, uint32 max)
@ LINEOFSIGHT_CHECK_GOBJECT
@ WS_TEAM_IN_INSTANCE_ALLIANCE
@ WS_TEAM_IN_INSTANCE_HORDE
@ SPAWNGROUP_FLAG_DYNAMIC_SPAWN_RATE
@ SPAWNGROUP_FLAG_MANUAL_SPAWN
@ SPAWNGROUP_FLAG_DESPAWN_ON_CONDITION_FAILURE
@ SPAWNGROUP_FLAG_ESCORTQUESTNPC
@ SPAWN_TYPEMASK_CREATURE
@ SPAWN_TYPEMASK_GAMEOBJECT
@ SPELL_AURA_FORCE_WEATHER
bool LoadFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap, bool allowDuplicate)
TransferAbortParams CannotEnter(Player *player) override
BattlegroundMap(uint32 id, time_t, uint32 InstanceId, Difficulty spawnMode)
void RemoveAllPlayers() override
std::unique_ptr< BattlegroundScript > _battlegroundScript
Battleground * GetBG() const
std::string const & GetScriptName() const
bool AddPlayerToMap(Player *player, bool initPlayer=true) override
void RemovePlayerFromMap(Player *, bool) override
virtual void InitVisibilityDistance() override
void Update(uint32 diff) override
void SetBgMap(BattlegroundMap *map)
std::unordered_map< ObjectGuid, CombatReference * > const & GetPvECombatRefs() const
void ReplaceAllFlags(uint32 flags)
void SetClass(uint8 playerClass)
void SetGuildGUID(ObjectGuid guildGuid)
void SetDisplayId(uint32 displayId)
void SetCustomizations(Trinity::IteratorPair< Iter > customizations)
CorpseDynFlags GetCorpseDynamicFlags() const
void SetFactionTemplate(int32 factionTemplate)
void RemoveFromWorld() override
void SetOwnerGUID(ObjectGuid owner)
void SetPartyGUID(ObjectGuid partyGuid)
UF::UpdateField< UF::CorpseData, int32(WowCS::EntityFragment::CGObject), TYPEID_CORPSE > m_corpseData
CellCoord const & GetCellCoord() const
void ReplaceAllCorpseDynamicFlags(CorpseDynFlags dynamicFlags)
ObjectGuid GetOwnerGUID() const override
bool LoadCorpseFromDB(ObjectGuid::LowType guid, Field *fields)
void SetCellCoord(CellCoord const &cellCoord)
bool Create(ObjectGuid::LowType guidlow, Map *map)
CorpseType GetType() const
void DeleteFromDB(CharacterDatabaseTransaction trans)
void GetRespawnPosition(float &x, float &y, float &z, float *ori=nullptr, float *dist=nullptr) const
bool LoadFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap, bool allowDuplicate)
bool isInLineOfSight(G3D::Vector3 const &startPos, G3D::Vector3 const &endPos, PhaseShift const &phaseShift) const
bool getObjectHitPos(G3D::Vector3 const &startPos, G3D::Vector3 const &endPos, G3D::Vector3 &resultHitPos, float modifyDist, PhaseShift const &phaseShift) const
Class used to access individual fields of database query result.
void GetRespawnPosition(float &x, float &y, float &z, float *ori=nullptr) const
bool LoadFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap, bool=true)
void RemoveFromWorld() override
ObjectGuid::LowType GetSpawnId() const
Transport * ToTransport()
void AddToWorld() override
PeriodicTimer & getRelocationTimer()
virtual void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const =0
void AddGridObject(SPECIFIC_OBJECT *obj)
void AddWorldObject(SPECIFIC_OBJECT *obj)
virtual InstanceLockData const * GetInstanceInitializationData() const
void SetInUse(bool inUse)
InstanceResetTimePoint GetExpiryTime() const
InstanceLockData * GetData()
Optional< SystemTimePoint > i_instanceExpireEvent
InstanceLock * i_instanceLock
TransferAbortParams CannotEnter(Player *player) override
void Update(uint32) override
InstanceResetResult Reset(InstanceResetMethod method)
TeamId GetTeamIdInInstance() const
InstanceScenario * i_scenario
void TrySetOwningGroup(Group *group)
void CreateInstanceLockForPlayer(Player *player)
uint32 GetMaxPlayers() const
virtual void InitVisibilityDistance() override
uint32 GetScriptId() const
void RemovePlayerFromMap(Player *, bool) override
InstanceMap(uint32 id, time_t, uint32 InstanceId, Difficulty SpawnMode, TeamId InstanceTeam, InstanceLock *instanceLock, Optional< uint32 > lfgDungeonsId)
GroupInstanceReference i_owningGroupRef
bool AddPlayerToMap(Player *player, bool initPlayer=true) override
std::string const & GetScriptName() const
std::string GetDebugInfo() const override
void CreateInstanceData()
InstanceScript * GetInstanceScript()
void UpdateInstanceLock(UpdateBossStateSaveDataEvent const &updateSaveDataEvent)
std::string GetSaveData()
Optional< uint32 > GetEntranceLocationForCompletedEncounters(uint32 completedEncountersMask) const
void Load(char const *data)
virtual void OnPlayerLeave(Player *)
void UpdateCombatResurrection(uint32 diff)
void SetEntranceLocation(uint32 worldSafeLocationId)
std::string UpdateAdditionalSaveData(std::string const &oldData, UpdateAdditionalSaveDataEvent const &event)
virtual void OnPlayerEnter(Player *)
virtual void Update(uint32)
std::string UpdateBossStateSaveData(std::string const &oldData, UpdateBossStateSaveDataEvent const &event)
MapObjectCellMoveState _moveState
void SetNewCellPosition(float x, float y, float z, float o)
Cell const & GetCurrentCell() const
MapEntry const * i_mapEntry
void DynamicObjectRelocation(DynamicObject *go, float x, float y, float z, float orientation)
std::map< WorldObject *, bool > i_objectsToSwitch
WorldObject * GetWorldObjectBySpawnId(SpawnObjectType type, ObjectGuid::LowType spawnId) const
std::unordered_map< uint32, uint32 > _zonePlayerCountMap
std::vector< Creature * > _creaturesToMove
void AddFarSpellCallback(FarSpellCallback &&callback)
void GameObjectRelocation(GameObject *go, float x, float y, float z, float orientation, bool respawnRelocationOnFail=true)
void AddGameObjectToMoveList(GameObject *go, float x, float y, float z, float ang)
void RemoveDynamicObjectFromMoveList(DynamicObject *go)
void CreatureRelocation(Creature *creature, float x, float y, float z, float ang, bool respawnRelocationOnFail=true)
ZLiquidStatus GetLiquidStatus(PhaseShift const &phaseShift, float x, float y, float z, Optional< map_liquidHeaderTypeFlags > ReqLiquidType={}, LiquidData *data=nullptr, float collisionHeight=2.03128f)
void SetZoneMusic(uint32 zoneId, uint32 musicId)
bool IsBattlegroundOrArena() const
void RemoveInfiniteAOIVignette(Vignettes::VignetteData *vignette)
bool UnloadGrid(NGridType &ngrid, bool pForce)
void SetSpawnGroupInactive(uint32 groupId)
std::unordered_map< ObjectGuid, Corpse * > _corpsesByPlayer
void UpdateSpawnGroupConditions()
void SetZoneWeather(uint32 zoneId, WeatherState weatherId, float intensity)
Pet * GetPet(ObjectGuid const &guid)
MapStoredObjectTypesContainer & GetObjectsStore()
TransportsContainer::iterator _transportsUpdateIter
void InitializeObject(T *obj)
bool SpawnGroupSpawn(uint32 groupId, bool ignoreRespawn=false, bool force=false, std::vector< WorldObject * > *spawnedObjects=nullptr)
void SwitchGridContainers(T *obj, bool on)
void AddObjectToRemoveList(WorldObject *obj)
std::map< HighGuid, ObjectGuidGenerator > _guidGenerators
void SendZoneWeather(uint32 zoneId, Player *player) const
virtual void RemovePlayerFromMap(Player *, bool)
virtual bool AddPlayerToMap(Player *player, bool initPlayer=true)
void MoveAllGameObjectsInMoveList()
Creature * GetCreatureBySpawnId(ObjectGuid::LowType spawnId) const
void RemoveAreaTriggerFromMoveList(AreaTrigger *at)
void RemoveFromActiveHelper(WorldObject *obj)
void DeleteRespawnInfoFromDB(SpawnObjectType type, ObjectGuid::LowType spawnId, CharacterDatabaseTransaction dbTrans=nullptr)
size_t DespawnAll(SpawnObjectType type, ObjectGuid::LowType spawnId)
void AddAreaTriggerToMoveList(AreaTrigger *at, float x, float y, float z, float ang)
std::function< void(Map *)> FarSpellCallback
void SetSpawnGroupActive(uint32 groupId, bool state)
void LoadGrid(float x, float y)
bool IsUnderWater(PhaseShift const &phaseShift, float x, float y, float z)
void SendZoneDynamicInfo(uint32 zoneId, Player *player) const
void RemoveFromActive(WorldObject *obj)
MapDifficultyEntry const * GetMapDifficulty() const
PeriodicTimer _vignetteUpdateTimer
void AddInfiniteAOIVignette(Vignettes::VignetteData *vignette)
RespawnInfoMap * GetRespawnMapForType(SpawnObjectType type)
void EnsureGridCreated(GridCoord const &)
virtual TransferAbortParams CannotEnter(Player *)
void RemoveUpdateObject(Object *obj)
RespawnInfoMap _gameObjectRespawnTimesBySpawnId
NGridType * i_grids[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS]
void UpdatePersonalPhasesForPlayer(Player const *player)
Weather * GetOrGenerateZoneDefaultWeather(uint32 zoneId)
virtual void DelayedUpdate(uint32 diff)
Player * GetPlayer(ObjectGuid const &guid)
AreaTriggerBySpawnIdContainer & GetAreaTriggerBySpawnIdStore()
bool isInLineOfSight(PhaseShift const &phaseShift, float x1, float y1, float z1, float x2, float y2, float z2, LineOfSightChecks checks, VMAP::ModelIgnoreFlags ignoreFlags) const
bool IsNonRaidDungeon() const
time_t GetLinkedRespawnTime(ObjectGuid guid) const
void AddCorpse(Corpse *corpse)
bool IsBattleground() const
void UpdatePlayerZoneStats(uint32 oldZone, uint32 newZone)
WorldStateValueContainer _worldStateValues
IntervalTimer _weatherUpdateTimer
bool CheckRespawn(RespawnInfo *info)
void ProcessRelocationNotifies(const uint32 diff)
void UnloadAllRespawnInfos()
void RemoveRespawnTime(SpawnObjectType type, ObjectGuid::LowType spawnId, CharacterDatabaseTransaction dbTrans=nullptr, bool alwaysDeleteFromDB=false)
bool GetEntrancePos(int32 &mapid, float &x, float &y)
bool _dynamicObjectsToMoveLock
NGridType * getNGrid(uint32 x, uint32 y) const
std::shared_ptr< TerrainInfo > m_terrain
void AddToActiveHelper(WorldObject *obj)
bool _gameObjectsToMoveLock
bool IsMythicPlus() const
uint32 _respawnCheckTimer
Corpse * ConvertCorpseToBones(ObjectGuid const &ownerGuid, bool insignia=false)
bool IsRemovalGrid(float x, float y) const
std::unordered_map< uint32, std::unordered_set< Corpse * > > _corpsesByCell
MapRefManager m_mapRefManager
bool ActiveObjectsNearGrid(NGridType const &ngrid) const
void RemoveCreatureFromMoveList(Creature *c)
void GetZoneAndAreaId(PhaseShift const &phaseShift, uint32 &zoneid, uint32 &areaid, float x, float y, float z)
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)
void ScriptsProcess()
Process queued scripts.
void Visit(Cell const &cell, TypeContainerVisitor< T, CONTAINER > &visitor)
ScriptScheduleMap m_scriptSchedule
void AddWorldObject(WorldObject *obj)
void GetFullTerrainStatusForPosition(PhaseShift const &phaseShift, float x, float y, float z, PositionFullTerrainStatus &data, Optional< map_liquidHeaderTypeFlags > reqLiquidType={}, float collisionHeight=2.03128f)
void ResetGridExpiry(NGridType &grid, float factor=1) const
DynamicMapTree _dynamicTree
std::vector< GameObject * > _gameObjectsToMove
void DeleteRespawnInfo(RespawnInfo *info, CharacterDatabaseTransaction dbTrans=nullptr)
bool IsTimewalking() const
void ApplyDynamicModeRespawnScaling(WorldObject const *obj, ObjectGuid::LowType spawnId, uint32 &respawnDelay, uint32 mode) const
bool GameObjectRespawnRelocation(GameObject *go, bool diffGridOnly)
float GetWaterOrGroundLevel(PhaseShift const &phaseShift, float x, float y, float z, float *ground=nullptr, bool swim=false, float collisionHeight=2.03128f)
SceneObject * GetSceneObject(ObjectGuid const &guid)
void DeleteRespawnTimesInDB()
int32 m_VisibilityNotifyPeriod
float GetMinHeight(PhaseShift const &phaseShift, float x, float y)
std::unordered_set< Corpse * > _corpseBones
void SetWorldStateValue(int32 worldStateId, int32 value, bool hidden)
void AreaTriggerRelocation(AreaTrigger *at, float x, float y, float z, float orientation)
MPSCQueue< FarSpellCallback > _farSpellCallbacks
int32 GetWorldStateValue(int32 worldStateId) const
AreaTrigger * GetAreaTriggerBySpawnId(ObjectGuid::LowType spawnId) const
time_t GetGORespawnTime(ObjectGuid::LowType spawnId) const
void EnsureGridLoadedForActiveObject(Cell const &, WorldObject const *object)
static bool CheckGridIntegrity(T *object, bool moved, char const *objType)
void SendInitSelf(Player *player)
void DoRespawn(SpawnObjectType type, ObjectGuid::LowType spawnId, uint32 gridId)
virtual void RemoveAllPlayers()
std::unordered_set< uint32 > _toggledSpawnGroupIds
bool isCellMarked(uint32 pCellId)
SpawnGroupTemplateData const * GetSpawnGroupData(uint32 groupId) const
bool GameObjectCellRelocation(GameObject *go, Cell new_cell)
void SendToPlayers(WorldPacket const *data) const
bool AreaTriggerCellRelocation(AreaTrigger *at, Cell new_cell)
time_t GetCreatureRespawnTime(ObjectGuid::LowType spawnId) const
MultiPersonalPhaseTracker & GetMultiPersonalPhaseTracker()
static TransferAbortParams PlayerCannotEnter(uint32 mapid, Player *player)
bool IsHeroicOrHigher() const
GameObject * GetGameObject(ObjectGuid const &guid)
void SetZoneOverrideLight(uint32 zoneId, uint32 areaLightId, uint32 overrideLightId, Milliseconds transitionTime)
virtual std::string GetDebugInfo() const
static void DeleteStateMachine()
void SaveRespawnInfoDB(RespawnInfo const &info, CharacterDatabaseTransaction dbTrans=nullptr)
bool IsSpawnGroupActive(uint32 groupId) const
MapRefManager::iterator m_mapRefIter
bool CreatureCellRelocation(Creature *creature, Cell new_cell)
std::unique_ptr< RespawnListContainer > _respawnTimes
Corpse * GetCorpse(ObjectGuid const &guid)
time_t GetRespawnTime(SpawnObjectType type, ObjectGuid::LowType spawnId) const
virtual void Update(uint32)
uint32 GetZoneId(PhaseShift const &phaseShift, float x, float y, float z)
ZoneDynamicInfoMap _zoneDynamicInfo
bool _areaTriggersToMoveLock
DynamicObject * GetDynamicObject(ObjectGuid const &guid)
std::vector< Vignettes::VignetteData * > _infiniteAOIVignettes
std::vector< AreaTrigger * > _areaTriggersToMove
void RemoveGameObjectFromMoveList(GameObject *go)
void LoadGridForActiveObject(float x, float y, WorldObject const *object)
Conversation * GetConversation(ObjectGuid const &guid)
void RemoveWorldObject(WorldObject *obj)
std::set< WorldObject * > i_worldObjects
Difficulty GetDifficultyID() const
ActiveNonPlayers m_activeNonPlayers
void SaveRespawnTime(SpawnObjectType type, ObjectGuid::LowType spawnId, uint32 entry, time_t respawnTime, uint32 gridId, CharacterDatabaseTransaction dbTrans=nullptr, bool startup=false)
void SendUpdateTransportVisibility(Player *player)
bool MapObjectCellRelocation(T *object, Cell new_cell, char const *objType)
void UpdateIteratorBack(Player *player)
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
bool Instanceable() const
ObjectGuidGenerator & GetGuidSequenceGenerator(HighGuid high)
void AddDynamicObjectToMoveList(DynamicObject *go, float x, float y, float z, float ang)
std::unordered_set< Object * > _updateObjects
void buildNGridLinkage(NGridType *pNGridType)
MapEntry const * GetEntry() const
std::set< WorldObject * > i_objectsToRemove
bool SpawnGroupDespawn(uint32 groupId, bool deleteRespawnTimes=false, size_t *count=nullptr)
MapStoredObjectTypesContainer _objectsStore
void AddToGrid(T *object, Cell const &cell)
void MoveAllDynamicObjectsInMoveList()
uint32 GetPlayersCountExceptGMs() const
void DeleteFromWorld(T *)
void UpdateAreaDependentAuras()
void SendInitTransports(Player *player)
float GetVisibilityRange() const
char const * GetMapName() const
float GetWaterLevel(PhaseShift const &phaseShift, float x, float y)
Corpse * GetCorpseByPlayer(ObjectGuid const &ownerGuid) const
void RemoveAllObjectsInRemoveList()
void MoveAllCreaturesInMoveList()
bool IsGridLoaded(uint32 gridId) const
uint32 GetAreaId(PhaseShift const &phaseShift, float x, float y, float z)
void InitSpawnGroupState()
void markCell(uint32 pCellId)
virtual void LoadGridObjects(NGridType *grid, Cell const &cell)
void VisitNearbyCellsOf(WorldObject *obj, TypeContainerVisitor< Trinity::ObjectUpdater, GridTypeMapContainer > &gridVisitor, TypeContainerVisitor< Trinity::ObjectUpdater, WorldTypeMapContainer > &worldVisitor)
WeatherState GetZoneWeather(uint32 zoneId) const
void AddCreatureToMoveList(Creature *c, float x, float y, float z, float ang)
void GridUnmarkNoUnload(uint32 x, uint32 y)
void MoveAllAreaTriggersInMoveList()
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore()
float GetGridHeight(PhaseShift const &phaseShift, float x, float y)
virtual void InitVisibilityDistance()
Map(uint32 id, time_t, uint32 InstanceId, Difficulty SpawnMode)
float GetStaticHeight(PhaseShift const &phaseShift, float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH)
RespawnInfo * GetRespawnInfo(SpawnObjectType type, ObjectGuid::LowType spawnId) const
void setGridObjectDataLoaded(bool pLoaded, uint32 x, uint32 y)
bool EnsureGridLoaded(Cell const &)
void RemoveFromMap(T *, bool)
std::vector< DynamicObject * > _dynamicObjectsToMove
uint32 GetInstanceId() const
TransportsContainer _transports
void SendRemoveTransports(Player *player)
PlayerList const & GetPlayers() const
void AddToActive(WorldObject *obj)
static void InitStateMachine()
SpawnedPoolData & GetPoolData()
AreaTrigger * GetAreaTrigger(ObjectGuid const &guid)
void PlayerRelocation(Player *, float x, float y, float z, float orientation)
RespawnInfoMap _creatureRespawnTimesBySpawnId
bool CreatureRespawnRelocation(Creature *c, bool diffGridOnly)
CreatureBySpawnIdContainer _creatureBySpawnIdStore
void AddObjectToSwitchList(WorldObject *obj, bool on)
bool AddRespawnInfo(RespawnInfo const &info)
ActiveNonPlayers::iterator m_activeNonPlayersIter
bool IsInWater(PhaseShift const &phaseShift, float x, float y, float z, LiquidData *data=nullptr)
void RemoveCorpse(Corpse *corpse)
Creature * GetCreature(ObjectGuid const &guid)
Transport * GetTransport(ObjectGuid const &guid)
GameObject * GetGameObjectBySpawnId(ObjectGuid::LowType spawnId) const
bool isGridObjectDataLoaded(uint32 x, uint32 y) const
void GridMarkNoUnload(uint32 x, uint32 y)
bool DynamicObjectCellRelocation(DynamicObject *go, Cell new_cell)
bool IsAlwaysActive() const
GameObjectBySpawnIdContainer _gameobjectBySpawnIdStore
void Respawn(RespawnInfo *info, CharacterDatabaseTransaction dbTrans=nullptr)
void setNGrid(NGridType *grid, uint32 x, uint32 y)
std::unique_ptr< SpawnedPoolData > _poolData
bool IsBattleArena() const
bool ShouldBeSpawnedOnGridLoad(SpawnObjectType type, ObjectGuid::LowType spawnId) const
void decUnloadActiveLock()
GridType & GetGridType(const uint32 x, const uint32 y)
grid_state_t GetGridState(void) const
void SetGridState(grid_state_t s)
bool isGridObjectDataLoaded() const
void VisitAllGrids(TypeContainerVisitor< VISITOR, WORLD_OBJECT_CONTAINER > &visitor)
void setUnloadExplicitLock(bool on)
GridInfo * getGridInfoRef()
uint32 GetWorldObjectCountInNGrid() const
void incUnloadActiveLock()
void Set(ObjectGuid::LowType val)
LowType GetCounter() const
bool IsMOTransport() const
std::string ToString() const
static Creature * ToCreature(Object *o)
bool IsDestroyedObject() const
static GameObject * ToGameObject(Object *o)
void BuildDestroyUpdateBlock(UpdateData *data) const
virtual void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const
virtual void BuildUpdate(UpdateDataMapType &)
static ObjectGuid GetGUID(Object const *o)
void BuildOutOfRangeUpdateBlock(UpdateData *data) const
void SetDestroyedObject(bool destroyed)
static DynamicObject * ToDynObject(Object *o)
static uint32 GetTerrainMapId(PhaseShift const &phaseShift, uint32 mapId, TerrainInfo const *terrain, float x, float y)
static void AddPhase(WorldObject *object, uint32 phaseId, bool updateVisibility)
static void InheritPhaseShift(WorldObject *target, WorldObject const *source)
static void SendToPlayer(Player const *player, PhaseShift const &phaseShift)
bool HaveAtClient(Object const *u) const
bool Satisfy(AccessRequirement const *ar, uint32 target_map, TransferAbortParams *params=nullptr, bool report=false)
bool IsBeingTeleportedFar() const
void SendDirectMessage(WorldPacket const *data) const
void Update(uint32 time) override
void UpdateZone(uint32 newZone, uint32 newArea)
void AddInstanceEnterTime(uint32 instanceId, time_t enterTime)
GuidUnorderedSet m_clientGUIDs
bool IsLoading() const override
bool CheckInstanceCount(uint32 instanceId) const
WorldSession * GetSession() const
void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const override
WorldObject * GetViewpoint() const
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, TeleportToOptions options=TELE_TO_NONE, Optional< uint32 > instanceId={}, uint32 teleportSpellId=0)
bool IsGameMaster() const
void SetPendingBind(uint32 instanceId, uint32 bindTimer)
GuidUnorderedSet m_visibleTransports
MapReference & GetMapRef()
uint32 GetBattlegroundId() const
void AddToWorld() override
Group * GetGroup(Optional< uint8 > partyIndex)
void UpdateObjectVisibility(bool forced=true) override
void SetMap(Map *map) override
void RemoveFromWorld() override
Difficulty GetDifficultyID(MapEntry const *mapEntry) const
void setUInt16(uint8 index, uint16 value)
void setUInt32(uint8 index, uint32 value)
void setInt64(uint8 index, int64 value)
void setUInt64(uint8 index, uint64 value)
void link(TO *toObj, FROM *fromObj)
virtual void Update(uint32)
virtual void OnPlayerExit(Player *player)
virtual void OnPlayerEnter(Player *player)
uint32 GetExpectedMapId() const
Returns id of the map that transport is expected to be on, according to current path progress.
void CombatStop(bool includingCast=false, bool mutualPvP=true, bool(*unitFilter)(Unit const *otherUnit)=nullptr)
void UpdateObjectVisibility(bool forced=true) override
std::array< ObjectGuid, MAX_SUMMON_SLOT > m_SummonSlot
MotionMaster * GetMotionMaster()
void CleanupsBeforeDelete(bool finalCleanup=true) override
bool HasAuraType(AuraType auraType) const
void RemoveAurasWithInterruptFlags(InterruptFlags flag, SpellInfo const *source=nullptr)
CombatManager & GetCombatManager()
AuraApplicationMap & GetAppliedAuras()
Vehicle * GetVehicleKit() const
bool BuildPacket(WorldPacket *packet)
static VMapManager2 * createOrGetVMapManager()
void RelocatePassengers()
Relocate passengers. Must be called after m_base::Relocate.
constexpr uint32 GetMapId() const
bool InSamePhase(PhaseShift const &phaseShift) const
void RemoveFromWorld() override
virtual void UpdateObjectVisibilityOnDestroy()
float GetGridActivationRange() const
PhaseShift & GetPhaseShift()
TransportBase * GetTransport() const
uint32 GetInstanceId() const
std::string const & GetName() const
virtual void SetMap(Map *map)
void UpdatePositionData()
bool IsStoredInWorldObjectGridContainer() const
bool IsAlwaysStoredInWorldObjectGridContainer() const
virtual void Update(uint32 diff)
virtual void UpdateObjectVisibility(bool forced=true)
virtual void CleanupsBeforeDelete(bool finalCleanup=true)
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
int32 TransitionMilliseconds
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * GetRawPacket() const
WorldPacket const * Write() override
std::vector< ObjectGuid > Removed
WorldPacket const * Write() override
Player session in the World.
bool Update(uint32 diff, PacketFilter &updater)
Update the WorldSession (triggered by World update)
static constexpr uint32 SPECIAL_INIT_ACTIVE_MOVER_TIME_SYNC_COUNTER
void SendCalendarRaidLockoutAdded(InstanceLock const *lock)
void RegisterTimeSync(uint32 counter)
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
static float GetMaxVisibleDistanceInInstances()
static int32 GetVisibilityNotifyPeriodOnContinents()
static float GetMaxVisibleDistanceInBG()
static int32 GetVisibilityNotifyPeriodInArenas()
static int32 GetVisibilityNotifyPeriodInBG()
static int32 GetVisibilityNotifyPeriodInInstances()
static float GetMaxVisibleDistanceOnContinents()
static float GetMaxVisibleDistanceInArenas()
WeatherData const * GetWeatherData(uint32 zone_id)
static void SendFineWeatherUpdateToPlayer(Player *player)
@ CONFIG_RESPAWN_DYNAMICMINIMUM_CREATURE
@ CONFIG_INSTANCE_UNLOAD_DELAY
@ CONFIG_RESPAWN_DYNAMICMINIMUM_GAMEOBJECT
@ CONFIG_RESPAWN_MINCHECKINTERVALMS
@ CONFIG_CHECK_GOBJECT_LOS
@ CONFIG_DEATH_BONES_BG_OR_ARENA
@ CONFIG_INSTANCE_IGNORE_RAID
@ CONFIG_RESPAWN_DYNAMIC_ESCORTNPC
@ CONFIG_DEATH_BONES_WORLD
@ CONFIG_RESPAWN_DYNAMICRATE_CREATURE
@ CONFIG_RESPAWN_DYNAMICRATE_GAMEOBJECT
SystemTimePoint GetSystemTime()
Current chrono system_clock time point.
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
void RemoveObject(T *object)
TC_GAME_API Corpse * GetCorpse(WorldObject const &u, ObjectGuid const &guid)
auto MapEqualRange(M &map, typename M::key_type const &key)
constexpr IteratorPair< iterator, end_iterator > MakeIteratorPair(iterator first, end_iterator second)
auto MapGetValuePtr(M &map, typename M::key_type const &key)
GridCoord ComputeGridCoord(float x, float y)
CellCoord ComputeCellCoord(float x, float y)
bool CanSee(Player const *player, VignetteData const &vignette)
bool DiffGrid(Cell const &cell) const
bool DiffCell(Cell const &cell) const
static CellArea CalculateCellArea(float x, float y, float radius)
struct Cell::@303::@304 Part
bool IsCoordValid() const
uint32 EntranceWorldSafeLocId
uint32 CompletedEncountersMask
void SetInterval(time_t interval)
time_t GetInterval() const
bool IsBattleground() const
bool GetEntrancePos(int32 &mapid, float &x, float &y) const
bool IsNonRaidDungeon() const
bool IsFlexLocking() const
bool IsBattlegroundOrArena() const
EnumFlag< MapFlags2 > GetFlags2() const
bool IsBattleArena() const
bool Instanceable() const
void Update(Map *map, uint32 diff)
void MarkAllPhasesForDeletion(ObjectGuid const &phaseOwner)
void LoadGrid(PhaseShift const &phaseShift, NGridType &grid, Map *map, Cell const &cell)
void UnregisterTrackedObject(WorldObject *object)
void UnloadGrid(NGridType &grid)
void OnOwnerPhaseChanged(WorldObject const *phaseOwner, NGridType *grid, Map *map, Cell const &cell)
bool Update(const uint32 diff)
void TReset(int32 diff, int32 period)
constexpr float GetPositionX() const
constexpr float GetPositionY() const
bool IsPositionValid() const
constexpr void Relocate(float x, float y)
constexpr float GetOrientation() const
constexpr float GetPositionZ() const
void resetNotify(GridRefManager< T > &m)
void Visit(PlayerMapType &m)
void Visit(GridRefManager< T > &)
void Visit(CreatureMapType &m)
RespawnInfoWithHandle(RespawnInfo const &other)
RespawnListContainer::handle_type handle
ObjectGuid::LowType spawnId
ObjectType * Find(typename UnderlyingContainer< ObjectType >::KeyType const &key) const
uint32 ChrCustomizationChoiceID
uint32 ChrCustomizationOptionID
DungeonEncounterEntry const * DungeonEncounter
EnumFlag< VignetteFlags > GetFlags() const
VignetteEntry const * Data
void FillPacket(WorldPackets::Vignette::VignetteDataSet &dataSet) const
std::unordered_set< uint32 > AreaIds
uint32 TransitionMilliseconds
std::vector< LightOverride > LightOverrides
std::unique_ptr< Weather > DefaultWeather