diff options
| author | azazel <none@none> | 2010-08-18 00:20:23 +0600 |
|---|---|---|
| committer | azazel <none@none> | 2010-08-18 00:20:23 +0600 |
| commit | 66fcd52106bb14961498afb9d3f0344e21d0890b (patch) | |
| tree | 91280ac7fbb94b056b62247843d73ff2a84c51b9 /src/server/scripts/Spells | |
| parent | 0284ed4cfeefe7f84488975beb908bb597e610c4 (diff) | |
Add more methods to SpellScript.
Spells cleanup: move spells from the core to scripts.
* Shaman spells: 39610 Mana Tide Totem, 1535 Fire Nova (and ranks)
* Death Knight spells: 55090 Scourge Strike (and ranks), 49158 Corpse Explosion (and ranks), 50524 Runic Power Feed
* Druid spells: 54846 Glyph of Starfire
* Warlock spells: 6201 Create Healthstone (and ranks), 47422 Everlasting Affliction, 47193 Demonic Empowerment, 63521 Guarded by The Light
* Hunter spells: 37506 Scatter Shot, 53412 Invigoration, 53209 Chimera Shot
* Quest spells: 45449 Arcane Prisoner Rescue (quest 11587), 46023 The Ultrasonic Screwdriver (quest 11730). Closes issue #3068
Clean old code for hunter's Heart of the Phoenix, move script effect of hunter's Master's Call to corresponding script.
Move DK's Hungering Cold to spell_scripts table (needs DB support)
--HG--
branch : trunk
Diffstat (limited to 'src/server/scripts/Spells')
| -rw-r--r-- | src/server/scripts/Spells/spell_dk.cpp | 135 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_druid.cpp | 61 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_hunter.cpp | 468 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_quest.cpp | 163 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_shaman.cpp | 109 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_warlock.cpp | 216 |
6 files changed, 997 insertions, 155 deletions
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 026dd45dd74..0ad65ac3e2a 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -22,8 +22,141 @@ */ #include "ScriptPCH.h" +#include "Spell.h" -void AddSC_deathknight_spell_scripts() +enum DeathKnightSpells +{ + DK_SPELL_SUMMON_GARGOYLE = 50514, + DK_SPELL_CORPSE_EXPLOSION_TRIGGERED = 43999, + DISPLAY_GHOUL_CORPSE = 25537, + DK_SPELL_SCOURGE_STRIKE_TRIGGERED = 70890, +}; + +// 49158 Corpse Explosion (51325, 51326, 51327, 51328) +class spell_dk_corpse_explosion : public SpellHandlerScript { +public: + spell_dk_corpse_explosion() : SpellHandlerScript("spell_dk_corpse_explosion") { } + + class spell_dk_corpse_explosion_SpellScript : public SpellScript + { + bool Validate(SpellEntry const * spellEntry) + { + if (!sSpellStore.LookupEntry(DK_SPELL_CORPSE_EXPLOSION_TRIGGERED)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex effIndex) + { + if (Unit* unitTarget = GetHitUnit()) + { + int32 bp = 0; + // Living ghoul as a target + if (unitTarget->isAlive()) + bp = unitTarget->GetMaxHealth() * 0.25f; + // Some corpse + else + bp = GetEffectValue(); + GetCaster()->CastCustomSpell(unitTarget, SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), 1), &bp, NULL, NULL, true); + // Corpse Explosion (Suicide) + unitTarget->CastCustomSpell(unitTarget, DK_SPELL_CORPSE_EXPLOSION_TRIGGERED, &bp, NULL, NULL, true); + // Set corpse look + unitTarget->SetDisplayId(DISPLAY_GHOUL_CORPSE + urand(0, 3)); + } + } + + void Register() + { + EffectHandlers += EffectHandlerFn(spell_dk_corpse_explosion_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_dk_corpse_explosion_SpellScript(); + } +}; + +// 50524 Runic Power Feed (keeping Gargoyle alive) +class spell_dk_runic_power_feed : public SpellHandlerScript +{ +public: + spell_dk_runic_power_feed() : SpellHandlerScript("spell_dk_runic_power_feed") { } + + class spell_dk_runic_power_feed_SpellScript : public SpellScript + { + bool Validate(SpellEntry const * spellEntry) + { + if (!sSpellStore.LookupEntry(DK_SPELL_SUMMON_GARGOYLE)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex effIndex) + { + if (Unit* caster = GetCaster()) + { + // No power, dismiss Gargoyle + if (caster->GetPower(POWER_RUNIC_POWER) < 30) + caster->RemoveAurasDueToSpell(DK_SPELL_SUMMON_GARGOYLE, caster->GetGUID()); + else + caster->ModifyPower(POWER_RUNIC_POWER, -30); + } + } + void Register() + { + EffectHandlers += EffectHandlerFn(spell_dk_runic_power_feed_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_dk_runic_power_feed_SpellScript(); + } +}; + +// 55090 Scourge Strike (55265, 55270, 55271) +class spell_dk_scourge_strike : public SpellHandlerScript +{ +public: + spell_dk_scourge_strike() : SpellHandlerScript("spell_dk_scourge_strike") { } + + class spell_dk_scourge_strike_SpellScript : public SpellScript + { + bool Validate(SpellEntry const * spellEntry) + { + if (!sSpellStore.LookupEntry(DK_SPELL_SCOURGE_STRIKE_TRIGGERED)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex effIndex) + { + Unit* caster = GetCaster(); + if (Unit* unitTarget = GetHitUnit()) + { + int32 bp = (GetHitDamage() * GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID())) / 100; + caster->CastCustomSpell(unitTarget, DK_SPELL_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true); + } + } + + void Register() + { + EffectHandlers += EffectHandlerFn(spell_dk_scourge_strike_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_dk_scourge_strike_SpellScript(); + } +}; + +void AddSC_deathknight_spell_scripts() +{ + new spell_dk_corpse_explosion(); + new spell_dk_runic_power_feed(); + new spell_dk_scourge_strike(); } diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index c475e1619a7..dc66faf3b89 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -22,8 +22,67 @@ */ #include "ScriptPCH.h" +#include "SpellAuraEffects.h" -void AddSC_druid_spell_scripts() +enum DruidSpells +{ + DRUID_INCREASED_MOONFIRE_DURATION = 38414, + DRUID_NATURES_SPLENDOR = 57865 +}; + +// 54846 Glyph of Starfire +class spell_dru_glyph_of_starfire : public SpellHandlerScript { +public: + spell_dru_glyph_of_starfire() : SpellHandlerScript("spell_dru_glyph_of_starfire") { } + + class spell_dru_glyph_of_starfire_SpellScript : public SpellScript + { + bool Validate(SpellEntry const * spellEntry) + { + if (!sSpellStore.LookupEntry(DRUID_INCREASED_MOONFIRE_DURATION)) + return false; + if (!sSpellStore.LookupEntry(DRUID_NATURES_SPLENDOR)) + return false; + return true; + } + + void HandleScriptEffect(SpellEffIndex effIndex) + { + Unit* caster = GetCaster(); + if (Unit* unitTarget = GetHitUnit()) + if (AuraEffect const * aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE,SPELLFAMILY_DRUID, 0x00000002, 0, 0, caster->GetGUID())) + { + Aura* aura = aurEff->GetBase(); + + uint32 countMin = aura->GetMaxDuration(); + uint32 countMax = 18000; + if (caster->HasAura(DRUID_INCREASED_MOONFIRE_DURATION)) + countMax += 3000; + if (caster->HasAura(DRUID_NATURES_SPLENDOR)) + countMax += 3000; + if (countMin < countMax) + { + aura->SetDuration(uint32(aura->GetDuration() + 3000)); + aura->SetMaxDuration(countMin + 3000); + } + } + } + + void Register() + { + EffectHandlers += EffectHandlerFn(spell_dru_glyph_of_starfire_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_dru_glyph_of_starfire_SpellScript(); + } +}; + +void AddSC_druid_spell_scripts() +{ + new spell_dru_glyph_of_starfire(); } diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 20ba278b804..ef9bcaeb440 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -22,6 +22,7 @@ */ #include "ScriptPCH.h" +#include "SpellAuraEffects.h" enum HunterSpells { @@ -32,229 +33,394 @@ enum HunterSpells HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED = 54114, HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF = 55711, HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED = 54045, + HUNTER_SPELL_INVIGORATION_TRIGGERED = 53398, + HUNTER_SPELL_MASTERS_CALL_TRIGGERED = 62305, + HUNTER_SPELL_CHIMERA_SHOT_SERPENT = 53353, + HUNTER_SPELL_CHIMERA_SHOT_VIPER = 53358, + HUNTER_SPELL_CHIMERA_SHOT_SCORPID = 53359, }; -class spell_hun_last_stand_pet : public SpellHandlerScript +// 53209 Chimera Shot +class spell_hun_chimera_shot : public SpellHandlerScript { - public: +public: + spell_hun_chimera_shot() : SpellHandlerScript("spell_hun_chimera_shot") { } - spell_hun_last_stand_pet() - : SpellHandlerScript("spell_hun_last_stand_pet") + class spell_hun_chimera_shot_SpellScript : public SpellScript + { + bool Validate(SpellEntry const * spellEntry) { + if (!sSpellStore.LookupEntry(HUNTER_SPELL_CHIMERA_SHOT_SERPENT)) + return false; + if (!sSpellStore.LookupEntry(HUNTER_SPELL_CHIMERA_SHOT_VIPER)) + return false; + if (!sSpellStore.LookupEntry(HUNTER_SPELL_CHIMERA_SHOT_SCORPID)) + return false; + return true; } - class spell_hun_last_stand_pet_SpellScript : public SpellScript + void HandleScriptEffect(SpellEffIndex effIndex) { - bool Validate(SpellEntry const * spellEntry) + Unit* caster = GetCaster(); + Unit* unitTarget = GetHitUnit(); + if (!unitTarget) + return; + + uint32 spellId = 0; + int32 basePoint = 0; + Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras(); + for (Unit::AuraApplicationMap::iterator i = Auras.begin(); i != Auras.end(); ++i) { - if (!sSpellStore.LookupEntry(HUNTER_PET_SPELL_LAST_STAND_TRIGGERED)) - return false; - return true; + Aura* aura = i->second->GetBase(); + if (aura->GetCasterGUID() != caster->GetGUID()) + continue; + + // Search only Serpent Sting, Viper Sting, Scorpid Sting auras + flag96 familyFlag = aura->GetSpellProto()->SpellFamilyFlags; + if (!(familyFlag[1] & 0x00000080 || familyFlag[0] & 0x0000C000)) + continue; + if (AuraEffect const * aurEff = aura->GetEffect(0)) + { + // Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting. + if (familyFlag[0] & 0x4000) + { + int32 TickCount = aurEff->GetTotalTicks(); + spellId = HUNTER_SPELL_CHIMERA_SHOT_SERPENT; + basePoint = aurEff->GetAmount() * TickCount * 40 / 100; + } + // Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting. + else if (familyFlag[1] & 0x00000080) + { + int32 TickCount = aura->GetEffect(0)->GetTotalTicks(); + spellId = HUNTER_SPELL_CHIMERA_SHOT_VIPER; + + // Amount of one aura tick + basePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 100 ; + int32 casterBasePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 50 ; + if (basePoint > casterBasePoint) + basePoint = casterBasePoint; + basePoint = basePoint * TickCount * 60 / 100; + } + // Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute. + else if (familyFlag[0] & 0x00008000) + spellId = HUNTER_SPELL_CHIMERA_SHOT_SCORPID; + // ?? nothing say in spell desc (possibly need addition check) + //if (familyFlag & 0x0000010000000000LL || // dot + // familyFlag & 0x0000100000000000LL) // stun + //{ + // spellId = 53366; // 53366 Chimera Shot - Wyvern + //} + + // Refresh aura duration + aura->RefreshDuration(); + } + break; } + if (spellId) + caster->CastCustomSpell(unitTarget, spellId, &basePoint, 0, 0, false); + } - void HandleDummy(SpellEffIndex effIndex) - { - Unit *caster = GetCaster(); - int32 healthModSpellBasePoints0 = int32(caster->GetMaxHealth()*0.3); - caster->CastCustomSpell(caster, HUNTER_PET_SPELL_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL); - } + void Register() + { + EffectHandlers += EffectHandlerFn(spell_hun_chimera_shot_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - void Register() - { - // add dummy effect spell handler to pet's Last Stand - EffectHandlers += EffectHandlerFn(spell_hun_last_stand_pet_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + SpellScript* GetSpellScript() const + { + return new spell_hun_chimera_shot_SpellScript(); + } +}; + +// 53412 Invigoration +class spell_hun_invigoration : public SpellHandlerScript +{ +public: + spell_hun_invigoration() : SpellHandlerScript("spell_hun_invigoration") { } + + class spell_hun_invigoration_SpellScript : public SpellScript + { + bool Validate(SpellEntry const * spellEntry) + { + if (!sSpellStore.LookupEntry(HUNTER_SPELL_INVIGORATION_TRIGGERED)) + return false; + return true; + } + + void HandleScriptEffect(SpellEffIndex effIndex) + { + if (Unit* unitTarget = GetHitUnit()) + if (AuraEffect* aurEff = unitTarget->GetDummyAuraEffect(SPELLFAMILY_HUNTER, 3487, 0)) + if (roll_chance_i(aurEff->GetAmount())) + unitTarget->CastSpell(unitTarget, HUNTER_SPELL_INVIGORATION_TRIGGERED, true); + } + + void Register() + { + EffectHandlers += EffectHandlerFn(spell_hun_invigoration_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const + SpellScript* GetSpellScript() const + { + return new spell_hun_invigoration_SpellScript(); + } +}; + +class spell_hun_last_stand_pet : public SpellHandlerScript +{ +public: + spell_hun_last_stand_pet() : SpellHandlerScript("spell_hun_last_stand_pet") { } + + class spell_hun_last_stand_pet_SpellScript : public SpellScript + { + bool Validate(SpellEntry const * spellEntry) + { + if (!sSpellStore.LookupEntry(HUNTER_PET_SPELL_LAST_STAND_TRIGGERED)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex effIndex) + { + Unit *caster = GetCaster(); + int32 healthModSpellBasePoints0 = int32(caster->GetMaxHealth()*0.3); + caster->CastCustomSpell(caster, HUNTER_PET_SPELL_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL); + } + + void Register() { - return new spell_hun_last_stand_pet_SpellScript(); + // add dummy effect spell handler to pet's Last Stand + EffectHandlers += EffectHandlerFn(spell_hun_last_stand_pet_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } + }; + + SpellScript* GetSpellScript() const + { + return new spell_hun_last_stand_pet_SpellScript(); + } }; class spell_hun_masters_call : public SpellHandlerScript { - public: +public: + spell_hun_masters_call() : SpellHandlerScript("spell_hun_masters_call") { } - spell_hun_masters_call() - : SpellHandlerScript("spell_hun_masters_call") + class spell_hun_masters_call_SpellScript : public SpellScript + { + bool Validate(SpellEntry const * spellEntry) { + if (!sSpellStore.LookupEntry(HUNTER_SPELL_MASTERS_CALL_TRIGGERED)) + return false; + return true; } - class spell_hun_masters_call_SpellScript : public SpellScript + void HandleDummy(SpellEffIndex effIndex) { - void HandleDummy(SpellEffIndex effIndex) - { - Unit *caster = GetCaster(); - Unit *unitTarget = GetHitUnit(); + Unit *caster = GetCaster(); + Unit *unitTarget = GetHitUnit(); - if (caster->GetTypeId() != TYPEID_PLAYER || !unitTarget) - return; + if (caster->GetTypeId() != TYPEID_PLAYER || !unitTarget) + return; - if (Pet *pet = caster->ToPlayer()->GetPet()) - if (pet->isAlive()) - pet->CastSpell(unitTarget, SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), effIndex), true); - } + if (Pet *pet = caster->ToPlayer()->GetPet()) + if (pet->isAlive()) + pet->CastSpell(unitTarget, SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), effIndex), true); + } - void Register() - { - // add dummy effect spell handler to Master's Call - EffectHandlers += EffectHandlerFn(spell_hun_masters_call_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void HandleScriptEffect(SpellEffIndex effIndex) + { + Unit* caster = GetCaster(); + if (caster->GetTypeId() != TYPEID_PLAYER) + return; + + if (Pet *pet = caster->ToPlayer()->GetPet()) + if (pet->isAlive()) + caster->CastSpell(pet, HUNTER_SPELL_MASTERS_CALL_TRIGGERED, true); + } - SpellScript* GetSpellScript() const + void Register() { - return new spell_hun_masters_call_SpellScript(); + EffectHandlers += EffectHandlerFn(spell_hun_masters_call_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + EffectHandlers += EffectHandlerFn(spell_hun_masters_call_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); } + }; + + SpellScript* GetSpellScript() const + { + return new spell_hun_masters_call_SpellScript(); + } }; class spell_hun_readiness : public SpellHandlerScript { - public: +public: + spell_hun_readiness() : SpellHandlerScript("spell_hun_readiness") { } - spell_hun_readiness() - : SpellHandlerScript("spell_hun_readiness") + class spell_hun_readiness_SpellScript : public SpellScript + { + void HandleDummy(SpellEffIndex effIndex) { + Unit *caster = GetCaster(); + if (caster->GetTypeId() != TYPEID_PLAYER) + return; + + // immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath + const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap(); + for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();) + { + SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); + + if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && + spellInfo->Id != HUNTER_SPELL_READINESS && + spellInfo->Id != HUNTER_SPELL_BESTIAL_WRATH && + GetSpellRecoveryTime(spellInfo) > 0) + caster->ToPlayer()->RemoveSpellCooldown((itr++)->first,true); + else + ++itr; + } } - class spell_hun_readiness_SpellScript : public SpellScript + void Register() { - void HandleDummy(SpellEffIndex effIndex) - { - Unit *caster = GetCaster(); - if (caster->GetTypeId() != TYPEID_PLAYER) - return; + // add dummy effect spell handler to Readiness + EffectHandlers += EffectHandlerFn(spell_hun_readiness_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - // immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath - const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap(); - for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();) - { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); - - if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && - spellInfo->Id != HUNTER_SPELL_READINESS && - spellInfo->Id != HUNTER_SPELL_BESTIAL_WRATH && - GetSpellRecoveryTime(spellInfo) > 0) - caster->ToPlayer()->RemoveSpellCooldown((itr++)->first,true); - else - ++itr; - } - } + SpellScript* GetSpellScript() const + { + return new spell_hun_readiness_SpellScript(); + } +}; - void Register() - { - // add dummy effect spell handler to Readiness - EffectHandlers += EffectHandlerFn(spell_hun_readiness_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; +// 37506 Scatter Shot +class spell_hun_scatter_shot : public SpellHandlerScript +{ +public: + spell_hun_scatter_shot() : SpellHandlerScript("spell_hun_scatter_shot") { } - SpellScript* GetSpellScript() const + class spell_hun_scatter_shot_SpellScript : public SpellScript + { + void HandleDummy(SpellEffIndex effIndex) { - return new spell_hun_readiness_SpellScript(); + Unit* caster = GetCaster(); + if (caster->GetTypeId() != TYPEID_PLAYER) + return; + + // break Auto Shot and autohit + caster->InterruptSpell(CURRENT_AUTOREPEAT_SPELL); + caster->AttackStop(); + caster->ToPlayer()->SendAttackSwingCancelAttack(); } + + void Register() + { + EffectHandlers += EffectHandlerFn(spell_hun_scatter_shot_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_hun_scatter_shot_SpellScript(); + } }; class spell_hun_pet_heart_of_the_phoenix : public SpellHandlerScript { - public: +public: + spell_hun_pet_heart_of_the_phoenix() : SpellHandlerScript("spell_hun_pet_heart_of_the_phoenix") { } - spell_hun_pet_heart_of_the_phoenix() - : SpellHandlerScript("spell_hun_pet_heart_of_the_phoenix") + class spell_hun_pet_heart_of_the_phoenix_SpellScript : public SpellScript + { + bool Validate(SpellEntry const * spellEntry) { + if (!sSpellStore.LookupEntry(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED)) + return false; + if (!sSpellStore.LookupEntry(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF)) + return false; + return true; } - class spell_hun_pet_heart_of_the_phoenix_SpellScript : public SpellScript + void HandleScript(SpellEffIndex effIndex) { - bool Validate(SpellEntry const * spellEntry) - { - if (!sSpellStore.LookupEntry(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED)) - return false; - if (!sSpellStore.LookupEntry(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF)) - return false; - return true; - } - - void HandleScript(SpellEffIndex effIndex) - { - Unit *caster = GetCaster(); - if (caster->HasAura(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF)) - return; - caster->CastCustomSpell(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED, SPELLVALUE_BASE_POINT0, 100, caster, true); - caster->CastSpell(caster, HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF, true); - } - - void Register() - { - // add dummy effect spell handler to pet's Last Stand - EffectHandlers += EffectHandlerFn(spell_hun_pet_heart_of_the_phoenix_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } + Unit *caster = GetCaster(); + if (caster->HasAura(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF)) + return; + caster->CastCustomSpell(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED, SPELLVALUE_BASE_POINT0, 100, caster, true); + caster->CastSpell(caster, HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF, true); + } - bool Load() - { - if (!GetCaster()->isPet()) - return false; - return true; - } - }; + void Register() + { + // add dummy effect spell handler to pet's Last Stand + EffectHandlers += EffectHandlerFn(spell_hun_pet_heart_of_the_phoenix_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } - SpellScript* GetSpellScript() const + bool Load() { - return new spell_hun_pet_heart_of_the_phoenix_SpellScript(); + if (!GetCaster()->isPet()) + return false; + return true; } + }; + + SpellScript* GetSpellScript() const + { + return new spell_hun_pet_heart_of_the_phoenix_SpellScript(); + } }; class spell_hun_pet_carrion_feeder : public SpellHandlerScript { - public: +public: + spell_hun_pet_carrion_feeder() : SpellHandlerScript("spell_hun_pet_carrion_feeder") { } - spell_hun_pet_carrion_feeder() - : SpellHandlerScript("spell_hun_pet_carrion_feeder") + class spell_hun_pet_carrion_feeder_SpellScript : public SpellScript + { + bool Validate(SpellEntry const * spellEntry) { + if (!sSpellStore.LookupEntry(HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED)) + return false; + return true; } - class spell_hun_pet_carrion_feeder_SpellScript : public SpellScript + void HandleDummy(SpellEffIndex effIndex) { - bool Validate(SpellEntry const * spellEntry) - { - if (!sSpellStore.LookupEntry(HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED)) - return false; - return true; - } - - void HandleDummy(SpellEffIndex effIndex) - { - if (!GetHitUnit()) - return; - Unit *caster = GetCaster(); - caster->CastSpell(caster, HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED, false); - } - - void Register() - { - // add dummy effect spell handler to pet's Last Stand - EffectHandlers += EffectHandlerFn(spell_hun_pet_carrion_feeder_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } + if (!GetHitUnit()) + return; + Unit *caster = GetCaster(); + caster->CastSpell(caster, HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED, false); + } - bool Load() - { - if (!GetCaster()->isPet()) - return false; - return true; - } - }; + void Register() + { + // add dummy effect spell handler to pet's Last Stand + EffectHandlers += EffectHandlerFn(spell_hun_pet_carrion_feeder_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } - SpellScript* GetSpellScript() const + bool Load() { - return new spell_hun_pet_carrion_feeder_SpellScript(); + if (!GetCaster()->isPet()) + return false; + return true; } + }; + + SpellScript* GetSpellScript() const + { + return new spell_hun_pet_carrion_feeder_SpellScript(); + } }; void AddSC_hunter_spell_scripts() { - new spell_hun_last_stand_pet; - new spell_hun_masters_call; - new spell_hun_readiness; - new spell_hun_pet_heart_of_the_phoenix; - new spell_hun_pet_carrion_feeder; + new spell_hun_chimera_shot(); + new spell_hun_invigoration(); + new spell_hun_last_stand_pet(); + new spell_hun_masters_call(); + new spell_hun_readiness(); + new spell_hun_scatter_shot(); + new spell_hun_pet_heart_of_the_phoenix(); + new spell_hun_pet_carrion_feeder(); } diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp new file mode 100644 index 00000000000..1253a2e9b97 --- /dev/null +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -0,0 +1,163 @@ +/* + * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/* + * Scripts for spells with SPELLFAMILY_GENERIC spells used for quests. + * Ordered alphabetically using questId and scriptname. + * Scriptnames of files in this file should be prefixed with "spell_q#questID_". + */ + +enum Quest11587Spells +{ + QUEST11587_SPELL_SUMMON_ARCANE_PRISONER_MALE = 45446, // Summon Arcane Prisoner - Male + QUEST11587_SPELL_SUMMON_ARCANE_PRISONER_FEMALE = 45448, // Summon Arcane Prisoner - Female + QUEST11587_SPELL_ARCANE_PRISONER_KILL_CREDIT = 45456 // Arcane Prisoner Kill Credit +}; + +// http://www.wowhead.com/quest=11587 Prison Break +// 45449 Arcane Prisoner Rescue +class spell_q11587_arcane_prisoner_rescue : public SpellHandlerScript +{ +public: + spell_q11587_arcane_prisoner_rescue() : SpellHandlerScript("spell_q11587_arcane_prisoner_rescue") { } + + class spell_q11587_arcane_prisoner_rescue_SpellScript : public SpellScript + { + bool Validate(SpellEntry const * spellEntry) + { + if (!sSpellStore.LookupEntry(QUEST11587_SPELL_SUMMON_ARCANE_PRISONER_MALE)) + return false; + if (!sSpellStore.LookupEntry(QUEST11587_SPELL_SUMMON_ARCANE_PRISONER_FEMALE)) + return false; + if (!sSpellStore.LookupEntry(QUEST11587_SPELL_ARCANE_PRISONER_KILL_CREDIT)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex effIndex) + { + Unit* caster = GetCaster(); + if (Unit* unitTarget = GetHitUnit()) + { + uint32 spellId = QUEST11587_SPELL_SUMMON_ARCANE_PRISONER_MALE; + if (rand() % 2) + spellId = QUEST11587_SPELL_SUMMON_ARCANE_PRISONER_FEMALE; + caster->CastSpell(caster, spellId, true); + unitTarget->CastSpell(caster, QUEST11587_SPELL_ARCANE_PRISONER_KILL_CREDIT, true); + } + } + + void Register() + { + EffectHandlers += EffectHandlerFn(spell_q11587_arcane_prisoner_rescue_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_q11587_arcane_prisoner_rescue_SpellScript(); + } +}; + +enum Quest11730Spells +{ + SPELL_QUEST_SUMMON_SCAVENGEBOT_004A8 = 46063, + SPELL_QUEST_SUMMON_SENTRYBOT_57K = 46068, + SPELL_QUEST_SUMMON_DEFENDOTANK_66D = 46058, + SPELL_QUEST_SUMMON_SCAVENGEBOT_005B6 = 46066, + SPELL_QUEST_SUMMON_55D_COLLECTATRON = 46034, + SPELL_QUEST_ROBOT_KILL_CREDIT = 46027, + NPC_SCAVENGEBOT_004A8 = 25752, + NPC_SENTRYBOT_57K = 25753, + NPC_DEFENDOTANK_66D = 25758, + NPC_SCAVENGEBOT_005B6 = 25792, + NPC_55D_COLLECTATRON = 25793 +}; + +// http://www.wowhead.com/quest=11730 Master and Servant +// 46023 The Ultrasonic Screwdriver +class spell_q11730_ultrasonic_screwdriver : public SpellHandlerScript +{ +public: + spell_q11730_ultrasonic_screwdriver() : SpellHandlerScript("spell_q11730_ultrasonic_screwdriver") { } + + class spell_q11730_ultrasonic_screwdriver_SpellScript : public SpellScript + { + bool Validate(SpellEntry const * spellEntry) + { + if (!sSpellStore.LookupEntry(SPELL_QUEST_SUMMON_SCAVENGEBOT_004A8)) + return false; + if (!sSpellStore.LookupEntry(SPELL_QUEST_SUMMON_SENTRYBOT_57K)) + return false; + if (!sSpellStore.LookupEntry(SPELL_QUEST_SUMMON_DEFENDOTANK_66D)) + return false; + if (!sSpellStore.LookupEntry(SPELL_QUEST_SUMMON_SCAVENGEBOT_005B6)) + return false; + if (!sSpellStore.LookupEntry(SPELL_QUEST_SUMMON_55D_COLLECTATRON)) + return false; + if (!sSpellStore.LookupEntry(SPELL_QUEST_ROBOT_KILL_CREDIT)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex effIndex) + { + Item *castItem = GetCastItem(); + if (!castItem) + return; + + Unit* pCaster = GetCaster(); + if (pCaster->GetTypeId() != TYPEID_PLAYER) + return; + + Creature* pTarget = GetHitCreature(); + if (!pTarget) + return; + + uint32 spellId = 0; + switch (pTarget->GetEntry()) + { + case NPC_SCAVENGEBOT_004A8: spellId = SPELL_QUEST_SUMMON_SCAVENGEBOT_004A8; break; + case NPC_SENTRYBOT_57K: spellId = SPELL_QUEST_SUMMON_SENTRYBOT_57K; break; + case NPC_DEFENDOTANK_66D: spellId = SPELL_QUEST_SUMMON_DEFENDOTANK_66D; break; + case NPC_SCAVENGEBOT_005B6: spellId = SPELL_QUEST_SUMMON_SCAVENGEBOT_005B6; break; + case NPC_55D_COLLECTATRON: spellId = SPELL_QUEST_SUMMON_55D_COLLECTATRON; break; + default: + return; + } + pCaster->CastSpell(pCaster, spellId, true, castItem); + pCaster->CastSpell(pCaster, SPELL_QUEST_ROBOT_KILL_CREDIT, true); + pTarget->ForcedDespawn(); + } + + void Register() + { + EffectHandlers += EffectHandlerFn(spell_q11730_ultrasonic_screwdriver_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript * GetSpellScript() const + { + return new spell_q11730_ultrasonic_screwdriver_SpellScript(); + } +}; + +void AddSC_quest_spell_scripts() +{ + new spell_q11587_arcane_prisoner_rescue(); + new spell_q11730_ultrasonic_screwdriver(); +} diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 2f3c9843460..d0ec883248d 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -22,8 +22,115 @@ */ #include "ScriptPCH.h" +#include "SpellAuraEffects.h" -void AddSC_shaman_spell_scripts() +enum ShamanSpells +{ + SHAMAN_SPELL_GLYPH_OF_MANA_TIDE = 55441, + SHAMAN_SPELL_MANA_TIDE_TOTEM = 39609, + SHAMAN_SPELL_FIRE_NOVA_R1 = 1535, + SHAMAN_SPELL_FIRE_NOVA_TRIGGERED_R1 = 8349 +}; + +// 1535 Fire Nova +class spell_sha_fire_nova : public SpellHandlerScript +{ +public: + spell_sha_fire_nova() : SpellHandlerScript("spell_sha_fire_nova") { } + + class spell_sha_fire_nova_SpellScript : public SpellScript + { + bool Validate(SpellEntry const * spellEntry) + { + if (!sSpellStore.LookupEntry(SHAMAN_SPELL_FIRE_NOVA_R1)) + return false; + if (sSpellMgr.GetFirstSpellInChain(SHAMAN_SPELL_FIRE_NOVA_R1) != sSpellMgr.GetFirstSpellInChain(spellEntry->Id)) + return false; + + uint8 rank = sSpellMgr.GetSpellRank(spellEntry->Id); + if (!sSpellMgr.GetSpellWithRank(SHAMAN_SPELL_FIRE_NOVA_TRIGGERED_R1, rank, true)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex effIndex) + { + if (Unit* caster = GetCaster()) + { + uint8 rank = sSpellMgr.GetSpellRank(GetSpellInfo()->Id); + uint32 spellId = sSpellMgr.GetSpellWithRank(SHAMAN_SPELL_FIRE_NOVA_TRIGGERED_R1, rank); + // fire slot + if (spellId && caster->m_SummonSlot[1]) + { + Creature* totem = caster->GetMap()->GetCreature(caster->m_SummonSlot[1]); + if (totem && totem->isTotem()) + totem->CastSpell(totem, spellId, true); + } + } + } + + void Register() + { + EffectHandlers += EffectHandlerFn(spell_sha_fire_nova_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_sha_fire_nova_SpellScript(); + } +}; + +// 39610 Mana Tide Totem +class spell_sha_mana_tide_totem : public SpellHandlerScript { +public: + spell_sha_mana_tide_totem() : SpellHandlerScript("spell_sha_mana_tide_totem") { } + + class spell_sha_mana_tide_totem_SpellScript : public SpellScript + { + bool Validate(SpellEntry const * spellEntry) + { + if (!sSpellStore.LookupEntry(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE)) + return false; + if (!sSpellStore.LookupEntry(SHAMAN_SPELL_MANA_TIDE_TOTEM)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex effIndex) + { + Unit* caster = GetCaster(); + if (Unit* unitTarget = GetHitUnit()) + { + if (unitTarget->getPowerType() == POWER_MANA) + { + int32 effValue = GetEffectValue(); + // Glyph of Mana Tide + if (Unit *owner = caster->GetOwner()) + if (AuraEffect *dummy = owner->GetAuraEffect(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE, 0)) + effValue += dummy->GetAmount(); + // Regenerate 6% of Total Mana Every 3 secs + int32 effBasePoints0 = unitTarget->GetMaxPower(POWER_MANA) * effValue / 100; + caster->CastCustomSpell(unitTarget, SHAMAN_SPELL_MANA_TIDE_TOTEM, &effBasePoints0, NULL, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID()); + } + } + } + void Register() + { + EffectHandlers += EffectHandlerFn(spell_sha_mana_tide_totem_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_sha_mana_tide_totem_SpellScript(); + } +}; + +void AddSC_shaman_spell_scripts() +{ + new spell_sha_fire_nova(); + new spell_sha_mana_tide_totem(); } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 6053f0be138..b330fd0daab 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -22,8 +22,222 @@ */ #include "ScriptPCH.h" +#include "Spell.h" +#include "SpellAuraEffects.h" -void AddSC_warlock_spell_scripts() +enum WarlockSpells +{ + WARLOCK_DIVINE_PLEA = 54428, + WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS = 54435, + WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER = 54443, + WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD = 54508, + WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER = 54509, + WARLOCK_DEMONIC_EMPOWERMENT_IMP = 54444, + WARLOCK_IMPROVED_HEALTHSTONE_R1 = 18692, + WARLOCK_IMPROVED_HEALTHSTONE_R2 = 18693, +}; + +// 47193 Demonic Empowerment +class spell_warl_demonic_empowerment : public SpellHandlerScript { +public: + spell_warl_demonic_empowerment() : SpellHandlerScript("spell_warl_demonic_empowerment") { } + + class spell_warl_demonic_empowerment_SpellScript : public SpellScript + { + bool Validate(SpellEntry const * spellEntry) + { + if (!sSpellStore.LookupEntry(WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS)) + return false; + if (!sSpellStore.LookupEntry(WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER)) + return false; + if (!sSpellStore.LookupEntry(WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD)) + return false; + if (!sSpellStore.LookupEntry(WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER)) + return false; + if (!sSpellStore.LookupEntry(WARLOCK_DEMONIC_EMPOWERMENT_IMP)) + return false; + return true; + } + + void HandleScriptEffect(SpellEffIndex effIndex) + { + if (Creature* targetCreature = GetHitCreature()) + { + if (targetCreature->isPet()) + { + CreatureInfo const * ci = sObjectMgr.GetCreatureTemplate(targetCreature->GetEntry()); + switch (ci->family) + { + case CREATURE_FAMILY_SUCCUBUS: + targetCreature->CastSpell(targetCreature, WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS, true); + break; + case CREATURE_FAMILY_VOIDWALKER: + { + SpellEntry const* spellInfo = sSpellStore.LookupEntry(WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER); + int32 hp = targetCreature->GetMaxHealth() * GetCaster()->CalculateSpellDamage(targetCreature, spellInfo, 0) / 100; + targetCreature->CastCustomSpell(targetCreature, WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER, &hp, NULL, NULL, true); + //unitTarget->CastSpell(unitTarget, 54441, true); + break; + } + case CREATURE_FAMILY_FELGUARD: + targetCreature->CastSpell(targetCreature, WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD, true); + break; + case CREATURE_FAMILY_FELHUNTER: + targetCreature->CastSpell(targetCreature, WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER, true); + break; + case CREATURE_FAMILY_IMP: + targetCreature->CastSpell(targetCreature, WARLOCK_DEMONIC_EMPOWERMENT_IMP, true); + break; + } + } + } + } + + void Register() + { + EffectHandlers += EffectHandlerFn(spell_warl_demonic_empowerment_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_warl_demonic_empowerment_SpellScript(); + } +}; + +// 47422 Everlasting Affliction +class spell_warl_everlasting_affliction : public SpellHandlerScript +{ +public: + spell_warl_everlasting_affliction() : SpellHandlerScript("spell_warl_everlasting_affliction") { } + + class spell_warl_everlasting_affliction_SpellScript : public SpellScript + { + void HandleScriptEffect(SpellEffIndex effIndex) + { + if (Unit* unitTarget = GetHitUnit()) + // Refresh corruption on target + if (AuraEffect* aur = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x2, 0, 0, GetCaster()->GetGUID())) + aur->GetBase()->RefreshDuration(); + } + + void Register() + { + EffectHandlers += EffectHandlerFn(spell_warl_everlasting_affliction_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_warl_everlasting_affliction_SpellScript(); + } +}; + +// 63521 Guarded by The Light +class spell_warl_guarded_by_the_light : public SpellHandlerScript +{ +public: + spell_warl_guarded_by_the_light() : SpellHandlerScript("spell_warl_guarded_by_the_light") { } + + class spell_warl_guarded_by_the_light_SpellScript : public SpellScript + { + bool Validate(SpellEntry const * spellEntry) + { + if (!sSpellStore.LookupEntry(WARLOCK_DIVINE_PLEA)) + return false; + return true; + } + void HandleScriptEffect(SpellEffIndex effIndex) + { + // Divine Plea + if (Aura* aura = GetCaster()->GetAura(WARLOCK_DIVINE_PLEA)) + aura->RefreshDuration(); + } + + void Register() + { + EffectHandlers += EffectHandlerFn(spell_warl_guarded_by_the_light_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_warl_guarded_by_the_light_SpellScript(); + } +}; + +// 6201 Create Healthstone (and ranks) +class spell_warl_create_healthstone : public SpellHandlerScript +{ +public: + spell_warl_create_healthstone() : SpellHandlerScript("spell_warl_create_healthstone") { } + + class spell_warl_create_healthstone_SpellScript : public SpellScript + { + static uint32 const iTypes[8][3]; + + bool Validate(SpellEntry const * spellEntry) + { + if (!sSpellStore.LookupEntry(WARLOCK_IMPROVED_HEALTHSTONE_R1)) + return false; + if (!sSpellStore.LookupEntry(WARLOCK_IMPROVED_HEALTHSTONE_R2)) + return false; + return true; + } + + void HandleScriptEffect(SpellEffIndex effIndex) + { + if (Unit* unitTarget = GetHitUnit()) + { + uint32 rank = 0; + // Improved Healthstone + if (AuraEffect const * aurEff = unitTarget->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, 284, 0)) + { + switch (aurEff->GetId()) + { + case WARLOCK_IMPROVED_HEALTHSTONE_R1: rank = 1; break; + case WARLOCK_IMPROVED_HEALTHSTONE_R2: rank = 2; break; + default: + sLog.outError("Unknown rank of Improved Healthstone id: %d", aurEff->GetId()); + break; + } + } + uint8 spellRank = sSpellMgr.GetSpellRank(GetSpellInfo()->Id); + if (spellRank > 0 && spellRank <= 8) + CreateItem(effIndex, iTypes[spellRank - 1][rank]); + } + } + + void Register() + { + EffectHandlers += EffectHandlerFn(spell_warl_create_healthstone_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_warl_create_healthstone_SpellScript(); + } +}; + +uint32 const spell_warl_create_healthstone::spell_warl_create_healthstone_SpellScript::iTypes[8][3] = { + { 5512, 19004, 19005}, // Minor Healthstone + { 5511, 19006, 19007}, // Lesser Healthstone + { 5509, 19008, 19009}, // Healthstone + { 5510, 19010, 19011}, // Greater Healthstone + { 9421, 19012, 19013}, // Major Healthstone + {22103, 22104, 22105}, // Master Healthstone + {36889, 36890, 36891}, // Demonic Healthstone + {36892, 36893, 36894} // Fel Healthstone +}; + + +void AddSC_warlock_spell_scripts() +{ + new spell_warl_demonic_empowerment(); + new spell_warl_everlasting_affliction(); + new spell_warl_guarded_by_the_light(); + new spell_warl_create_healthstone(); } |
