*Add base scripting interfce for spells - thanks to Brian for help in making it compile with GCC.
*Add hook for handling spell effects in new scripting system. --HG-- branch : trunk
This commit is contained in:
1 parent
687cd83bdd
commit
2352fc7cdf
30 files changed
+1253
-14
No files matched your search
@@ -513,6 +513,20 @@ void AddSC_terokkar_forest();
|
||||
void AddSC_zangarmarsh();
|
||||
void AddSC_onevents();
|
||||
|
||||
// spells
|
||||
void AddSC_deathknight_spell_scripts();
|
||||
void AddSC_druid_spell_scripts();
|
||||
void AddSC_generic_spell_scripts();
|
||||
void AddSC_hunter_spell_scripts();
|
||||
void AddSC_mage_spell_scripts();
|
||||
void AddSC_paladin_spell_scripts();
|
||||
void AddSC_priest_spell_scripts();
|
||||
void AddSC_rogue_spell_scripts();
|
||||
void AddSC_shaman_spell_scripts();
|
||||
void AddSC_warlock_spell_scripts();
|
||||
void AddSC_warrior_spell_scripts();
|
||||
void AddSC_example_spell_scripts();
|
||||
|
||||
#endif
|
||||
|
||||
void AddScripts()
|
||||
@@ -1015,5 +1029,18 @@ void AddScripts()
|
||||
AddSC_zangarmarsh();
|
||||
AddSC_onevents();
|
||||
|
||||
// spells
|
||||
AddSC_deathknight_spell_scripts();
|
||||
AddSC_druid_spell_scripts();
|
||||
AddSC_generic_spell_scripts();
|
||||
AddSC_hunter_spell_scripts();
|
||||
AddSC_mage_spell_scripts();
|
||||
AddSC_paladin_spell_scripts();
|
||||
AddSC_priest_spell_scripts();
|
||||
AddSC_rogue_spell_scripts();
|
||||
AddSC_shaman_spell_scripts();
|
||||
AddSC_warlock_spell_scripts();
|
||||
AddSC_warrior_spell_scripts();
|
||||
AddSC_example_spell_scripts();
|
||||
#endif
|
||||
}
|
||||
@@ -544,3 +544,25 @@ InstanceData* ScriptMgr::CreateInstanceData(Map *map)
|
||||
return tmpscript->GetInstanceData(map);
|
||||
}
|
||||
|
||||
void ScriptMgr::CreateSpellScripts(uint32 spell_id, std::list<SpellScript *> & script_vector)
|
||||
{
|
||||
SpellScriptsBounds bounds = objmgr.GetSpellScriptsBounds(spell_id);
|
||||
for (SpellScriptsMap::iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
Script *tmpscript = m_scripts[itr->second];
|
||||
if (!tmpscript || !tmpscript->GetSpellScript) continue;
|
||||
script_vector.push_back(tmpscript->GetSpellScript());
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptMgr::CreateSpellScripts(uint32 spell_id, std::vector<std::pair<SpellScript *, SpellScriptsMap::iterator> > & script_vector)
|
||||
{
|
||||
SpellScriptsBounds bounds = objmgr.GetSpellScriptsBounds(spell_id);
|
||||
script_vector.reserve(std::distance(bounds.first, bounds.second));
|
||||
for (SpellScriptsMap::iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
Script *tmpscript = m_scripts[itr->second];
|
||||
if (!tmpscript || !tmpscript->GetSpellScript) continue;
|
||||
script_vector.push_back(std::make_pair(tmpscript->GetSpellScript(), itr));
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ class Player;
|
||||
class Creature;
|
||||
class CreatureAI;
|
||||
class InstanceData;
|
||||
class SpellScript;
|
||||
class Quest;
|
||||
class Item;
|
||||
class GameObject;
|
||||
@@ -25,6 +26,7 @@ class Map;
|
||||
class Unit;
|
||||
class WorldObject;
|
||||
struct ItemPrototype;
|
||||
class Spell;
|
||||
|
||||
#define MAX_SCRIPTS 5000 //72 bytes each (approx 351kb)
|
||||
#define VISIBLE_RANGE (166.0f) //MAX visible range (size of grid)
|
||||
@@ -42,7 +44,7 @@ struct Script
|
||||
pChooseReward(NULL), pGODestroyed(NULL), pItemHello(NULL), pGOHello(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL),
|
||||
pGOQuestAccept(NULL), pGOChooseReward(NULL),pItemUse(NULL), pItemExpire(NULL),
|
||||
pEffectDummyCreature(NULL), pEffectDummyGameObj(NULL), pEffectDummyItem(NULL),
|
||||
GetAI(NULL), GetInstanceData(NULL)
|
||||
GetAI(NULL), GetInstanceData(NULL), GetSpellScript(NULL)
|
||||
{}
|
||||
|
||||
std::string Name;
|
||||
@@ -89,6 +91,9 @@ struct Script
|
||||
CreatureAI* (*GetAI)(Creature*);
|
||||
InstanceData* (*GetInstanceData)(Map*);
|
||||
|
||||
SpellScript*(*GetSpellScript)();
|
||||
//AuraScript*(*GetAuraScript)();
|
||||
|
||||
void RegisterSelf();
|
||||
};
|
||||
|
||||
@@ -143,6 +148,8 @@ class ScriptMgr
|
||||
bool EffectDummyGameObj(Unit *caster, uint32 spellId, uint32 effIndex, GameObject *gameObjTarget);
|
||||
bool EffectDummyItem(Unit *caster, uint32 spellId, uint32 effIndex, Item *itemTarget);
|
||||
InstanceData* CreateInstanceData(Map *map);
|
||||
void CreateSpellScripts(uint32 spell_id, std::list<SpellScript *> & script_vector);
|
||||
void CreateSpellScripts(uint32 spell_id, std::vector<std::pair<SpellScript *, SpellScriptsMap::iterator> > & script_vector);
|
||||
};
|
||||
|
||||
//Config file accessors
|
||||
|
||||
Reference in new issue
Block a user