65 for (std::set<uint16>::const_iterator itr =
mGameEvent[entry].prerequisite_events.begin(); itr !=
mGameEvent[entry].prerequisite_events.end(); ++itr)
73 return !(
mGameEvent[entry].prerequisite_events.empty());
111 if (
mGameEvent[entry].end < time_t(currenttime + delay))
119 if (event_id < 1 || event_id >=
mGameEvent.size())
164 if (overwrite && conditions_met)
165 sWorld->ForceGameEventUpdate();
167 return conditions_met;
179 if (overwrite && !serverwide_evt)
185 else if (serverwide_evt)
193 GameEventConditionMap::iterator itr;
195 itr->second.done = 0;
216 QueryResult result =
WorldDatabase.Query(
"SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, holidayStage, description, world_event, announce FROM game_event");
220 TC_LOG_INFO(
"server.loading",
">> Loaded 0 game events. DB table `game_event` is empty.");
227 Field* fields = result->Fetch();
232 TC_LOG_ERROR(
"sql.sql",
"`game_event`: game event entry 0 is reserved and can't be used.");
238 pGameEvent.
start = time_t(starttime);
240 pGameEvent.
end = time_t(endtime);
254 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);
262 TC_LOG_ERROR(
"sql.sql",
"`game_event`: game event id ({}) contains nonexisting holiday id {}.", event_id, pGameEvent.
holiday_id);
268 TC_LOG_ERROR(
"sql.sql",
"`game_event` game event id ({}) has out of range holidayStage {}.", event_id, pGameEvent.
holidayStage);
277 while (result->NextRow());
283 TC_LOG_INFO(
"server.loading",
"Loading Game Event Saves Data...");
291 TC_LOG_INFO(
"server.loading",
">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty.");
297 Field* fields = result->Fetch();
303 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);
310 mGameEvent[event_id].nextstart = time_t(fields[2].GetUInt32());
314 TC_LOG_ERROR(
"sql.sql",
"game_event_save includes event save for non-worldevent id {}.", event_id);
320 while (result->NextRow());
327 TC_LOG_INFO(
"server.loading",
"Loading Game Event Prerequisite Data...");
334 TC_LOG_INFO(
"server.loading",
">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty.");
340 Field* fields = result->Fetch();
346 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);
355 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);
358 mGameEvent[event_id].prerequisite_events.insert(prerequisite_event);
362 TC_LOG_ERROR(
"sql.sql",
"game_event_prerequisiste includes event entry for non-worldevent id {}.", event_id);
368 while (result->NextRow());
375 TC_LOG_INFO(
"server.loading",
"Loading Game Event Creature Data...");
383 TC_LOG_INFO(
"server.loading",
">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty.");
389 Field* fields = result->Fetch();
399 TC_LOG_ERROR(
"sql.sql",
"`game_event_creature` contains creature (GUID: {}) not found in `creature` table.", guid);
405 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);
411 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, poolId);
414 crelist.push_back(guid);
418 while (result->NextRow());
425 TC_LOG_INFO(
"server.loading",
"Loading Game Event GO Data...");
433 TC_LOG_INFO(
"server.loading",
">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty.");
439 Field* fields = result->Fetch();
449 TC_LOG_ERROR(
"sql.sql",
"`game_event_gameobject` contains gameobject (GUID: {}) not found in `gameobject` table.", guid);
455 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);
461 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, poolId);
464 golist.push_back(guid);
468 while (result->NextRow());
474 TC_LOG_INFO(
"server.loading",
"Loading Game Event Model/Equipment Change Data...");
479 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 "
480 "FROM creature JOIN game_event_model_equip ON creature.guid = game_event_model_equip.guid");
483 TC_LOG_INFO(
"server.loading",
">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty.");
489 Field* fields = result->Fetch();
497 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);
511 if (!
sObjectMgr->GetEquipmentInfo(entry, equipId))
513 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.",
519 equiplist.push_back(std::pair<ObjectGuid::LowType, ModelEquip>(guid, newModelEquipSet));
523 while (result->NextRow());
529 TC_LOG_INFO(
"server.loading",
"Loading Game Event Quest Data...");
537 TC_LOG_INFO(
"server.loading",
">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty.");
543 Field* fields = result->Fetch();
551 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);
560 while (result->NextRow());
566 TC_LOG_INFO(
"server.loading",
"Loading Game Event GO Quest Data...");
574 TC_LOG_INFO(
"server.loading",
">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty.");
580 Field* fields = result->Fetch();
588 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);
597 while (result->NextRow());
603 TC_LOG_INFO(
"server.loading",
"Loading Game Event Quest Condition Data...");
608 QueryResult result =
WorldDatabase.Query(
"SELECT quest, eventEntry, condition_id, num FROM game_event_quest_condition");
611 TC_LOG_INFO(
"server.loading",
">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty.");
617 Field* fields = result->Fetch();
626 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);
636 while (result->NextRow());
642 TC_LOG_INFO(
"server.loading",
"Loading Game Event Condition Data...");
647 QueryResult result =
WorldDatabase.Query(
"SELECT eventEntry, condition_id, req_num, max_world_state_field, done_world_state_field FROM game_event_condition");
650 TC_LOG_INFO(
"server.loading",
">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty.");
656 Field* fields = result->Fetch();
663 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);
668 mGameEvent[event_id].conditions[condition].done = 0;
674 while (result->NextRow());
680 TC_LOG_INFO(
"server.loading",
"Loading Game Event Condition Save Data...");
688 TC_LOG_INFO(
"server.loading",
">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty.");
694 Field* fields = result->Fetch();
701 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);
705 GameEventConditionMap::iterator itr =
mGameEvent[event_id].conditions.find(condition);
706 if (itr !=
mGameEvent[event_id].conditions.end())
708 itr->second.done = fields[2].
GetFloat();
712 TC_LOG_ERROR(
"sql.sql",
"game_event_condition_save contains not present condition event id {} condition id {}.", event_id, condition);
718 while (result->NextRow());
724 TC_LOG_INFO(
"server.loading",
"Loading Game Event NPCflag Data...");
732 TC_LOG_INFO(
"server.loading",
">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty.");
738 Field* fields = result->Fetch();
746 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);
754 while (result->NextRow());
760 TC_LOG_INFO(
"server.loading",
"Loading Game Event Seasonal Quest Relations...");
768 TC_LOG_INFO(
"server.loading",
">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty.");
774 Field* fields = result->Fetch();
782 TC_LOG_ERROR(
"sql.sql",
"`game_event_seasonal_questrelation`: quest id ({}) does not exist in `quest_template`.", questId);
788 TC_LOG_ERROR(
"sql.sql",
"`game_event_seasonal_questrelation`: event id ({}) is out of range compared to max event in `game_event`.", eventEntry);
795 while (result->NextRow());
801 TC_LOG_INFO(
"server.loading",
"Loading Game Event Vendor Additions Data...");
806 QueryResult result =
WorldDatabase.Query(
"SELECT eventEntry, guid, item, maxcount, incrtime, ExtendedCost FROM game_event_npc_vendor ORDER BY guid, slot ASC");
809 TC_LOG_INFO(
"server.loading",
">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty.");
815 Field* fields = result->Fetch();
821 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);
833 uint32 event_npc_flag = 0;
835 for (NPCFlagList::const_iterator itr = flist.begin(); itr != flist.end(); ++itr)
837 if (itr->first == guid)
839 event_npc_flag = itr->second;
847 newEntry.
entry = data->id;
853 vendors.push_back(newEntry);
857 while (result->NextRow());
863 TC_LOG_INFO(
"server.loading",
"Loading Game Event Battleground Holiday Data...");
871 TC_LOG_INFO(
"server.loading",
">> Loaded 0 battleground holidays in game events. DB table `game_event_battleground_holiday` is empty.");
877 Field* fields = result->Fetch();
883 TC_LOG_ERROR(
"sql.sql",
"`game_event_battleground_holiday`: game event id ({}) is out of range compared to max event id in `game_event`.", event_id);
891 while (result->NextRow());
897 TC_LOG_INFO(
"server.loading",
"Loading Game Event Pool Data...");
902 QueryResult result =
WorldDatabase.Query(
"SELECT pool_template.entry, game_event_pool.eventEntry FROM pool_template"
903 " JOIN game_event_pool ON pool_template.entry = game_event_pool.pool_entry");
906 TC_LOG_INFO(
"server.loading",
">> Loaded 0 pools for game events. DB table `game_event_pool` is empty.");
912 Field* fields = result->Fetch();
921 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);
927 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);
932 poollist.push_back(entry);
936 while (result->NextRow());
951 TC_LOG_INFO(
"server.loading",
">> Loaded 0 holiday dates. DB table `holiday_dates` is empty.");
958 Field* fields = result->Fetch();
964 TC_LOG_ERROR(
"sql.sql",
"holiday_dates entry has invalid holiday id {}.", holidayId);
971 TC_LOG_ERROR(
"sql.sql",
"holiday_dates entry has out of range date_id {}.", dateId);
977 if (
uint32 duration = fields[3].GetUInt32())
985 }
while (result->NextRow());
1000 if (itr->first == guid)
1001 mask |= itr->second;
1012 Field* fields = result->Fetch();
1043 QueryResult result =
WorldDatabase.PQuery(
"SELECT eventEntry FROM game_event_arena_seasons WHERE season = '{}'", season);
1047 TC_LOG_ERROR(
"gameevent",
"ArenaSeason ({}) must be an existing Arena Season.", season);
1051 Field* fields = result->Fetch();
1056 TC_LOG_ERROR(
"gameevent",
"EventEntry {} for ArenaSeason ({}) does not exist.", eventId, season);
1061 TC_LOG_INFO(
"gameevent",
"Arena Season {} started...", season);
1070 std::set<uint16> activate, deactivate;
1088 deactivate.insert(itr);
1099 activate.insert(itr);
1105 deactivate.insert(itr);
1110 int16 event_nid = (-1) * (itr);
1117 if (calcDelay < nextEventDelay)
1118 nextEventDelay = calcDelay;
1123 for (std::set<uint16>::iterator itr = activate.begin(); itr != activate.end(); ++itr)
1129 for (std::set<uint16>::iterator itr = deactivate.begin(); itr != deactivate.end(); ++itr)
1131 TC_LOG_INFO(
"gameevent",
"Next game event check in {} seconds.", nextEventDelay + 1);
1137 TC_LOG_INFO(
"gameevent",
"GameEvent {} \"{}\" removed.", event_id,
mGameEvent[event_id].description);
1143 int16 event_nid = (-1) * event_id;
1164 TC_LOG_INFO(
"gameevent",
"GameEvent {} \"{}\" started.", event_id,
mGameEvent[event_id].description);
1169 int16 event_nid = (-1) * event_id;
1192 std::unordered_map<uint32, std::unordered_set<ObjectGuid::LowType>> creaturesByMap;
1198 creaturesByMap[data->mapId].insert(itr->first);
1200 for (
auto const& p : creaturesByMap)
1202 sMapMgr->DoForAllMapsWithMapId(p.first, [
this, &p](
Map* map)
1204 for (
auto& spawnId : p.second)
1207 for (
auto itr = creatureBounds.first; itr != creatureBounds.second; ++itr)
1212 npcflag |= creatureTemplate->npcflag;
1236 sObjectMgr->AddVendorItem(itr->entry, itr->item, itr->maxcount, itr->incrtime, itr->ExtendedCost,
false);
1238 sObjectMgr->RemoveVendorItem(itr->entry, itr->item,
false);
1248 TC_LOG_ERROR(
"gameevent",
"GameEventMgr::GameEventSpawn attempted access to out of range mGameEventCreatureGuids element {} (size: {}).",
1261 Map* map =
sMapMgr->CreateBaseMap(data->mapId);
1268 if (!creature->
LoadFromDB(*itr, map,
true,
false))
1276 TC_LOG_ERROR(
"gameevent",
"GameEventMgr::GameEventSpawn attempted access to out of range mGameEventGameobjectGuids element {} (size: {}).",
1289 Map* map =
sMapMgr->CreateBaseMap(data->mapId);
1297 if (!pGameobject->
LoadFromDB(*itr, map,
false))
1310 TC_LOG_ERROR(
"gameevent",
"GameEventMgr::GameEventSpawn attempted access to out of range mGameEventPoolIds element {} (size: {}).",
1325 TC_LOG_ERROR(
"gameevent",
"GameEventMgr::GameEventUnspawn attempted access to out of range mGameEventCreatureGuids element {} (size: {}).",
1338 sObjectMgr->RemoveCreatureFromGrid(*itr, data);
1340 sMapMgr->DoForAllMapsWithMapId(data->mapId, [&itr](
Map* map)
1342 map->RemoveRespawnTime(SPAWN_TYPE_CREATURE, *itr);
1343 auto creatureBounds = map->GetCreatureBySpawnIdStore().equal_range(*itr);
1344 for (auto itr2 = creatureBounds.first; itr2 != creatureBounds.second;)
1346 Creature* creature = itr2->second;
1348 creature->AddObjectToRemoveList();
1354 if (internal_event_id < 0 || internal_event_id >=
int32(mGameEventGameobjectGuids.size()))
1356 TC_LOG_ERROR(
"gameevent",
"GameEventMgr::GameEventUnspawn attempted access to out of range mGameEventGameobjectGuids element {} (size: {}).",
1357 internal_event_id, mGameEventGameobjectGuids.size());
1361 for (GuidList::iterator itr = mGameEventGameobjectGuids[internal_event_id].begin(); itr != mGameEventGameobjectGuids[internal_event_id].end(); ++itr)
1364 if (event_id >0 && hasGameObjectActiveEventExcept(*itr, event_id))
1369 sObjectMgr->RemoveGameobjectFromGrid(*itr, data);
1371 sMapMgr->DoForAllMapsWithMapId(data->mapId, [&itr](
Map* map)
1373 map->RemoveRespawnTime(SPAWN_TYPE_GAMEOBJECT, *itr);
1374 auto gameobjectBounds = map->GetGameObjectBySpawnIdStore().equal_range(*itr);
1375 for (auto itr2 = gameobjectBounds.first; itr2 != gameobjectBounds.second;)
1377 GameObject* go = itr2->second;
1379 go->AddObjectToRemoveList();
1384 if (internal_event_id < 0 || internal_event_id >=
int32(mGameEventPoolIds.size()))
1386 TC_LOG_ERROR(
"gameevent",
"GameEventMgr::GameEventUnspawn attempted access to out of range mGameEventPoolIds element {} (size: {}).", internal_event_id, mGameEventPoolIds.size());
1390 for (IdList::iterator itr = mGameEventPoolIds[internal_event_id].begin(); itr != mGameEventPoolIds[internal_event_id].end(); ++itr)
1406 sMapMgr->DoForAllMapsWithMapId(data->
mapId, [&itr, activate](
Map* map)
1409 auto creatureBounds = map->GetCreatureBySpawnIdStore().equal_range(itr->first);
1410 for (auto itr2 = creatureBounds.first; itr2 != creatureBounds.second; ++itr2)
1412 Creature* creature = itr2->second;
1415 itr->second.equipement_id_prev = creature->GetCurrentEquipmentId();
1416 itr->second.modelid_prev = creature->GetDisplayId();
1417 creature->LoadEquipment(itr->second.equipment_id, true);
1418 if (itr->second.modelid > 0 && itr->second.modelid_prev != itr->second.modelid &&
1419 sObjectMgr->GetCreatureModelInfo(itr->second.modelid))
1421 creature->SetDisplayId(itr->second.modelid);
1422 creature->SetNativeDisplayId(itr->second.modelid);
1427 creature->LoadEquipment(itr->second.equipement_id_prev, true);
1428 if (itr->second.modelid_prev > 0 && itr->second.modelid_prev != itr->second.modelid &&
1429 sObjectMgr->GetCreatureModelInfo(itr->second.modelid_prev))
1431 creature->SetDisplayId(itr->second.modelid_prev);
1432 creature->SetNativeDisplayId(itr->second.modelid_prev);
1441 itr->second.modelid_prev = data2.
displayid;
1442 itr->second.equipement_id_prev = data2.
equipmentId;
1448 data2.
displayid = itr->second.modelid_prev;
1449 data2.
equipmentId = itr->second.equipement_id_prev;
1458 if ((*e_itr) != event_id)
1462 if (itr->second == quest_id)
1472 if ((*e_itr) != event_id)
1476 if (itr->second == quest_id)
1485 if ((*e_itr) != event_id)
1491 if (*itr == creature_id)
1501 if ((*e_itr) != event_id)
1516 QuestRelList::iterator itr;
1521 CreatureQuestMap->insert(QuestRelations::value_type(itr->first, itr->second));
1527 QuestRelations::iterator qitr = CreatureQuestMap->find(itr->first);
1528 if (qitr == CreatureQuestMap->end())
1530 QuestRelations::iterator lastElement = CreatureQuestMap->upper_bound(itr->first);
1531 for (; qitr != lastElement; ++qitr)
1533 if (qitr->second == itr->second)
1535 CreatureQuestMap->erase(qitr);
1546 GameObjectQuestMap->insert(QuestRelations::value_type(itr->first, itr->second));
1552 QuestRelations::iterator qitr = GameObjectQuestMap->find(itr->first);
1553 if (qitr == GameObjectQuestMap->end())
1555 QuestRelations::iterator lastElement = GameObjectQuestMap->upper_bound(itr->first);
1556 for (; qitr != lastElement; ++qitr)
1558 if (qitr->second == itr->second)
1560 GameObjectQuestMap->erase(qitr);
1582 worldstate.
Value = Activate ? 1 : 0;
1598 uint16 event_id = itr->second.event_id;
1599 uint32 condition = itr->second.condition;
1600 float num = itr->second.num;
1608 GameEventConditionMap::iterator citr =
mGameEvent[event_id].conditions.find(condition);
1610 if (citr !=
mGameEvent[event_id].conditions.end())
1613 if (citr->second.done < citr->second.reqNum)
1615 citr->second.done += num;
1617 if (citr->second.done > citr->second.reqNum)
1618 citr->second.done = citr->second.reqNum;
1625 trans->Append(stmt);
1630 stmt->
setFloat(2, citr->second.done);
1631 trans->Append(stmt);
1639 sWorld->ForceGameEventUpdate();
1648 for (GameEventConditionMap::const_iterator itr =
mGameEvent[event_id].conditions.begin(); itr !=
mGameEvent[event_id].conditions.end(); ++itr)
1649 if (itr->second.done < itr->second.reqNum)
1669 trans->Append(stmt);
1675 trans->Append(stmt);
1681 GameEventConditionMap::const_iterator itr;
1682 for (itr =
mGameEvent[event_id].conditions.begin(); itr !=
mGameEvent[event_id].conditions.end(); ++itr)
1684 if (itr->second.done_world_state)
1686 if (itr->second.max_world_state)
1696 void Visit(std::unordered_map<ObjectGuid, Creature*>& creatureMap)
1698 for (
auto const& p : creatureMap)
1699 if (p.second->IsInWorld() && p.second->IsAIEnabled())
1703 void Visit(std::unordered_map<ObjectGuid, GameObject*>& gameObjectMap)
1705 for (
auto const& p : gameObjectMap)
1706 if (p.second->IsInWorld())
1711 void Visit(std::unordered_map<ObjectGuid, T*>&) { }
1722 sMapMgr->DoForAllMaps([event_id, activate](
Map* map)
1742 uint8 stageIndex =
event.holidayStage - 1;
1745 time_t stageOffset = 0;
1746 for (
uint8 i = 0; i < stageIndex; ++i)
1765 event.occurence = 0;
1770 bool singleDate = ((holiday->
Date[0] >> 24) & 0x1F) == 31;
1780 localtime_r(&curTime, &timeInfo);
1781 timeInfo.tm_year -= 1;
1784 timeInfo.tm_year = ((date >> 24) & 0x1F) + 100;
1786 timeInfo.tm_mon = (date >> 20) & 0xF;
1787 timeInfo.tm_mday = ((date >> 14) & 0x3F) + 1;
1788 timeInfo.tm_hour = (date >> 6) & 0x1F;
1789 timeInfo.tm_min = date & 0x3F;
1790 timeInfo.tm_sec = 0;
1791 timeInfo.tm_wday = 0;
1792 timeInfo.tm_yday = 0;
1793 timeInfo.tm_isdst = -1;
1796 time_t startTime = mktime(&timeInfo);
1799 event.start = startTime + stageOffset;
1802 else if (singleDate)
1805 localtime_r(&curTime, &tmCopy);
1806 int year = tmCopy.tm_year;
1808 tmCopy.tm_year = year;
1810 event.start = mktime(&tmCopy) + stageOffset;
1832 SystemTimePoint::duration durationSinceLastStart = (now - eventInitialStart) % occurence;
1833 return std::chrono::system_clock::to_time_t(now - durationSinceLastStart);
1844 for (GameEventMgr::ActiveEvents::const_iterator itr = ae.begin(); itr != ae.end(); ++itr)
1845 if (events[*itr].holiday_id ==
id)
1854 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
DBCStorage< BattlemasterListEntry > sBattlemasterListStore(BattlemasterListEntryfmt)
DBCStorage< HolidaysEntry > sHolidaysStore(Holidaysfmt)
#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::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__,...)
#define TC_LOG_INFO(filterType__,...)
std::multimap< uint32, uint32 > QuestRelations
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
NPCFlags
Non Player Character flags.
static BattlegroundTypeId WeekendHolidayIdToBGType(HolidayIds holiday)
bool LoadFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap, bool allowDuplicate)
ObjectGuid::LowType GetSpawnId() const
CreatureTemplate const * GetCreatureTemplate() const
Class used to access individual fields of database query result.
std::string GetString() const
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)
GameEventDataMap mGameEvent
GameEventNPCFlagMap mGameEventNPCFlags
bool IsActiveEvent(uint16 event_id)
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)
GameEventModelEquipMap mGameEventModelEquip
std::list< ModelEquipPair > ModelEquipList
void UpdateBattlegroundSettings()
GameEventBattlegroundMap mGameEventBattlegroundHolidays
GameEventNPCVendorMap mGameEventVendors
GameEventQuestMap mGameEventCreatureQuests
GameEventGuidMap mGameEventGameobjectGuids
void SaveWorldEventStateToDB(uint16 event_id)
void UpdateEventNPCFlags(uint16 event_id)
bool CheckOneGameEventConditions(uint16 event_id)
Runs SMART_EVENT_GAME_EVENT_START/_END SAI.
void ChangeEquipOrModel(int16 event_id, bool activate)
void RunSmartAIScripts(uint16 event_id, bool activate)
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)
uint32 GetNPCFlag(Creature *cr)
bool CheckOneGameEvent(uint16 entry) const
void StopEvent(uint16 event_id, bool overwrite=false)
std::list< NPCVendorEntry > NPCVendorList
bool hasGameObjectQuestActiveEventExcept(uint32 quest_id, uint16 event_id)
std::pair< uint32, uint32 > QuestRelation
std::pair< ObjectGuid::LowType, uint32 > GuidNPCFlagPair
std::vector< uint32 > modifiedHolidays
bool LoadFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap, bool=true)
bool isSpawnedByDefault() const
MapStoredObjectTypesContainer & GetObjectsStore()
void RemoveRespawnTime(SpawnObjectType type, ObjectGuid::LowType spawnId, CharacterDatabaseTransaction dbTrans=nullptr, bool alwaysDeleteFromDB=false)
bool Instanceable() const
bool IsGridLoaded(uint32 gridId) const
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore()
void SendUpdateWorldState(uint32 variable, uint32 value) const
void setUInt32(uint8 index, uint32 value)
void setFloat(uint8 index, float value)
void setUInt8(uint8 index, uint8 value)
void SetEventIdForQuest(uint16 eventId)
void Visit(TYPE_CONTAINER &c)
void ReplaceAllNpcFlags(NPCFlags flags)
WorldPacket const * Write() override
SystemTimePoint GetSystemTime()
Current chrono system_clock time point.
GameEventConditionMap conditions
uint32 Duration[MAX_HOLIDAY_DURATIONS]
uint32 Date[MAX_HOLIDAY_DATES]