AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
DisableMgr Class Reference

#include "DisableMgr.h"

Public Types

typedef std::unordered_map< uint32, DisableDataDisableTypeMap
 
typedef std::array< DisableTypeMap, MAX_DISABLE_TYPESDisableMap
 

Public Member Functions

void LoadDisables ()
 
void AddDisable (DisableType type, uint32 entry, uint8 flags, std::string const &param0, std::string const &param1)
 Allow to add disables without adding it to the database. Useful for modules.
 
bool HandleDisableType (DisableType type, uint32 entry, uint8 flags, std::string const &params_0, std::string const &params_1, DisableData &data)
 
void CheckQuestDisables ()
 

Static Public Member Functions

static DisableMgrinstance ()
 
static bool IsDisabledFor (DisableType type, uint32 entry, Unit const *unit, uint8 flags=0)
 
static bool IsVMAPDisabledFor (uint32 entry, uint8 flags)
 
static bool IsPathfindingEnabled (Map const *map)
 

Private Member Functions

 DisableMgr ()
 
 ~DisableMgr ()
 

Static Private Attributes

static DisableMap m_DisableMap
 

Detailed Description

Member Typedef Documentation

◆ DisableMap

◆ DisableTypeMap

typedef std::unordered_map<uint32, DisableData> DisableMgr::DisableTypeMap

Constructor & Destructor Documentation

◆ DisableMgr()

DisableMgr::DisableMgr ( )
private
32{}

◆ ~DisableMgr()

DisableMgr::~DisableMgr ( )
private
33{}

Member Function Documentation

◆ AddDisable()

void DisableMgr::AddDisable ( DisableType  type,
uint32  entry,
uint8  flags,
std::string const &  param0,
std::string const &  param1 
)

Allow to add disables without adding it to the database. Useful for modules.

Parameters
typeDisable type
entryEntry of Spell/Quest/Map/BG/Achievement/Map/GameEvent/Item
flagsFlag depending on Type
param0MapId if DISABLE_TYPE_SPELL used, 0 for all maps.
param1AreaId if DISABLE_TYPE_SPELL used, 0 for all areas.
100{
101 if (type >= MAX_DISABLE_TYPES)
102 {
103 LOG_ERROR("disables", "AddDisable: Invalid type {} specified for entry {}, skipped.", type);
104 return;
105 }
106
107 DisableData data;
108 data.flags = flags;
109
110 if (!HandleDisableType(type, entry, flags, param0, param1, data))
111 return;
112
113 m_DisableMap[type].insert(DisableTypeMap::value_type(entry, data));
114}
@ MAX_DISABLE_TYPES
Definition DisableMgr.h:39
#define LOG_ERROR(filterType__,...)
Definition Log.h:158
bool HandleDisableType(DisableType type, uint32 entry, uint8 flags, std::string const &params_0, std::string const &params_1, DisableData &data)
Definition DisableMgr.cpp:116
static DisableMap m_DisableMap
Definition DisableMgr.h:85
Definition DisableMgr.h:57
uint8 flags
Definition DisableMgr.h:58

References DisableData::flags, HandleDisableType(), LOG_ERROR, m_DisableMap, and MAX_DISABLE_TYPES.

◆ CheckQuestDisables()

void DisableMgr::CheckQuestDisables ( )
303{
304 uint32 oldMSTime = getMSTime();
305
306 uint32 count = m_DisableMap[DISABLE_TYPE_QUEST].size();
307 if (!count)
308 {
309 LOG_INFO("server.loading", ">> Checked 0 quest disables.");
310 LOG_INFO("server.loading", " ");
311 return;
312 }
313
314 // check only quests, rest already done at startup
315 for (DisableTypeMap::iterator itr = m_DisableMap[DISABLE_TYPE_QUEST].begin(); itr != m_DisableMap[DISABLE_TYPE_QUEST].end();)
316 {
317 const uint32 entry = itr->first;
318 if (!sObjectMgr->GetQuestTemplate(entry))
319 {
320 LOG_ERROR("sql.sql", "Quest entry {} from `disables` doesn't exist, skipped.", entry);
321 m_DisableMap[DISABLE_TYPE_QUEST].erase(itr++);
322 continue;
323 }
324 if (itr->second.flags)
325 LOG_ERROR("sql.sql", "Disable flags specified for quest {}, useless data.", entry);
326 ++itr;
327 }
328
329 LOG_INFO("server.loading", ">> Checked {} Quest Disables in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
330 LOG_INFO("server.loading", " ");
331}
std::uint32_t uint32
Definition Define.h:107
@ DISABLE_TYPE_QUEST
Definition DisableMgr.h:29
#define LOG_INFO(filterType__,...)
Definition Log.h:166
#define sObjectMgr
Definition ObjectMgr.h:1712
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition Timer.h:131
uint32 getMSTime()
Definition Timer.h:103

References DISABLE_TYPE_QUEST, getMSTime(), GetMSTimeDiffToNow(), LOG_ERROR, LOG_INFO, m_DisableMap, and sObjectMgr.

◆ HandleDisableType()

bool DisableMgr::HandleDisableType ( DisableType  type,
uint32  entry,
uint8  flags,
std::string const &  params_0,
std::string const &  params_1,
DisableData data 
)
117{
118 switch (type)
119 {
121 if (!sObjectMgr->GetGameObjectTemplate(entry))
122 {
123 LOG_ERROR("sql.sql", "Gameobject entry {} from `disables` doesn't exist in dbc, skipped.", entry);
124 return false;
125 }
126 if (flags)
127 LOG_ERROR("sql.sql", "Disable flags specified for gameobject {}, useless data.", entry);
128 break;
130 if (!(sSpellMgr->GetSpellInfo(entry) || flags & SPELL_DISABLE_DEPRECATED_SPELL))
131 {
132 LOG_ERROR("sql.sql", "Spell entry {} from `disables` doesn't exist in dbc, skipped.", entry);
133 return false;
134 }
135
136 if (!flags || flags > MAX_SPELL_DISABLE_TYPE)
137 {
138 LOG_ERROR("sql.sql", "Disable flags for spell {} are invalid, skipped.", entry);
139 return false;
140 }
141
142 if (flags & SPELL_DISABLE_MAP)
143 {
144 for (std::string_view mapStr : Acore::Tokenize(params_0, ',', true))
145 {
146 if (Optional<uint32> mapId = Acore::StringTo<uint32>(mapStr))
147 data.params[0].insert(*mapId);
148 else
149 LOG_ERROR("sql.sql", "Disable map '{}' for spell {} is invalid, skipped.", mapStr, entry);
150 }
151 }
152
153 if (flags & SPELL_DISABLE_AREA)
154 {
155 for (std::string_view areaStr : Acore::Tokenize(params_1, ',', true))
156 {
157 if (Optional<uint32> areaId = Acore::StringTo<uint32>(areaStr))
158 data.params[1].insert(*areaId);
159 else
160 LOG_ERROR("sql.sql", "Disable area '{}' for spell {} is invalid, skipped.", areaStr, entry);
161 }
162 }
163
164 // xinef: if spell has disabled los, add flag
165 if (flags & SPELL_DISABLE_LOS)
166 {
167 SpellInfo* spellInfo = const_cast<SpellInfo*>(sSpellMgr->GetSpellInfo(entry));
169 }
170
171 break;
172 // checked later
174 break;
175 case DISABLE_TYPE_MAP:
177 {
178 MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
179 if (!mapEntry)
180 {
181 LOG_ERROR("sql.sql", "Map entry {} from `disables` doesn't exist in dbc, skipped.", entry);
182 return false;
183 }
184 bool isFlagInvalid = false;
185 switch (mapEntry->map_type)
186 {
187 case MAP_COMMON:
188 if (flags)
189 isFlagInvalid = true;
190 break;
191 case MAP_INSTANCE:
192 case MAP_RAID:
194 isFlagInvalid = true;
196 isFlagInvalid = true;
198 isFlagInvalid = true;
199 break;
200 case MAP_BATTLEGROUND:
201 case MAP_ARENA:
202 LOG_ERROR("sql.sql", "Battleground map {} specified to be disabled in map case, skipped.", entry);
203 return false;
204 }
205 if (isFlagInvalid)
206 {
207 LOG_ERROR("sql.sql", "Disable flags for map {} are invalid, skipped.", entry);
208 return false;
209 }
210 break;
211 }
213 if (!sBattlemasterListStore.LookupEntry(entry))
214 {
215 LOG_ERROR("sql.sql", "Battleground entry {} from `disables` doesn't exist in dbc, skipped.", entry);
216 return false;
217 }
218 if (flags)
219 LOG_ERROR("sql.sql", "Disable flags specified for battleground {}, useless data.", entry);
220 break;
222 if (entry > MAX_OUTDOORPVP_TYPES)
223 {
224 LOG_ERROR("sql.sql", "OutdoorPvPTypes value {} from `disables` is invalid, skipped.", entry);
225 return false;
226 }
227 if (flags)
228 LOG_ERROR("sql.sql", "Disable flags specified for outdoor PvP {}, useless data.", entry);
229 break;
231 if (!sAchievementCriteriaStore.LookupEntry(entry))
232 {
233 LOG_ERROR("sql.sql", "Achievement Criteria entry {} from `disables` doesn't exist in dbc, skipped.", entry);
234 return false;
235 }
236 if (flags)
237 LOG_ERROR("sql.sql", "Disable flags specified for Achievement Criteria {}, useless data.", entry);
238 break;
240 {
241 MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
242 if (!mapEntry)
243 {
244 LOG_ERROR("sql.sql", "Map entry {} from `disables` doesn't exist in dbc, skipped.", entry);
245 return false;
246 }
247 switch (mapEntry->map_type)
248 {
249 case MAP_COMMON:
250 if (flags & VMAP::VMAP_DISABLE_AREAFLAG)
251 LOG_INFO("disable", "Areaflag disabled for world map {}.", entry);
253 LOG_INFO("disable", "Liquid status disabled for world map {}.", entry);
254 break;
255 case MAP_INSTANCE:
256 case MAP_RAID:
257 if (flags & VMAP::VMAP_DISABLE_HEIGHT)
258 LOG_INFO("disable", "Height disabled for instance map {}.", entry);
259 if (flags & VMAP::VMAP_DISABLE_LOS)
260 LOG_INFO("disable", "LoS disabled for instance map {}.", entry);
261 break;
262 case MAP_BATTLEGROUND:
263 if (flags & VMAP::VMAP_DISABLE_HEIGHT)
264 LOG_INFO("disable", "Height disabled for battleground map {}.", entry);
265 if (flags & VMAP::VMAP_DISABLE_LOS)
266 LOG_INFO("disable", "LoS disabled for battleground map {}.", entry);
267 break;
268 case MAP_ARENA:
269 if (flags & VMAP::VMAP_DISABLE_HEIGHT)
270 LOG_INFO("disable", "Height disabled for arena map {}.", entry);
271 if (flags & VMAP::VMAP_DISABLE_LOS)
272 LOG_INFO("disable", "LoS disabled for arena map {}.", entry);
273 break;
274 default:
275 break;
276 }
277 break;
278 }
280 {
281 GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList();
282 if (activeEvents.find(entry) != activeEvents.end())
283 {
284 sGameEventMgr->StopEvent(entry);
285 LOG_INFO("disable", "Event entry {} was stopped because it has been disabled.", entry);
286 }
287 break;
288 }
290 break;
292 {
293 LOG_ERROR("disable", "SourceType out of range for entry {}, skipped", entry);
294 return false;
295 }
296 default:
297 return false;
298 }
299 return true;
300}
@ MAP_COMMON
Definition DBCEnums.h:346
@ MAP_BATTLEGROUND
Definition DBCEnums.h:349
@ MAP_ARENA
Definition DBCEnums.h:350
@ MAP_INSTANCE
Definition DBCEnums.h:347
@ MAP_RAID
Definition DBCEnums.h:348
@ RAID_DIFFICULTY_25MAN_HEROIC
Definition DBCEnums.h:276
@ DUNGEON_DIFFICULTY_HEROIC
Definition DBCEnums.h:270
@ RAID_DIFFICULTY_10MAN_HEROIC
Definition DBCEnums.h:275
DBCStorage< AchievementCriteriaEntry > sAchievementCriteriaStore(AchievementCriteriafmt)
DBCStorage< BattlemasterListEntry > sBattlemasterListStore(BattlemasterListEntryfmt)
MapDifficulty const * GetMapDifficultyData(uint32 mapId, Difficulty difficulty)
Definition DBCStores.cpp:761
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
@ SPELL_DISABLE_LOS
Definition DisableMgr.h:50
@ SPELL_DISABLE_MAP
Definition DisableMgr.h:48
@ SPELL_DISABLE_DEPRECATED_SPELL
Definition DisableMgr.h:47
@ MAX_SPELL_DISABLE_TYPE
Definition DisableMgr.h:51
@ SPELL_DISABLE_AREA
Definition DisableMgr.h:49
@ DISABLE_TYPE_SPELL
Definition DisableMgr.h:28
@ DISABLE_TYPE_VMAP
Definition DisableMgr.h:34
@ DISABLE_TYPE_MAP
Definition DisableMgr.h:30
@ DISABLE_TYPE_BATTLEGROUND
Definition DisableMgr.h:31
@ DISABLE_TYPE_ACHIEVEMENT_CRITERIA
Definition DisableMgr.h:32
@ DISABLE_TYPE_LOOT
Definition DisableMgr.h:38
@ DISABLE_TYPE_GAME_EVENT
Definition DisableMgr.h:37
@ DISABLE_TYPE_LFG_MAP
Definition DisableMgr.h:36
@ DISABLE_TYPE_GO_LOS
Definition DisableMgr.h:35
@ DISABLE_TYPE_OUTDOORPVP
Definition DisableMgr.h:33
#define sGameEventMgr
Definition GameEventMgr.h:201
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition Optional.h:24
#define MAX_OUTDOORPVP_TYPES
Definition OutdoorPvP.h:39
@ SPELL_ATTR2_IGNORE_LINE_OF_SIGHT
Definition SharedDefines.h:446
@ RAID_STATUSFLAG_10MAN_HEROIC
Definition SharedDefines.h:3957
@ RAID_STATUSFLAG_25MAN_HEROIC
Definition SharedDefines.h:3958
@ DUNGEON_STATUSFLAG_HEROIC
Definition SharedDefines.h:3953
#define sSpellMgr
Definition SpellMgr.h:836
std::set< uint16 > ActiveEvents
Definition GameEventMgr.h:106
Definition SpellInfo.h:340
uint32 AttributesEx2
Definition SpellInfo.h:350
Definition AsioHacksFwd.h:47
std::vector< std::string_view > Tokenize(std::string_view str, char sep, bool keepEmpty)
Definition Tokenize.cpp:20
@ VMAP_DISABLE_LIQUIDSTATUS
Definition VMapMgr2.h:51
@ VMAP_DISABLE_LOS
Definition VMapMgr2.h:50
@ VMAP_DISABLE_HEIGHT
Definition VMapMgr2.h:49
@ VMAP_DISABLE_AREAFLAG
Definition VMapMgr2.h:48
std::set< uint32 > params[2]
Definition DisableMgr.h:59
Definition DBCStructure.h:1325
uint32 map_type
Definition DBCStructure.h:1328

References SpellInfo::AttributesEx2, DISABLE_TYPE_ACHIEVEMENT_CRITERIA, DISABLE_TYPE_BATTLEGROUND, DISABLE_TYPE_GAME_EVENT, DISABLE_TYPE_GO_LOS, DISABLE_TYPE_LFG_MAP, DISABLE_TYPE_LOOT, DISABLE_TYPE_MAP, DISABLE_TYPE_OUTDOORPVP, DISABLE_TYPE_QUEST, DISABLE_TYPE_SPELL, DISABLE_TYPE_VMAP, DUNGEON_DIFFICULTY_HEROIC, DUNGEON_STATUSFLAG_HEROIC, GetMapDifficultyData(), LOG_ERROR, LOG_INFO, MAP_ARENA, MAP_BATTLEGROUND, MAP_COMMON, MAP_INSTANCE, MAP_RAID, MapEntry::map_type, MAX_DISABLE_TYPES, MAX_OUTDOORPVP_TYPES, MAX_SPELL_DISABLE_TYPE, DisableData::params, RAID_DIFFICULTY_10MAN_HEROIC, RAID_DIFFICULTY_25MAN_HEROIC, RAID_STATUSFLAG_10MAN_HEROIC, RAID_STATUSFLAG_25MAN_HEROIC, sAchievementCriteriaStore, sBattlemasterListStore, sGameEventMgr, sMapStore, sObjectMgr, SPELL_ATTR2_IGNORE_LINE_OF_SIGHT, SPELL_DISABLE_AREA, SPELL_DISABLE_DEPRECATED_SPELL, SPELL_DISABLE_LOS, SPELL_DISABLE_MAP, sSpellMgr, Acore::Tokenize(), VMAP::VMAP_DISABLE_AREAFLAG, VMAP::VMAP_DISABLE_HEIGHT, VMAP::VMAP_DISABLE_LIQUIDSTATUS, and VMAP::VMAP_DISABLE_LOS.

Referenced by AddDisable(), and LoadDisables().

◆ instance()

DisableMgr * DisableMgr::instance ( )
static
36{
37 static DisableMgr instance;
38 return &instance;
39}
Definition DisableMgr.h:63
static DisableMgr * instance()
Definition DisableMgr.cpp:35

References instance().

Referenced by instance().

◆ IsDisabledFor()

bool DisableMgr::IsDisabledFor ( DisableType  type,
uint32  entry,
Unit const *  unit,
uint8  flags = 0 
)
static
334{
335 if (type >= MAX_DISABLE_TYPES)
336 {
337 LOG_ERROR("server", "Disables::IsDisabledFor() called with unknown disable type {}! (entry {}, flags {}).", type, entry, flags);
338 return false;
339 }
340
341 if (m_DisableMap[type].empty())
342 return false;
343
344 DisableTypeMap::iterator itr = m_DisableMap[type].find(entry);
345 if (itr == m_DisableMap[type].end()) // not disabled
346 return false;
347
348 switch (type)
349 {
351 {
352 uint8 spellFlags = itr->second.flags;
353 if (unit)
354 {
355 if ((spellFlags & SPELL_DISABLE_PLAYER && unit->IsPlayer()) ||
356 (unit->IsCreature() && ((unit->IsPet() && spellFlags & SPELL_DISABLE_PET) || spellFlags & SPELL_DISABLE_CREATURE)))
357 {
358 if (spellFlags & SPELL_DISABLE_MAP)
359 {
360 std::set<uint32> const& mapIds = itr->second.params[0];
361 if (mapIds.find(unit->GetMapId()) != mapIds.end())
362 return true; // Spell is disabled on current map
363
364 if (!(spellFlags & SPELL_DISABLE_AREA))
365 return false; // Spell is disabled on another map, but not this one, return false
366
367 // Spell is disabled in an area, but not explicitly our current mapId. Continue processing.
368 }
369
370 if (spellFlags & SPELL_DISABLE_AREA)
371 {
372 std::set<uint32> const& areaIds = itr->second.params[1];
373 if (areaIds.find(unit->GetAreaId()) != areaIds.end())
374 return true; // Spell is disabled in this area
375 return false; // Spell is disabled in another area, but not this one, return false
376 }
377 else
378 return true; // Spell disabled for all maps
379 }
380
381 return false;
382 }
383 else if (spellFlags & SPELL_DISABLE_DEPRECATED_SPELL) // call not from spellcast
384 return true;
385
386 break;
387 }
388 case DISABLE_TYPE_MAP:
390 {
391 MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
392 if (!mapEntry)
393 return false;
394
395 if (!mapEntry->IsDungeon())
396 return mapEntry->map_type == MAP_COMMON;
397
398 uint8 disabledModes = itr->second.flags;
399
400 Difficulty targetDifficulty;
401 if (unit && unit->IsPlayer())
402 targetDifficulty = unit->ToPlayer()->GetDifficulty(mapEntry->IsRaid());
403 else
404 targetDifficulty = Difficulty(flags);
405
406 GetDownscaledMapDifficultyData(entry, targetDifficulty);
407
408 switch (targetDifficulty)
409 {
411 return disabledModes & DUNGEON_STATUSFLAG_NORMAL;
413 return disabledModes & DUNGEON_STATUSFLAG_HEROIC;
415 return disabledModes & RAID_STATUSFLAG_10MAN_HEROIC;
417 return disabledModes & RAID_STATUSFLAG_25MAN_HEROIC;
418 default:
419 return false;
420 }
421 return false;
422 }
424 return flags & itr->second.flags;
432 return true;
433 default:
434 break;
435 }
436
437 return false;
438}
Difficulty
Definition DBCEnums.h:266
@ DUNGEON_DIFFICULTY_NORMAL
Definition DBCEnums.h:269
MapDifficulty const * GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty)
Definition DBCStores.cpp:767
std::uint8_t uint8
Definition Define.h:109
@ SPELL_DISABLE_CREATURE
Definition DisableMgr.h:45
@ SPELL_DISABLE_PET
Definition DisableMgr.h:46
@ SPELL_DISABLE_PLAYER
Definition DisableMgr.h:44
@ DUNGEON_STATUSFLAG_NORMAL
Definition SharedDefines.h:3952
bool IsDungeon() const
Definition DBCStructure.h:1351
bool IsRaid() const
Definition DBCStructure.h:1354

References DISABLE_TYPE_ACHIEVEMENT_CRITERIA, DISABLE_TYPE_BATTLEGROUND, DISABLE_TYPE_GAME_EVENT, DISABLE_TYPE_GO_LOS, DISABLE_TYPE_LFG_MAP, DISABLE_TYPE_LOOT, DISABLE_TYPE_MAP, DISABLE_TYPE_OUTDOORPVP, DISABLE_TYPE_QUEST, DISABLE_TYPE_SPELL, DISABLE_TYPE_VMAP, DUNGEON_DIFFICULTY_HEROIC, DUNGEON_DIFFICULTY_NORMAL, DUNGEON_STATUSFLAG_HEROIC, DUNGEON_STATUSFLAG_NORMAL, WorldObject::GetAreaId(), Player::GetDifficulty(), GetDownscaledMapDifficultyData(), WorldLocation::GetMapId(), Object::IsCreature(), MapEntry::IsDungeon(), Unit::IsPet(), Object::IsPlayer(), MapEntry::IsRaid(), LOG_ERROR, m_DisableMap, MAP_COMMON, MapEntry::map_type, MAX_DISABLE_TYPES, RAID_DIFFICULTY_10MAN_HEROIC, RAID_DIFFICULTY_25MAN_HEROIC, RAID_STATUSFLAG_10MAN_HEROIC, RAID_STATUSFLAG_25MAN_HEROIC, sMapStore, SPELL_DISABLE_AREA, SPELL_DISABLE_CREATURE, SPELL_DISABLE_DEPRECATED_SPELL, SPELL_DISABLE_MAP, SPELL_DISABLE_PET, SPELL_DISABLE_PLAYER, and Object::ToPlayer().

Referenced by IsVMAPDisabledFor().

◆ IsPathfindingEnabled()

bool DisableMgr::IsPathfindingEnabled ( Map const *  map)
static
446{
447 if (!map)
448 return false;
449
450 // Still not an ideal solution but removes the extra awful forbiddenMaps hack
451 // int32 f[] = {616 /*EoE*/, 649 /*ToC25*/, 650 /*ToC5*/, -1};
452 switch (map->GetId())
453 {
454 case 616: // EoE
455 case 649: // ToC25
456 case 650: // ToC5
457 return false;
458 default:
459 break;
460 }
461
462 return (sWorld->getBoolConfig(CONFIG_ENABLE_MMAPS) ? true : map->IsBattlegroundOrArena());
463}
@ CONFIG_ENABLE_MMAPS
Definition WorldConfig.h:104
#define sWorld
Definition World.h:316

References CONFIG_ENABLE_MMAPS, Map::GetId(), Map::IsBattlegroundOrArena(), and sWorld.

Referenced by MapCollisionData::LoadMMapTile().

◆ IsVMAPDisabledFor()

bool DisableMgr::IsVMAPDisabledFor ( uint32  entry,
uint8  flags 
)
static
441{
442 return IsDisabledFor(DISABLE_TYPE_VMAP, entry, nullptr, flags);
443}
static bool IsDisabledFor(DisableType type, uint32 entry, Unit const *unit, uint8 flags=0)
Definition DisableMgr.cpp:333

References DISABLE_TYPE_VMAP, and IsDisabledFor().

Referenced by StaticVMapCollisionData::GetAreaAndLiquidData(), StaticVMapCollisionData::getHeight(), StaticVMapCollisionData::GetObjectHitPos(), StaticVMapCollisionData::isInLineOfSight(), and World::SetInitialWorldSettings().

◆ LoadDisables()

void DisableMgr::LoadDisables ( )
42{
43 uint32 oldMSTime = getMSTime();
44
45 // reload case
46 for (DisableTypeMap& disableTypeMap : m_DisableMap)
47 disableTypeMap.clear();
48
49 QueryResult result = WorldDatabase.Query("SELECT sourceType, entry, flags, params_0, params_1 FROM disables");
50
51 uint32 total_count = 0;
52
53 if (!result)
54 {
55 LOG_WARN("server.loading", ">> Loaded 0 disables. DB table `disables` is empty!");
56 LOG_INFO("server.loading", " ");
57 return;
58 }
59
60 Field* fields;
61 do
62 {
63 fields = result->Fetch();
64 DisableType type = DisableType(fields[0].Get<uint32>());
65 if (type >= MAX_DISABLE_TYPES)
66 {
67 LOG_ERROR("sql.sql", "Invalid type {} specified in `disables` table, skipped.", type);
68 continue;
69 }
70
71 uint32 entry = fields[1].Get<uint32>();
72 uint8 flags = fields[2].Get<uint8>();
73 std::string params_0 = fields[3].Get<std::string>();
74 std::string params_1 = fields[4].Get<std::string>();
75
76 DisableData data;
77 data.flags = flags;
78
79 if (!HandleDisableType(type, entry, flags, params_0, params_1, data))
80 continue;
81
82 m_DisableMap[type].insert(DisableTypeMap::value_type(entry, data));
83 ++total_count;
84 } while (result->NextRow());
85
86 LOG_INFO("server.loading", ">> Loaded {} Disables in {} ms", total_count, GetMSTimeDiffToNow(oldMSTime));
87 LOG_INFO("server.loading", " ");
88}
std::shared_ptr< ResultSet > QueryResult
Definition DatabaseEnvFwd.h:27
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition DatabaseEnv.cpp:20
DisableType
Definition DisableMgr.h:27
#define LOG_WARN(filterType__,...)
Definition Log.h:162
std::unordered_map< uint32, DisableData > DisableTypeMap
Definition DisableMgr.h:80
Class used to access individual fields of database query result.
Definition Field.h:98
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition Field.h:112

References DisableData::flags, Field::Get(), getMSTime(), GetMSTimeDiffToNow(), HandleDisableType(), LOG_ERROR, LOG_INFO, LOG_WARN, m_DisableMap, MAX_DISABLE_TYPES, and WorldDatabase.

Member Data Documentation

◆ m_DisableMap

DisableMgr::DisableMap DisableMgr::m_DisableMap
staticprivate

The documentation for this class was generated from the following files: