44 typedef std::map<uint32, DisableData> DisableTypeMap;
46 typedef std::map<DisableType, DisableTypeMap> DisableMap;
48 DisableMap m_DisableMap;
50 uint8 MAX_DISABLE_TYPES = 9;
58 for (DisableMap::iterator itr = m_DisableMap.begin(); itr != m_DisableMap.end(); ++itr)
69 TC_LOG_INFO(
"server.loading",
">> Loaded 0 disables. DB table `disables` is empty!");
76 fields = result->Fetch();
78 if (type >= MAX_DISABLE_TYPES)
80 TC_LOG_ERROR(
"sql.sql",
"Invalid type {} specified in `disables` table, skipped.", type);
86 std::string params_0 = fields[3].
GetString();
87 std::string params_1 = fields[4].
GetString();
97 TC_LOG_ERROR(
"sql.sql",
"Spell entry {} from `disables` doesn't exist in dbc, skipped.", entry);
103 TC_LOG_ERROR(
"sql.sql",
"Disable flags for spell {} are invalid, skipped.", entry);
112 data.params[0].insert(*mapId);
114 TC_LOG_ERROR(
"sql.sql",
"Disable map '{}' for spell {} is invalid, skipped.", std::string(mapStr), entry);
123 data.params[1].insert(*areaId);
125 TC_LOG_ERROR(
"sql.sql",
"Disable area '{}' for spell {} is invalid, skipped.", std::string(areaStr), entry);
139 TC_LOG_ERROR(
"sql.sql",
"Map entry {} from `disables` doesn't exist in dbc, skipped.", entry);
142 bool isFlagInvalid =
false;
147 isFlagInvalid =
true;
158 isFlagInvalid =
true;
162 TC_LOG_ERROR(
"sql.sql",
"Battleground map {} specified to be disabled in map case, skipped.", entry);
167 TC_LOG_ERROR(
"sql.sql",
"Disable flags for map {} are invalid, skipped.", entry);
175 TC_LOG_ERROR(
"sql.sql",
"Battleground entry {} from `disables` doesn't exist in dbc, skipped.", entry);
179 TC_LOG_ERROR(
"sql.sql",
"Disable flags specified for battleground {}, useless data.", entry);
184 TC_LOG_ERROR(
"sql.sql",
"OutdoorPvPTypes value {} from `disables` is invalid, skipped.", entry);
188 TC_LOG_ERROR(
"sql.sql",
"Disable flags specified for outdoor PvP {}, useless data.", entry);
193 TC_LOG_ERROR(
"sql.sql",
"Achievement Criteria entry {} from `disables` doesn't exist in dbc, skipped.", entry);
197 TC_LOG_ERROR(
"sql.sql",
"Disable flags specified for Achievement Criteria {}, useless data.", entry);
204 TC_LOG_ERROR(
"sql.sql",
"Map entry {} from `disables` doesn't exist in dbc, skipped.", entry);
211 TC_LOG_INFO(
"misc",
"Areaflag disabled for world map {}.", entry);
213 TC_LOG_INFO(
"misc",
"Liquid status disabled for world map {}.", entry);
218 TC_LOG_INFO(
"misc",
"Height disabled for instance map {}.", entry);
220 TC_LOG_INFO(
"misc",
"LoS disabled for instance map {}.", entry);
224 TC_LOG_INFO(
"misc",
"Height disabled for battleground map {}.", entry);
226 TC_LOG_INFO(
"misc",
"LoS disabled for battleground map {}.", entry);
230 TC_LOG_INFO(
"misc",
"Height disabled for arena map {}.", entry);
232 TC_LOG_INFO(
"misc",
"LoS disabled for arena map {}.", entry);
244 TC_LOG_ERROR(
"sql.sql",
"Map entry {} from `disables` doesn't exist in dbc, skipped.", entry);
250 TC_LOG_INFO(
"misc",
"Pathfinding disabled for world map {}.", entry);
254 TC_LOG_INFO(
"misc",
"Pathfinding disabled for instance map {}.", entry);
257 TC_LOG_INFO(
"misc",
"Pathfinding disabled for battleground map {}.", entry);
260 TC_LOG_INFO(
"misc",
"Pathfinding disabled for arena map {}.", entry);
271 m_DisableMap[type].insert(DisableTypeMap::value_type(entry, data));
274 while (result->NextRow());
286 TC_LOG_INFO(
"server.loading",
">> Checked 0 quest disables.");
293 const uint32 entry = itr->first;
296 TC_LOG_ERROR(
"sql.sql",
"Quest entry {} from `disables` doesn't exist, skipped.", entry);
300 if (itr->second.flags)
301 TC_LOG_ERROR(
"sql.sql",
"Disable flags specified for quest {}, useless data.", entry);
310 ASSERT(type < MAX_DISABLE_TYPES);
311 if (m_DisableMap[type].empty())
314 DisableTypeMap::iterator itr = m_DisableMap[type].find(entry);
315 if (itr == m_DisableMap[type].end())
322 uint16 spellFlags = itr->second.flags;
343 std::set<uint32>
const& mapIds = itr->second.params[0];
344 if (mapIds.find(ref->
GetMapId()) != mapIds.end())
355 std::set<uint32>
const& areaIds = itr->second.params[1];
356 if (areaIds.find(ref->
GetAreaId()) != areaIds.end())
380 uint8 disabledModes = itr->second.flags;
383 switch (targetDifficulty)
407 return (
flags & itr->second.flags) != 0;
@ RAID_DIFFICULTY_25MAN_HEROIC
@ DUNGEON_DIFFICULTY_NORMAL
@ DUNGEON_DIFFICULTY_HEROIC
@ RAID_DIFFICULTY_10MAN_HEROIC
DBCStorage< AchievementCriteriaEntry > sAchievementCriteriaStore(AchievementCriteriafmt)
MapDifficulty const * GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty)
DBCStorage< BattlemasterListEntry > sBattlemasterListStore(BattlemasterListEntryfmt)
MapDifficulty 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
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