Core:/SmartScript: Added log for item has credit spell blabla

This commit is contained in:
Vincent-Michael
2014-09-21 17:45:31 +02:00
parent d33c2952ad
commit 1d8feb271c
2 changed files with 27 additions and 2 deletions

View File

@@ -883,10 +883,9 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
CacheSpellContainerBounds sBounds = GetSummonGameObjectSpellContainerBounds(e.action.summonGO.entry);
for (CacheSpellContainer::const_iterator itr = sBounds.first; itr != sBounds.second; ++itr)
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u gameobject summon: There is a summon spell for gameobject entry %u (SpellId: %u, effect: %u)",
e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonGO.entry, itr->second.first, itr->second.second);
e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonGO.entry, itr->second.first, itr->second.second);
break;
}
case SMART_ACTION_ADD_ITEM:
case SMART_ACTION_REMOVE_ITEM:
if (!IsItemValid(e, e.action.item.entry))
return false;
@@ -894,6 +893,20 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
if (!NotNULL(e, e.action.item.count))
return false;
break;
case SMART_ACTION_ADD_ITEM:
{
if (!IsItemValid(e, e.action.item.entry))
return false;
if (!NotNULL(e, e.action.item.count))
return false;
CacheSpellContainerBounds sBounds = GetCreditItemSpellContainerBounds(e.action.item.entry);
for (CacheSpellContainer::const_iterator itr = sBounds.first; itr != sBounds.second; ++itr)
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u Create Item: There is a create item spell for item %u (SpellId: %u effect: %u)",
e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.item.entry, itr->second.first, itr->second.second);
break;
}
case SMART_ACTION_TELEPORT:
if (!sMapStore.LookupEntry(e.action.teleport.mapID))
{
@@ -1135,6 +1148,9 @@ void SmartAIMgr::LoadHelperStores()
else if (spellInfo->Effects[j].IsEffect(SPELL_EFFECT_KILL_CREDIT) || spellInfo->Effects[j].IsEffect(SPELL_EFFECT_KILL_CREDIT2))
KillCreditSpellStore.insert(std::make_pair(uint32(spellInfo->Effects[j].MiscValue), std::make_pair(i, SpellEffIndex(j))));
else if (spellInfo->Effects[j].IsEffect(SPELL_EFFECT_CREATE_ITEM))
CreateItemSpellStore.insert(std::make_pair(uint32(spellInfo->Effects[j].ItemType), std::make_pair(i, SpellEffIndex(j))));
}
}
@@ -1146,6 +1162,7 @@ void SmartAIMgr::UnLoadHelperStores()
SummonCreatureSpellStore.clear();
SummonGameObjectSpellStore.clear();
KillCreditSpellStore.clear();
CreateItemSpellStore.clear();
}
CacheSpellContainerBounds SmartAIMgr::GetSummonCreatureSpellContainerBounds(uint32 creatureEntry) const
@@ -1162,3 +1179,9 @@ CacheSpellContainerBounds SmartAIMgr::GetKillCreditSpellContainerBounds(uint32 k
{
return KillCreditSpellStore.equal_range(killCredit);
}
CacheSpellContainerBounds SmartAIMgr::GetCreditItemSpellContainerBounds(uint32 itemId) const
{
return CreateItemSpellStore.equal_range(itemId);
}

View File

@@ -1615,10 +1615,12 @@ class SmartAIMgr
CacheSpellContainerBounds GetSummonCreatureSpellContainerBounds(uint32 creatureEntry) const;
CacheSpellContainerBounds GetSummonGameObjectSpellContainerBounds(uint32 gameObjectEntry) const;
CacheSpellContainerBounds GetKillCreditSpellContainerBounds(uint32 killCredit) const;
CacheSpellContainerBounds GetCreditItemSpellContainerBounds(uint32 itemId) const;
CacheSpellContainer SummonCreatureSpellStore;
CacheSpellContainer SummonGameObjectSpellStore;
CacheSpellContainer KillCreditSpellStore;
CacheSpellContainer CreateItemSpellStore;
};
#define sSmartScriptMgr SmartAIMgr::instance()