70 for (std::set<uint16>::const_iterator itr =
mGameEvent[entry].prerequisite_events.begin(); itr !=
mGameEvent[entry].prerequisite_events.end(); ++itr)
78 return !(
mGameEvent[entry].prerequisite_events.empty());
116 if (
mGameEvent[entry].end < time_t(currenttime + delay))
124 if (event_id < 1 || event_id >=
mGameEvent.size())
169 if (overwrite && conditions_met)
170 sWorld->ForceGameEventUpdate();
172 return conditions_met;
184 if (overwrite && !serverwide_evt)
190 else if (serverwide_evt)
198 GameEventConditionMap::iterator itr;
200 itr->second.done = 0;
221 QueryResult result =
WorldDatabase.Query(
"SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, holidayStage, WorldStateId, description, world_event, announce FROM game_event");
225 TC_LOG_INFO(
"server.loading",
">> Loaded 0 game events. DB table `game_event` is empty.");
232 Field* fields = result->Fetch();
237 TC_LOG_ERROR(
"sql.sql",
"`game_event`: game event entry 0 is reserved and can't be used.");
243 pGameEvent.
start = time_t(starttime);
245 pGameEvent.
end = time_t(endtime);
260 TC_LOG_ERROR(
"sql.sql",
"`game_event`: game event id ({}) is not a world event and has length = 0, thus cannot be used.", event_id);
268 TC_LOG_ERROR(
"sql.sql",
"`game_event`: game event id ({}) contains nonexisting holiday id {}.", event_id, pGameEvent.
holiday_id);
274 TC_LOG_ERROR(
"sql.sql",
"`game_event` game event id ({}) has out of range holidayStage {}.", event_id, pGameEvent.
holidayStage);
281 if (bl->HolidayWorldState)
284 TC_LOG_ERROR(
"sql.sql",
"`game_event` game event id ({}) has world state id set, but holiday {} is linked to battleground, set to battlemaster world state id {}", event_id, pGameEvent.
holiday_id, bl->HolidayWorldState);
294 TC_LOG_ERROR(
"sql.sql",
"`game_event` game event id ({}) has an invalid world state Id {}, set to 0.", event_id, *pGameEvent.
WorldStateId);
299 while (result->NextRow());
305 TC_LOG_INFO(
"server.loading",
"Loading Game Event Saves Data...");
313 TC_LOG_INFO(
"server.loading",
">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty.");
319 Field* fields = result->Fetch();
325 TC_LOG_ERROR(
"sql.sql",
"`game_event_save`: game event entry ({}) is out of range compared to max event entry in `game_event`.", event_id);
332 mGameEvent[event_id].nextstart = time_t(fields[2].GetUInt32());
336 TC_LOG_ERROR(
"sql.sql",
"game_event_save includes event save for non-worldevent id {}.", event_id);
342 while (result->NextRow());
349 TC_LOG_INFO(
"server.loading",
"Loading Game Event Prerequisite Data...");
356 TC_LOG_INFO(
"server.loading",
">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty.");
362 Field* fields = result->Fetch();
368 TC_LOG_ERROR(
"sql.sql",
"`game_event_prerequisite`: game event id ({}) is out of range compared to max event id in `game_event`.", event_id);
377 TC_LOG_ERROR(
"sql.sql",
"`game_event_prerequisite`: game event prerequisite id ({}) is out of range compared to max event id in `game_event`.", prerequisite_event);
380 mGameEvent[event_id].prerequisite_events.insert(prerequisite_event);
384 TC_LOG_ERROR(
"sql.sql",
"game_event_prerequisiste includes event entry for non-worldevent id {}.", event_id);
390 while (result->NextRow());
397 TC_LOG_INFO(
"server.loading",
"Loading Game Event Creature Data...");
405 TC_LOG_INFO(
"server.loading",
">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty.");
411 Field* fields = result->Fetch();
421 TC_LOG_ERROR(
"sql.sql",
"`game_event_creature` contains creature (GUID: {}) not found in `creature` table.", guid);
427 TC_LOG_ERROR(
"sql.sql",
"`game_event_creature`: game event id ({}) is out of range compared to max event id in `game_event`.", event_id);
433 TC_LOG_ERROR(
"sql.sql",
"`game_event_creature`: game event id ({}) contains creature ({}) which is part of a pool ({}). This should be spawned in game_event_pool", event_id, guid, data->
poolId);
436 crelist.push_back(guid);
440 while (result->NextRow());
447 TC_LOG_INFO(
"server.loading",
"Loading Game Event GO Data...");
455 TC_LOG_INFO(
"server.loading",
">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty.");
461 Field* fields = result->Fetch();
471 TC_LOG_ERROR(
"sql.sql",
"`game_event_gameobject` contains gameobject (GUID: {}) not found in `gameobject` table.", guid);
477 TC_LOG_ERROR(
"sql.sql",
"`game_event_gameobject`: game event id ({}) is out of range compared to max event id in `game_event`.", event_id);
483 TC_LOG_ERROR(
"sql.sql",
"`game_event_gameobject`: game event id ({}) contains game object ({}) which is part of a pool ({}). This should be spawned in game_event_pool", event_id, guid, data->
poolId);
486 golist.push_back(guid);
490 while (result->NextRow());
496 TC_LOG_INFO(
"server.loading",
"Loading Game Event Model/Equipment Change Data...");
501 QueryResult result =
WorldDatabase.Query(
"SELECT creature.guid, creature.id, game_event_model_equip.eventEntry, game_event_model_equip.modelid, game_event_model_equip.equipment_id "
502 "FROM creature JOIN game_event_model_equip ON creature.guid = game_event_model_equip.guid");
505 TC_LOG_INFO(
"server.loading",
">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty.");
511 Field* fields = result->Fetch();
519 TC_LOG_ERROR(
"sql.sql",
"`game_event_model_equip`: game event id ({}) is out of range compared to max event id in `game_event`.", event_id);
533 if (!
sObjectMgr->GetEquipmentInfo(entry, equipId))
535 TC_LOG_ERROR(
"sql.sql",
"Table `game_event_model_equip` contains creature (Guid: {}, entry: {}) with equipment_id {} not found in table `creature_equip_template`. Setting entry to no equipment.",
541 equiplist.push_back(std::pair<ObjectGuid::LowType, ModelEquip>(guid, newModelEquipSet));
545 while (result->NextRow());
551 TC_LOG_INFO(
"server.loading",
"Loading Game Event Quest Data...");
559 TC_LOG_INFO(
"server.loading",
">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty.");
565 Field* fields = result->Fetch();
573 TC_LOG_ERROR(
"sql.sql",
"`game_event_creature_quest`: game event id ({}) is out of range compared to max event id in `game_event`.", event_id);
582 while (result->NextRow());
588 TC_LOG_INFO(
"server.loading",
"Loading Game Event GO Quest Data...");
596 TC_LOG_INFO(
"server.loading",
">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty.");
602 Field* fields = result->Fetch();
610 TC_LOG_ERROR(
"sql.sql",
"`game_event_gameobject_quest`: game event id ({}) is out of range compared to max event id in `game_event`.", event_id);
619 while (result->NextRow());
625 TC_LOG_INFO(
"server.loading",
"Loading Game Event Quest Condition Data...");
630 QueryResult result =
WorldDatabase.Query(
"SELECT quest, eventEntry, condition_id, num FROM game_event_quest_condition");
633 TC_LOG_INFO(
"server.loading",
">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty.");
639 Field* fields = result->Fetch();
648 TC_LOG_ERROR(
"sql.sql",
"`game_event_quest_condition`: game event id ({}) is out of range compared to max event id in `game_event`.", event_id);
658 while (result->NextRow());
664 TC_LOG_INFO(
"server.loading",
"Loading Game Event Condition Data...");
669 QueryResult result =
WorldDatabase.Query(
"SELECT eventEntry, condition_id, req_num, max_world_state_field, done_world_state_field FROM game_event_condition");
672 TC_LOG_INFO(
"server.loading",
">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty.");
678 Field* fields = result->Fetch();
685 TC_LOG_ERROR(
"sql.sql",
"`game_event_condition`: game event id ({}) is out of range compared to max event id in `game_event`.", event_id);
690 mGameEvent[event_id].conditions[condition].done = 0;
696 while (result->NextRow());
702 TC_LOG_INFO(
"server.loading",
"Loading Game Event Condition Save Data...");
710 TC_LOG_INFO(
"server.loading",
">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty.");
716 Field* fields = result->Fetch();
723 TC_LOG_ERROR(
"sql.sql",
"`game_event_condition_save`: game event id ({}) is out of range compared to max event id in `game_event`.", event_id);
727 GameEventConditionMap::iterator itr =
mGameEvent[event_id].conditions.find(condition);
728 if (itr !=
mGameEvent[event_id].conditions.end())
730 itr->second.done = fields[2].
GetFloat();
734 TC_LOG_ERROR(
"sql.sql",
"game_event_condition_save contains not present condition event id {} condition id {}.", event_id, condition);
740 while (result->NextRow());
746 TC_LOG_INFO(
"server.loading",
"Loading Game Event NPCflag Data...");
754 TC_LOG_INFO(
"server.loading",
">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty.");
760 Field* fields = result->Fetch();
768 TC_LOG_ERROR(
"sql.sql",
"`game_event_npcflag`: game event id ({}) is out of range compared to max event id in `game_event`.", event_id);
776 while (result->NextRow());
782 TC_LOG_INFO(
"server.loading",
"Loading Game Event Seasonal Quest Relations...");
790 TC_LOG_INFO(
"server.loading",
">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty.");
796 Field* fields = result->Fetch();
804 TC_LOG_ERROR(
"sql.sql",
"`game_event_seasonal_questrelation`: quest id ({}) does not exist in `quest_template`.", questId);
810 TC_LOG_ERROR(
"sql.sql",
"`game_event_seasonal_questrelation`: event id ({}) is out of range compared to max event in `game_event`.", eventEntry);
817 while (result->NextRow());
823 TC_LOG_INFO(
"server.loading",
"Loading Game Event Vendor Additions Data...");
828 QueryResult result =
WorldDatabase.Query(
"SELECT eventEntry, guid, item, maxcount, incrtime, ExtendedCost, type, BonusListIDs, PlayerConditionId, IgnoreFiltering FROM game_event_npc_vendor ORDER BY guid, slot ASC");
831 TC_LOG_INFO(
"server.loading",
">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty.");
837 Field* fields = result->Fetch();
844 TC_LOG_ERROR(
"sql.sql",
"`game_event_npc_vendor`: game event id ({}) is out of range compared to max event id in `game_event`.", event_id);
849 uint32 event_npc_flag = 0;
851 for (NPCFlagList::const_iterator itr = flist.begin(); itr != flist.end(); ++itr)
853 if (itr->first == guid)
855 event_npc_flag = itr->second;
873 for (std::string_view token :
Trinity::Tokenize(fields[7].GetStringView(),
' ',
false))
878 if (!
sObjectMgr->IsVendorItemValid(entry, vItem,
nullptr,
nullptr, event_npc_flag))
882 vendors[entry].emplace_back(std::move(vItem));
886 while (result->NextRow());
892 TC_LOG_INFO(
"server.loading",
"Loading Game Event Pool Data...");
897 QueryResult result =
WorldDatabase.Query(
"SELECT pool_template.entry, game_event_pool.eventEntry FROM pool_template"
898 " JOIN game_event_pool ON pool_template.entry = game_event_pool.pool_entry");
901 TC_LOG_INFO(
"server.loading",
">> Loaded 0 pools for game events. DB table `game_event_pool` is empty.");
907 Field* fields = result->Fetch();
916 TC_LOG_ERROR(
"sql.sql",
"`game_event_pool`: game event id ({}) is out of range compared to max event id in `game_event`.", event_id);
922 TC_LOG_ERROR(
"sql.sql",
"Pool Id ({}) has all creatures or gameobjects with explicit chance sum <> 100 and no equal chance defined. The pool system cannot pick one to spawn.", entry);
927 poollist.push_back(entry);
931 while (result->NextRow());
948 if (itr->first == guid)
960 Field* fields = result->Fetch();
990 QueryResult result =
WorldDatabase.PQuery(
"SELECT eventEntry FROM game_event_arena_seasons WHERE season = '{}'", season);
994 TC_LOG_ERROR(
"gameevent",
"ArenaSeason ({}) must be an existing Arena Season.", season);
998 Field* fields = result->Fetch();
1003 TC_LOG_ERROR(
"gameevent",
"EventEntry {} for ArenaSeason ({}) does not exist.", eventId, season);
1008 TC_LOG_INFO(
"gameevent",
"Arena Season {} started...", season);
1017 std::set<uint16> activate, deactivate;
1035 deactivate.insert(itr);
1046 activate.insert(itr);
1052 deactivate.insert(itr);
1057 int16 event_nid = (-1) * (itr);
1064 if (calcDelay < nextEventDelay)
1065 nextEventDelay = calcDelay;
1070 for (std::set<uint16>::iterator itr = activate.begin(); itr != activate.end(); ++itr)
1076 for (std::set<uint16>::iterator itr = deactivate.begin(); itr != deactivate.end(); ++itr)
1078 TC_LOG_INFO(
"gameevent",
"Next game event check in {} seconds.", nextEventDelay + 1);
1084 TC_LOG_INFO(
"gameevent",
"GameEvent {} \"{}\" removed.", event_id,
mGameEvent[event_id].description);
1090 int16 event_nid = (-1) * event_id;
1109 TC_LOG_INFO(
"gameevent",
"GameEvent {} \"{}\" started.", event_id,
mGameEvent[event_id].description);
1114 int16 event_nid = (-1) * event_id;
1135 std::unordered_map<uint32, std::unordered_set<ObjectGuid::LowType>> creaturesByMap;
1141 creaturesByMap[data->mapId].insert(itr->first);
1143 for (
auto const& p : creaturesByMap)
1145 sMapMgr->DoForAllMapsWithMapId(p.first, [
this, &p](
Map* map)
1147 for (
auto& spawnId : p.second)
1150 for (
auto itr = creatureBounds.first; itr != creatureBounds.second; ++itr)
1155 npcflag |= creatureTemplate->npcflag;
1174 sObjectMgr->AddVendorItem(itr->first, vItem,
false);
1176 sObjectMgr->RemoveVendorItem(itr->first, vItem.item, vItem.Type,
false);
1187 TC_LOG_ERROR(
"gameevent",
"GameEventMgr::GameEventSpawn attempted access to out of range mGameEventCreatureGuids element {} (size: {}).",
1200 sMapMgr->DoForAllMapsWithMapId(data->mapId, [&itr, data](
Map* map)
1202 map->RemoveRespawnTime(SPAWN_TYPE_CREATURE, *itr);
1204 if (map->IsGridLoaded(data->spawnPoint))
1205 Creature::CreateCreatureFromDB(*itr, map);
1212 TC_LOG_ERROR(
"gameevent",
"GameEventMgr::GameEventSpawn attempted access to out of range mGameEventGameobjectGuids element {} (size: {}).",
1225 sMapMgr->DoForAllMapsWithMapId(data->mapId, [&itr, data](
Map* map)
1227 map->RemoveRespawnTime(SPAWN_TYPE_GAMEOBJECT, *itr);
1229 if (map->IsGridLoaded(data->spawnPoint))
1231 if (GameObject* go = GameObject::CreateGameObjectFromDB(*itr, map, false))
1234 if (go->isSpawnedByDefault())
1236 if (!map->AddToMap(go))
1245 if (internal_event_id >=
int32(mGameEventPoolIds.size()))
1247 TC_LOG_ERROR(
"gameevent",
"GameEventMgr::GameEventSpawn attempted access to out of range mGameEventPoolIds element {} (size: {}).",
1248 internal_event_id, mGameEventPoolIds.size());
1252 for (IdList::iterator itr = mGameEventPoolIds[internal_event_id].begin(); itr != mGameEventPoolIds[internal_event_id].end(); ++itr)
1256 sMapMgr->DoForAllMapsWithMapId(poolTemplate->MapId, [&itr](
Map* map)
1258 sPoolMgr->SpawnPool(map->GetPoolData(), *itr);
1270 TC_LOG_ERROR(
"gameevent",
"GameEventMgr::GameEventUnspawn attempted access to out of range mGameEventCreatureGuids element {} (size: {}).",
1285 sMapMgr->DoForAllMapsWithMapId(data->mapId, [&itr](
Map* map)
1287 map->RemoveRespawnTime(SPAWN_TYPE_CREATURE, *itr);
1288 auto creatureBounds = map->GetCreatureBySpawnIdStore().equal_range(*itr);
1289 for (auto itr2 = creatureBounds.first; itr2 != creatureBounds.second;)
1291 Creature* creature = itr2->second;
1293 creature->AddObjectToRemoveList();
1299 if (internal_event_id < 0 || internal_event_id >=
int32(mGameEventGameobjectGuids.size()))
1301 TC_LOG_ERROR(
"gameevent",
"GameEventMgr::GameEventUnspawn attempted access to out of range mGameEventGameobjectGuids element {} (size: {}).",
1302 internal_event_id, mGameEventGameobjectGuids.size());
1306 for (GuidList::iterator itr = mGameEventGameobjectGuids[internal_event_id].begin(); itr != mGameEventGameobjectGuids[internal_event_id].end(); ++itr)
1309 if (event_id >0 && hasGameObjectActiveEventExcept(*itr, event_id))
1316 sMapMgr->DoForAllMapsWithMapId(data->mapId, [&itr](
Map* map)
1318 map->RemoveRespawnTime(SPAWN_TYPE_GAMEOBJECT, *itr);
1319 auto gameobjectBounds = map->GetGameObjectBySpawnIdStore().equal_range(*itr);
1320 for (auto itr2 = gameobjectBounds.first; itr2 != gameobjectBounds.second;)
1322 GameObject* go = itr2->second;
1324 go->AddObjectToRemoveList();
1330 if (internal_event_id < 0 || internal_event_id >=
int32(mGameEventPoolIds.size()))
1332 TC_LOG_ERROR(
"gameevent",
"GameEventMgr::GameEventUnspawn attempted access to out of range mGameEventPoolIds element {} (size: {}).", internal_event_id, mGameEventPoolIds.size());
1336 for (IdList::iterator itr = mGameEventPoolIds[internal_event_id].begin(); itr != mGameEventPoolIds[internal_event_id].end(); ++itr)
1340 sMapMgr->DoForAllMapsWithMapId(poolTemplate->MapId, [&itr](
Map* map)
1342 sPoolMgr->DespawnPool(map->GetPoolData(), *itr, true);
1358 sMapMgr->DoForAllMapsWithMapId(data->
mapId, [&itr, activate](
Map* map)
1360 auto creatureBounds = map->GetCreatureBySpawnIdStore().equal_range(itr->first);
1361 for (auto itr2 = creatureBounds.first; itr2 != creatureBounds.second; ++itr2)
1363 Creature* creature = itr2->second;
1366 itr->second.equipement_id_prev = creature->GetCurrentEquipmentId();
1367 itr->second.modelid_prev = creature->GetDisplayId();
1368 creature->LoadEquipment(itr->second.equipment_id, true);
1369 if (itr->second.modelid > 0 && itr->second.modelid_prev != itr->second.modelid && sObjectMgr->GetCreatureModelInfo(itr->second.modelid))
1370 creature->SetDisplayId(itr->second.modelid, true);
1374 creature->LoadEquipment(itr->second.equipement_id_prev, true);
1375 if (itr->second.modelid_prev > 0 && itr->second.modelid_prev != itr->second.modelid && sObjectMgr->GetCreatureModelInfo(itr->second.modelid_prev))
1376 creature->SetDisplayId(itr->second.modelid_prev, true);
1385 itr->second.modelid_prev = data2.
display ? data2.
display->CreatureDisplayID : 0;
1386 itr->second.equipement_id_prev = data2.
equipmentId;
1387 if (itr->second.modelid)
1395 if (itr->second.modelid_prev)
1399 data2.
equipmentId = itr->second.equipement_id_prev;
1408 if ((*e_itr) != event_id)
1412 if (itr->second == quest_id)
1422 if ((*e_itr) != event_id)
1426 if (itr->second == quest_id)
1435 if ((*e_itr) != event_id)
1441 if (*itr == creature_id)
1451 if ((*e_itr) != event_id)
1466 QuestRelList::iterator itr;
1471 CreatureQuestMap->insert(QuestRelations::value_type(itr->first, itr->second));
1477 QuestRelations::iterator qitr = CreatureQuestMap->find(itr->first);
1478 if (qitr == CreatureQuestMap->end())
1480 QuestRelations::iterator lastElement = CreatureQuestMap->upper_bound(itr->first);
1481 for (; qitr != lastElement; ++qitr)
1483 if (qitr->second == itr->second)
1485 CreatureQuestMap->erase(qitr);
1496 GameObjectQuestMap->insert(QuestRelations::value_type(itr->first, itr->second));
1502 QuestRelations::iterator qitr = GameObjectQuestMap->find(itr->first);
1503 if (qitr == GameObjectQuestMap->end())
1505 QuestRelations::iterator lastElement = GameObjectQuestMap->upper_bound(itr->first);
1506 for (; qitr != lastElement; ++qitr)
1508 if (qitr->second == itr->second)
1510 GameObjectQuestMap->erase(qitr);
1540 uint16 event_id = itr->second.event_id;
1541 uint32 condition = itr->second.condition;
1542 float num = itr->second.num;
1550 GameEventConditionMap::iterator citr =
mGameEvent[event_id].conditions.find(condition);
1552 if (citr !=
mGameEvent[event_id].conditions.end())
1555 if (citr->second.done < citr->second.reqNum)
1557 citr->second.done += num;
1559 if (citr->second.done > citr->second.reqNum)
1560 citr->second.done = citr->second.reqNum;
1567 trans->Append(stmt);
1572 stmt->
setFloat(2, citr->second.done);
1573 trans->Append(stmt);
1581 sWorld->ForceGameEventUpdate();
1590 for (GameEventConditionMap::const_iterator itr =
mGameEvent[event_id].conditions.begin(); itr !=
mGameEvent[event_id].conditions.end(); ++itr)
1591 if (itr->second.done < itr->second.reqNum)
1611 trans->Append(stmt);
1617 trans->Append(stmt);
1623 GameEventConditionMap::const_iterator itr;
1624 for (itr =
mGameEvent[event_id].conditions.begin(); itr !=
mGameEvent[event_id].conditions.end(); ++itr)
1626 if (itr->second.done_world_state)
1628 if (itr->second.max_world_state)
1648 void Visit(std::unordered_map<ObjectGuid, Creature*>& creatureMap)
1650 for (
auto const& p : creatureMap)
1651 if (p.second->IsInWorld() && p.second->IsAIEnabled())
1655 void Visit(std::unordered_map<ObjectGuid, GameObject*>& gameObjectMap)
1657 for (
auto const& p : gameObjectMap)
1658 if (p.second->IsInWorld())
1663 void Visit(std::unordered_map<ObjectGuid, T*>&) { }
1674 sMapMgr->DoForAllMaps([event_id, activate](
Map* map)
1694 uint8 stageIndex =
event.holidayStage - 1;
1697 Hours stageOffset = 0h;
1698 for (
uint8 i = 0; i < stageIndex; ++i)
1701 switch (
static_cast<std::make_signed_t<decltype(holiday-
>CalendarFilterType)>>(holiday->
CalendarFilterType))
1717 event.occurence = 0;
1727 bool singleDate = date.
GetYear() == -1;
1734 event.start = (date + stageOffset).GetUnixTimeFromUtcTime();
1737 else if (singleDate)
1740 event.start = (date + stageOffset).GetUnixTimeFromUtcTime();
1762 SystemTimePoint::duration durationSinceLastStart = (now - eventInitialStart) % occurence;
1763 return std::chrono::system_clock::to_time_t(now - durationSinceLastStart);
1774 for (GameEventMgr::ActiveEvents::const_iterator itr = ae.begin(); itr != ae.end(); ++itr)
1775 if (events[*itr].holiday_id ==
id)
1784 return ae.find(eventId) != ae.end();
@ CHAR_DEL_GAME_EVENT_SAVE
@ CHAR_DEL_ALL_GAME_EVENT_CONDITION_SAVE
@ CHAR_INS_GAME_EVENT_SAVE
@ CHAR_DEL_GAME_EVENT_CONDITION_SAVE
@ CHAR_INS_GAME_EVENT_CONDITION_SAVE
DB2Storage< BattlemasterListEntry > sBattlemasterListStore("BattlemasterList.db2", &BattlemasterListLoadInfo::Instance)
DB2Storage< HolidaysEntry > sHolidaysStore("Holidays.db2", &HolidaysLoadInfo::Instance)
#define MAX_HOLIDAY_DURATIONS
#define MAX_HOLIDAY_DATES
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
std::shared_ptr< ResultSet > QueryResult
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
std::chrono::system_clock::time_point SystemTimePoint
std::chrono::hours Hours
Hours shorthand typedef.
std::chrono::minutes Minutes
Minutes shorthand typedef.
bool IsHolidayActive(HolidayIds id)
bool IsEventActive(uint16 eventId)
#define max_ge_check_delay
@ GAMEEVENT_WORLD_FINISHED
@ GAMEEVENT_WORLD_CONDITIONS
@ GAMEEVENT_WORLD_NEXTPHASE
@ GAMEEVENT_WORLD_INACTIVE
#define TC_LOG_ERROR(filterType__, message__,...)
#define TC_LOG_INFO(filterType__, message__,...)
#define DEFAULT_PLAYER_DISPLAY_SCALE
std::multimap< uint32, uint32 > QuestRelations
std::optional< T > Optional
Optional helper class to wrap optional values within.
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
NPCFlags
Non Player Character flags.
static BattlegroundTypeId WeekendHolidayIdToBGType(HolidayIds holiday)
ObjectGuid::LowType GetSpawnId() const
CreatureTemplate const * GetCreatureTemplate() const
Class used to access individual fields of database query result.
float GetFloat() const noexcept
uint64 GetUInt64() const noexcept
bool GetBool() const noexcept
uint32 GetUInt32() const noexcept
Optional< int32 > GetInt32OrNull() const noexcept
uint16 GetUInt16() const noexcept
uint8 GetUInt8() const noexcept
std::string GetString() const noexcept
int8 GetInt8() const noexcept
void Visit(std::unordered_map< ObjectGuid, T * > &)
void Visit(std::unordered_map< ObjectGuid, Creature * > &creatureMap)
void Visit(std::unordered_map< ObjectGuid, GameObject * > &gameObjectMap)
GameEventAIHookWorker(uint16 eventId, bool activate)
static GameEventMgr * instance()
uint32 NextCheck(uint16 entry) const
void HandleQuestComplete(uint32 quest_id)
ActiveEvents m_ActiveEvents
bool StartEvent(uint16 event_id, bool overwrite=false)
bool IsActiveEvent(uint16 event_id) const
GameEventDataMap mGameEvent
GameEventNPCFlagMap mGameEventNPCFlags
GameEventIdMap mGameEventPoolIds
std::vector< GameEventData > GameEventDataMap
void GameEventSpawn(int16 event_id)
void GameEventUnspawn(int16 event_id)
GameEventGuidMap mGameEventCreatureGuids
void RemoveActiveEvent(uint16 event_id)
void UnApplyEvent(uint16 event_id)
void UpdateEventQuests(uint16 event_id, bool activate)
void UpdateEventNPCVendor(uint16 event_id, bool activate)
void UpdateWorldStates(uint16 event_id, bool Activate)
bool hasCreatureActiveEventExcept(ObjectGuid::LowType creature_guid, uint16 event_id)
time_t GetLastStartTime(uint16 event_id) const
void AddActiveEvent(uint16 event_id)
void StartInternalEvent(uint16 event_id)
std::list< ObjectGuid::LowType > GuidList
void ApplyNewEvent(uint16 event_id)
std::pair< ObjectGuid::LowType, uint64 > GuidNPCFlagPair
GameEventModelEquipMap mGameEventModelEquip
std::list< ModelEquipPair > ModelEquipList
GameEventNPCVendorMap mGameEventVendors
GameEventQuestMap mGameEventCreatureQuests
GameEventGuidMap mGameEventGameobjectGuids
void SaveWorldEventStateToDB(uint16 event_id)
void UpdateEventNPCFlags(uint16 event_id)
bool CheckOneGameEventConditions(uint16 event_id)
void ChangeEquipOrModel(int16 event_id, bool activate)
void RunSmartAIScripts(uint16 event_id, bool activate)
Runs SMART_EVENT_GAME_EVENT_START/_END SAI.
std::set< uint16 > ActiveEvents
QuestIdToEventConditionMap mQuestToEventConditions
bool hasCreatureQuestActiveEventExcept(uint32 quest_id, uint16 event_id)
std::list< GuidNPCFlagPair > NPCFlagList
std::list< uint32 > IdList
GameEventQuestMap mGameEventGameObjectQuests
void SetHolidayEventTime(GameEventData &event)
std::list< QuestRelation > QuestRelList
void SendWorldStateUpdate(Player *player, uint16 event_id)
bool hasGameObjectActiveEventExcept(ObjectGuid::LowType go_guid, uint16 event_id)
std::unordered_map< uint32, std::vector< VendorItem > > NPCVendorMap
bool CheckOneGameEvent(uint16 entry) const
void StopEvent(uint16 event_id, bool overwrite=false)
bool hasGameObjectQuestActiveEventExcept(uint32 quest_id, uint16 event_id)
std::pair< uint32, uint32 > QuestRelation
uint64 GetNPCFlag(Creature *cr)
MapStoredObjectTypesContainer & GetObjectsStore()
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore()
void SendUpdateWorldState(uint32 variable, uint32 value, bool hidden=false) const
void setUInt32(uint8 index, uint32 value)
void setInt64(uint8 index, int64 value)
void setFloat(uint8 index, float value)
void setUInt8(uint8 index, uint8 value)
void SetEventIdForQuest(uint16 eventId)
void Visit(TypeContainer &c)
void ReplaceAllNpcFlags2(NPCFlags2 flags)
void ReplaceAllNpcFlags(NPCFlags flags)
void SetPackedTime(uint32 packedTime)
WowTime const * GetWowTime()
SystemTimePoint GetSystemTime()
Current chrono system_clock time point.
TC_COMMON_API std::vector< std::string_view > Tokenize(std::string_view str, char sep, bool keepEmpty)
TC_GAME_API void SetValue(int32 worldStateId, int32 value, bool hidden, Map *map)
TC_GAME_API WorldStateTemplate const * GetWorldStateTemplate(int32 worldStateId)
Optional< CreatureModel > display
GameEventConditionMap conditions
Optional< int32 > WorldStateId
std::array< uint32, MAX_HOLIDAY_DATES > Date
std::array< uint16, MAX_HOLIDAY_DURATIONS > Duration
std::vector< int32 > BonusListIDs