aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Spells
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2011-03-04 21:18:38 +0100
committerShauren <shauren.trinity@gmail.com>2011-03-04 21:19:43 +0100
commit7120f1eff80c9f057a40831a10d8975c0a8a7439 (patch)
treee77c66ff87570d1484b2cf81be6920ad5cd5e7fd /src/server/scripts/Spells
parenta9582964d3ca140a1ec1d5894b79e72ed15a65a6 (diff)
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)
Diffstat (limited to 'src/server/scripts/Spells')
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp34
-rw-r--r--src/server/scripts/Spells/spell_item.cpp34
2 files changed, 68 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 5befce55949..63df688b92f 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -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();
}
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp
index 43589c68180..4cffbdf4437 100644
--- a/src/server/scripts/Spells/spell_item.cpp
+++ b/src/server/scripts/Spells/spell_item.cpp
@@ -22,6 +22,7 @@
*/
#include "ScriptPCH.h"
+#include "SkillDiscovery.h"
// Generic script for handling item dummy effects which trigger another spell.
class spell_item_trigger_spell : public SpellScriptLoader
@@ -849,6 +850,38 @@ class spell_item_create_heart_candy : public SpellScriptLoader
}
};
+class spell_item_book_of_glyph_mastery : public SpellScriptLoader
+{
+ public:
+ spell_item_book_of_glyph_mastery() : SpellScriptLoader("spell_item_book_of_glyph_mastery") {}
+
+ class spell_item_book_of_glyph_mastery_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_item_book_of_glyph_mastery_SpellScript);
+
+ SpellCastResult CheckRequirement()
+ {
+ if (GetCaster()->GetTypeId() == TYPEID_PLAYER && HasDiscoveredAllSpells(GetSpellInfo()->Id, GetCaster()->ToPlayer()))
+ {
+ SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_LEARNED_EVERYTHING);
+ return SPELL_FAILED_CUSTOM_ERROR;
+ }
+
+ return SPELL_CAST_OK;
+ }
+
+ void Register()
+ {
+ OnCheckCast += SpellCheckCastFn(spell_item_book_of_glyph_mastery_SpellScript::CheckRequirement);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_item_book_of_glyph_mastery_SpellScript();
+ }
+};
+
void AddSC_item_spell_scripts()
{
// 23074 Arcanite Dragonling
@@ -874,4 +907,5 @@ void AddSC_item_spell_scripts()
new spell_item_red_rider_air_rifle();
new spell_item_create_heart_candy();
+ new spell_item_book_of_glyph_mastery();
}