Core/Spells:
* Implemented on CheckCast spell script hook * Added possibility to send SPELL_FAILED_CUSTOM_ERROR and added enum with all possible options for it Scripts/Spells: * Added example script for CheckCast hook with SPELL_FAILED_CUSTOM_ERROR (profession research and Book of Glyph Mastery)
This commit is contained in:
1 parent
a9582964d3
commit
7120f1eff8
12 files changed
+262
-8
No files matched your search
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "SkillDiscovery.h"
|
||||
|
||||
class spell_gen_absorb0_hitlimit1 : public SpellScriptLoader
|
||||
{
|
||||
@@ -766,6 +767,38 @@ class spell_gen_dungeon_credit : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
class spell_gen_profession_research : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_profession_research() : SpellScriptLoader("spell_gen_profession_research") {}
|
||||
|
||||
class spell_gen_profession_research_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_profession_research_SpellScript);
|
||||
|
||||
SpellCastResult CheckRequirement()
|
||||
{
|
||||
if (GetCaster()->GetTypeId() == TYPEID_PLAYER && HasDiscoveredAllSpells(GetSpellInfo()->Id, GetCaster()->ToPlayer()))
|
||||
{
|
||||
SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_NOTHING_TO_DISCOVER);
|
||||
return SPELL_FAILED_CUSTOM_ERROR;
|
||||
}
|
||||
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnCheckCast += SpellCheckCastFn(spell_gen_profession_research_SpellScript::CheckRequirement);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_gen_profession_research_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_generic_spell_scripts()
|
||||
{
|
||||
new spell_gen_absorb0_hitlimit1();
|
||||
@@ -785,4 +818,5 @@ void AddSC_generic_spell_scripts()
|
||||
new spell_gen_parachute_ic();
|
||||
new spell_gen_gunship_portal();
|
||||
new spell_gen_dungeon_credit();
|
||||
new spell_gen_profession_research();
|
||||
}
|
||||
Reference in new issue
Block a user