Misc: Reorder scripts in some script files and some cosmetic stuff

This commit is contained in:
joschiwald committed 2013-01-11 04:18:02 +01:00
1 parent ddea01290c
commit 0c16b95905
4 files changed
+957 -942

No files matched your search

+212 -209
View File
@@ -28,13 +28,13 @@
enum RogueSpells
{
ROGUE_SPELL_SHIV_TRIGGERED = 5940,
ROGUE_SPELL_GLYPH_OF_PREPARATION = 56819,
ROGUE_SPELL_PREY_ON_THE_WEAK = 58670,
ROGUE_SPELL_CHEAT_DEATH_COOLDOWN = 31231,
SPELL_ROGUE_CHEAT_DEATH_COOLDOWN = 31231,
SPELL_ROGUE_GLYPH_OF_PREPARATION = 56819,
SPELL_ROGUE_PREY_ON_THE_WEAK = 58670,
SPELL_ROGUE_SHIV_TRIGGERED = 5940,
};
// Cheat Death
// -31228 - Cheat Death
class spell_rog_cheat_death : public SpellScriptLoader
{
public:
@@ -46,9 +46,9 @@ class spell_rog_cheat_death : public SpellScriptLoader
uint32 absorbChance;
bool Validate(SpellInfo const* /*spellEntry*/)
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_CHEAT_DEATH_COOLDOWN))
if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN))
return false;
return true;
}
@@ -68,11 +68,11 @@ class spell_rog_cheat_death : public SpellScriptLoader
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
Player* target = GetTarget()->ToPlayer();
if (dmgInfo.GetDamage() < target->GetHealth() || target->HasSpellCooldown(ROGUE_SPELL_CHEAT_DEATH_COOLDOWN) || !roll_chance_i(absorbChance))
if (dmgInfo.GetDamage() < target->GetHealth() || target->HasSpellCooldown(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN) || !roll_chance_i(absorbChance))
return;
target->CastSpell(target, ROGUE_SPELL_CHEAT_DEATH_COOLDOWN, true);
target->AddSpellCooldown(ROGUE_SPELL_CHEAT_DEATH_COOLDOWN, 0, time(NULL) + 60);
target->CastSpell(target, SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, true);
target->AddSpellCooldown(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, 0, time(NULL) + 60);
uint32 health10 = target->CountPctFromMaxHealth(10);
@@ -97,203 +97,7 @@ class spell_rog_cheat_death : public SpellScriptLoader
}
};
// 31130 - Nerves of Steel
class spell_rog_nerves_of_steel : public SpellScriptLoader
{
public:
spell_rog_nerves_of_steel() : SpellScriptLoader("spell_rog_nerves_of_steel") { }
class spell_rog_nerves_of_steel_AuraScript : public AuraScript
{
PrepareAuraScript(spell_rog_nerves_of_steel_AuraScript);
uint32 absorbPct;
bool Load()
{
absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster());
return true;
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
{
// Set absorbtion amount to unlimited
amount = -1;
}
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
// reduces all damage taken while stun or fear
if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)))
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_rog_nerves_of_steel_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
OnEffectAbsorb += AuraEffectAbsorbFn(spell_rog_nerves_of_steel_AuraScript::Absorb, EFFECT_0);
}
};
AuraScript* GetAuraScript() const
{
return new spell_rog_nerves_of_steel_AuraScript();
}
};
class spell_rog_preparation : public SpellScriptLoader
{
public:
spell_rog_preparation() : SpellScriptLoader("spell_rog_preparation") { }
class spell_rog_preparation_SpellScript : public SpellScript
{
PrepareSpellScript(spell_rog_preparation_SpellScript);
bool Load()
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_GLYPH_OF_PREPARATION))
return false;
return true;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Player* caster = GetCaster()->ToPlayer();
//immediately finishes the cooldown on certain Rogue abilities
const SpellCooldowns& cm = caster->GetSpellCooldownMap();
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE)
{
if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_COLDB_SHADOWSTEP || // Cold Blood, Shadowstep
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_VAN_EVAS_SPRINT) // Vanish, Evasion, Sprint
caster->RemoveSpellCooldown((itr++)->first, true);
else if (caster->HasAura(ROGUE_SPELL_GLYPH_OF_PREPARATION))
{
if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_DISMANTLE || // Dismantle
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_KICK || // Kick
(spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_BLADE_FLURRY && // Blade Flurry
spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_BLADE_FLURRY))
caster->RemoveSpellCooldown((itr++)->first, true);
else
++itr;
}
else
++itr;
}
else
++itr;
}
}
void Register()
{
// add dummy effect spell handler to Preparation
OnEffectHitTarget += SpellEffectFn(spell_rog_preparation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_rog_preparation_SpellScript();
}
};
// 51685-51689 Prey on the Weak
class spell_rog_prey_on_the_weak : public SpellScriptLoader
{
public:
spell_rog_prey_on_the_weak() : SpellScriptLoader("spell_rog_prey_on_the_weak") { }
class spell_rog_prey_on_the_weak_AuraScript : public AuraScript
{
PrepareAuraScript(spell_rog_prey_on_the_weak_AuraScript);
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_PREY_ON_THE_WEAK))
return false;
return true;
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
Unit* target = GetTarget();
Unit* victim = target->getVictim();
if (victim && (target->GetHealthPct() > victim->GetHealthPct()))
{
if (!target->HasAura(ROGUE_SPELL_PREY_ON_THE_WEAK))
{
int32 bp = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
target->CastCustomSpell(target, ROGUE_SPELL_PREY_ON_THE_WEAK, &bp, 0, 0, true);
}
}
else
target->RemoveAurasDueToSpell(ROGUE_SPELL_PREY_ON_THE_WEAK);
}
void Register()
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_rog_prey_on_the_weak_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const
{
return new spell_rog_prey_on_the_weak_AuraScript();
}
};
class spell_rog_shiv : public SpellScriptLoader
{
public:
spell_rog_shiv() : SpellScriptLoader("spell_rog_shiv") { }
class spell_rog_shiv_SpellScript : public SpellScript
{
PrepareSpellScript(spell_rog_shiv_SpellScript);
bool Load()
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_SHIV_TRIGGERED))
return false;
return true;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (Unit* unitTarget = GetHitUnit())
caster->CastSpell(unitTarget, ROGUE_SPELL_SHIV_TRIGGERED, true);
}
void Register()
{
// add dummy effect spell handler to Shiv
OnEffectHitTarget += SpellEffectFn(spell_rog_shiv_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_rog_shiv_SpellScript();
}
};
// -2818 - Deadly Poison
class spell_rog_deadly_poison : public SpellScriptLoader
{
public:
@@ -387,6 +191,164 @@ class spell_rog_deadly_poison : public SpellScriptLoader
}
};
// -31130 - Nerves of Steel
class spell_rog_nerves_of_steel : public SpellScriptLoader
{
public:
spell_rog_nerves_of_steel() : SpellScriptLoader("spell_rog_nerves_of_steel") { }
class spell_rog_nerves_of_steel_AuraScript : public AuraScript
{
PrepareAuraScript(spell_rog_nerves_of_steel_AuraScript);
uint32 absorbPct;
bool Load()
{
absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster());
return true;
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
{
// Set absorbtion amount to unlimited
amount = -1;
}
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
// reduces all damage taken while stun or fear
if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)))
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_rog_nerves_of_steel_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
OnEffectAbsorb += AuraEffectAbsorbFn(spell_rog_nerves_of_steel_AuraScript::Absorb, EFFECT_0);
}
};
AuraScript* GetAuraScript() const
{
return new spell_rog_nerves_of_steel_AuraScript();
}
};
// 14185 - Preparation
class spell_rog_preparation : public SpellScriptLoader
{
public:
spell_rog_preparation() : SpellScriptLoader("spell_rog_preparation") { }
class spell_rog_preparation_SpellScript : public SpellScript
{
PrepareSpellScript(spell_rog_preparation_SpellScript);
bool Load()
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_GLYPH_OF_PREPARATION))
return false;
return true;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Player* caster = GetCaster()->ToPlayer();
//immediately finishes the cooldown on certain Rogue abilities
const SpellCooldowns& cm = caster->GetSpellCooldownMap();
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE)
{
if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_COLDB_SHADOWSTEP || // Cold Blood, Shadowstep
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_VAN_EVAS_SPRINT) // Vanish, Evasion, Sprint
caster->RemoveSpellCooldown((itr++)->first, true);
else if (caster->HasAura(SPELL_ROGUE_GLYPH_OF_PREPARATION))
{
if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_DISMANTLE || // Dismantle
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_KICK || // Kick
(spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_BLADE_FLURRY && // Blade Flurry
spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_BLADE_FLURRY))
caster->RemoveSpellCooldown((itr++)->first, true);
else
++itr;
}
else
++itr;
}
else
++itr;
}
}
void Register()
{
// add dummy effect spell handler to Preparation
OnEffectHitTarget += SpellEffectFn(spell_rog_preparation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_rog_preparation_SpellScript();
}
};
// -51685 - Prey on the Weak
class spell_rog_prey_on_the_weak : public SpellScriptLoader
{
public:
spell_rog_prey_on_the_weak() : SpellScriptLoader("spell_rog_prey_on_the_weak") { }
class spell_rog_prey_on_the_weak_AuraScript : public AuraScript
{
PrepareAuraScript(spell_rog_prey_on_the_weak_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_PREY_ON_THE_WEAK))
return false;
return true;
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
Unit* target = GetTarget();
Unit* victim = target->getVictim();
if (victim && (target->GetHealthPct() > victim->GetHealthPct()))
{
if (!target->HasAura(SPELL_ROGUE_PREY_ON_THE_WEAK))
{
int32 bp = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
target->CastCustomSpell(target, SPELL_ROGUE_PREY_ON_THE_WEAK, &bp, 0, 0, true);
}
}
else
target->RemoveAurasDueToSpell(SPELL_ROGUE_PREY_ON_THE_WEAK);
}
void Register()
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_rog_prey_on_the_weak_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const
{
return new spell_rog_prey_on_the_weak_AuraScript();
}
};
// 36554 - Shadowstep
class spell_rog_shadowstep : public SpellScriptLoader
{
public:
@@ -415,13 +377,54 @@ class spell_rog_shadowstep : public SpellScriptLoader
}
};
// 5938 - Shiv
class spell_rog_shiv : public SpellScriptLoader
{
public:
spell_rog_shiv() : SpellScriptLoader("spell_rog_shiv") { }
class spell_rog_shiv_SpellScript : public SpellScript
{
PrepareSpellScript(spell_rog_shiv_SpellScript);
bool Load()
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_SHIV_TRIGGERED))
return false;
return true;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (Unit* unitTarget = GetHitUnit())
caster->CastSpell(unitTarget, SPELL_ROGUE_SHIV_TRIGGERED, true);
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_rog_shiv_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_rog_shiv_SpellScript();
}
};
void AddSC_rogue_spell_scripts()
{
new spell_rog_cheat_death();
new spell_rog_deadly_poison();
new spell_rog_nerves_of_steel();
new spell_rog_preparation();
new spell_rog_prey_on_the_weak();
new spell_rog_shiv();
new spell_rog_deadly_poison();
new spell_rog_shadowstep();
new spell_rog_shiv();
}