67#include <boost/heap/fibonacci_heap.hpp>
70#define DEFAULT_GRID_EXPIRY 300
71#define MAX_GRID_LOAD_TIME 50
72#define MAX_CREATURE_ATTACK_RADIUS (45.0f * sWorld->getRate(RATE_CREATURE_AGGRO))
82struct RespawnListContainer : boost::heap::fibonacci_heap<RespawnInfoWithHandle*, boost::heap::compare<CompareRespawnInfo>>
90 RespawnListContainer::handle_type
handle;
138_creatureToMoveLock(false), _gameObjectsToMoveLock(false), _dynamicObjectsToMoveLock(false), _areaTriggersToMoveLock(false),
139i_mapEntry(
sMapStore.LookupEntry(id)), i_spawnMode(SpawnMode), i_InstanceId(InstanceId),
142m_activeNonPlayersIter(m_activeNonPlayers.end()), _transportsUpdateIter(_transports.end()),
143i_gridExpiry(expiry), m_terrain(
sTerrainMgr.LoadTerrain(id)), m_forceEnabledNavMeshFilterFlags(0), m_forceDisabledNavMeshFilterFlags(0), i_grids(),
144i_scriptLock(false), _respawnTimes(
std::make_unique<
RespawnListContainer>()), _respawnCheckTimer(0), _vignetteUpdateTimer(5200, 5200)
177 if constexpr (WorldTypeMapContainer::TypeExists<T> && GridTypeMapContainer::TypeExists<T>)
180 if (obj->IsStoredInWorldObjectGridContainer())
185 else if constexpr (WorldTypeMapContainer::TypeExists<T>)
187 else if constexpr (GridTypeMapContainer::TypeExists<T>)
190 if constexpr (std::is_base_of_v<MapObject, T>)
191 obj->SetCurrentCell(cell);
391 Cell cell(cellCoord);
438 int32 oldValue = itr->second;
439 if (oldValue == value && !inserted)
445 if (worldStateTemplate)
446 sScriptMgr->OnWorldStateValueChange(worldStateTemplate, oldValue, value,
this);
451 updateWorldState.
Value = value;
452 updateWorldState.
Hidden = hidden;
453 updateWorldState.
Write();
457 if (worldStateTemplate && !worldStateTemplate->
AreaIds.empty())
459 bool isInAllowedArea = std::any_of(worldStateTemplate->
AreaIds.begin(), worldStateTemplate->
AreaIds.end(),
460 [playerAreaId = mapReference.GetSource()->GetAreaId()](
uint32 requiredAreaId) { return DB2Manager::IsInArea(playerAreaId, requiredAreaId); });
461 if (!isInAllowedArea)
465 mapReference.GetSource()->SendDirectMessage(updateWorldState.
GetRawPacket());
475 vignetteUpdate.
Write();
479 ref.GetSource()->SendDirectMessage(vignetteUpdate.
GetRawPacket());
489 vignetteUpdate.
Write();
494 if (ref.GetSource()->GetZoneId() == vignette->
ZoneID)
495 ref.GetSource()->SendDirectMessage(vignetteUpdate.
GetRawPacket());
520 if (obj->IsInWorld())
523 obj->UpdateObjectVisibility(
true);
534 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);
539 obj->setActive(
true);
541 Cell cell(cellCoord);
542 if (obj->isActiveObject())
547 TC_LOG_DEBUG(
"maps",
"Object {} enters grid[{}, {}]", obj->GetGUID().ToString(), cell.
GridX(), cell.
GridY());
555 if (obj->isActiveObject())
560 obj->SetIsNewObject(
true);
561 obj->UpdateObjectVisibilityOnCreate();
562 obj->SetIsNewObject(
false);
589 if (itr->GetSource()->GetTransport() != obj && itr->GetSource()->
InSamePhase(obj))
593 itr->GetSource()->m_visibleTransports.insert(obj->
GetGUID());
596 itr->GetSource()->SendDirectMessage(&packet);
632 Visit(cell, gridVisitor);
633 Visit(cell, worldVisitor);
641 if (oldZone == newZone)
647 ASSERT(oldZoneCount,
"A player left zone %u (went to %u) - but there were no players in the zone!", oldZone, newZone);
668 session->
Update(t_diff, updater);
712 std::vector<Unit*> toVisit;
716 toVisit.push_back(unit);
717 for (
Unit* unit : toVisit)
722 std::unordered_set<Unit*> toVisit;
723 for (std::pair<uint32, AuraApplication*> pair : player->
GetAppliedAuras())
725 if (
Unit* caster = pair.second->GetBase()->GetCaster())
727 toVisit.insert(caster);
729 for (
Unit* unit : toVisit)
734 std::vector<Unit*> toVisit;
738 if (!summonGuid.IsEmpty())
741 toVisit.push_back(unit);
743 for (
Unit* unit : toVisit)
771 if (vignette->NeedUpdate)
774 vignette->FillPacket(vignetteUpdate.
Updated);
775 vignetteUpdate.
Write();
778 ref.GetSource()->SendDirectMessage(vignetteUpdate.
GetRawPacket());
780 vignette->NeedUpdate =
false;
800 zoneInfo.second.DefaultWeather.reset();
831 iter->GetSource()->ResetAllNotifies();
871 Visit(cell, grid_object_relocation);
872 Visit(cell, world_object_relocation);
908 Visit(cell, grid_notifier);
909 Visit(cell, world_notifier);
925 bool const inWorld = player->
IsInWorld();
945 obj->RemoveFromWorld();
946 if (obj->isActiveObject())
952 obj->UpdateObjectVisibilityOnDestroy();
954 obj->RemoveFromGrid();
979 if (itr->GetSource()->GetTransport() != obj && itr->GetSource()->m_visibleTransports.count(obj->
GetGUID()))
981 itr->GetSource()->SendDirectMessage(&packet);
982 itr->GetSource()->m_visibleTransports.erase(obj->
GetGUID());
989 TransportsContainer::iterator itr =
_transports.find(obj);
1005template <
typename T>
1008 Cell const& cur_cell =
object->GetCurrentCell();
1009 Cell xy_cell(object->GetPositionX(), object->GetPositionY());
1010 if (xy_cell != cur_cell)
1012 TC_LOG_DEBUG(
"maps",
"{} {} X: {} Y: {} ({}) is in grid[{}, {}]cell[{}, {}] instead of grid[{}, {}]cell[{}, {}]",
1013 objType, object->GetGUID().ToString(),
1014 object->GetPositionX(), object->GetPositionY(), (moved ?
"final" :
"original"),
1028 Cell new_cell(x, y);
1030 player->
Relocate(x, y, z, orientation);
1036 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());
1054 Cell new_cell(x, y);
1064 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());
1085 Cell new_cell(x, y);
1096 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());
1103 go->
Relocate(x, y, z, orientation);
1114 Cell new_cell(x, y);
1125 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());
1132 dynObj->
Relocate(x, y, z, orientation);
1144 Cell new_cell(x, y);
1155 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());
1162 at->
Relocate(x, y, z, orientation);
1354 if (dynObj->
FindMap() !=
this)
1426template <
typename T>
1429 Cell const& old_cell =
object->GetCurrentCell();
1436 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());
1439 object->RemoveFromGrid();
1445 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());
1453 if (object->isActiveObject())
1458 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());
1461 object->RemoveFromGrid();
1468 if (c->GetCharmerOrOwnerGUID().IsPlayer())
1475 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());
1478 object->RemoveFromGrid();
1487 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());
1525 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());
1552 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());
1631 TC_LOG_DEBUG(
"maps",
"Unloading grid[{}, {}] for map {} finished", x, y,
GetId());
1641 Player* player = itr->GetSource();
1645 TC_LOG_ERROR(
"maps",
"Map::UnloadAll: player {} is still in map {} during unload, this should not happen!", player->
GetName(),
GetId());
1670 RemoveFromMap<Transport>(transport,
true);
1675 for (
Corpse* corpse : cellCorpsePair.second)
1677 corpse->RemoveFromWorld();
1691 m_terrain->GetFullTerrainStatusForPosition(phaseShift,
GetId(), x, y, z, data, reqLiquidType, collisionHeight, &
_dynamicTree);
1695 float collisionHeight)
1697 return m_terrain->GetLiquidStatus(phaseShift,
GetId(), x, y, z, ReqLiquidType, data, collisionHeight);
1727 return m_terrain->GetStaticHeight(phaseShift,
GetId(), x, y, z, checkVMap, maxSearchDist);
1753 && !
VMAP::VMapFactory::createOrGetVMapManager()->
isInLineOfSight(
PhasingHandler::GetTerrainMapId(phaseShift,
GetId(),
m_terrain.get(), x1, y1), x1, y1, z1, x2, y2, z2, ignoreFlags))
1761bool 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)
1763 G3D::Vector3 startPos(x1, y1, z1);
1764 G3D::Vector3 dstPos(x2, y2, z2);
1766 G3D::Vector3 resultPos;
1782 G3D::AABox
const& bounds = model.
getBounds();
1831 uint32 instanceIdToCheck =
sMapMgr->FindInstanceIdForPlayer(mapid, player);
1832 if (
Map* boundMap =
sMapMgr->FindMap(mapid, instanceIdToCheck))
1858 transport->BuildCreateUpdateBlockForPlayer(&data, player);
1867 for (
WorldObject* passenger : transport->GetPassengers())
1868 if (player != passenger && player->
HaveAtClient(passenger))
1869 passenger->BuildCreateUpdateBlockForPlayer(&data, player);
1887 transport->BuildCreateUpdateBlockForPlayer(&transData, player);
1908 transport->BuildOutOfRangeUpdateBlock(&transData);
1927 if (!transport->IsInWorld())
1935 transport->BuildCreateUpdateBlockForPlayer(&transData, player);
1941 transport->BuildOutOfRangeUpdateBlock(&transData);
1958 TC_LOG_ERROR(
"maps",
"map::setNGrid() Invalid grid coordinates found: {}, {}!", x, y);
1977 for (UpdateDataMapType::iterator iter = update_players.begin(); iter != update_players.end(); ++iter)
1979 iter->second.BuildPacket(&packet);
1980 iter->first->SendDirectMessage(&packet);
2002 bool alreadyExists =
false;
2011 for (
auto it = range.first; it != range.second; ++it)
2019 alreadyExists =
true;
2027 alreadyExists =
true;
2047 if (linkedTime == std::numeric_limits<time_t>::max())
2048 respawnTime = linkedTime;
2049 else if (
sObjectMgr->GetLinkedRespawnGuid(thisGUID) == thisGUID)
2050 respawnTime = now +
WEEK;
2052 respawnTime = std::max<time_t>(now, linkedTime) +
urand(5, 15);
2071 std::vector<WorldObject*> toUnload;
2076 toUnload.push_back(pair.second);
2080 toUnload.push_back(pair.second);
2089 return toUnload.size();
2107 auto it = bySpawnIdMap->find(info.
spawnId);
2108 if (it != bySpawnIdMap->end())
2116 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);
2123 bySpawnIdMap->emplace(ri->
spawnId, ri);
2129 data.reserve(data.size() + map.size());
2130 for (
auto const& pair : map)
2131 data.push_back(pair.second);
2147 auto it = map->find(spawnId);
2148 if (it == map->end())
2172 auto range = spawnMap->equal_range(info->
spawnId);
2173 auto it = std::find_if(range.first, range.second, [info](RespawnInfoMap::value_type
const& pair) { return (pair.second == info); });
2175 spawnMap->erase(it);
2210 if (!obj->
LoadFromDB(spawnId,
this,
true,
true))
2232 if (now < next->respawnTime)
2270 ASSERT(now < next->respawnTime);
2308 uint32 const playerCount = it->second;
2312 if (adjustFactor >= 1.0)
2315 if (respawnDelay <= timeMinimum)
2318 respawnDelay = std::max<uint32>(ceil(respawnDelay * adjustFactor), timeMinimum);
2336 if (!
GetPoolData().IsSpawnedObject(type, spawnId))
2355 TC_LOG_ERROR(
"maps",
"Tried to spawn non-existing (or system) spawn group {} on map {}. Blocked.", groupId,
GetId());
2361 std::vector<SpawnData const*> toSpawn;
2362 for (
auto& pair :
sObjectMgr->GetSpawnMetadataForGroup(groupId))
2371 if (force || ignoreRespawn)
2394 if (std::find(data->spawnDifficulties.begin(), data->spawnDifficulties.end(),
GetDifficultyID()) == data->spawnDifficulties.end())
2407 if (!creature->
LoadFromDB(data->spawnId,
this,
true, force))
2409 else if (spawnedObjects)
2410 spawnedObjects->push_back(creature);
2416 if (!gameobject->
LoadFromDB(data->spawnId,
this,
true))
2418 else if (spawnedObjects)
2419 spawnedObjects->push_back(gameobject);
2425 if (!areaTrigger->
LoadFromDB(data->spawnId,
this,
true,
false))
2427 else if (spawnedObjects)
2428 spawnedObjects->push_back(areaTrigger);
2444 TC_LOG_ERROR(
"maps",
"Tried to despawn non-existing (or system) spawn group {} on map {}. Blocked.", groupId,
GetId());
2448 for (
auto const& pair :
sObjectMgr->GetSpawnMetadataForGroup(groupId))
2452 if (deleteRespawnTimes)
2467 TC_LOG_ERROR(
"maps",
"Tried to set non-existing (or system) spawn group {} to {} on map {}. Blocked.", groupId, state ?
"active" :
"inactive",
GetId());
2481 TC_LOG_ERROR(
"maps",
"Tried to query state of non-existing spawn group {} on map {}.", groupId,
GetId());
2492 std::vector<uint32>
const* spawnGroups =
sObjectMgr->GetSpawnGroupsForMap(
GetId());
2496 for (
uint32 spawnGroupId : *spawnGroups)
2508 std::vector<uint32>
const* spawnGroups =
sObjectMgr->GetSpawnGroupsForMap(
GetId());
2512 for (
uint32 spawnGroupId : *spawnGroups)
2528 if (isActive == shouldBeActive)
2570 GridInfo* info = i->GetSource()->getGridInfoRef();
2599 else if (itr->second != on)
2611 bool on = itr->second;
2619 SwitchGridContainers<Creature>(obj->
ToCreature(), on);
2669 TC_LOG_ERROR(
"maps",
"Non-grid object (TypeId: {}) is in grid object remove list, ignored.", obj->
GetTypeId());
2683 if (!itr->GetSource()->IsGameMaster())
2691 itr->GetSource()->SendDirectMessage(data);
2703 cell_min.
dec_x(cell_range);
2704 cell_min.
dec_y(cell_range);
2705 cell_max.
inc_x(cell_range);
2706 cell_max.
inc_y(cell_range);
2710 Player* player = iter->GetSource();
2749 if (
Creature* creature = obj->
ToCreature(); !creature->IsPet() && creature->GetSpawnId())
2750 respawnLocation = creature->GetRespawnPosition();
2754 respawnLocation = gameObject->GetRespawnPosition();
2760 if (respawnLocation)
2768 TC_LOG_ERROR(
"maps",
"Active object {} added to grid[{}, {}] but spawn grid[{}, {}] was not loaded.",
2794 if (
Creature* creature = obj->
ToCreature(); !creature->IsPet() && creature->GetSpawnId())
2795 respawnLocation = creature->GetRespawnPosition();
2799 respawnLocation = gameObject->GetRespawnPosition();
2805 if (respawnLocation)
2813 TC_LOG_ERROR(
"maps",
"Active object {} removed from to grid[{}, {}] but spawn grid[{}, {}] was not loaded.",
2839 :
Map(id, expiry, InstanceId, SpawnMode),
2840 i_data(nullptr), i_script_id(0), i_instanceLock(instanceLock), i_lfgDungeonsId(lfgDungeonsId)
2911 if (!player->
IsInGroup(owningGroup->GetGUID()))
2928 if (!entries.MapDifficulty->IsUsingEncounterLocks())
2938 pendingRaidLock.
WarningOnly = entries.Map->IsFlexLocking();
2940 if (!entries.Map->IsFlexLocking())
3029 if (!lockData->
Data.empty())
3060 ref.GetSource()->SendResetFailedNotify(
GetId());
3071 raidInstanceMessage.
Write();
3074 ref.GetSource()->SendDirectMessage(raidInstanceMessage.
GetRawPacket());
3083 pendingRaidLock.
Write();
3087 ref.GetSource()->SendDirectMessage(pendingRaidLock.
GetRawPacket());
3142 if (entries.IsInstanceIdBound())
3148 Player* player = mapReference.GetSource();
3154 std::string
const* oldData =
nullptr;
3155 uint32 playerCompletedEncounters = 0;
3162 bool isNewLock = !playerLock || playerLock->
IsNew() || playerLock->
IsExpired();
3192 if (entries.IsInstanceIdBound())
3194 instanceCompletedEncounters,
nullptr, {}));
3198 Player* player = mapReference.GetSource();
3204 std::string
const* oldData =
nullptr;
3208 bool isNewLock = !playerLock || playerLock->
IsNew() || playerLock->
IsExpired();
3212 instanceCompletedEncounters,
nullptr, {}));
3233 bool isNewLock = !playerLock || playerLock->
IsNew() || playerLock->
IsExpired();
3417 :
Map(id, expiry, InstanceId, spawnMode), m_bg(nullptr), _battlegroundScript(nullptr), _scriptId(0)
3506 if (
Player* player = itr->GetSource())
3507 if (!player->IsBeingTeleportedFar())
3508 player->TeleportTo(player->GetBattlegroundEntryPoint());
3574 if (bounds.first == bounds.second)
3577 std::unordered_multimap<ObjectGuid::LowType, Creature*>::const_iterator creatureItr = std::find_if(bounds.first, bounds.second, [](Map::CreatureBySpawnIdContainer::value_type
const& pair)
3579 return pair.second->IsAlive();
3582 return creatureItr != bounds.second ? creatureItr->second : bounds.first->second;
3588 if (bounds.first == bounds.second)
3591 std::unordered_multimap<ObjectGuid::LowType, GameObject*>::const_iterator creatureItr = std::find_if(bounds.first, bounds.second, [](Map::GameObjectBySpawnIdContainer::value_type
const& pair)
3593 return pair.second->isSpawned();
3596 return creatureItr != bounds.second ? creatureItr->second : bounds.first->second;
3602 if (bounds.first == bounds.second)
3605 return bounds.first->second;
3619 TC_LOG_ERROR(
"maps",
"Map {} attempt to save respawn time for nonexistant spawnid ({},{}).",
GetId(), type, spawnId);
3641 TC_LOG_ERROR(
"maps",
"Attempt to load saved respawn {} for ({},{}) failed - duplicate respawn? Skipped.", respawnTime,
uint32(type), spawnId);
3673 Field* fields = result->Fetch();
3676 time_t respawnTime = fields[2].
GetInt64();
3683 TC_LOG_ERROR(
"maps",
"Loading saved respawn time of {} for spawnid ({},{}) - spawn does not exist, ignoring", respawnTime,
uint32(type), spawnId);
3687 TC_LOG_ERROR(
"maps",
"Loading saved respawn time of {} for spawnid ({},{}) - invalid spawn type, ignoring", respawnTime,
uint32(type), spawnId);
3690 }
while (result->NextRow());
3733 std::unordered_map<ObjectGuid::LowType, std::unordered_set<uint32>> phases;
3734 std::unordered_map<ObjectGuid::LowType, std::vector<UF::ChrCustomizationChoice>> customizations;
3746 Field* fields = phaseResult->Fetch();
3750 phases[guid].insert(phaseId);
3752 }
while (phaseResult->NextRow());
3765 Field* fields = customizationResult->Fetch();
3767 std::vector<UF::ChrCustomizationChoice>& customizationsForCorpse = customizations[guid];
3769 customizationsForCorpse.emplace_back();
3774 }
while (customizationResult->NextRow());
3779 Field* fields = result->Fetch();
3784 TC_LOG_ERROR(
"misc",
"Corpse (guid: {}) have wrong corpse type ({}), not loading.", guid, type);
3789 if (!corpse->
LoadCorpseFromDB(GenerateLowGuid<HighGuid::Corpse>(), fields))
3795 for (
uint32 phaseId : phases[guid])
3802 }
while (result->NextRow());
3906 std::vector<ObjectGuid> corpses;
3910 if (p.second->IsExpired(now))
3911 corpses.push_back(p.first);
3916 std::vector<Corpse*> expiredBones;
3918 if (bones->IsExpired(now))
3919 expiredBones.push_back(bones);
3921 for (
Corpse* bones : expiredBones)
3934 if (
uint32 music = itr->second.MusicId)
3942 overrideLight.
AreaLightID = lightOverride.AreaLightId;
3970 zoneDynamicInfo.
DefaultWeather->SendWeatherUpdateToPlayer(player);
3981 if (!players.
empty())
3987 if (
Player* player = itr->GetSource())
4002 info.
DefaultWeather = std::make_unique<Weather>(zoneId, weatherData);
4013 if (zoneDynamicInfo)
4032 if (!players.
empty())
4038 if (
Player* player = itr->GetSource())
4039 if (player->GetZoneId() == zoneId)
4050 return lightOverride.AreaLightId == areaLightId;
4054 if (overrideLightId)
4063 if (!players.
empty())
4069 overrideLight.
Write();
4072 if (
Player* player = itr->GetSource())
4073 if (player->GetZoneId() == zoneId)
4074 player->SendDirectMessage(overrideLight.
GetRawPacket());
4083 if (
Player* player = itr->GetSource())
4085 if (player->IsInWorld())
4087 player->UpdateAreaDependentAuras(player->GetAreaId());
4088 player->UpdateZoneDependentAuras(player->GetZoneId());
4096 std::stringstream sstr;
4097 sstr << std::boolalpha
4105 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 CENTER_GRID_CELL_ID
#define SIZE_OF_GRID_CELL
NGrid< MAX_NUMBER_OF_CELLS, WorldTypeMapContainer, GridTypeMapContainer > NGridType
#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::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)
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
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)
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)
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()
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)
void EnsureGridCreated(GridCoord const &)
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)
virtual void DelayedUpdate(uint32 diff)
Player * GetPlayer(ObjectGuid const &guid)
AreaTriggerBySpawnIdContainer & GetAreaTriggerBySpawnIdStore()
void RemoveUpdateObject(BaseEntity *obj)
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
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 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
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)
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()
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
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)
void AddInstanceEnterTime(uint32 instanceId, time_t enterTime)
GuidUnorderedSet m_clientGUIDs
bool IsLoading() const override
bool CheckInstanceCount(uint32 instanceId) const
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)
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.
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)
GridCoord ComputeGridCoord(float x, float y)
CellCoord ComputeCellCoord(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::@299::@300 Part
bool DiffGrid(Cell const &cell) const
bool DiffCell(Cell const &cell) const
static CellArea CalculateCellArea(float x, float y, float radius)
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
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