Disable spawns: base checking entry, additionally - guid

Set `flags` to 1 and `data` to guid.
If flags not set, all spawns of the entry are disabled.
This commit is contained in:
Olion 2015-09-30 21:58:57 +03:00 committed by Antz
parent ae88c9cdcf
commit 93abbf4c72
3 changed files with 19 additions and 8 deletions

View File

@ -1062,7 +1062,7 @@ void ObjectMgr::LoadCreatures()
uint32 guid = fields[ 0].GetUInt32();
uint32 entry = fields[ 1].GetUInt32();
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_CREATURE_SPAWN, guid))
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_CREATURE_SPAWN, entry, NULL, 0, guid))
{
sLog.outDebug("Creature guid %u (entry %u) spawning is disabled.", guid, entry);
continue;
@ -1236,7 +1236,7 @@ void ObjectMgr::LoadGameObjects()
uint32 guid = fields[ 0].GetUInt32();
uint32 entry = fields[ 1].GetUInt32();
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_GAMEOBJECT_SPAWN, guid))
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_GAMEOBJECT_SPAWN, entry, NULL, 0, guid))
{
sLog.outDebug("Gameobject guid %u (entry %u) spawning is disabled.", guid, entry);
continue;

View File

@ -237,6 +237,17 @@ void LoadDisables()
}
case DISABLE_TYPE_CREATURE_SPAWN:
case DISABLE_TYPE_GAMEOBJECT_SPAWN:
if ((flags & SPAWN_DISABLE_CHECK_GUID) != 0)
{
if (data0)
data->params[0].insert(data0);
else
{
ERROR_DB_STRICT_LOG("Disables type %u: required GUID is missing for entry %u, ignoring disable entry.", type, entry);
delete data;
continue;
}
}
break;
default:
break;
@ -278,7 +289,7 @@ void CheckQuestDisables()
sLog.outString(">> Checked %u quest disables", count);
}
bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags)
bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags, uint32 adData)
{
MANGOS_ASSERT(type < MAX_DISABLE_TYPES);
if (m_DisableMap[type].empty())
@ -366,11 +377,12 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags
case DISABLE_TYPE_OUTDOORPVP:
case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
case DISABLE_TYPE_MMAP:
case DISABLE_TYPE_CREATURE_SPAWN:
case DISABLE_TYPE_GAMEOBJECT_SPAWN:
return true;
case DISABLE_TYPE_VMAP:
return (flags & itr->second.flags) != 0;
case DISABLE_TYPE_CREATURE_SPAWN:
case DISABLE_TYPE_GAMEOBJECT_SPAWN:
return (itr->second.flags & SPAWN_DISABLE_CHECK_GUID) == 0 || itr->second.params[0].count(adData) > 0;
}
return false;

View File

@ -55,14 +55,13 @@ enum SpellDisableTypes
enum SpawnDisableTypes
{
SPAWN_DISABLE_FOR_ENTRY = 0,
SPAWN_DISABLE_FOR_GUID = 1
SPAWN_DISABLE_CHECK_GUID = 0x1
};
namespace DisableMgr
{
void LoadDisables();
bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit = NULL, uint8 flags = 0);
bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit = NULL, uint8 flags = 0, uint32 data = 0);
void CheckQuestDisables();
bool IsVMAPDisabledFor(uint32 entry, uint8 flags);
bool IsPathfindingEnabled(uint32 mapId);