Skip to content

Instantly share code, notes, and snippets.

@BlackMetalz
Created November 4, 2020 02:11
Show Gist options
  • Save BlackMetalz/90f1b2750ddf8ed42ec68e66a6b8c3ce to your computer and use it in GitHub Desktop.
Save BlackMetalz/90f1b2750ddf8ed42ec68e66a6b8c3ce to your computer and use it in GitHub Desktop.
// Spark of Zandalar - 138957
class spell_item_proc_charges_for_strength_transform : public SpellScriptLoader
{
public:
spell_item_proc_charges_for_strength_transform() : SpellScriptLoader("spell_item_proc_charges_for_strength_transform") { }
enum SparkOfZandalar
{
SPARK_OF_ZANDALAR = 138958,
ZANDALARI_WARRIOR = 138960,
NORMAL_VERSION = 94526,
RAID_FINDER_VERSION = 95654,
THUNDERFOREGED_VERSION = 96026,
HEROIC_VERSION = 96398,
HEROIC_THUNDERFORGED_VERSION = 96770
};
class spell_item_proc_charges_for_strength_transform_AuraScript : public AuraScript
{
PrepareAuraScript(spell_item_proc_charges_for_strength_transform_AuraScript);
void OnProc(constAuraEffectPtr /*aurEff*/, ProcEventInfo& eventInfo)
{
Player* player = GetCaster()->ToPlayer();
if (player == nullptr)
return;
if (player->HasAura(ZANDALARI_WARRIOR) || player->HasSpellCooldown(ZANDALARI_WARRIOR))
return;
Item* spark = player->GetItemByEntry(NORMAL_VERSION);
if (!spark)
spark = player->GetItemByEntry(RAID_FINDER_VERSION);
if (!spark)
spark = player->GetItemByEntry(THUNDERFOREGED_VERSION);
if (!spark)
spark = player->GetItemByEntry(HEROIC_VERSION);
if (!spark)
spark = player->GetItemByEntry(HEROIC_THUNDERFORGED_VERSION);
auto _aura = player->GetAura(SPARK_OF_ZANDALAR);
if (_aura && _aura->GetStackAmount() >= 9)
{
_aura->Remove();
player->CastSpell(player, ZANDALARI_WARRIOR, true, spark);
player->RemoveAura(SPARK_OF_ZANDALAR, true);
}
else
{
player->CastSpell(player, SPARK_OF_ZANDALAR, true);
}
}
void Register()
{
OnEffectProc += AuraEffectProcFn(spell_item_proc_charges_for_strength_transform_AuraScript::OnProc, EFFECT_0, AuraType::SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const
{
return new spell_item_proc_charges_for_strength_transform_AuraScript();
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment