*Add AuraScript class for scripting aura objects - scripts are registered same way as SpellScripts, bound to SpellScriptNames table. For more details see example_spell.cpp and SpellScript.h

*Rename SpellHandlerScript to SpellScriptLoader, EffectHandlerFn to SpellEffectFn, HitHandlerFn to SpellHitFn, SpellScript::EffectHandlers to SpellScript::OnEffect, these changes were neccesary to prevent namespace collisions, happily you can solve these by simple find and replace
*Make spells 66244 and 5581 example scripts.

--HG--
branch : trunk
This commit is contained in:
QAston
2010-08-24 00:10:49 +02:00
parent e581feb551
commit 07a3a1254b
28 changed files with 1075 additions and 291 deletions
+26 -6
View File
@@ -5103,18 +5103,38 @@ void ObjectMgr::ValidateSpellScripts()
for (SpellScriptsMap::iterator itr = mSpellScripts.begin(); itr != mSpellScripts.end();)
{
SpellEntry const * spellEntry = sSpellStore.LookupEntry(itr->first);
std::vector<std::pair<SpellScript *, SpellScriptsMap::iterator> > spellScripts;
sScriptMgr.CreateSpellScripts(itr->first, spellScripts);
std::vector<std::pair<SpellScriptLoader *, SpellScriptsMap::iterator> > SpellScriptLoaders;
sScriptMgr.CreateSpellScriptLoaders(itr->first, SpellScriptLoaders);
SpellScriptsMap::iterator bitr;
itr = mSpellScripts.upper_bound(itr->first);
for (std::vector<std::pair<SpellScript *, SpellScriptsMap::iterator> >::iterator sitr = spellScripts.begin(); sitr != spellScripts.end(); ++sitr)
for (std::vector<std::pair<SpellScriptLoader *, SpellScriptsMap::iterator> >::iterator sitr = SpellScriptLoaders.begin(); sitr != SpellScriptLoaders.end(); ++sitr)
{
bar.step();
sitr->first->Register();
if (!sitr->first->_Validate(spellEntry, sObjectMgr.GetScriptName(sitr->second->second)))
SpellScript * spellScript = sitr->first->GetSpellScript();
AuraScript * auraScript = sitr->first->GetAuraScript();
bool valid = true;
if (!spellScript && !auraScript)
{
sLog.outError("TSCR: Functions GetSpellScript() and GetAuraScript() of script `%s` do not return objects - script skipped", GetScriptName(sitr->second->second));
valid = false;
}
if (spellScript)
{
spellScript->Register();
if (!spellScript->_Validate(spellEntry, sObjectMgr.GetScriptName(sitr->second->second)))
valid = false;
delete spellScript;
}
if (auraScript)
{
auraScript->Register();
if (!auraScript->_Validate(spellEntry, sObjectMgr.GetScriptName(sitr->second->second)))
valid = false;
delete auraScript;
}
if (!valid)
mSpellScripts.erase(sitr->second);
delete sitr->first;
}
}