--HG--
branch : trunk
This commit is contained in:
XTZGZoReX
2010-08-06 20:43:47 +02:00
+30 -20
View File
@@ -24,8 +24,13 @@
#include "ScriptPCH.h" #include "ScriptPCH.h"
class spell_ex_49375SpellScript : public SpellScript class spell_ex_49375 : public SpellHandlerScript
{ {
public:
spell_ex_49375() : SpellHandlerScript("spell_ex_49375") { }
class spell_ex_49375SpellScript : public SpellScript
{
std::string localVariable; std::string localVariable;
char * localVariable2; char * localVariable2;
@@ -39,6 +44,7 @@ class spell_ex_49375SpellScript : public SpellScript
if (Unit * target = GetHitUnit()) if (Unit * target = GetHitUnit())
GetCaster()->CastSpell(target, 70522, true); GetCaster()->CastSpell(target, 70522, true);
}; };
void Register() void Register()
{ {
// we're registering our function here // we're registering our function here
@@ -51,6 +57,7 @@ class spell_ex_49375SpellScript : public SpellScript
// this will make HandleDummy function to be called on all != 0 effect of spell 49375 // this will make HandleDummy function to be called on all != 0 effect of spell 49375
//EffectHandlers += EffectHandlerFn(spell_gen_49375SpellScript::HandleDummy, EFFECT_ALL, SPELL_EFFECT_ANY); //EffectHandlers += EffectHandlerFn(spell_gen_49375SpellScript::HandleDummy, EFFECT_ALL, SPELL_EFFECT_ANY);
}; };
// function called on server startup // function called on server startup
// checks if script has data required for it to work // checks if script has data required for it to work
bool Validate(SpellEntry const * spellEntry) bool Validate(SpellEntry const * spellEntry)
@@ -60,6 +67,7 @@ class spell_ex_49375SpellScript : public SpellScript
return false; return false;
return true; return true;
}; };
// function called just after script is added to spell // function called just after script is added to spell
// we initialize local variables if needed // we initialize local variables if needed
bool Load() bool Load()
@@ -72,23 +80,29 @@ class spell_ex_49375SpellScript : public SpellScript
// if (GetCaster()->GetTypeID() != TYPEID_PLAYER) // if (GetCaster()->GetTypeID() != TYPEID_PLAYER)
// return false; // return false;
} }
// function called just before script delete // function called just before script delete
// we free allocated memory // we free allocated memory
void Unload() void Unload()
{ {
delete localVariable2; delete localVariable2;
} }
}; };
// function which creates SpellScript // function which creates SpellScript
SpellScript * GetSpellScript_spell_ex_49375() SpellScript *GetSpellScript() const
{ {
return new spell_ex_49375SpellScript(); return new spell_ex_49375SpellScript();
} }
};
/* empty script for copypasting /* empty script for copypasting
class spell_ex_SpellScript : public SpellScript class spell_ex : public SpellHandlerScript
{ {
public:
spell_ex() : SpellHandlerScript("spell_ex") { }
class spell_ex_SpellScript : public SpellScript
{
void Function(SpellEffIndex effIndex){} void Function(SpellEffIndex effIndex){}
void Register() void Register()
{ {
@@ -98,24 +112,20 @@ class spell_ex_SpellScript : public SpellScript
//bool Load(){return true;} //bool Load(){return true;}
//void Unload(){} //void Unload(){}
//bool Validate(SpellEntry const * spellEntry){return true;} //bool Validate(SpellEntry const * spellEntry){return true;}
}; };
SpellScript * GetSpellScript_spell_ex_()
{ SpellScript *GetSpellScript() const
{
return new spell_ex_SpellScript(); return new spell_ex_SpellScript();
} }
};
*/ */
// this function has to be added to function set in ScriptLoader.cpp // this function has to be added to function set in ScriptLoader.cpp
void AddSC_example_spell_scripts() void AddSC_example_spell_scripts()
{ {
/* Commented out to prevent loading errors /* Commented out to prevent loading errors
Script *newscript; new spell_ex_49375;
newscript = new Script;
// name to be put in `spell_script_names`
newscript->Name = "spell_ex_49375";
// assign create function to the script
newscript->GetSpellScript = &GetSpellScript_spell_ex_49375;
newscript->RegisterSelf();
*/ */
} }