50 std::unordered_set<uint32>
params[2];
54 typedef std::unordered_map<uint32, DisableData> DisableTypeMap;
56 std::array<DisableTypeMap, MAX_DISABLE_TYPES> m_DisableMap;
64 for (std::size_t i = 0; i < m_DisableMap.size(); ++i)
65 m_DisableMap[i].clear();
73 TC_LOG_INFO(
"server.loading",
">> Loaded 0 disables. DB table `disables` is empty!");
80 fields = result->Fetch();
84 TC_LOG_ERROR(
"sql.sql",
"Invalid type {} specified in `disables` table, skipped.", type);
90 std::string params_0 = fields[3].
GetString();
91 std::string params_1 = fields[4].
GetString();
101 TC_LOG_ERROR(
"sql.sql",
"Spell entry {} from `disables` doesn't exist in dbc, skipped.", entry);
107 TC_LOG_ERROR(
"sql.sql",
"Disable flags for spell {} are invalid, skipped.", entry);
116 data.params[0].insert(*mapId);
118 TC_LOG_ERROR(
"sql.sql",
"Disable map '{}' for spell {} is invalid, skipped.", mapStr, entry);
127 data.params[1].insert(*areaId);
129 TC_LOG_ERROR(
"sql.sql",
"Disable area '{}' for spell {} is invalid, skipped.", areaStr, entry);
143 TC_LOG_ERROR(
"sql.sql",
"Map entry {} from `disables` doesn't exist in dbc, skipped.", entry);
146 bool isFlagInvalid =
false;
151 isFlagInvalid =
true;
162 isFlagInvalid =
true;
166 TC_LOG_ERROR(
"sql.sql",
"Battleground map {} specified to be disabled in map case, skipped.", entry);
171 TC_LOG_ERROR(
"sql.sql",
"Disable flags for map {} are invalid, skipped.", entry);
179 TC_LOG_ERROR(
"sql.sql",
"Battleground entry {} from `disables` doesn't exist in dbc, skipped.", entry);
183 TC_LOG_ERROR(
"sql.sql",
"Disable flags specified for battleground {}, useless data.", entry);
188 TC_LOG_ERROR(
"sql.sql",
"OutdoorPvPTypes value {} from `disables` is invalid, skipped.", entry);
192 TC_LOG_ERROR(
"sql.sql",
"Disable flags specified for outdoor PvP {}, useless data.", entry);
197 TC_LOG_ERROR(
"sql.sql",
"Criteria entry {} from `disables` doesn't exist in dbc, skipped.", entry);
201 TC_LOG_ERROR(
"sql.sql",
"Disable flags specified for Criteria {}, useless data.", entry);
208 TC_LOG_ERROR(
"sql.sql",
"Map entry {} from `disables` doesn't exist in dbc, skipped.", entry);
237 TC_LOG_ERROR(
"sql.sql",
"Map entry {} from `disables` doesn't exist in dbc, skipped.", entry);
248 TC_LOG_ERROR(
"sql.sql",
"Phase entry {} from `disables` doesn't exist in dbc, skipped.", entry);
252 TC_LOG_ERROR(
"sql.sql",
"Disable flags specified for phase {}, useless data.", entry);
259 m_DisableMap[type][entry] = std::move(data);
262 while (result->NextRow());
274 TC_LOG_INFO(
"server.loading",
">> Checked 0 quest disables.");
281 uint32 entry = itr->first;
284 TC_LOG_ERROR(
"sql.sql",
"Quest entry {} from `disables` doesn't exist, skipped.", entry);
288 if (itr->second.flags)
289 TC_LOG_ERROR(
"sql.sql",
"Disable flags specified for quest {}, useless data.", entry);
299 if (m_DisableMap[type].empty())
302 DisableTypeMap::iterator itr = m_DisableMap[type].find(entry);
303 if (itr == m_DisableMap[type].end())
310 uint16 spellFlags = itr->second.flags;
331 std::unordered_set<uint32>
const& mapIds = itr->second.params[0];
332 if (mapIds.find(ref->
GetMapId()) != mapIds.end())
343 std::unordered_set<uint32>
const& areaIds = itr->second.params[1];
344 if (areaIds.find(ref->
GetAreaId()) != areaIds.end())
370 uint8 disabledModes = itr->second.flags;
371 Difficulty targetDifficulty = player->GetDifficultyID(mapEntry);
372 sDB2Manager.GetDownscaledMapDifficultyData(entry, targetDifficulty);
373 switch (targetDifficulty)
400 return (
flags & itr->second.flags) != 0;
DB2Storage< PhaseEntry > sPhaseStore("Phase.db2", &PhaseLoadInfo::Instance)
DB2Storage< BattlemasterListEntry > sBattlemasterListStore("BattlemasterList.db2", &BattlemasterListLoadInfo::Instance)
DB2Storage< MapEntry > sMapStore("Map.db2", &MapLoadInfo::Instance)
DB2Storage< CriteriaEntry > sCriteriaStore("Criteria.db2", &CriteriaLoadInfo::Instance)
std::shared_ptr< ResultSet > QueryResult
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
std::unordered_set< uint32 > params[2]
@ MMAP_DISABLE_PATHFINDING
@ SPELL_DISABLE_DEPRECATED_SPELL
@ SPELL_DISABLE_BATTLEGROUNDS
@ SPELL_DISABLE_GAMEOBJECT
@ DISABLE_TYPE_PHASE_AREA
@ DISABLE_TYPE_BATTLEGROUND
@ DISABLE_TYPE_OUTDOORPVP
#define TC_LOG_ERROR(filterType__, message__,...)
#define TC_LOG_INFO(filterType__, message__,...)
std::optional< T > Optional
Optional helper class to wrap optional values within.
@ DUNGEON_STATUSFLAG_NORMAL
@ RAID_STATUSFLAG_10MAN_HEROIC
@ RAID_STATUSFLAG_25MAN_HEROIC
@ DUNGEON_STATUSFLAG_HEROIC
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Class used to access individual fields of database query result.
std::string GetString() const
static Unit * ToUnit(Object *o)
static Player * ToPlayer(Object *o)
constexpr uint32 GetMapId() const
void CheckQuestDisables()
bool IsDisabledFor(DisableType type, uint32 entry, WorldObject const *ref, uint8 flags)
char const * MapTypeNames[]
bool IsVMAPDisabledFor(uint32 entry, uint8 flags)
bool IsPathfindingEnabled(uint32 mapId)
TC_COMMON_API std::vector< std::string_view > Tokenize(std::string_view str, char sep, bool keepEmpty)
@ VMAP_DISABLE_LIQUIDSTATUS