Disables: DISABLE_TYPE_ITEM_DROP=10. Also fixed memory leak
This commit is contained in:
parent
71ba7d9374
commit
983ea0c038
@ -31,6 +31,7 @@
|
|||||||
#include "SharedDefines.h"
|
#include "SharedDefines.h"
|
||||||
#include "DBCStores.h"
|
#include "DBCStores.h"
|
||||||
#include "SQLStorages.h"
|
#include "SQLStorages.h"
|
||||||
|
#include "DisableMgr.h"
|
||||||
|
|
||||||
static eConfigFloatValues const qualityToRate[MAX_ITEM_QUALITY] =
|
static eConfigFloatValues const qualityToRate[MAX_ITEM_QUALITY] =
|
||||||
{
|
{
|
||||||
@ -1003,7 +1004,7 @@ bool LootTemplate::LootGroup::HasStartingQuestDropForPlayer(Player const* player
|
|||||||
void LootTemplate::LootGroup::Process(Loot& loot) const
|
void LootTemplate::LootGroup::Process(Loot& loot) const
|
||||||
{
|
{
|
||||||
LootStoreItem const* item = Roll();
|
LootStoreItem const* item = Roll();
|
||||||
if (item != NULL)
|
if (item != NULL && !DisableMgr::IsDisabledFor(DISABLE_TYPE_ITEM_DROP, item->itemid))
|
||||||
{ loot.AddItem(*item); }
|
{ loot.AddItem(*item); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1101,7 +1102,7 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint8
|
|||||||
// Rolling non-grouped items
|
// Rolling non-grouped items
|
||||||
for (LootStoreItemList::const_iterator i = Entries.begin() ; i != Entries.end() ; ++i)
|
for (LootStoreItemList::const_iterator i = Entries.begin() ; i != Entries.end() ; ++i)
|
||||||
{
|
{
|
||||||
if (!i->Roll(rate))
|
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_ITEM_DROP, i->itemid) || !i->Roll(rate))
|
||||||
{ continue; } // Bad luck for the entry
|
{ continue; } // Bad luck for the entry
|
||||||
|
|
||||||
if (i->mincountOrRef < 0) // References processing
|
if (i->mincountOrRef < 0) // References processing
|
||||||
|
@ -44,6 +44,8 @@ namespace
|
|||||||
DisableMap m_DisableMap;
|
DisableMap m_DisableMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CONTINUE if (newData) delete data; continue
|
||||||
|
|
||||||
void LoadDisables()
|
void LoadDisables()
|
||||||
{
|
{
|
||||||
// reload case
|
// reload case
|
||||||
@ -79,10 +81,14 @@ void LoadDisables()
|
|||||||
uint32 data0 = fields[3].GetUInt32();
|
uint32 data0 = fields[3].GetUInt32();
|
||||||
|
|
||||||
DisableData* data;
|
DisableData* data;
|
||||||
|
bool newData = false;
|
||||||
if (m_DisableMap[type].find(entry) != m_DisableMap[type].end())
|
if (m_DisableMap[type].find(entry) != m_DisableMap[type].end())
|
||||||
data = &m_DisableMap[type][entry];
|
data = &m_DisableMap[type][entry];
|
||||||
else
|
else
|
||||||
|
{
|
||||||
data = new DisableData();
|
data = new DisableData();
|
||||||
|
newData = true;
|
||||||
|
}
|
||||||
|
|
||||||
data->flags = flags;
|
data->flags = flags;
|
||||||
|
|
||||||
@ -92,13 +98,13 @@ void LoadDisables()
|
|||||||
if (!(sSpellStore.LookupEntry(entry) || flags & SPELL_DISABLE_DEPRECATED_SPELL))
|
if (!(sSpellStore.LookupEntry(entry) || flags & SPELL_DISABLE_DEPRECATED_SPELL))
|
||||||
{
|
{
|
||||||
ERROR_DB_STRICT_LOG("Spell entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
ERROR_DB_STRICT_LOG("Spell entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
||||||
continue;
|
CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!flags || flags > MAX_SPELL_DISABLE_TYPE)
|
if (!flags || flags > MAX_SPELL_DISABLE_TYPE)
|
||||||
{
|
{
|
||||||
ERROR_DB_STRICT_LOG("Disable flags for spell %u are invalid, skipped.", entry);
|
ERROR_DB_STRICT_LOG("Disable flags for spell %u are invalid, skipped.", entry);
|
||||||
continue;
|
CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & SPELL_DISABLE_MAP)
|
if (flags & SPELL_DISABLE_MAP)
|
||||||
@ -117,7 +123,7 @@ void LoadDisables()
|
|||||||
if (!mapEntry)
|
if (!mapEntry)
|
||||||
{
|
{
|
||||||
ERROR_DB_STRICT_LOG("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
ERROR_DB_STRICT_LOG("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
||||||
continue;
|
CONTINUE;
|
||||||
}
|
}
|
||||||
bool isFlagInvalid = false;
|
bool isFlagInvalid = false;
|
||||||
switch (mapEntry->map_type)
|
switch (mapEntry->map_type)
|
||||||
@ -131,12 +137,12 @@ void LoadDisables()
|
|||||||
case MAP_BATTLEGROUND:
|
case MAP_BATTLEGROUND:
|
||||||
//case MAP_ARENA: [-ZERO]
|
//case MAP_ARENA: [-ZERO]
|
||||||
ERROR_DB_STRICT_LOG("Battleground map %u specified to be disabled in map case, skipped.", entry);
|
ERROR_DB_STRICT_LOG("Battleground map %u specified to be disabled in map case, skipped.", entry);
|
||||||
continue;
|
CONTINUE;
|
||||||
}
|
}
|
||||||
if (isFlagInvalid)
|
if (isFlagInvalid)
|
||||||
{
|
{
|
||||||
ERROR_DB_STRICT_LOG("Disable flags for map %u are invalid, skipped.", entry);
|
ERROR_DB_STRICT_LOG("Disable flags for map %u are invalid, skipped.", entry);
|
||||||
continue;
|
CONTINUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -144,7 +150,7 @@ void LoadDisables()
|
|||||||
if (!sBattleGroundMgr.GetBattleGroundTemplate(BattleGroundTypeId(entry)))
|
if (!sBattleGroundMgr.GetBattleGroundTemplate(BattleGroundTypeId(entry)))
|
||||||
{
|
{
|
||||||
ERROR_DB_STRICT_LOG("Battleground entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
ERROR_DB_STRICT_LOG("Battleground entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
||||||
continue;
|
CONTINUE;
|
||||||
}
|
}
|
||||||
if (flags)
|
if (flags)
|
||||||
ERROR_DB_STRICT_LOG("Disable flags specified for battleground %u, useless data.", entry);
|
ERROR_DB_STRICT_LOG("Disable flags specified for battleground %u, useless data.", entry);
|
||||||
@ -153,7 +159,7 @@ void LoadDisables()
|
|||||||
if (entry > MAX_OPVP_ID)
|
if (entry > MAX_OPVP_ID)
|
||||||
{
|
{
|
||||||
ERROR_DB_STRICT_LOG("OutdoorPvPTypes value %u from `disables` is invalid, skipped.", entry);
|
ERROR_DB_STRICT_LOG("OutdoorPvPTypes value %u from `disables` is invalid, skipped.", entry);
|
||||||
continue;
|
CONTINUE;
|
||||||
}
|
}
|
||||||
if (flags)
|
if (flags)
|
||||||
ERROR_DB_STRICT_LOG("Disable flags specified for outdoor PvP %u, useless data.", entry);
|
ERROR_DB_STRICT_LOG("Disable flags specified for outdoor PvP %u, useless data.", entry);
|
||||||
@ -173,7 +179,7 @@ void LoadDisables()
|
|||||||
if (!mapEntry)
|
if (!mapEntry)
|
||||||
{
|
{
|
||||||
ERROR_DB_STRICT_LOG("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
ERROR_DB_STRICT_LOG("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
||||||
continue;
|
CONTINUE;
|
||||||
}
|
}
|
||||||
switch (mapEntry->map_type)
|
switch (mapEntry->map_type)
|
||||||
{
|
{
|
||||||
@ -213,7 +219,7 @@ void LoadDisables()
|
|||||||
if (!mapEntry)
|
if (!mapEntry)
|
||||||
{
|
{
|
||||||
ERROR_DB_STRICT_LOG("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
ERROR_DB_STRICT_LOG("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
||||||
continue;
|
CONTINUE;
|
||||||
}
|
}
|
||||||
switch (mapEntry->map_type)
|
switch (mapEntry->map_type)
|
||||||
{
|
{
|
||||||
@ -244,11 +250,12 @@ void LoadDisables()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR_DB_STRICT_LOG("Disables type %u: required GUID is missing for entry %u, ignoring disable entry.", type, entry);
|
ERROR_DB_STRICT_LOG("Disables type %u: required GUID is missing for entry %u, ignoring disable entry.", type, entry);
|
||||||
delete data;
|
CONTINUE;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case DISABLE_TYPE_ITEM_DROP:
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -377,6 +384,7 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags
|
|||||||
case DISABLE_TYPE_OUTDOORPVP:
|
case DISABLE_TYPE_OUTDOORPVP:
|
||||||
case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
|
case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
|
||||||
case DISABLE_TYPE_MMAP:
|
case DISABLE_TYPE_MMAP:
|
||||||
|
case DISABLE_TYPE_ITEM_DROP:
|
||||||
return true;
|
return true;
|
||||||
case DISABLE_TYPE_VMAP:
|
case DISABLE_TYPE_VMAP:
|
||||||
return (flags & itr->second.flags) != 0;
|
return (flags & itr->second.flags) != 0;
|
||||||
|
@ -36,7 +36,8 @@ enum DisableType
|
|||||||
DISABLE_TYPE_MMAP = 7,
|
DISABLE_TYPE_MMAP = 7,
|
||||||
DISABLE_TYPE_CREATURE_SPAWN = 8,
|
DISABLE_TYPE_CREATURE_SPAWN = 8,
|
||||||
DISABLE_TYPE_GAMEOBJECT_SPAWN = 9,
|
DISABLE_TYPE_GAMEOBJECT_SPAWN = 9,
|
||||||
MAX_DISABLE_TYPES = 10
|
DISABLE_TYPE_ITEM_DROP = 10,
|
||||||
|
MAX_DISABLE_TYPES = 11
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SpellDisableTypes
|
enum SpellDisableTypes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user