aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Scripting/ScriptLoader.cpp2
-rw-r--r--src/server/game/Spells/SpellEffects.cpp356
-rw-r--r--src/server/game/Spells/SpellScript.cpp10
-rw-r--r--src/server/game/Spells/SpellScript.h6
-rw-r--r--src/server/scripts/Spells/spell_dk.cpp135
-rw-r--r--src/server/scripts/Spells/spell_druid.cpp61
-rw-r--r--src/server/scripts/Spells/spell_hunter.cpp468
-rw-r--r--src/server/scripts/Spells/spell_quest.cpp163
-rw-r--r--src/server/scripts/Spells/spell_shaman.cpp109
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp216
10 files changed, 1026 insertions, 500 deletions
diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp
index 75b223f541a..e40b9736712 100644
--- a/src/server/game/Scripting/ScriptLoader.cpp
+++ b/src/server/game/Scripting/ScriptLoader.cpp
@@ -523,6 +523,7 @@ void AddSC_rogue_spell_scripts();
void AddSC_shaman_spell_scripts();
void AddSC_warlock_spell_scripts();
void AddSC_warrior_spell_scripts();
+void AddSC_quest_spell_scripts();
void AddSC_example_spell_scripts();
// battlegrounds
@@ -580,6 +581,7 @@ void AddSpellScripts()
AddSC_shaman_spell_scripts();
AddSC_warlock_spell_scripts();
AddSC_warrior_spell_scripts();
+ AddSC_quest_spell_scripts();
AddSC_example_spell_scripts();
#endif
}
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index a72e9e83401..4b3031922d7 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -1607,22 +1607,6 @@ void Spell::EffectDummy(uint32 i)
return;
}
break;
- case SPELLFAMILY_HUNTER:
- switch(m_spellInfo->Id)
- {
- case 37506: // Scatter Shot
- {
- if (m_caster->GetTypeId() != TYPEID_PLAYER)
- return;
-
- // break Auto Shot and autohit
- m_caster->InterruptSpell(CURRENT_AUTOREPEAT_SPELL);
- m_caster->AttackStop();
- m_caster->ToPlayer()->SendAttackSwingCancelAttack();
- return;
- }
- }
- break;
case SPELLFAMILY_PALADIN:
// Divine Storm
if (m_spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_PALADIN_DIVINESTORM && i == 1)
@@ -1690,50 +1674,6 @@ void Spell::EffectDummy(uint32 i)
m_caster->CastCustomSpell(unitTarget, 52032, &damage, 0, 0, true, 0, 0, m_originalCasterGUID);
return;
}
- if (m_spellInfo->Id == 39610) // Mana Tide Totem effect
- {
- if (!unitTarget || unitTarget->getPowerType() != POWER_MANA)
- return;
- // Glyph of Mana Tide
- if (Unit *owner = m_caster->GetOwner())
- if (AuraEffect *dummy = owner->GetAuraEffect(55441, 0))
- damage += dummy->GetAmount();
- // Regenerate 6% of Total Mana Every 3 secs
- int32 EffectBasePoints0 = unitTarget->GetMaxPower(POWER_MANA) * damage / 100;
- m_caster->CastCustomSpell(unitTarget, 39609, &EffectBasePoints0, NULL, NULL, true, NULL, NULL, m_originalCasterGUID);
- return;
- }
- // Fire Nova
- if (m_spellInfo->SpellIconID == 33)
- {
- if (!m_caster)
- return;
-
- uint32 triggered_spell_id;
- switch(m_spellInfo->Id)
- {
- case 1535: triggered_spell_id = 8349; break;
- case 8498: triggered_spell_id = 8502; break;
- case 8499: triggered_spell_id = 8503; break;
- case 11314: triggered_spell_id = 11306; break;
- case 11315: triggered_spell_id = 11307; break;
- case 25546: triggered_spell_id = 25535; break;
- case 25547: triggered_spell_id = 25537; break;
- case 61649: triggered_spell_id = 61650; break;
- case 61657: triggered_spell_id = 61654; break;
- default:
- break;
- }
- // fire slot
- if (triggered_spell_id && m_caster->m_SummonSlot[1])
- {
- Creature* totem = m_caster->GetMap()->GetCreature(m_caster->m_SummonSlot[1]);
- if (totem && totem->isTotem())
- totem->CastSpell(totem, triggered_spell_id, true);
- return;
- }
- return;
- }
// Lava Lash
if (m_spellInfo->SpellFamilyFlags[2] & SPELLFAMILYFLAG2_SHAMAN_LAVA_LASH)
{
@@ -1761,13 +1701,6 @@ void Spell::EffectDummy(uint32 i)
m_caster->CastCustomSpell(m_caster, 45470, &bp, NULL, NULL, false);
return;
}
- // Scourge Strike
- if (m_spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_DK_SCOURGE_STRIKE)
- {
- int32 bp = (m_damage * damage * unitTarget->GetDiseasesByCaster(m_caster->GetGUID())) / 100;
- m_caster->CastCustomSpell(unitTarget, 70890, &bp, NULL, NULL, true);
- return;
- }
// Death Coil
if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_DK_DEATH_COIL)
{
@@ -1783,40 +1716,30 @@ void Spell::EffectDummy(uint32 i)
}
return;
}
- // Hungering Cold
- if (m_spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_DK_HUNGERING_COLD)
- {
- unitTarget->CastSpell(m_caster, 51209, true);
- return;
- }
- // Death Grip
- if (m_spellInfo->Id == 49560)
+ switch (m_spellInfo->Id)
{
+ case 49560: // Death Grip
Position pos;
GetSummonPosition(i, pos);
if (Unit *unit = unitTarget->GetVehicleBase()) // what is this for?
- unit->CastSpell(pos.GetPositionX(),pos.GetPositionY(),pos.GetPositionZ(),damage,true);
+ unit->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), damage, true);
else
- unitTarget->CastSpell(pos.GetPositionX(),pos.GetPositionY(),pos.GetPositionZ(),damage,true);
+ unitTarget->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), damage, true);
return;
- }
- else if (m_spellInfo->Id == 46584) // Raise dead
- {
+ case 46584: // Raise Dead
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
// Do we have talent Master of Ghouls?
if (m_caster->HasAura(52143))
// summon as pet
- bp = 52150;
+ bp = 52150;
else
// or guardian
bp = 46585;
if (m_targets.HasDst())
- {
targets.setDst(m_targets.m_dstPos);
- }
else
{
targets.setDst(*m_caster);
@@ -1824,50 +1747,16 @@ void Spell::EffectDummy(uint32 i)
triggered = false;
}
// Remove cooldown - summon spellls have category
- m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id,true);
- spell_id=48289;
- }
+ m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true);
+ spell_id = 48289;
+ break;
// Raise dead - take reagents and trigger summon spells
- else if (m_spellInfo->Id == 48289)
- {
+ case 48289:
if (m_targets.HasDst())
targets.setDst(m_targets.m_dstPos);
spell_id = CalculateDamage(0, NULL);
- }
- // Corpse Explosion
- else if (m_spellInfo->SpellIconID == 1737)
- {
- // Dummy effect 1 is used only for targeting and damage amount
- if (i != 0)
- return;
- int32 bp = 0;
- // Living ghoul as a target
- if (unitTarget->isAlive())
- {
- bp = unitTarget->GetMaxHealth()*0.25f;
- }
- // Some corpse
- else
- {
- bp = damage;
- }
- m_caster->CastCustomSpell(unitTarget, SpellMgr::CalculateSpellEffectAmount(m_spellInfo, 1), &bp,NULL,NULL,true);
- // Corpse Explosion (Suicide)
- unitTarget->CastCustomSpell(unitTarget,43999,&bp,NULL,NULL,true);
- // Set corpse look
- unitTarget->SetDisplayId(25537+urand(0,3));
- }
- // Runic Power Feed (keeping Gargoyle alive)
- else if (m_spellInfo->Id == 50524)
- {
- // No power, dismiss Gargoyle
- if (m_caster->GetPower(POWER_RUNIC_POWER)<30)
- m_caster->RemoveAurasDueToSpell(50514, m_caster->GetGUID());
- else
- m_caster->ModifyPower(POWER_RUNIC_POWER,-30);
-
- return;
+ break;
}
break;
}
@@ -4748,24 +4637,6 @@ void Spell::EffectScriptEffect(uint32 effIndex)
}
return;
}
- // Glyph of Starfire
- case 54846:
- {
- if (AuraEffect const * aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE,SPELLFAMILY_DRUID,0x00000002,0,0,m_caster->GetGUID()))
- {
- uint32 countMin = aurEff->GetBase()->GetMaxDuration();
- uint32 countMax = 18000;
- countMax += m_caster->HasAura(38414) ? 3000 : 0;
- countMax += m_caster->HasAura(57865) ? 3000 : 0;
-
- if (countMin < countMax)
- {
- aurEff->GetBase()->SetDuration(uint32(aurEff->GetBase()->GetDuration()+3000));
- aurEff->GetBase()->SetMaxDuration(countMin+3000);
- }
- }
- return;
- }
// Glyph of Backstab
case 63975:
{
@@ -5653,211 +5524,6 @@ void Spell::EffectScriptEffect(uint32 effIndex)
}
break;
}
- case SPELLFAMILY_WARLOCK:
- {
- switch(m_spellInfo->Id)
- {
- // Healthstone creating spells
- case 6201:
- case 6202:
- case 5699:
- case 11729:
- case 11730:
- case 27230:
- case 47871:
- case 47878:
- {
- uint32 itemtype;
- uint32 rank = 0;
-
- // Improved Healthstone
- if (AuraEffect const * aurEff = unitTarget->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, 284, 0))
- {
- if (aurEff->GetId() == 18692)
- rank = 1;
- else if (aurEff->GetId() == 18693)
- rank = 2;
- else
- sLog.outError("Unknown rank of Improved Healthstone id: %d", aurEff->GetId());
- }
-
- static uint32 const 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
- };
-
- switch(m_spellInfo->Id)
- {
- case 6201:
- itemtype=itypes[0][rank];break; // Minor Healthstone
- case 6202:
- itemtype=itypes[1][rank];break; // Lesser Healthstone
- case 5699:
- itemtype=itypes[2][rank];break; // Healthstone
- case 11729:
- itemtype=itypes[3][rank];break; // Greater Healthstone
- case 11730:
- itemtype=itypes[4][rank];break; // Major Healthstone
- case 27230:
- itemtype=itypes[5][rank];break; // Master Healthstone
- case 47871:
- itemtype=itypes[6][rank];break; // Demonic Healthstone
- case 47878:
- itemtype=itypes[7][rank];break; // Fel Healthstone
- default:
- return;
- }
- DoCreateItem(effIndex, itemtype);
- return;
- }
- // Everlasting Affliction
- case 47422:
- // Refresh corruption on target
- if (AuraEffect * aur = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x2, 0, 0, m_caster->GetGUID()))
- aur->GetBase()->RefreshDuration();
- return;
- // Demonic Empowerment
- case 47193:
- {
- if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT || !unitTarget->ToCreature()->isPet())
- return;
- CreatureInfo const * ci = sObjectMgr.GetCreatureTemplate(unitTarget->GetEntry());
- switch (ci->family)
- {
- case CREATURE_FAMILY_SUCCUBUS:
- unitTarget->CastSpell(unitTarget, 54435, true);
- break;
- case CREATURE_FAMILY_VOIDWALKER:
- {
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(54443);
- int32 hp = unitTarget->GetMaxHealth() * m_caster->CalculateSpellDamage(unitTarget, spellInfo, 0) /100;
- unitTarget->CastCustomSpell(unitTarget, 54443,&hp, NULL, NULL,true);
- //unitTarget->CastSpell(unitTarget, 54441, true);
- break;
- }
- case CREATURE_FAMILY_FELGUARD:
- unitTarget->CastSpell(unitTarget, 54508, true);
- break;
- case CREATURE_FAMILY_FELHUNTER:
- unitTarget->CastSpell(unitTarget, 54509, true);
- break;
- case CREATURE_FAMILY_IMP:
- unitTarget->CastSpell(unitTarget, 54444, true);
- break;
- }
- return;
- }
- // Guarded by The Light
- case 63521:
- {
- // Divine Plea
- if (Aura * aura = m_caster->GetAura(54428))
- aura->RefreshDuration();
- return;
- }
- }
- break;
- }
- case SPELLFAMILY_HUNTER:
- {
- switch(m_spellInfo->Id)
- {
- // Invigoration
- case 53412:
- {
- if (AuraEffect * aurEff = unitTarget->GetDummyAuraEffect(SPELLFAMILY_HUNTER, 3487, 0))
- {
- if (roll_chance_i(aurEff->GetAmount()))
- unitTarget->CastSpell(unitTarget, 53398, true);
- }
- break;
- }
- // Heart of the Pheonix
- case 55709:
- {
- int pct = 100;
- if (unitTarget->GetTypeId() == TYPEID_UNIT && unitTarget->ToCreature()->isPet())
- if (Unit* owner = unitTarget->ToCreature()->GetOwner())
- owner->CastCustomSpell(unitTarget, 54114, &pct, NULL, NULL, true);
- break;
- }
- // Chimera Shot
- case 53209:
- {
- uint32 spellId = 0;
- int32 basePoint = 0;
- Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras();
- for (Unit::AuraApplicationMap::iterator i = Auras.begin(); i != Auras.end(); ++i)
- {
- Aura * aura = (*i).second->GetBase();
- if (aura->GetCasterGUID() != m_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 = 53353; // 53353 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 = 53358; // 53358 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 = 53359; // 53359 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)
- m_caster->CastCustomSpell(unitTarget, spellId, &basePoint, 0, 0, false);
- return;
- }
- // Master's Call
- case 53271:
- {
- if (m_caster->GetTypeId() != TYPEID_PLAYER)
- return;
-
- if (Pet *PlrPet = m_caster->ToPlayer()->GetPet())
- m_caster->CastSpell(PlrPet, 62305, true);
- return;
- }
- default:
- break;
- }
- break;
- }
case SPELLFAMILY_PALADIN:
{
// Judgement (seal trigger)
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp
index db1f3facb62..4e4557801b9 100644
--- a/src/server/game/Spells/SpellScript.cpp
+++ b/src/server/game/Spells/SpellScript.cpp
@@ -241,3 +241,13 @@ int32 SpellScript::GetEffectValue()
{
return m_spell->damage;
}
+
+Item * SpellScript::GetCastItem()
+{
+ return m_spell->m_CastItem;
+}
+
+void SpellScript::CreateItem(uint32 effIndex, uint32 itemId)
+{
+ m_spell->DoCreateItem(effIndex, itemId);
+}
diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h
index f1e8b177ef8..090318f696d 100644
--- a/src/server/game/Spells/SpellScript.h
+++ b/src/server/game/Spells/SpellScript.h
@@ -155,6 +155,12 @@ class SpellScript : public _SpellScript
// method avalible only in EffectHandler method
int32 GetEffectValue();
+
+ // returns: cast item if present.
+ Item * GetCastItem();
+
+ // Creates item. Calls Spell::DoCreateItem method.
+ void CreateItem(uint32 effIndex, uint32 itemId);
};
// SpellScript interface
//
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();
}