38 constexpr std::string_view MapTypeNames[] =
54 typedef std::map<uint32, DisableData> DisableTypeMap;
56 typedef std::map<DisableType, DisableTypeMap> DisableMap;
58 DisableMap m_DisableMap;
60 uint8 MAX_DISABLE_TYPES = 9;
68 for (DisableMap::iterator itr = m_DisableMap.begin(); itr != m_DisableMap.end(); ++itr)
79 TC_LOG_INFO(
"server.loading",
">> Loaded 0 disables. DB table `disables` is empty!");
86 fields = result->Fetch();
88 if (type >= MAX_DISABLE_TYPES)
90 TC_LOG_ERROR(
"sql.sql",
"Invalid type {} specified in `disables` table, skipped.", type);
96 std::string params_0 = fields[3].
GetString();
97 std::string params_1 = fields[4].
GetString();
107 TC_LOG_ERROR(
"sql.sql",
"Spell entry {} from `disables` doesn't exist in dbc, skipped.", entry);
113 TC_LOG_ERROR(
"sql.sql",
"Disable flags for spell {} are invalid, skipped.", entry);
122 data.params[0].insert(*mapId);
124 TC_LOG_ERROR(
"sql.sql",
"Disable map '{}' for spell {} is invalid, skipped.", std::string(mapStr), entry);
133 data.params[1].insert(*areaId);
135 TC_LOG_ERROR(
"sql.sql",
"Disable area '{}' for spell {} is invalid, skipped.", std::string(areaStr), entry);
149 TC_LOG_ERROR(
"sql.sql",
"Map entry {} from `disables` doesn't exist in dbc, skipped.", entry);
152 bool isFlagInvalid =
false;
157 isFlagInvalid =
true;
168 isFlagInvalid =
true;
172 TC_LOG_ERROR(
"sql.sql",
"Battleground map {} specified to be disabled in map case, skipped.", entry);
177 TC_LOG_ERROR(
"sql.sql",
"Disable flags for map {} are invalid, skipped.", entry);
185 TC_LOG_ERROR(
"sql.sql",
"Battleground entry {} from `disables` doesn't exist in dbc, skipped.", entry);
189 TC_LOG_ERROR(
"sql.sql",
"Disable flags specified for battleground {}, useless data.", entry);
194 TC_LOG_ERROR(
"sql.sql",
"OutdoorPvPTypes value {} from `disables` is invalid, skipped.", entry);
198 TC_LOG_ERROR(
"sql.sql",
"Disable flags specified for outdoor PvP {}, useless data.", entry);
203 TC_LOG_ERROR(
"sql.sql",
"Achievement Criteria entry {} from `disables` doesn't exist in dbc, skipped.", entry);
207 TC_LOG_ERROR(
"sql.sql",
"Disable flags specified for Achievement Criteria {}, useless data.", entry);
214 TC_LOG_ERROR(
"sql.sql",
"Map entry {} from `disables` doesn't exist in dbc, skipped.", entry);
244 TC_LOG_ERROR(
"sql.sql",
"Map entry {} from `disables` doesn't exist in dbc, skipped.", entry);
255 m_DisableMap[type].insert(DisableTypeMap::value_type(entry, data));
258 while (result->NextRow());
270 TC_LOG_INFO(
"server.loading",
">> Checked 0 quest disables.");
277 const uint32 entry = itr->first;
280 TC_LOG_ERROR(
"sql.sql",
"Quest entry {} from `disables` doesn't exist, skipped.", entry);
284 if (itr->second.flags)
285 TC_LOG_ERROR(
"sql.sql",
"Disable flags specified for quest {}, useless data.", entry);
294 ASSERT(type < MAX_DISABLE_TYPES);
295 if (m_DisableMap[type].empty())
298 DisableTypeMap::iterator itr = m_DisableMap[type].find(entry);
299 if (itr == m_DisableMap[type].end())
306 uint16 spellFlags = itr->second.flags;
327 std::set<uint32>
const& mapIds = itr->second.params[0];
328 if (mapIds.find(ref->
GetMapId()) != mapIds.end())
339 std::set<uint32>
const& areaIds = itr->second.params[1];
340 if (areaIds.find(ref->
GetAreaId()) != areaIds.end())
364 uint8 disabledModes = itr->second.flags;
365 Group const* group = player->GetGroup();
368 switch (targetDifficulty)
392 return (
flags & itr->second.flags) != 0;
@ RAID_DIFFICULTY_25MAN_HEROIC
@ DUNGEON_DIFFICULTY_NORMAL
@ DUNGEON_DIFFICULTY_HEROIC
@ RAID_DIFFICULTY_10MAN_HEROIC
DBCStorage< AchievementCriteriaEntry > sAchievementCriteriaStore(AchievementCriteriafmt)
MapDifficultyEntry const * GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty)
DBCStorage< BattlemasterListEntry > sBattlemasterListStore(BattlemasterListEntryfmt)
MapDifficultyEntry const * GetMapDifficultyData(uint32 mapId, Difficulty difficulty)
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
std::shared_ptr< ResultSet > QueryResult
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
std::set< uint32 > params[2]
@ MMAP_DISABLE_PATHFINDING
@ SPELL_DISABLE_DEPRECATED_SPELL
@ SPELL_DISABLE_BATTLEGROUNDS
@ SPELL_DISABLE_GAMEOBJECT
@ DISABLE_TYPE_BATTLEGROUND
@ DISABLE_TYPE_ACHIEVEMENT_CRITERIA
@ DISABLE_TYPE_OUTDOORPVP
#define TC_LOG_ERROR(filterType__,...)
#define TC_LOG_INFO(filterType__,...)
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
Difficulty GetDifficultyID(MapEntry const *mapEntry) const
static Creature * ToCreature(Object *o)
static Player * ToPlayer(Object *o)
void CheckQuestDisables()
bool IsDisabledFor(DisableType type, uint32 entry, WorldObject const *ref, uint8 flags)
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