38 constexpr std::string_view MapTypeNames[] =
48 "Housing neighborhood"
54 std::unordered_set<uint32>
params[2];
58 typedef std::unordered_map<uint32, DisableData> DisableTypeMap;
60 std::array<DisableTypeMap, MAX_DISABLE_TYPES> m_DisableMap;
68 for (std::size_t i = 0; i < m_DisableMap.size(); ++i)
69 m_DisableMap[i].clear();
77 TC_LOG_INFO(
"server.loading",
">> Loaded 0 disables. DB table `disables` is empty!");
84 fields = result->Fetch();
88 TC_LOG_ERROR(
"sql.sql",
"Invalid type {} specified in `disables` table, skipped.", type);
94 std::string params_0 = fields[3].
GetString();
95 std::string params_1 = fields[4].
GetString();
105 TC_LOG_ERROR(
"sql.sql",
"Spell entry {} from `disables` doesn't exist in dbc, skipped.", entry);
111 TC_LOG_ERROR(
"sql.sql",
"Disable flags for spell {} are invalid, skipped.", entry);
120 data.params[0].insert(*mapId);
122 TC_LOG_ERROR(
"sql.sql",
"Disable map '{}' for spell {} is invalid, skipped.", mapStr, entry);
131 data.params[1].insert(*areaId);
133 TC_LOG_ERROR(
"sql.sql",
"Disable area '{}' for spell {} is invalid, skipped.", areaStr, entry);
147 TC_LOG_ERROR(
"sql.sql",
"Map entry {} from `disables` doesn't exist in dbc, skipped.", entry);
150 bool isFlagInvalid =
false;
155 isFlagInvalid =
true;
166 isFlagInvalid =
true;
170 TC_LOG_ERROR(
"sql.sql",
"Battleground map {} specified to be disabled in map case, skipped.", entry);
175 TC_LOG_ERROR(
"sql.sql",
"Disable flags for map {} are invalid, skipped.", entry);
183 TC_LOG_ERROR(
"sql.sql",
"Battleground entry {} from `disables` doesn't exist in dbc, skipped.", entry);
187 TC_LOG_ERROR(
"sql.sql",
"Disable flags specified for battleground {}, useless data.", entry);
192 TC_LOG_ERROR(
"sql.sql",
"OutdoorPvPTypes value {} from `disables` is invalid, skipped.", entry);
196 TC_LOG_ERROR(
"sql.sql",
"Disable flags specified for outdoor PvP {}, useless data.", entry);
201 TC_LOG_ERROR(
"sql.sql",
"Criteria entry {} from `disables` doesn't exist in dbc, skipped.", entry);
205 TC_LOG_ERROR(
"sql.sql",
"Disable flags specified for Criteria {}, useless data.", entry);
212 TC_LOG_ERROR(
"sql.sql",
"Map entry {} from `disables` doesn't exist in dbc, skipped.", entry);
243 TC_LOG_ERROR(
"sql.sql",
"Map entry {} from `disables` doesn't exist in dbc, skipped.", entry);
254 TC_LOG_ERROR(
"sql.sql",
"Phase entry {} from `disables` doesn't exist in dbc, skipped.", entry);
258 TC_LOG_ERROR(
"sql.sql",
"Disable flags specified for phase {}, useless data.", entry);
265 m_DisableMap[type][entry] = std::move(data);
268 while (result->NextRow());
280 TC_LOG_INFO(
"server.loading",
">> Checked 0 quest disables.");
287 uint32 entry = itr->first;
290 TC_LOG_ERROR(
"sql.sql",
"Quest entry {} from `disables` doesn't exist, skipped.", entry);
294 if (itr->second.flags)
295 TC_LOG_ERROR(
"sql.sql",
"Disable flags specified for quest {}, useless data.", entry);
305 if (m_DisableMap[type].empty())
308 DisableTypeMap::iterator itr = m_DisableMap[type].find(entry);
309 if (itr == m_DisableMap[type].end())
316 uint16 spellFlags = itr->second.flags;
337 std::unordered_set<uint32>
const& mapIds = itr->second.params[0];
338 if (mapIds.find(ref->
GetMapId()) != mapIds.end())
349 std::unordered_set<uint32>
const& areaIds = itr->second.params[1];
350 if (areaIds.find(ref->
GetAreaId()) != areaIds.end())
376 uint8 disabledModes = itr->second.flags;
377 Group const* group = player->GetGroup();
409 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.
uint32 GetUInt32() const noexcept
uint16 GetUInt16() const noexcept
std::string GetString() const noexcept
Difficulty GetDifficultyID(MapEntry const *mapEntry) const
constexpr uint32 GetMapId() const
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