* Merge.
--HG-- branch : trunk
This commit is contained in:
@@ -24,98 +24,108 @@
|
|||||||
|
|
||||||
#include "ScriptPCH.h"
|
#include "ScriptPCH.h"
|
||||||
|
|
||||||
class spell_ex_49375SpellScript : public SpellScript
|
class spell_ex_49375 : public SpellHandlerScript
|
||||||
{
|
{
|
||||||
std::string localVariable;
|
public:
|
||||||
char * localVariable2;
|
spell_ex_49375() : SpellHandlerScript("spell_ex_49375") { }
|
||||||
|
|
||||||
// effect handler hook - effIndex - effIndex of handled effect of a spell
|
class spell_ex_49375SpellScript : public SpellScript
|
||||||
void HandleDummy(SpellEffIndex effIndex)
|
{
|
||||||
{
|
std::string localVariable;
|
||||||
// we're handling SPELL_EFFECT_DUMMY in effIndex 0 here
|
char * localVariable2;
|
||||||
sLog.outError("WE ARE HANDLING DUMMY!");
|
|
||||||
sLog.outError(localVariable.c_str());
|
// effect handler hook - effIndex - effIndex of handled effect of a spell
|
||||||
// make caster cast a spell on a unit target of effect
|
void HandleDummy(SpellEffIndex effIndex)
|
||||||
if (Unit * target = GetHitUnit())
|
{
|
||||||
GetCaster()->CastSpell(target, 70522, true);
|
// we're handling SPELL_EFFECT_DUMMY in effIndex 0 here
|
||||||
};
|
sLog.outError("WE ARE HANDLING DUMMY!");
|
||||||
void Register()
|
sLog.outError(localVariable.c_str());
|
||||||
{
|
// make caster cast a spell on a unit target of effect
|
||||||
// we're registering our function here
|
if (Unit * target = GetHitUnit())
|
||||||
// function HandleDummy will be called when unit is hit by spell, just before default effect 0 handler
|
GetCaster()->CastSpell(target, 70522, true);
|
||||||
EffectHandlers += EffectHandlerFn(spell_ex_49375SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
};
|
||||||
// this will prompt an error on startup because effect 0 of spell 49375 is set to SPELL_EFFECT_DUMMY, not SPELL_EFFECT_APPLY_AURA
|
|
||||||
//EffectHandlers += EffectHandlerFn(spell_gen_49375SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
|
void Register()
|
||||||
// this will make HandleDummy function to be called on first != 0 effect of spell 49375
|
{
|
||||||
//EffectHandlers += EffectHandlerFn(spell_gen_49375SpellScript::HandleDummy, EFFECT_FIRST_FOUND, SPELL_EFFECT_ANY);
|
// we're registering our function here
|
||||||
// this will make HandleDummy function to be called on all != 0 effect of spell 49375
|
// function HandleDummy will be called when unit is hit by spell, just before default effect 0 handler
|
||||||
//EffectHandlers += EffectHandlerFn(spell_gen_49375SpellScript::HandleDummy, EFFECT_ALL, SPELL_EFFECT_ANY);
|
EffectHandlers += EffectHandlerFn(spell_ex_49375SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||||
};
|
// this will prompt an error on startup because effect 0 of spell 49375 is set to SPELL_EFFECT_DUMMY, not SPELL_EFFECT_APPLY_AURA
|
||||||
// function called on server startup
|
//EffectHandlers += EffectHandlerFn(spell_gen_49375SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
|
||||||
// checks if script has data required for it to work
|
// this will make HandleDummy function to be called on first != 0 effect of spell 49375
|
||||||
bool Validate(SpellEntry const * spellEntry)
|
//EffectHandlers += EffectHandlerFn(spell_gen_49375SpellScript::HandleDummy, EFFECT_FIRST_FOUND, SPELL_EFFECT_ANY);
|
||||||
{
|
// this will make HandleDummy function to be called on all != 0 effect of spell 49375
|
||||||
// check if spellid 1 exists in dbc
|
//EffectHandlers += EffectHandlerFn(spell_gen_49375SpellScript::HandleDummy, EFFECT_ALL, SPELL_EFFECT_ANY);
|
||||||
if (!sSpellStore.LookupEntry(70522))
|
};
|
||||||
return false;
|
|
||||||
return true;
|
// function called on server startup
|
||||||
};
|
// checks if script has data required for it to work
|
||||||
// function called just after script is added to spell
|
bool Validate(SpellEntry const * spellEntry)
|
||||||
// we initialize local variables if needed
|
{
|
||||||
bool Load()
|
// check if spellid 1 exists in dbc
|
||||||
{
|
if (!sSpellStore.LookupEntry(70522))
|
||||||
localVariable = "WE'RE USING LOCAL VARIABLE";
|
return false;
|
||||||
localVariable2 = new char;
|
return true;
|
||||||
return true;
|
};
|
||||||
// script will be immediately removed from the spell
|
|
||||||
// for example - we don't want this script to be executed on a creature
|
// function called just after script is added to spell
|
||||||
// if (GetCaster()->GetTypeID() != TYPEID_PLAYER)
|
// we initialize local variables if needed
|
||||||
// return false;
|
bool Load()
|
||||||
}
|
{
|
||||||
// function called just before script delete
|
localVariable = "WE'RE USING LOCAL VARIABLE";
|
||||||
// we free allocated memory
|
localVariable2 = new char;
|
||||||
void Unload()
|
return true;
|
||||||
{
|
// script will be immediately removed from the spell
|
||||||
delete localVariable2;
|
// for example - we don't want this script to be executed on a creature
|
||||||
}
|
// if (GetCaster()->GetTypeID() != TYPEID_PLAYER)
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// function called just before script delete
|
||||||
|
// we free allocated memory
|
||||||
|
void Unload()
|
||||||
|
{
|
||||||
|
delete localVariable2;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// function which creates SpellScript
|
||||||
|
SpellScript *GetSpellScript() const
|
||||||
|
{
|
||||||
|
return new spell_ex_49375SpellScript();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// function which creates SpellScript
|
|
||||||
SpellScript * GetSpellScript_spell_ex_49375()
|
|
||||||
{
|
|
||||||
return new spell_ex_49375SpellScript();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* empty script for copypasting
|
/* empty script for copypasting
|
||||||
class spell_ex_SpellScript : public SpellScript
|
class spell_ex : public SpellHandlerScript
|
||||||
{
|
{
|
||||||
void Function(SpellEffIndex effIndex){}
|
public:
|
||||||
void Register()
|
spell_ex() : SpellHandlerScript("spell_ex") { }
|
||||||
{
|
|
||||||
//EffectHandlers += EffectHandlerFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_EFFECT_ANY);
|
|
||||||
}
|
|
||||||
|
|
||||||
//bool Load(){return true;}
|
class spell_ex_SpellScript : public SpellScript
|
||||||
//void Unload(){}
|
{
|
||||||
//bool Validate(SpellEntry const * spellEntry){return true;}
|
void Function(SpellEffIndex effIndex){}
|
||||||
|
void Register()
|
||||||
|
{
|
||||||
|
//EffectHandlers += EffectHandlerFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_EFFECT_ANY);
|
||||||
|
}
|
||||||
|
|
||||||
|
//bool Load(){return true;}
|
||||||
|
//void Unload(){}
|
||||||
|
//bool Validate(SpellEntry const * spellEntry){return true;}
|
||||||
|
};
|
||||||
|
|
||||||
|
SpellScript *GetSpellScript() const
|
||||||
|
{
|
||||||
|
return new spell_ex_SpellScript();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
SpellScript * GetSpellScript_spell_ex_()
|
|
||||||
{
|
|
||||||
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();
|
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user