Merge branch 'master' into 4.3.4

Conflicts:
	src/server/game/Battlegrounds/Battleground.cpp
	src/server/game/Battlegrounds/BattlegroundMgr.cpp
	src/server/game/Battlegrounds/BattlegroundMgr.h
	src/server/game/Battlegrounds/BattlegroundQueue.cpp
	src/server/game/DataStores/DBCfmt.h
	src/server/game/Guilds/Guild.cpp
	src/server/game/Handlers/BattleGroundHandler.cpp
	src/server/game/Handlers/BattlefieldHandler.cpp
	src/server/game/Handlers/GuildHandler.cpp
	src/server/game/Movement/Spline/MoveSplineInit.cpp
	src/server/game/Movement/Spline/MovementPacketBuilder.cpp
	src/server/game/Movement/Spline/MovementUtil.cpp
	src/server/game/Server/WorldSession.cpp
	src/server/game/Spells/Auras/SpellAuras.cpp
	src/server/game/Spells/Spell.cpp
	src/server/game/Spells/SpellEffects.cpp
	src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
	src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp
	src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp
	src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp
	src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp
	src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp
	src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp
	src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
	src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp
	src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp
	src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp
	src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp
	src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp
	src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp
	src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h
	src/server/scripts/EasternKingdoms/boss_kruul.cpp
	src/server/scripts/Kalimdor/zone_feralas.cpp
	src/server/scripts/Spells/spell_druid.cpp
	src/server/scripts/Spells/spell_mage.cpp
	src/server/scripts/Spells/spell_paladin.cpp
	src/server/scripts/Spells/spell_rogue.cpp
	src/server/scripts/Spells/spell_shaman.cpp
	src/server/scripts/Spells/spell_warlock.cpp
	src/server/scripts/Spells/spell_warrior.cpp
	src/server/shared/Packets/ByteBuffer.h
This commit is contained in:
Spp committed 2013-01-14 11:04:03 +01:00
commit d75222feca
486 files changed
+3261 -2604

No files matched your search

+440 -425
View File
@@ -29,28 +29,28 @@
enum PaladinSpells
{
PALADIN_SPELL_DIVINE_PLEA = 54428,
PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF = 67480,
SPELL_PALADIN_DIVINE_PLEA = 54428,
SPELL_PALADIN_BLESSING_OF_SANCTUARY_BUFF = 67480,
PALADIN_SPELL_HOLY_SHOCK_R1 = 20473,
PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE = 25912,
PALADIN_SPELL_HOLY_SHOCK_R1_HEALING = 25914,
SPELL_PALADIN_HOLY_SHOCK_R1 = 20473,
SPELL_PALADIN_HOLY_SHOCK_R1_DAMAGE = 25912,
SPELL_PALADIN_HOLY_SHOCK_R1_HEALING = 25914,
SPELL_BLESSING_OF_LOWER_CITY_DRUID = 37878,
SPELL_BLESSING_OF_LOWER_CITY_PALADIN = 37879,
SPELL_BLESSING_OF_LOWER_CITY_PRIEST = 37880,
SPELL_BLESSING_OF_LOWER_CITY_SHAMAN = 37881,
SPELL_PALADIN_BLESSING_OF_LOWER_CITY_DRUID = 37878,
SPELL_PALADIN_BLESSING_OF_LOWER_CITY_PALADIN = 37879,
SPELL_PALADIN_BLESSING_OF_LOWER_CITY_PRIEST = 37880,
SPELL_PALADIN_BLESSING_OF_LOWER_CITY_SHAMAN = 37881,
SPELL_DIVINE_STORM = 53385,
SPELL_DIVINE_STORM_DUMMY = 54171,
SPELL_DIVINE_STORM_HEAL = 54172,
SPELL_PALADIN_DIVINE_STORM = 53385,
SPELL_PALADIN_DIVINE_STORM_DUMMY = 54171,
SPELL_PALADIN_DIVINE_STORM_HEAL = 54172,
SPELL_FORBEARANCE = 25771,
SPELL_AVENGING_WRATH_MARKER = 61987,
SPELL_IMMUNE_SHIELD_MARKER = 61988,
SPELL_PALADIN_FORBEARANCE = 25771,
SPELL_PALADIN_AVENGING_WRATH_MARKER = 61987,
SPELL_PALADIN_IMMUNE_SHIELD_MARKER = 61988,
SPELL_HAND_OF_SACRIFICE = 6940,
SPELL_DIVINE_SACRIFICE = 64205,
SPELL_PALADIN_HAND_OF_SACRIFICE = 6940,
SPELL_PALADIN_DIVINE_SACRIFICE = 64205,
};
// 31850 - Ardent Defender
@@ -129,6 +129,7 @@ enum PaladinSpells
}
};*/
// 37877 - Blessing of Faith
class spell_pal_blessing_of_faith : public SpellScriptLoader
{
public:
@@ -138,9 +139,9 @@ class spell_pal_blessing_of_faith : public SpellScriptLoader
{
PrepareSpellScript(spell_pal_blessing_of_faith_SpellScript);
bool Validate(SpellInfo const* /*spellEntry*/)
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_DRUID) || !sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_PALADIN) || !sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_PRIEST) || !sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_SHAMAN))
if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_BLESSING_OF_LOWER_CITY_DRUID) || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_BLESSING_OF_LOWER_CITY_PALADIN) || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_BLESSING_OF_LOWER_CITY_PRIEST) || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_BLESSING_OF_LOWER_CITY_SHAMAN))
return false;
return true;
}
@@ -152,11 +153,20 @@ class spell_pal_blessing_of_faith : public SpellScriptLoader
uint32 spell_id = 0;
switch (unitTarget->getClass())
{
case CLASS_DRUID: spell_id = SPELL_BLESSING_OF_LOWER_CITY_DRUID; break;
case CLASS_PALADIN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PALADIN; break;
case CLASS_PRIEST: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PRIEST; break;
case CLASS_SHAMAN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_SHAMAN; break;
default: return; // ignore for non-healing classes
case CLASS_DRUID:
spell_id = SPELL_PALADIN_BLESSING_OF_LOWER_CITY_DRUID;
break;
case CLASS_PALADIN:
spell_id = SPELL_PALADIN_BLESSING_OF_LOWER_CITY_PALADIN;
break;
case CLASS_PRIEST:
spell_id = SPELL_PALADIN_BLESSING_OF_LOWER_CITY_PRIEST;
break;
case CLASS_SHAMAN:
spell_id = SPELL_PALADIN_BLESSING_OF_LOWER_CITY_SHAMAN;
break;
default:
return; // ignore for non-healing classes
}
Unit* caster = GetCaster();
caster->CastSpell(caster, spell_id, true);
@@ -165,7 +175,6 @@ class spell_pal_blessing_of_faith : public SpellScriptLoader
void Register()
{
// add dummy effect spell handler to Blessing of Faith
OnEffectHitTarget += SpellEffectFn(spell_pal_blessing_of_faith_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -187,9 +196,9 @@ class spell_pal_blessing_of_sanctuary : public SpellScriptLoader
{
PrepareAuraScript(spell_pal_blessing_of_sanctuary_AuraScript);
bool Validate(SpellInfo const* /*entry*/)
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF))
if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_BLESSING_OF_SANCTUARY_BUFF))
return false;
return true;
}
@@ -198,13 +207,13 @@ class spell_pal_blessing_of_sanctuary : public SpellScriptLoader
{
Unit* target = GetTarget();
if (Unit* caster = GetCaster())
caster->CastSpell(target, PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF, true);
caster->CastSpell(target, SPELL_PALADIN_BLESSING_OF_SANCTUARY_BUFF, true);
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
target->RemoveAura(PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF, GetCasterGUID());
target->RemoveAura(SPELL_PALADIN_BLESSING_OF_SANCTUARY_BUFF, GetCasterGUID());
}
void Register()
@@ -220,399 +229,7 @@ class spell_pal_blessing_of_sanctuary : public SpellScriptLoader
}
};
// 63521 Guarded by The Light
class spell_pal_guarded_by_the_light : public SpellScriptLoader
{
public:
spell_pal_guarded_by_the_light() : SpellScriptLoader("spell_pal_guarded_by_the_light") { }
class spell_pal_guarded_by_the_light_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_guarded_by_the_light_SpellScript);
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_DIVINE_PLEA))
return false;
return true;
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
// Divine Plea
if (Aura* aura = GetCaster()->GetAura(PALADIN_SPELL_DIVINE_PLEA))
aura->RefreshDuration();
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_pal_guarded_by_the_light_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const
{
return new spell_pal_guarded_by_the_light_SpellScript();
}
};
class spell_pal_holy_shock : public SpellScriptLoader
{
public:
spell_pal_holy_shock() : SpellScriptLoader("spell_pal_holy_shock") { }
class spell_pal_holy_shock_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_holy_shock_SpellScript);
bool Validate(SpellInfo const* spell)
{
if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_HOLY_SHOCK_R1))
return false;
// can't use other spell than holy shock due to spell_ranks dependency
if (sSpellMgr->GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != sSpellMgr->GetFirstSpellInChain(spell->Id))
return false;
uint8 rank = sSpellMgr->GetSpellRank(spell->Id);
if (!sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank, true) || !sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank, true))
return false;
return true;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (Unit* unitTarget = GetHitUnit())
{
uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
if (caster->IsFriendlyTo(unitTarget))
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank), true, 0);
else
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank), true, 0);
}
}
SpellCastResult CheckCast()
{
Unit* caster = GetCaster();
if (Unit* target = GetExplTargetUnit())
{
if (!caster->IsFriendlyTo(target))
{
if (!caster->IsValidAttackTarget(target))
return SPELL_FAILED_BAD_TARGETS;
if (!caster->isInFront(target))
return SPELL_FAILED_UNIT_NOT_INFRONT;
}
}
else
return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;
}
void Register()
{
// add dummy effect spell handler to Holy Shock
OnCheckCast += SpellCheckCastFn(spell_pal_holy_shock_SpellScript::CheckCast);
OnEffectHitTarget += SpellEffectFn(spell_pal_holy_shock_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_pal_holy_shock_SpellScript();
}
};
class spell_pal_judgement_of_command : public SpellScriptLoader
{
public:
spell_pal_judgement_of_command() : SpellScriptLoader("spell_pal_judgement_of_command") { }
class spell_pal_judgement_of_command_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_judgement_of_command_SpellScript)
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Unit* unitTarget = GetHitUnit())
if (SpellInfo const* spell_proto = sSpellMgr->GetSpellInfo(GetEffectValue()))
GetCaster()->CastSpell(unitTarget, spell_proto, true, NULL);
}
void Register()
{
// add dummy effect spell handler to Judgement of Command
OnEffectHitTarget += SpellEffectFn(spell_pal_judgement_of_command_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_pal_judgement_of_command_SpellScript();
}
};
class spell_pal_divine_storm : public SpellScriptLoader
{
public:
spell_pal_divine_storm() : SpellScriptLoader("spell_pal_divine_storm") { }
class spell_pal_divine_storm_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_divine_storm_SpellScript);
uint32 healPct;
bool Validate(SpellInfo const* /* spell */)
{
if (!sSpellMgr->GetSpellInfo(SPELL_DIVINE_STORM_DUMMY))
return false;
return true;
}
bool Load()
{
healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster());
return true;
}
void TriggerHeal()
{
Unit* caster = GetCaster();
caster->CastCustomSpell(SPELL_DIVINE_STORM_DUMMY, SPELLVALUE_BASE_POINT0, (GetHitDamage() * healPct) / 100, caster, true);
}
void Register()
{
AfterHit += SpellHitFn(spell_pal_divine_storm_SpellScript::TriggerHeal);
}
};
SpellScript* GetSpellScript() const
{
return new spell_pal_divine_storm_SpellScript();
}
};
class spell_pal_divine_storm_dummy : public SpellScriptLoader
{
public:
spell_pal_divine_storm_dummy() : SpellScriptLoader("spell_pal_divine_storm_dummy") { }
class spell_pal_divine_storm_dummy_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_divine_storm_dummy_SpellScript);
bool Validate(SpellInfo const* /* spell */)
{
if (!sSpellMgr->GetSpellInfo(SPELL_DIVINE_STORM_HEAL))
return false;
return true;
}
void CountTargets(std::list<WorldObject*>& targetList)
{
_targetCount = targetList.size();
}
void HandleDummy(SpellEffIndex /* effIndex */)
{
if (!_targetCount || ! GetHitUnit())
return;
int32 heal = GetEffectValue() / _targetCount;
GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_DIVINE_STORM_HEAL, &heal, NULL, NULL, true);
}
private:
uint32 _targetCount;
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_pal_divine_storm_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pal_divine_storm_dummy_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID);
}
};
SpellScript* GetSpellScript() const
{
return new spell_pal_divine_storm_dummy_SpellScript();
}
};
class spell_pal_lay_on_hands : public SpellScriptLoader
{
public:
spell_pal_lay_on_hands() : SpellScriptLoader("spell_pal_lay_on_hands") { }
class spell_pal_lay_on_hands_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_lay_on_hands_SpellScript);
bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_FORBEARANCE))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_AVENGING_WRATH_MARKER))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_IMMUNE_SHIELD_MARKER))
return false;
return true;
}
SpellCastResult CheckCast()
{
Unit* caster = GetCaster();
if (Unit* target = GetExplTargetUnit())
if (caster == target)
if (target->HasAura(SPELL_FORBEARANCE) || target->HasAura(SPELL_AVENGING_WRATH_MARKER) || target->HasAura(SPELL_IMMUNE_SHIELD_MARKER))
return SPELL_FAILED_TARGET_AURASTATE;
return SPELL_CAST_OK;
}
void HandleScript()
{
Unit* caster = GetCaster();
if (caster == GetHitUnit())
{
caster->CastSpell(caster, SPELL_FORBEARANCE, true);
caster->CastSpell(caster, SPELL_AVENGING_WRATH_MARKER, true);
caster->CastSpell(caster, SPELL_IMMUNE_SHIELD_MARKER, true);
}
}
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_pal_lay_on_hands_SpellScript::CheckCast);
AfterHit += SpellHitFn(spell_pal_lay_on_hands_SpellScript::HandleScript);
}
};
SpellScript* GetSpellScript() const
{
return new spell_pal_lay_on_hands_SpellScript();
}
};
class spell_pal_righteous_defense : public SpellScriptLoader
{
public:
spell_pal_righteous_defense() : SpellScriptLoader("spell_pal_righteous_defense") { }
class spell_pal_righteous_defense_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_righteous_defense_SpellScript);
SpellCastResult CheckCast()
{
Unit* caster = GetCaster();
if (caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_DONT_REPORT;
if (Unit* target = GetExplTargetUnit())
{
if (!target->IsFriendlyTo(caster) || target->getAttackers().empty())
return SPELL_FAILED_BAD_TARGETS;
}
else
return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;
}
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_pal_righteous_defense_SpellScript::CheckCast);
}
};
SpellScript* GetSpellScript() const
{
return new spell_pal_righteous_defense_SpellScript();
}
};
class spell_pal_exorcism_and_holy_wrath_damage : public SpellScriptLoader
{
public:
spell_pal_exorcism_and_holy_wrath_damage() : SpellScriptLoader("spell_pal_exorcism_and_holy_wrath_damage") { }
class spell_pal_exorcism_and_holy_wrath_damage_AuraScript : public AuraScript
{
PrepareAuraScript(spell_pal_exorcism_and_holy_wrath_damage_AuraScript);
void HandleEffectCalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod)
{
if (!spellMod)
{
spellMod = new SpellModifier(aurEff->GetBase());
spellMod->op = SPELLMOD_DAMAGE;
spellMod->type = SPELLMOD_FLAT;
spellMod->spellId = GetId();
spellMod->mask[1] = 0x200002;
}
spellMod->value = aurEff->GetAmount();
}
void Register()
{
DoEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_pal_exorcism_and_holy_wrath_damage_AuraScript::HandleEffectCalcSpellMod, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const
{
return new spell_pal_exorcism_and_holy_wrath_damage_AuraScript();
}
};
class spell_pal_hand_of_sacrifice : public SpellScriptLoader
{
public:
spell_pal_hand_of_sacrifice() : SpellScriptLoader("spell_pal_hand_of_sacrifice") { }
class spell_pal_hand_of_sacrifice_AuraScript : public AuraScript
{
PrepareAuraScript(spell_pal_hand_of_sacrifice_AuraScript);
int32 remainingAmount;
bool Load()
{
if (Unit* caster = GetCaster())
{
remainingAmount = caster->GetMaxHealth();
return true;
}
return false;
}
void Split(AuraEffect* /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & splitAmount)
{
remainingAmount -= splitAmount;
if (remainingAmount <= 0)
{
GetTarget()->RemoveAura(SPELL_HAND_OF_SACRIFICE);
}
}
void Register()
{
OnEffectSplit += AuraEffectSplitFn(spell_pal_hand_of_sacrifice_AuraScript::Split, EFFECT_0);
}
};
AuraScript* GetAuraScript() const
{
return new spell_pal_hand_of_sacrifice_AuraScript();
}
};
// 64205 - Divine Sacrifice
class spell_pal_divine_sacrifice : public SpellScriptLoader
{
public:
@@ -653,7 +270,7 @@ class spell_pal_divine_sacrifice : public SpellScriptLoader
// break when absorbed everything it could, or if the casters hp drops below 20%
if (Unit* caster = GetCaster())
if (remainingAmount <= 0 || (caster->GetHealthPct() < minHpPct))
caster->RemoveAura(SPELL_DIVINE_SACRIFICE);
caster->RemoveAura(SPELL_PALADIN_DIVINE_SACRIFICE);
}
void Register()
@@ -668,6 +285,406 @@ class spell_pal_divine_sacrifice : public SpellScriptLoader
}
};
// 53385 - Divine Storm
class spell_pal_divine_storm : public SpellScriptLoader
{
public:
spell_pal_divine_storm() : SpellScriptLoader("spell_pal_divine_storm") { }
class spell_pal_divine_storm_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_divine_storm_SpellScript);
uint32 healPct;
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_DIVINE_STORM_DUMMY))
return false;
return true;
}
bool Load()
{
healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster());
return true;
}
void TriggerHeal()
{
Unit* caster = GetCaster();
caster->CastCustomSpell(SPELL_PALADIN_DIVINE_STORM_DUMMY, SPELLVALUE_BASE_POINT0, (GetHitDamage() * healPct) / 100, caster, true);
}
void Register()
{
AfterHit += SpellHitFn(spell_pal_divine_storm_SpellScript::TriggerHeal);
}
};
SpellScript* GetSpellScript() const
{
return new spell_pal_divine_storm_SpellScript();
}
};
// 54171 - Divine Storm (Dummy)
class spell_pal_divine_storm_dummy : public SpellScriptLoader
{
public:
spell_pal_divine_storm_dummy() : SpellScriptLoader("spell_pal_divine_storm_dummy") { }
class spell_pal_divine_storm_dummy_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_divine_storm_dummy_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_DIVINE_STORM_HEAL))
return false;
return true;
}
void CountTargets(std::list<WorldObject*>& targetList)
{
_targetCount = targetList.size();
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (!_targetCount || ! GetHitUnit())
return;
int32 heal = GetEffectValue() / _targetCount;
GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_PALADIN_DIVINE_STORM_HEAL, &heal, NULL, NULL, true);
}
private:
uint32 _targetCount;
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_pal_divine_storm_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pal_divine_storm_dummy_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID);
}
};
SpellScript* GetSpellScript() const
{
return new spell_pal_divine_storm_dummy_SpellScript();
}
};
// 33695 - Exorcism and Holy Wrath Damage
class spell_pal_exorcism_and_holy_wrath_damage : public SpellScriptLoader
{
public:
spell_pal_exorcism_and_holy_wrath_damage() : SpellScriptLoader("spell_pal_exorcism_and_holy_wrath_damage") { }
class spell_pal_exorcism_and_holy_wrath_damage_AuraScript : public AuraScript
{
PrepareAuraScript(spell_pal_exorcism_and_holy_wrath_damage_AuraScript);
void HandleEffectCalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod)
{
if (!spellMod)
{
spellMod = new SpellModifier(aurEff->GetBase());
spellMod->op = SPELLMOD_DAMAGE;
spellMod->type = SPELLMOD_FLAT;
spellMod->spellId = GetId();
spellMod->mask[1] = 0x200002;
}
spellMod->value = aurEff->GetAmount();
}
void Register()
{
DoEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_pal_exorcism_and_holy_wrath_damage_AuraScript::HandleEffectCalcSpellMod, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const
{
return new spell_pal_exorcism_and_holy_wrath_damage_AuraScript();
}
};
// 63521 - Guarded by The Light
class spell_pal_guarded_by_the_light : public SpellScriptLoader
{
public:
spell_pal_guarded_by_the_light() : SpellScriptLoader("spell_pal_guarded_by_the_light") { }
class spell_pal_guarded_by_the_light_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_guarded_by_the_light_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_DIVINE_PLEA))
return false;
return true;
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
// Divine Plea
if (Aura* aura = GetCaster()->GetAura(SPELL_PALADIN_DIVINE_PLEA))
aura->RefreshDuration();
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_pal_guarded_by_the_light_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const
{
return new spell_pal_guarded_by_the_light_SpellScript();
}
};
// 6940 - Hand of Sacrifice
class spell_pal_hand_of_sacrifice : public SpellScriptLoader
{
public:
spell_pal_hand_of_sacrifice() : SpellScriptLoader("spell_pal_hand_of_sacrifice") { }
class spell_pal_hand_of_sacrifice_AuraScript : public AuraScript
{
PrepareAuraScript(spell_pal_hand_of_sacrifice_AuraScript);
int32 remainingAmount;
bool Load()
{
if (Unit* caster = GetCaster())
{
remainingAmount = caster->GetMaxHealth();
return true;
}
return false;
}
void Split(AuraEffect* /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & splitAmount)
{
remainingAmount -= splitAmount;
if (remainingAmount <= 0)
{
GetTarget()->RemoveAura(SPELL_PALADIN_HAND_OF_SACRIFICE);
}
}
void Register()
{
OnEffectSplit += AuraEffectSplitFn(spell_pal_hand_of_sacrifice_AuraScript::Split, EFFECT_0);
}
};
AuraScript* GetAuraScript() const
{
return new spell_pal_hand_of_sacrifice_AuraScript();
}
};
// -20473 - Holy Shock
class spell_pal_holy_shock : public SpellScriptLoader
{
public:
spell_pal_holy_shock() : SpellScriptLoader("spell_pal_holy_shock") { }
class spell_pal_holy_shock_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_holy_shock_SpellScript);
bool Validate(SpellInfo const* spell)
{
if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_HOLY_SHOCK_R1))
return false;
// can't use other spell than holy shock due to spell_ranks dependency
if (sSpellMgr->GetFirstSpellInChain(SPELL_PALADIN_HOLY_SHOCK_R1) != sSpellMgr->GetFirstSpellInChain(spell->Id))
return false;
uint8 rank = sSpellMgr->GetSpellRank(spell->Id);
if (!sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HOLY_SHOCK_R1_DAMAGE, rank, true) || !sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HOLY_SHOCK_R1_HEALING, rank, true))
return false;
return true;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (Unit* unitTarget = GetHitUnit())
{
uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
if (caster->IsFriendlyTo(unitTarget))
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HOLY_SHOCK_R1_HEALING, rank), true, 0);
else
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HOLY_SHOCK_R1_DAMAGE, rank), true, 0);
}
}
SpellCastResult CheckCast()
{
Unit* caster = GetCaster();
if (Unit* target = GetExplTargetUnit())
{
if (!caster->IsFriendlyTo(target))
{
if (!caster->IsValidAttackTarget(target))
return SPELL_FAILED_BAD_TARGETS;
if (!caster->isInFront(target))
return SPELL_FAILED_UNIT_NOT_INFRONT;
}
}
else
return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;
}
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_pal_holy_shock_SpellScript::CheckCast);
OnEffectHitTarget += SpellEffectFn(spell_pal_holy_shock_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_pal_holy_shock_SpellScript();
}
};
// 20425 - Judgement of Command
class spell_pal_judgement_of_command : public SpellScriptLoader
{
public:
spell_pal_judgement_of_command() : SpellScriptLoader("spell_pal_judgement_of_command") { }
class spell_pal_judgement_of_command_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_judgement_of_command_SpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Unit* unitTarget = GetHitUnit())
if (SpellInfo const* spell_proto = sSpellMgr->GetSpellInfo(GetEffectValue()))
GetCaster()->CastSpell(unitTarget, spell_proto, true, NULL);
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_pal_judgement_of_command_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_pal_judgement_of_command_SpellScript();
}
};
// -633 - Lay on Hands
class spell_pal_lay_on_hands : public SpellScriptLoader
{
public:
spell_pal_lay_on_hands() : SpellScriptLoader("spell_pal_lay_on_hands") { }
class spell_pal_lay_on_hands_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_lay_on_hands_SpellScript);
bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_FORBEARANCE))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_AVENGING_WRATH_MARKER))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_IMMUNE_SHIELD_MARKER))
return false;
return true;
}
SpellCastResult CheckCast()
{
Unit* caster = GetCaster();
if (Unit* target = GetExplTargetUnit())
if (caster == target)
if (target->HasAura(SPELL_PALADIN_FORBEARANCE) || target->HasAura(SPELL_PALADIN_AVENGING_WRATH_MARKER) || target->HasAura(SPELL_PALADIN_IMMUNE_SHIELD_MARKER))
return SPELL_FAILED_TARGET_AURASTATE;
return SPELL_CAST_OK;
}
void HandleScript()
{
Unit* caster = GetCaster();
if (caster == GetHitUnit())
{
caster->CastSpell(caster, SPELL_PALADIN_FORBEARANCE, true);
caster->CastSpell(caster, SPELL_PALADIN_AVENGING_WRATH_MARKER, true);
caster->CastSpell(caster, SPELL_PALADIN_IMMUNE_SHIELD_MARKER, true);
}
}
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_pal_lay_on_hands_SpellScript::CheckCast);
AfterHit += SpellHitFn(spell_pal_lay_on_hands_SpellScript::HandleScript);
}
};
SpellScript* GetSpellScript() const
{
return new spell_pal_lay_on_hands_SpellScript();
}
};
// 31789 - Righteous Defense
class spell_pal_righteous_defense : public SpellScriptLoader
{
public:
spell_pal_righteous_defense() : SpellScriptLoader("spell_pal_righteous_defense") { }
class spell_pal_righteous_defense_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_righteous_defense_SpellScript);
SpellCastResult CheckCast()
{
Unit* caster = GetCaster();
if (caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_DONT_REPORT;
if (Unit* target = GetExplTargetUnit())
{
if (!target->IsFriendlyTo(caster) || target->getAttackers().empty())
return SPELL_FAILED_BAD_TARGETS;
}
else
return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;
}
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_pal_righteous_defense_SpellScript::CheckCast);
}
};
SpellScript* GetSpellScript() const
{
return new spell_pal_righteous_defense_SpellScript();
}
};
class spell_pal_sacred_shield : public SpellScriptLoader
{
public:
@@ -712,8 +729,6 @@ void AddSC_paladin_spell_scripts()
new spell_pal_hand_of_sacrifice();
new spell_pal_holy_shock();
new spell_pal_judgement_of_command();
new spell_pal_divine_storm();
new spell_pal_divine_storm_dummy();
new spell_pal_lay_on_hands();
new spell_pal_righteous_defense();
new spell_pal_sacred_shield();