68#include <boost/heap/fibonacci_heap.hpp>
71#define DEFAULT_GRID_EXPIRY 300
72#define MAX_GRID_LOAD_TIME 50
73#define MAX_CREATURE_ATTACK_RADIUS (45.0f * sWorld->getRate(RATE_CREATURE_AGGRO))
83struct RespawnListContainer : boost::heap::fibonacci_heap<RespawnInfoWithHandle*, boost::heap::compare<CompareRespawnInfo>>
91 RespawnListContainer::handle_type
handle;
139_creatureToMoveLock(false), _gameObjectsToMoveLock(false), _dynamicObjectsToMoveLock(false), _areaTriggersToMoveLock(false),
140i_mapEntry(
sMapStore.LookupEntry(id)), i_spawnMode(SpawnMode), i_InstanceId(InstanceId),
143m_activeNonPlayersIter(m_activeNonPlayers.end()), _transportsUpdateIter(_transports.end()),
144i_gridExpiry(expiry), m_terrain(
sTerrainMgr.LoadTerrain(id)), m_forceEnabledNavMeshFilterFlags(0), m_forceDisabledNavMeshFilterFlags(0), i_grids(),
145i_scriptLock(false), _respawnTimes(
std::make_unique<
RespawnListContainer>()), _respawnCheckTimer(0), _vignetteUpdateTimer(5200, 5200)
178 if constexpr (WorldTypeMapContainer::TypeExists<T> && GridTypeMapContainer::TypeExists<T>)
181 if (obj->IsStoredInWorldObjectGridContainer())
186 else if constexpr (WorldTypeMapContainer::TypeExists<T>)
188 else if constexpr (GridTypeMapContainer::TypeExists<T>)
191 if constexpr (std::is_base_of_v<MapObject, T>)
192 obj->SetCurrentCell(cell);
401 Cell cell(cellCoord);
448 int32 oldValue = itr->second;
449 if (oldValue == value && !inserted)
455 if (worldStateTemplate)
456 sScriptMgr->OnWorldStateValueChange(worldStateTemplate, oldValue, value,
this);
461 updateWorldState.
Value = value;
462 updateWorldState.
Hidden = hidden;
463 updateWorldState.
Write();
467 if (worldStateTemplate && !worldStateTemplate->
AreaIds.empty())
469 bool isInAllowedArea = std::any_of(worldStateTemplate->
AreaIds.begin(), worldStateTemplate->
AreaIds.end(),
470 [playerAreaId = mapReference.GetSource()->GetAreaId()](
uint32 requiredAreaId) { return DB2Manager::IsInArea(playerAreaId, requiredAreaId); });
471 if (!isInAllowedArea)
475 mapReference.GetSource()->SendDirectMessage(updateWorldState.
GetRawPacket());
485 vignetteUpdate.
Write();
489 ref.GetSource()->SendDirectMessage(vignetteUpdate.
GetRawPacket());
499 vignetteUpdate.
Write();
504 if (ref.GetSource()->GetZoneId() == vignette->
ZoneID)
505 ref.GetSource()->SendDirectMessage(vignetteUpdate.
GetRawPacket());
530 if (obj->IsInWorld())
533 obj->UpdateObjectVisibility(
true);
544 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);
549 obj->setActive(
true);
551 Cell cell(cellCoord);
552 if (obj->isActiveObject())
557 TC_LOG_DEBUG(
"maps",
"Object {} enters grid[{}, {}]", obj->GetGUID().ToString(), cell.
GridX(), cell.
GridY());
565 if (obj->isActiveObject())
570 obj->SetIsNewObject(
true);
571 obj->UpdateObjectVisibilityOnCreate();
572 obj->SetIsNewObject(
false);
599 if (itr->GetSource()->GetTransport() != obj && itr->GetSource()->
InSamePhase(obj))
603 itr->GetSource()->m_visibleTransports.insert(obj->
GetGUID());
606 itr->GetSource()->SendDirectMessage(&packet);
642 Visit(cell, gridVisitor);
643 Visit(cell, worldVisitor);
651 if (oldZone == newZone)
657 ASSERT(oldZoneCount,
"A player left zone %u (went to %u) - but there were no players in the zone!", oldZone, newZone);
678 session->
Update(t_diff, updater);
722 std::vector<Unit*> toVisit;
726 toVisit.push_back(unit);
727 for (
Unit* unit : toVisit)
732 std::unordered_set<Unit*> toVisit;
733 for (std::pair<uint32, AuraApplication*> pair : player->
GetAppliedAuras())
735 if (
Unit* caster = pair.second->GetBase()->GetCaster())
737 toVisit.insert(caster);
739 for (
Unit* unit : toVisit)
744 std::vector<Unit*> toVisit;
748 if (!summonGuid.IsEmpty())
751 toVisit.push_back(unit);
753 for (
Unit* unit : toVisit)
781 if (vignette->NeedUpdate)
784 vignette->FillPacket(vignetteUpdate.
Updated);
785 vignetteUpdate.
Write();
788 ref.GetSource()->SendDirectMessage(vignetteUpdate.
GetRawPacket());
790 vignette->NeedUpdate =
false;
810 zoneInfo.second.DefaultWeather.reset();
841 iter->GetSource()->ResetAllNotifies();
880 Visit(cell, grid_object_relocation);
881 Visit(cell, world_object_relocation);
916 Visit(cell, grid_notifier);
917 Visit(cell, world_notifier);
933 bool const inWorld = player->
IsInWorld();
953 obj->RemoveFromWorld();
954 if (obj->isActiveObject())
960 obj->UpdateObjectVisibilityOnDestroy();
962 obj->RemoveFromGrid();
987 if (itr->GetSource()->GetTransport() != obj && itr->GetSource()->m_visibleTransports.count(obj->
GetGUID()))
989 itr->GetSource()->SendDirectMessage(&packet);
990 itr->GetSource()->m_visibleTransports.erase(obj->
GetGUID());
997 TransportsContainer::iterator itr =
_transports.find(obj);
1013template <
typename T>
1016 Cell const& cur_cell =
object->GetCurrentCell();
1017 Cell xy_cell(object->GetPositionX(), object->GetPositionY());
1018 if (xy_cell != cur_cell)
1020 TC_LOG_DEBUG(
"maps",
"{} {} X: {} Y: {} ({}) is in grid[{}, {}]cell[{}, {}] instead of grid[{}, {}]cell[{}, {}]",
1021 objType, object->GetGUID().ToString(),
1022 object->GetPositionX(), object->GetPositionY(), (moved ?
"final" :
"original"),
1036 Cell new_cell(x, y);
1038 player->
Relocate(x, y, z, orientation);
1044 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());
1062 Cell new_cell(x, y);
1072 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());
1093 Cell new_cell(x, y);
1104 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());
1111 go->
Relocate(x, y, z, orientation);
1122 Cell new_cell(x, y);
1133 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());
1140 dynObj->
Relocate(x, y, z, orientation);
1152 Cell new_cell(x, y);
1163 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());
1170 at->
Relocate(x, y, z, orientation);
1362 if (dynObj->
FindMap() !=
this)
1434template <
typename T>
1437 Cell const& old_cell =
object->GetCurrentCell();
1444 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());
1447 object->RemoveFromGrid();
1453 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());
1463 if (object->isActiveObject())
1468 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());
1471 object->RemoveFromGrid();
1478 if (c->GetCharmerOrOwnerGUID().IsPlayer())
1485 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());
1488 object->RemoveFromGrid();
1497 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());
1535 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());
1562 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());
1641 TC_LOG_DEBUG(
"maps",
"Unloading grid[{}, {}] for map {} finished", x, y,
GetId());
1651 Player* player = itr->GetSource();
1655 TC_LOG_ERROR(
"maps",
"Map::UnloadAll: player {} is still in map {} during unload, this should not happen!", player->
GetName(),
GetId());
1680 RemoveFromMap<Transport>(transport,
true);
1685 for (
Corpse* corpse : corpses)
1687 corpse->RemoveFromWorld();
1701 m_terrain->GetFullTerrainStatusForPosition(phaseShift,
GetId(), x, y, z, data, reqLiquidType, collisionHeight, &
_dynamicTree);
1705 float collisionHeight)
1707 return m_terrain->GetLiquidStatus(phaseShift,
GetId(), x, y, z, ReqLiquidType, data, collisionHeight);
1737 return m_terrain->GetStaticHeight(phaseShift,
GetId(), x, y, z, checkVMap, maxSearchDist);
1763 && !
VMAP::VMapFactory::createOrGetVMapManager()->
isInLineOfSight(
PhasingHandler::GetTerrainMapId(phaseShift,
GetId(),
m_terrain.get(), x1, y1), x1, y1, z1, x2, y2, z2, ignoreFlags))
1771bool 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)
1773 G3D::Vector3 startPos(x1, y1, z1);
1774 G3D::Vector3 dstPos(x2, y2, z2);
1776 G3D::Vector3 resultPos;
1792 G3D::AABox
const& bounds = model.
getBounds();
1841 uint32 instanceIdToCheck =
sMapMgr->FindInstanceIdForPlayer(mapid, player);
1842 if (
Map* boundMap =
sMapMgr->FindMap(mapid, instanceIdToCheck))
1868 transport->BuildCreateUpdateBlockForPlayer(&data, player);
1877 for (
WorldObject* passenger : transport->GetPassengers())
1878 if (player != passenger && player->
HaveAtClient(passenger))
1879 passenger->BuildCreateUpdateBlockForPlayer(&data, player);
1897 transport->BuildCreateUpdateBlockForPlayer(&transData, player);
1918 transport->BuildOutOfRangeUpdateBlock(&transData);
1937 if (!transport->IsInWorld())
1945 transport->BuildCreateUpdateBlockForPlayer(&transData, player);
1951 transport->BuildOutOfRangeUpdateBlock(&transData);
1968 TC_LOG_ERROR(
"maps",
"map::setNGrid() Invalid grid coordinates found: {}, {}!", x, y);
1987 for (UpdateDataMapType::iterator iter = update_players.begin(); iter != update_players.end(); ++iter)
1989 iter->second.BuildPacket(&packet);
1990 iter->first->SendDirectMessage(&packet);
2012 bool alreadyExists =
false;
2021 for (
auto it = range.first; it != range.second; ++it)
2029 alreadyExists =
true;
2037 alreadyExists =
true;
2057 if (linkedTime == std::numeric_limits<time_t>::max())
2058 respawnTime = linkedTime;
2059 else if (
sObjectMgr->GetLinkedRespawnGuid(thisGUID) == thisGUID)
2060 respawnTime = now +
WEEK;
2062 respawnTime = std::max<time_t>(now, linkedTime) +
urand(5, 15);
2081 std::vector<WorldObject*> toUnload;
2086 toUnload.push_back(pair.second);
2090 toUnload.push_back(pair.second);
2099 return toUnload.size();
2117 auto it = bySpawnIdMap->find(info.
spawnId);
2118 if (it != bySpawnIdMap->end())
2126 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);
2133 bySpawnIdMap->emplace(ri->
spawnId, ri);
2139 data.reserve(data.size() + map.size());
2140 for (
auto const& pair : map)
2141 data.push_back(pair.second);
2157 auto it = map->find(spawnId);
2158 if (it == map->end())
2182 auto range = spawnMap->equal_range(info->
spawnId);
2183 auto it = std::find_if(range.first, range.second, [info](RespawnInfoMap::value_type
const& pair) { return (pair.second == info); });
2185 spawnMap->erase(it);
2220 if (!obj->
LoadFromDB(spawnId,
this,
true,
true))
2242 if (now < next->respawnTime)
2280 ASSERT(now < next->respawnTime);
2318 uint32 const playerCount = it->second;
2322 if (adjustFactor >= 1.0)
2325 if (respawnDelay <= timeMinimum)
2328 respawnDelay = std::max<uint32>(ceil(respawnDelay * adjustFactor), timeMinimum);
2346 if (!
GetPoolData().IsSpawnedObject(type, spawnId))
2365 TC_LOG_ERROR(
"maps",
"Tried to spawn non-existing (or system) spawn group {} on map {}. Blocked.", groupId,
GetId());
2371 std::vector<SpawnData const*> toSpawn;
2372 for (
auto& pair :
sObjectMgr->GetSpawnMetadataForGroup(groupId))
2381 if (force || ignoreRespawn)
2404 if (std::find(data->spawnDifficulties.begin(), data->spawnDifficulties.end(),
GetDifficultyID()) == data->spawnDifficulties.end())
2417 if (!creature->
LoadFromDB(data->spawnId,
this,
true, force))
2419 else if (spawnedObjects)
2420 spawnedObjects->push_back(creature);
2426 if (!gameobject->
LoadFromDB(data->spawnId,
this,
true))
2428 else if (spawnedObjects)
2429 spawnedObjects->push_back(gameobject);
2435 if (!areaTrigger->
LoadFromDB(data->spawnId,
this,
true,
false))
2437 else if (spawnedObjects)
2438 spawnedObjects->push_back(areaTrigger);
2454 TC_LOG_ERROR(
"maps",
"Tried to despawn non-existing (or system) spawn group {} on map {}. Blocked.", groupId,
GetId());
2458 for (
auto const& pair :
sObjectMgr->GetSpawnMetadataForGroup(groupId))
2462 if (deleteRespawnTimes)
2477 TC_LOG_ERROR(
"maps",
"Tried to set non-existing (or system) spawn group {} to {} on map {}. Blocked.", groupId, state ?
"active" :
"inactive",
GetId());
2491 TC_LOG_ERROR(
"maps",
"Tried to query state of non-existing spawn group {} on map {}.", groupId,
GetId());
2502 std::vector<uint32>
const* spawnGroups =
sObjectMgr->GetSpawnGroupsForMap(
GetId());
2506 for (
uint32 spawnGroupId : *spawnGroups)
2518 std::vector<uint32>
const* spawnGroups =
sObjectMgr->GetSpawnGroupsForMap(
GetId());
2522 for (
uint32 spawnGroupId : *spawnGroups)
2538 if (isActive == shouldBeActive)
2580 GridInfo* info = i->GetSource()->getGridInfoRef();
2609 else if (itr->second != on)
2621 bool on = itr->second;
2629 SwitchGridContainers<Creature>(obj->
ToCreature(), on);
2679 TC_LOG_ERROR(
"maps",
"Non-grid object (TypeId: {}) is in grid object remove list, ignored.", obj->
GetTypeId());
2693 if (!itr->GetSource()->IsGameMaster())
2701 itr->GetSource()->SendDirectMessage(data);
2707 bool foundPlayerToSend =
false;
2711 Player* player = ref.GetSource();
2715 (!team || player->
GetTeam() == *team))
2718 foundPlayerToSend =
true;
2722 return foundPlayerToSend;
2734 cell_min.
dec_x(cell_range);
2735 cell_min.
dec_y(cell_range);
2736 cell_max.
inc_x(cell_range);
2737 cell_max.
inc_y(cell_range);
2741 Player* player = iter->GetSource();
2780 if (
Creature* creature = obj->
ToCreature(); !creature->IsPet() && creature->GetSpawnId())
2781 respawnLocation = creature->GetRespawnPosition();
2785 respawnLocation = gameObject->GetRespawnPosition();
2791 if (respawnLocation)
2799 TC_LOG_ERROR(
"maps",
"Active object {} added to grid[{}, {}] but spawn grid[{}, {}] was not loaded.",
2825 if (
Creature* creature = obj->
ToCreature(); !creature->IsPet() && creature->GetSpawnId())
2826 respawnLocation = creature->GetRespawnPosition();
2830 respawnLocation = gameObject->GetRespawnPosition();
2836 if (respawnLocation)
2844 TC_LOG_ERROR(
"maps",
"Active object {} removed from to grid[{}, {}] but spawn grid[{}, {}] was not loaded.",
2870 :
Map(id, expiry, InstanceId, SpawnMode),
2871 i_data(nullptr), i_script_id(0), i_instanceLock(instanceLock), i_lfgDungeonsId(lfgDungeonsId)
2942 if (!player->
IsInGroup(owningGroup->GetGUID()))
2959 if (!entries.MapDifficulty->IsUsingEncounterLocks())
2969 pendingRaidLock.
WarningOnly = entries.Map->IsFlexLocking();
2971 if (!entries.Map->IsFlexLocking())
3060 if (!lockData->
Data.empty())
3091 ref.GetSource()->SendResetFailedNotify(
GetId());
3102 raidInstanceMessage.
Write();
3105 ref.GetSource()->SendDirectMessage(raidInstanceMessage.
GetRawPacket());
3114 pendingRaidLock.
Write();
3118 ref.GetSource()->SendDirectMessage(pendingRaidLock.
GetRawPacket());
3173 if (entries.IsInstanceIdBound())
3179 Player* player = mapReference.GetSource();
3185 std::string
const* oldData =
nullptr;
3186 uint32 playerCompletedEncounters = 0;
3193 bool isNewLock = !playerLock || playerLock->
IsNew() || playerLock->
IsExpired();
3223 if (entries.IsInstanceIdBound())
3225 instanceCompletedEncounters,
nullptr, {}));
3229 Player* player = mapReference.GetSource();
3235 std::string
const* oldData =
nullptr;
3239 bool isNewLock = !playerLock || playerLock->
IsNew() || playerLock->
IsExpired();
3243 instanceCompletedEncounters,
nullptr, {}));
3264 bool isNewLock = !playerLock || playerLock->
IsNew() || playerLock->
IsExpired();
3453 :
Map(id, expiry, InstanceId, spawnMode), m_bg(nullptr), _battlegroundScript(nullptr), _scriptId(0)
3542 if (
Player* player = itr->GetSource())
3543 if (!player->IsBeingTeleportedFar())
3544 player->TeleportTo(player->GetBattlegroundEntryPoint());
3610 if (bounds.first == bounds.second)
3613 std::unordered_multimap<ObjectGuid::LowType, Creature*>::const_iterator creatureItr = std::find_if(bounds.first, bounds.second, [](Map::CreatureBySpawnIdContainer::value_type
const& pair)
3615 return pair.second->IsAlive();
3618 return creatureItr != bounds.second ? creatureItr->second : bounds.first->second;
3624 if (bounds.first == bounds.second)
3627 std::unordered_multimap<ObjectGuid::LowType, GameObject*>::const_iterator creatureItr = std::find_if(bounds.first, bounds.second, [](Map::GameObjectBySpawnIdContainer::value_type
const& pair)
3629 return pair.second->isSpawned();
3632 return creatureItr != bounds.second ? creatureItr->second : bounds.first->second;
3638 if (bounds.first == bounds.second)
3641 return bounds.first->second;
3655 TC_LOG_ERROR(
"maps",
"Map {} attempt to save respawn time for nonexistant spawnid ({},{}).",
GetId(), type, spawnId);
3677 TC_LOG_ERROR(
"maps",
"Attempt to load saved respawn {} for ({},{}) failed - duplicate respawn? Skipped.", respawnTime,
uint32(type), spawnId);
3709 Field* fields = result->Fetch();
3712 time_t respawnTime = fields[2].
GetInt64();
3719 TC_LOG_ERROR(
"maps",
"Loading saved respawn time of {} for spawnid ({},{}) - spawn does not exist, ignoring", respawnTime,
uint32(type), spawnId);
3723 TC_LOG_ERROR(
"maps",
"Loading saved respawn time of {} for spawnid ({},{}) - invalid spawn type, ignoring", respawnTime,
uint32(type), spawnId);
3726 }
while (result->NextRow());
3769 std::unordered_map<ObjectGuid::LowType, std::unordered_set<uint32>> phases;
3770 std::unordered_map<ObjectGuid::LowType, std::vector<UF::ChrCustomizationChoice>> customizations;
3782 Field* fields = phaseResult->Fetch();
3786 phases[guid].insert(phaseId);
3788 }
while (phaseResult->NextRow());
3801 Field* fields = customizationResult->Fetch();
3803 std::vector<UF::ChrCustomizationChoice>& customizationsForCorpse = customizations[guid];
3805 customizationsForCorpse.emplace_back();
3810 }
while (customizationResult->NextRow());
3815 Field* fields = result->Fetch();
3820 TC_LOG_ERROR(
"misc",
"Corpse (guid: {}) have wrong corpse type ({}), not loading.", guid, type);
3825 if (!corpse->
LoadCorpseFromDB(GenerateLowGuid<HighGuid::Corpse>(), fields))
3831 for (
uint32 phaseId : phases[guid])
3838 }
while (result->NextRow());
3943 std::vector<ObjectGuid> corpses;
3947 if (p.second->IsExpired(now))
3948 corpses.push_back(p.first);
3953 std::vector<Corpse*> expiredBones;
3955 if (bones->IsExpired(now))
3956 expiredBones.push_back(bones);
3958 for (
Corpse* bones : expiredBones)
3971 if (
uint32 music = itr->second.MusicId)
3979 overrideLight.
AreaLightID = lightOverride.AreaLightId;
4007 zoneDynamicInfo.
DefaultWeather->SendWeatherUpdateToPlayer(player);
4038 info.
DefaultWeather = std::make_unique<Weather>(
this, zoneId, weatherData);
4049 if (zoneDynamicInfo)
4068 if (!players.
empty())
4074 if (
Player* player = itr->GetSource())
4086 return lightOverride.AreaLightId == areaLightId;
4090 if (overrideLightId)
4110 if (
Player* player = itr->GetSource())
4112 if (player->IsInWorld())
4114 player->UpdateAreaDependentAuras(player->GetAreaId());
4115 player->UpdateZoneDependentAuras(player->GetZoneId());
4123 std::stringstream sstr;
4124 sstr << std::boolalpha
4132 std::stringstream sstr;
std::unordered_map< Player *, UpdateData > UpdateDataMapType
@ 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_FLAG_DISPLAY_MYTHIC
@ DIFFICULTY_FLAG_DISPLAY_HEROIC
@ DIFFICULTY_LFR_15TH_ANNIVERSARY
@ DIFFICULTY_MYTHIC_KEYSTONE
@ DIFFICULTY_3_MAN_SCENARIO_HC
@ DIFFICULTY_TIMEWALKING_RAID
@ DIFFICULTY_NORMAL_WARFRONT
@ DIFFICULTY_NORMAL_ISLAND
@ 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)
#define MAX_NUMBER_OF_CELLS
#define TOTAL_NUMBER_OF_CELLS_PER_MAP
CoordPair< MAX_NUMBER_OF_GRIDS > GridCoord
#define MAX_NUMBER_OF_GRIDS
#define SIZE_OF_GRID_CELL
NGrid< MAX_NUMBER_OF_CELLS, WorldTypeMapContainer, GridTypeMapContainer > NGridType
#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::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
constexpr std::underlying_type< E >::type AsUnderlyingType(E enumValue)
bool LoadFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap, bool allowDuplicate)
ObjectGuid const & GetGUID() const
void SetDestroyedObject(bool destroyed)
void BuildDestroyUpdateBlock(UpdateData *data) const
virtual void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const
bool IsDestroyedObject() const
void BuildOutOfRangeUpdateBlock(UpdateData *data) const
virtual void BuildUpdate(UpdateDataMapType &data_map)
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
uint32 GetDisplayId() const
ObjectGuid GetPartyGUID() const
void SetClass(uint8 playerClass)
ObjectGuid GetGuildGUID() const
void SetGuildGUID(ObjectGuid guildGuid)
void SetDisplayId(uint32 displayId)
CorpseDynFlags GetCorpseDynamicFlags() const
void ReplaceAllCorpseFlags(CorpseFlags flags)
void SetFactionTemplate(int32 factionTemplate)
void RemoveFromWorld() override
void SetOwnerGUID(ObjectGuid owner)
void SetPartyGUID(ObjectGuid partyGuid)
void ReplaceAllCorpseDynamicFlags(CorpseDynFlags dynamicFlags)
CorpseFlags GetCorpseFlags() const
ObjectGuid GetOwnerGUID() const override
bool LoadCorpseFromDB(ObjectGuid::LowType guid, Field *fields)
std::span< UF::ChrCustomizationChoice const > GetCustomizations() const
void SetCustomizations(std::span< UF::ChrCustomizationChoice const > customizations)
bool Create(ObjectGuid::LowType guidlow, Map *map)
uint32 GetFactionTemplate() const
CorpseType GetType() const
void DeleteFromDB(CharacterDatabaseTransaction trans)
bool LoadFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap, bool allowDuplicate)
Position GetRespawnPosition(float *dist=nullptr) const
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.
uint64 GetUInt64() const noexcept
uint32 GetUInt32() const noexcept
int64 GetInt64() const noexcept
const G3D::AABox & getBounds() const
G3D::Vector3 const & GetPosition() const
bool LoadFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap, bool=true)
void RemoveFromWorld() override
ObjectGuid::LowType GetSpawnId() const
Transport * ToTransport()
void AddToWorld() override
Position GetRespawnPosition() const
PeriodicTimer & getRelocationTimer()
virtual void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const =0
void AddWorldObject(SPECIFIC_OBJECT *obj)
void AddGridObject(SPECIFIC_OBJECT *obj)
Difficulty GetDifficultyID(MapEntry const *mapEntry) const
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
std::unique_ptr< 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
void SetInstanceScenario(InstanceScenario *scenario)
std::string GetDebugInfo() const override
void CreateInstanceData()
Group * GetOwningGroup() const
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)
static bool isRebuildingTilesEnabledOnMap(uint32 mapId)
static MMapManager * instance()
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()
bool SendZoneMessage(uint32 zone, WorldPacket const *packet, WorldSession const *self=nullptr, Optional< Team > team={ }) const
Send a packet to all players (or players selected team) in the zone (except self if mentioned)
void EnsureGridCreated(GridCoord const &p)
Creature * GetCreatureBySpawnId(ObjectGuid::LowType spawnId) const
void RemoveAreaTriggerFromMoveList(AreaTrigger *at)
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
std::shared_ptr< MMAP::DynamicTileBuilder > m_mmapTileRebuilder
void AddInfiniteAOIVignette(Vignettes::VignetteData *vignette)
RespawnInfoMap * GetRespawnMapForType(SpawnObjectType type)
virtual TransferAbortParams CannotEnter(Player *)
RespawnInfoMap _gameObjectRespawnTimesBySpawnId
NGridType * i_grids[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS]
void UpdatePersonalPhasesForPlayer(Player const *player)
Weather * GetOrGenerateZoneDefaultWeather(uint32 zoneId)
void SendZoneText(uint32 zoneId, const char *text, WorldSession const *self=nullptr, Optional< Team > team={ }) const
Send a System Message to all players in the zone (except self if mentioned)
virtual void DelayedUpdate(uint32 diff)
Player * GetPlayer(ObjectGuid const &guid)
AreaTriggerBySpawnIdContainer & GetAreaTriggerBySpawnIdStore()
void RemoveUpdateObject(BaseEntity *obj)
void EnsureGridLoadedForActiveObject(GridCoord const &p, WorldObject const *object)
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)
std::unordered_set< BaseEntity * > _updateObjects
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
bool _gameObjectsToMoveLock
bool IsMythicPlus() const
uint32 _respawnCheckTimer
Corpse * ConvertCorpseToBones(ObjectGuid const &ownerGuid, bool insignia=false)
bool IsRemovalGrid(float x, float y) const
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 RequestRebuildNavMeshOnGameObjectModelChange(GameObjectModel const &model, PhaseShift const &phaseShift)
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
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)
virtual void LoadGridObjects(NGridType *grid)
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)
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()
bool EnsureGridLoaded(GridCoord const &p)
void markCell(uint32 pCellId)
void LoadGridsInRange(float x, float y, float radius)
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 RemoveFromMap(T *, bool)
std::vector< DynamicObject * > _dynamicObjectsToMove
uint32 GetInstanceId() const
TransportsContainer _transports
void SendRemoveTransports(Player *player)
std::unordered_map< uint32, std::unordered_set< Corpse * > > _corpsesByGrid
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
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()
void setUnloadExplicitLock(bool on)
void SetGridState(grid_state_t s)
grid_state_t GetGridState(void) const
void VisitAllGrids(TypeContainerVisitor< VISITOR, WORLD_OBJECT_CONTAINER > &visitor)
GridType & GetGridType(const uint32 x, const uint32 y)
bool HasWorldObjectsInNGrid() const
void setGridObjectDataLoaded(bool pLoaded)
bool isGridObjectDataLoaded() const
GridInfo * getGridInfoRef()
void incUnloadActiveLock()
void Set(ObjectGuid::LowType val)
LowType GetCounter() const
bool IsMOTransport() const
std::string ToString() const
DynamicObject * ToDynObject()
GameObject * ToGameObject()
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 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)
GuidUnorderedSet m_clientGUIDs
bool IsLoading() const override
bool HaveAtClient(BaseEntity const *u) 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
bool IsInGroup(ObjectGuid groupGuid) const
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 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 VMapManager * 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)
void Initialize(ChatMsg chatType, Language language, WorldObject const *sender, WorldObject const *receiver, std::string_view message, uint32 achievementId=0, std::string_view channelName="", LocaleConstant locale=DEFAULT_LOCALE, std::string_view addonPrefix="")
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
int32 TransitionMilliseconds
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.
bool UpdateAndCheckInstanceCount(uint32 instanceId)
void AddInstanceEnterTime(uint32 instanceId, SystemTimePoint enterTime)
WeatherData const * GetWeatherData(uint32 zone_id)
static void SendFineWeatherUpdateToPlayer(Player *player)
@ CONFIG_VISIBILITY_NOTIFY_PERIOD_CONTINENT
@ CONFIG_VISIBILITY_NOTIFY_PERIOD_BATTLEGROUND
@ CONFIG_RESPAWN_DYNAMICMINIMUM_CREATURE
@ CONFIG_VISIBILITY_NOTIFY_PERIOD_ARENA
@ CONFIG_INSTANCE_UNLOAD_DELAY
@ CONFIG_VISIBILITY_NOTIFY_PERIOD_INSTANCE
@ CONFIG_RESPAWN_DYNAMICMINIMUM_GAMEOBJECT
@ CONFIG_RESPAWN_MINCHECKINTERVALMS
@ CONFIG_RESPAWN_DYNAMICRATE_CREATURE
@ CONFIG_MAX_VISIBILITY_DISTANCE_ARENA
@ CONFIG_MAX_VISIBILITY_DISTANCE_INSTANCE
@ CONFIG_MAX_VISIBILITY_DISTANCE_BATTLEGROUND
@ CONFIG_MAX_VISIBILITY_DISTANCE_CONTINENT
@ CONFIG_RESPAWN_DYNAMICRATE_GAMEOBJECT
@ CONFIG_CHECK_GOBJECT_LOS
@ CONFIG_DEATH_BONES_BG_OR_ARENA
@ CONFIG_INSTANCE_IGNORE_RAID
@ CONFIG_RESPAWN_DYNAMIC_ESCORTNPC
@ CONFIG_DEATH_BONES_WORLD
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)
constexpr CellCoord ComputeCellCoord(float x, float y)
constexpr GridCoord ComputeGridCoord(float x, float y)
bool CanSee(Player const *player, VignetteData const &vignette)
TC_GAME_API void SetValue(int32 worldStateId, int32 value, bool hidden, Map *map)
TC_GAME_API WorldStateTemplate const * GetWorldStateTemplate(int32 worldStateId)
TC_GAME_API int32 GetValue(int32 worldStateId, Map const *map)
WorldStateValueContainer GetInitialWorldStatesForMap(Map const *map)
struct Cell::@301::@302 Part
bool DiffGrid(Cell const &cell) const
bool DiffCell(Cell const &cell) const
static CellArea CalculateCellArea(float x, float y, float radius)
constexpr void inc_y(uint32 val)
constexpr void dec_y(uint32 val)
constexpr void dec_x(uint32 val)
constexpr uint32 GetId() const
constexpr bool IsCoordValid() const
constexpr void inc_x(uint32 val)
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)
void OnOwnerPhaseChanged(WorldObject const *phaseOwner, NGridType *grid, Map *map)
void UnregisterTrackedObject(WorldObject *object)
void UnloadGrid(NGridType &grid)
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
ValueType< 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