aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/SmartScripts
diff options
context:
space:
mode:
authorVincent-Michael <Vincent_Michael@gmx.de>2014-09-22 06:41:14 +0200
committerVincent-Michael <Vincent_Michael@gmx.de>2014-09-22 06:41:14 +0200
commit15520e38d015b87e39a6d6be7e532a4ba6872798 (patch)
tree020d1741bf279f97c49afa091e5524c47b834bbe /src/server/game/AI/SmartScripts
parent1bd700284f80e64d385eba9399923c83c1d5596f (diff)
parentec59c3ab0377f4077a2d63e7b242f2a3693dd2d4 (diff)
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts: sql/base/dev/world_database.sql src/server/game/Entities/Player/Player.h
Diffstat (limited to 'src/server/game/AI/SmartScripts')
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp27
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h2
2 files changed, 27 insertions, 2 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index db61730326c..86119785cbd 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -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))
{
@@ -1172,6 +1185,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))));
}
}
@@ -1183,6 +1199,7 @@ void SmartAIMgr::UnLoadHelperStores()
SummonCreatureSpellStore.clear();
SummonGameObjectSpellStore.clear();
KillCreditSpellStore.clear();
+ CreateItemSpellStore.clear();
}
CacheSpellContainerBounds SmartAIMgr::GetSummonCreatureSpellContainerBounds(uint32 creatureEntry) const
@@ -1199,3 +1216,9 @@ CacheSpellContainerBounds SmartAIMgr::GetKillCreditSpellContainerBounds(uint32 k
{
return KillCreditSpellStore.equal_range(killCredit);
}
+
+CacheSpellContainerBounds SmartAIMgr::GetCreditItemSpellContainerBounds(uint32 itemId) const
+{
+ return CreateItemSpellStore.equal_range(itemId);
+}
+
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index 4404b224db1..51105d5b433 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -1623,10 +1623,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()