diff options
author | DevRival <dev.rival@mail.ru> | 2015-11-15 02:00:18 +0100 |
---|---|---|
committer | tkrokli <tkrokli@hotmail.com> | 2015-11-17 17:24:25 +0100 |
commit | 3fdbcf18ae2eeb7a965a9b2dc4b7e22796aaceae (patch) | |
tree | 48af051a59eba7ff8fbe79b195deebb156c166ee | |
parent | 071ede8a93ab239e06c2ab338bc918791cb14b06 (diff) |
Scripts/Spells: Hallow's End item Hallowed Wand
Hallowed Wand items should cast a transformation on party members.
by @DevRival, closes #3574
Before this patch, the following spells do not have any effect at all:
- 24717, Pirate Costume
- 24718, Ninja Costume
- 24719, Leper Gnome Costume
- 24720, Random Costume
- 24737, Ghost Costume
Details from testing on the current 3.3.5 branch (commit ecbbcc8):
- 24724 (Skeleton Costume) seems to work as intended
- 24733 (Bat Costume) only lasts 10 seconds instead of 60 minutes
- 24741 (Wisp Costume) also seems to work as intended
All the spells listed above are included in this PR.
-rw-r--r-- | sql/updates/world/2015_11_15_3574_world.sql | 12 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_holiday.cpp | 81 |
2 files changed, 93 insertions, 0 deletions
diff --git a/sql/updates/world/2015_11_15_3574_world.sql b/sql/updates/world/2015_11_15_3574_world.sql new file mode 100644 index 00000000000..456a36fe882 --- /dev/null +++ b/sql/updates/world/2015_11_15_3574_world.sql @@ -0,0 +1,12 @@ +-- +-- Hallowed wand spell script names +DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_hallow_end_wand'; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(24717, 'spell_hallow_end_wand'), -- Pirate Costume +(24718, 'spell_hallow_end_wand'), -- Ninja Costume +(24719, 'spell_hallow_end_wand'), -- Leper Gnome Costume +(24720, 'spell_hallow_end_wand'), -- Random Costume +(24724, 'spell_hallow_end_wand'), -- Skeleton Costume +(24733, 'spell_hallow_end_wand'), -- Bat Costume +(24737, 'spell_hallow_end_wand'), -- Ghost Costume +(24741, 'spell_hallow_end_wand') -- Wisp Costume; diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp index a1b218010aa..e29f87a5ff9 100644 --- a/src/server/scripts/Spells/spell_holiday.cpp +++ b/src/server/scripts/Spells/spell_holiday.cpp @@ -277,6 +277,86 @@ class spell_hallow_end_tricky_treat : public SpellScriptLoader } }; +// Hallowed wands +enum HallowendData +{ + //wand spells + SPELL_HALLOWED_WAND_PIRATE = 24717, + SPELL_HALLOWED_WAND_NINJA = 24718, + SPELL_HALLOWED_WAND_LEPER_GNOME = 24719, + SPELL_HALLOWED_WAND_RANDOM = 24720, + SPELL_HALLOWED_WAND_SKELETON = 24724, + SPELL_HALLOWED_WAND_WISP = 24733, + SPELL_HALLOWED_WAND_GHOST = 24737, + SPELL_HALLOWED_WAND_BAT = 24741 +}; + +class spell_hallow_end_wand : public SpellScriptLoader +{ +public: + spell_hallow_end_wand() : SpellScriptLoader("spell_hallow_end_wand") {} + + class spell_hallow_end_wand_SpellScript : public SpellScript + { + PrepareSpellScript(spell_hallow_end_wand_SpellScript); + + bool Validate(SpellInfo const* /*spellEntry*/) override + { + if (!sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_MALE) || + !sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_FEMALE) || + !sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_MALE) || + !sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_FEMALE) || + !sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_MALE) || + !sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_FEMALE) || + !sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_MALE) || + !sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_FEMALE)) + return false; + return true; + } + + void HandleScriptEffect() + { + Unit* caster = GetCaster(); + Unit* target = GetHitUnit(); + + uint32 spellId = 0; + uint8 gender = target->getGender(); + + switch (GetSpellInfo()->Id) + { + case SPELL_HALLOWED_WAND_LEPER_GNOME: + spellId = gender ? SPELL_LEPER_GNOME_COSTUME_FEMALE : SPELL_LEPER_GNOME_COSTUME_MALE; + break; + case SPELL_HALLOWED_WAND_PIRATE: + spellId = gender ? SPELL_PIRATE_COSTUME_FEMALE : SPELL_PIRATE_COSTUME_MALE; + break; + case SPELL_HALLOWED_WAND_GHOST: + spellId = gender ? SPELL_GHOST_COSTUME_FEMALE : SPELL_GHOST_COSTUME_MALE; + break; + case SPELL_HALLOWED_WAND_NINJA: + spellId = gender ? SPELL_NINJA_COSTUME_FEMALE : SPELL_NINJA_COSTUME_MALE; + break; + case SPELL_HALLOWED_WAND_RANDOM: + spellId = RAND(SPELL_HALLOWED_WAND_PIRATE, SPELL_HALLOWED_WAND_NINJA, SPELL_HALLOWED_WAND_LEPER_GNOME, SPELL_HALLOWED_WAND_SKELETON, SPELL_HALLOWED_WAND_WISP, SPELL_HALLOWED_WAND_GHOST, SPELL_HALLOWED_WAND_BAT); + break; + default: + return; + } + caster->CastSpell(target, spellId, true); + } + + void Register() override + { + AfterHit += SpellHitFn(spell_hallow_end_wand_SpellScript::HandleScriptEffect); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_hallow_end_wand_SpellScript(); + } +}; + enum PilgrimsBountyBuffFood { // Pilgrims Bounty Buff Food @@ -886,6 +966,7 @@ void AddSC_holiday_spell_scripts() new spell_hallow_end_trick(); new spell_hallow_end_trick_or_treat(); new spell_hallow_end_tricky_treat(); + new spell_hallow_end_wand(); // Pilgrims Bounty new spell_pilgrims_bounty_buff_food("spell_gen_slow_roasted_turkey", SPELL_WELL_FED_AP_TRIGGER); new spell_pilgrims_bounty_buff_food("spell_gen_cranberry_chutney", SPELL_WELL_FED_ZM_TRIGGER); |