Core/Auras: periodics refactor part 5: ported periodic trigger spell auras to scripts

(cherry picked from commit a36e804ae4)
This commit is contained in:
ariel-
2017-12-15 00:14:55 -03:00
committed by funjoker
parent d9b145615d
commit 44c8ccadd7
12 changed files with 458 additions and 266 deletions

View File

@@ -0,0 +1,36 @@
-- UPDATE `spell_dbc` SET `EffectTriggerSpell1`=30571 WHERE `Id`=30576;
UPDATE `serverside_spell_effect` SET `EffectTriggerSpell`=30576 WHERE `SpellID`=30576 AND `EffectIndex`=0 AND `DifficultyID`=0;
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_gen_restoration','spell_gen_nitrous_boost','spell_kelthuzad_frost_blast','spell_inoculate_nestlewood','spell_item_extract_gas','spell_alar_flame_quills','spell_item_absorb_eye_of_grillok','spell_sha_t3_8p_bonus','spell_pursuing_spikes',/*'spell_sha_mana_tide',*/'spell_gen_negative_energy_periodic','spell_jormungars_slime_pool',/*'spell_pal_beacon_of_light',*/'spell_silithus_summon_cultist_periodic');
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(23493, 'spell_gen_restoration'),
(24379, 'spell_gen_restoration'),
(27746, 'spell_gen_nitrous_boost'),
(27808, 'spell_kelthuzad_frost_blast'),
(29528, 'spell_inoculate_nestlewood'),
(30427, 'spell_item_extract_gas'),
(34229, 'spell_alar_flame_quills'),
(38554, 'spell_item_absorb_eye_of_grillok'),
(28820, 'spell_sha_t3_8p_bonus'),
(65920, 'spell_pursuing_spikes'),
(65922, 'spell_pursuing_spikes'),
(65923, 'spell_pursuing_spikes'),
-- (16191, 'spell_sha_mana_tide'),
(46284, 'spell_gen_negative_energy_periodic'),
(66882, 'spell_jormungars_slime_pool'),
-- (53563, 'spell_pal_beacon_of_light'),
(24745, 'spell_silithus_summon_cultist_periodic'),
(24747, 'spell_silithus_summon_cultist_periodic'),
(24757, 'spell_silithus_summon_cultist_periodic'),
(24759, 'spell_silithus_summon_cultist_periodic'),
(24761, 'spell_silithus_summon_cultist_periodic'),
(24762, 'spell_silithus_summon_cultist_periodic'),
(24766, 'spell_silithus_summon_cultist_periodic'),
(24769, 'spell_silithus_summon_cultist_periodic'),
(24771, 'spell_silithus_summon_cultist_periodic'),
(24773, 'spell_silithus_summon_cultist_periodic'),
(24785, 'spell_silithus_summon_cultist_periodic'),
(24787, 'spell_silithus_summon_cultist_periodic'),
(24791, 'spell_silithus_summon_cultist_periodic'),
(24792, 'spell_silithus_summon_cultist_periodic'),
(24793, 'spell_silithus_summon_cultist_periodic'),
(46595, 'spell_silithus_summon_cultist_periodic');

View File

@@ -26,7 +26,6 @@
#include "GridNotifiersImpl.h"
#include "Item.h"
#include "Log.h"
#include "LootMgr.h"
#include "MiscPackets.h"
#include "MotionMaster.h"
#include "MovementPackets.h"
@@ -5068,272 +5067,8 @@ void AuraEffect::HandleMastery(AuraApplication const* aurApp, uint8 mode, bool /
void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) const
{
// generic casting code with custom spells and target/caster customs
uint32 triggerSpellId = GetSpellEffectInfo()->TriggerSpell;
SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId, GetBase()->GetCastDifficulty());
SpellInfo const* auraSpellInfo = GetSpellInfo();
uint32 auraId = auraSpellInfo->Id;
// specific code for cases with no trigger spell provided in field
if (triggeredSpellInfo == nullptr)
{
switch (auraSpellInfo->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
{
switch (auraId)
{
// Brood Affliction: Bronze
case 23170:
triggerSpellId = 23171;
break;
// Restoration
case 24379:
case 23493:
{
if (caster)
{
int32 heal = caster->CountPctFromMaxHealth(10);
HealInfo healInfo(caster, target, heal, auraSpellInfo, auraSpellInfo->GetSchoolMask());
caster->HealBySpell(healInfo);
/// @todo: should proc other auras?
if (int32 mana = caster->GetMaxPower(POWER_MANA))
{
mana /= 10;
caster->EnergizeBySpell(caster, 23493, mana, POWER_MANA);
}
}
return;
}
// Nitrous Boost
case 27746:
if (caster && target->GetPower(POWER_MANA) >= 10)
{
target->ModifyPower(POWER_MANA, -10);
target->SendEnergizeSpellLog(caster, 27746, 10, 0, POWER_MANA);
}
else
target->RemoveAurasDueToSpell(27746);
return;
// Frost Blast
case 27808:
if (caster)
caster->CastCustomSpell(29879, SPELLVALUE_BASE_POINT0, int32(target->CountPctFromMaxHealth(21)), target, true, nullptr, this);
return;
// Inoculate Nestlewood Owlkin
case 29528:
if (target->GetTypeId() != TYPEID_UNIT) // prevent error reports in case ignored player target
return;
break;
// Feed Captured Animal
case 29917:
triggerSpellId = 29916;
break;
// Extract Gas
case 30427:
{
// move loot to player inventory and despawn target
if (caster && caster->GetTypeId() == TYPEID_PLAYER &&
target->GetTypeId() == TYPEID_UNIT &&
target->ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_GAS_CLOUD)
{
Player* player = caster->ToPlayer();
Creature* creature = target->ToCreature();
// missing lootid has been reported on startup - just return
if (!creature->GetCreatureTemplate()->SkinLootId)
return;
player->AutoStoreLoot(creature->GetCreatureTemplate()->SkinLootId, LootTemplates_Skinning, ItemContext::NONE, true);
creature->DespawnOrUnsummon();
}
return;
}
// Quake
case 30576:
triggerSpellId = 30571;
break;
// Doom
/// @todo effect trigger spell may be independant on spell targets, and executed in spell finish phase
// so instakill will be naturally done before trigger spell
case 31347:
{
target->CastSpell(target, 31350, true, nullptr, this);
target->KillSelf();
return;
}
// Spellcloth
case 31373:
{
// Summon Elemental after create item
target->SummonCreature(17870, 0, 0, 0, target->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 0);
return;
}
// Flame Quills
case 34229:
{
// cast 24 spells 34269-34289, 34314-34316
for (uint32 spell_id = 34269; spell_id != 34290; ++spell_id)
target->CastSpell(target, spell_id, true, nullptr, this);
for (uint32 spell_id = 34314; spell_id != 34317; ++spell_id)
target->CastSpell(target, spell_id, true, nullptr, this);
return;
}
// Remote Toy
case 37027:
triggerSpellId = 37029;
break;
// Eye of Grillok
case 38495:
triggerSpellId = 38530;
break;
// Absorb Eye of Grillok (Zezzak's Shard)
case 38554:
{
if (!caster || target->GetTypeId() != TYPEID_UNIT)
return;
caster->CastSpell(caster, 38495, true, nullptr, this);
Creature* creatureTarget = target->ToCreature();
creatureTarget->DespawnOrUnsummon();
return;
}
// Tear of Azzinoth Summon Channel - it's not really supposed to do anything, and this only prevents the console spam
case 39857:
triggerSpellId = 39856;
break;
// Personalized Weather
case 46736:
triggerSpellId = 46737;
break;
}
break;
}
case SPELLFAMILY_SHAMAN:
{
switch (auraId)
{
// Lightning Shield (The Earthshatterer set trigger after cast Lighting Shield)
case 28820:
{
// Need remove self if Lightning Shield not active
if (!target->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, flag128(0x400, 0, 0)))
target->RemoveAurasDueToSpell(28820);
return;
}
// Totemic Mastery (Skyshatter Regalia (Shaman Tier 6) - bonus)
case 38443:
{
bool all = true;
for (int i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i)
{
if (!target->m_SummonSlot[i])
{
all = false;
break;
}
}
if (all)
target->CastSpell(target, 38437, true, nullptr, this);
else
target->RemoveAurasDueToSpell(38437);
return;
}
}
break;
}
default:
break;
}
}
else
{
// Spell exist but require custom code
switch (auraId)
{
// Pursuing Spikes (Anub'arak)
case 65920:
case 65922:
case 65923:
{
Unit* permafrostCaster = nullptr;
Aura* permafrostAura = target->GetAura(66193);
if (!permafrostAura)
permafrostAura = target->GetAura(67855);
if (!permafrostAura)
permafrostAura = target->GetAura(67856);
if (!permafrostAura)
permafrostAura = target->GetAura(67857);
if (permafrostAura)
permafrostCaster = permafrostAura->GetCaster();
if (permafrostCaster)
{
if (Creature* permafrostCasterCreature = permafrostCaster->ToCreature())
permafrostCasterCreature->DespawnOrUnsummon(3000);
target->CastSpell(target, 66181, false);
target->RemoveAllAuras();
if (Creature* targetCreature = target->ToCreature())
targetCreature->DisappearAndDie();
}
break;
}
// Mana Tide
case 16191:
target->CastCustomSpell(target, triggerSpellId, &m_amount, nullptr, nullptr, true, nullptr, this);
return;
// Negative Energy Periodic
case 46284:
target->CastCustomSpell(triggerSpellId, SPELLVALUE_MAX_TARGETS, _ticksDone / 10 + 1, nullptr, true, nullptr, this);
return;
// Slime Pool (Dreadscale & Acidmaw)
case 66882:
target->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, static_cast<int32>(((_ticksDone / 60.f) * 0.9f + 0.1f) * 10000.f * 2.f / 3.f), nullptr, true, nullptr, this);
return;
// Slime Spray - temporary here until preventing default effect works again
// added on 9.10.2010
case 69508:
{
if (caster)
caster->CastSpell(target, triggerSpellId, true, nullptr, nullptr, caster->GetGUID());
return;
}
case 24745: // Summon Templar, Trigger
case 24747: // Summon Templar Fire, Trigger
case 24757: // Summon Templar Air, Trigger
case 24759: // Summon Templar Earth, Trigger
case 24761: // Summon Templar Water, Trigger
case 24762: // Summon Duke, Trigger
case 24766: // Summon Duke Fire, Trigger
case 24769: // Summon Duke Air, Trigger
case 24771: // Summon Duke Earth, Trigger
case 24773: // Summon Duke Water, Trigger
case 24785: // Summon Royal, Trigger
case 24787: // Summon Royal Fire, Trigger
case 24791: // Summon Royal Air, Trigger
case 24792: // Summon Royal Earth, Trigger
case 24793: // Summon Royal Water, Trigger
{
// All this spells trigger a spell that requires reagents; if the
// triggered spell is cast as "triggered", reagents are not consumed
if (caster)
caster->CastSpell(target, triggerSpellId, false);
return;
}
}
}
// Reget trigger spell proto
triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId, GetBase()->GetCastDifficulty());
if (triggeredSpellInfo)
if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId, GetBase()->GetCastDifficulty()))
{
if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? caster : target)
{

View File

@@ -3244,6 +3244,45 @@ void SpellMgr::LoadSpellInfoCorrections()
});
}
// specific code for cases with no trigger spell provided in field
{
// Brood Affliction: Bronze
ApplySpellFix({ 23170 }, [](SpellInfo* spellInfo)
{
const_cast<SpellEffectInfo*>(spellInfo->GetEffect(EFFECT_0))->TriggerSpell = 23171;
});
// Feed Captured Animal
ApplySpellFix({ 29917 }, [](SpellInfo* spellInfo)
{
const_cast<SpellEffectInfo*>(spellInfo->GetEffect(EFFECT_0))->TriggerSpell = 29916;
});
// Remote Toy
ApplySpellFix({ 37027 }, [](SpellInfo* spellInfo)
{
const_cast<SpellEffectInfo*>(spellInfo->GetEffect(EFFECT_0))->TriggerSpell = 37029;
});
// Eye of Grillok
ApplySpellFix({ 38495 }, [](SpellInfo* spellInfo)
{
const_cast<SpellEffectInfo*>(spellInfo->GetEffect(EFFECT_0))->TriggerSpell = 38530;
});
// Tear of Azzinoth Summon Channel - it's not really supposed to do anything, and this only prevents the console spam
ApplySpellFix({ 39857 }, [](SpellInfo* spellInfo)
{
const_cast<SpellEffectInfo*>(spellInfo->GetEffect(EFFECT_0))->TriggerSpell = 39856;
});
// Personalized Weather
ApplySpellFix({ 46736 }, [](SpellInfo* spellInfo)
{
const_cast<SpellEffectInfo*>(spellInfo->GetEffect(EFFECT_1))->TriggerSpell = 46737;
});
}
ApplySpellFix({
63026, // Summon Aspirant Test NPC (HACK: Target shouldn't be changed)
63137 // Summon Valiant Test (HACK: Target shouldn't be changed; summon position should be untied from spell destination)

View File

@@ -716,6 +716,23 @@ public:
}
};
// 29528 - Inoculate Nestlewood Owlkin
class spell_inoculate_nestlewood : public AuraScript
{
PrepareAuraScript(spell_inoculate_nestlewood);
void PeriodicTick(AuraEffect const* /*aurEff*/)
{
if (GetTarget()->GetTypeId() != TYPEID_UNIT) // prevent error reports in case ignored player target
PreventDefaultAction();
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_inoculate_nestlewood::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
void AddSC_azuremyst_isle()
{
new npc_draenei_survivor();
@@ -724,4 +741,5 @@ void AddSC_azuremyst_isle()
new npc_magwin();
new npc_death_ravager();
new go_ravager_cage();
RegisterAuraScript(spell_inoculate_nestlewood);
}

View File

@@ -44,6 +44,7 @@ EndContentData */
#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "SpellAuraEffects.h"
#include "TemporarySummon.h"
/*#####
@@ -1385,6 +1386,47 @@ class go_wind_stone : public GameObjectScript
}
};
// 24745 - Summon Templar, Trigger
// 24747 - Summon Templar Fire, Trigger
// 24757 - Summon Templar Air, Trigger
// 24759 - Summon Templar Earth, Trigger
// 24761 - Summon Templar Water, Trigger
// 24762 - Summon Duke, Trigger
// 24766 - Summon Duke Fire, Trigger
// 24769 - Summon Duke Air, Trigger
// 24771 - Summon Duke Earth, Trigger
// 24773 - Summon Duke Water, Trigger
// 24785 - Summon Royal, Trigger
// 24787 - Summon Royal Fire, Trigger
// 24791 - Summon Royal Air, Trigger
// 24792 - Summon Royal Earth, Trigger
// 24793 - Summon Royal Water, Trigger
// 46595 - Summon Ice Stone Lieutenant, Trigger
class spell_silithus_summon_cultist_periodic : public AuraScript
{
PrepareAuraScript(spell_silithus_summon_cultist_periodic);
bool Validate(SpellInfo const* spellInfo) override
{
return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0)->TriggerSpell });
}
void PeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
// All these spells trigger a spell that requires reagents; if the
// triggered spell is cast as "triggered", reagents are not consumed
if (Unit* caster = GetCaster())
caster->CastSpell(nullptr, GetSpellInfo()->GetEffect(aurEff->GetEffIndex())->TriggerSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST), nullptr, aurEff);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_silithus_summon_cultist_periodic::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
void AddSC_silithus()
{
new go_crystalline_tear();
@@ -1392,4 +1434,5 @@ void AddSC_silithus()
new npc_anachronos_the_ancient();
new npc_qiraj_war_spawn();
new go_wind_stone();
RegisterAuraScript(spell_silithus_summon_cultist_periodic);
}

View File

@@ -830,6 +830,49 @@ class npc_anubarak_spike : public CreatureScript
};
};
// 65920 - Pursuing Spikes
// 65922 - Pursuing Spikes
// 65923 - Pursuing Spikes
class spell_pursuing_spikes : public AuraScript
{
PrepareAuraScript(spell_pursuing_spikes);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_PERMAFROST, SPELL_SPIKE_FAIL });
}
bool Load() override
{
return InstanceHasScript(GetUnitOwner(), ToCrScriptName);
}
void PeriodicTick(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
Unit* permafrostCaster = nullptr;
if (Aura* permafrostAura = GetTarget()->GetAura(SPELL_PERMAFROST))
permafrostCaster = permafrostAura->GetCaster();
if (permafrostCaster)
{
if (Creature* permafrostCasterCreature = permafrostCaster->ToCreature())
permafrostCasterCreature->DespawnOrUnsummon(3000);
GetTarget()->CastSpell(nullptr, SPELL_SPIKE_FAIL, false);
GetTarget()->RemoveAllAuras();
if (Creature* targetCreature = GetTarget()->ToCreature())
targetCreature->DisappearAndDie();
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_pursuing_spikes::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
class spell_impale : public SpellScriptLoader
{
public:
@@ -909,6 +952,7 @@ void AddSC_boss_anubarak_trial()
new npc_anubarak_spike();
new npc_frost_sphere();
RegisterAuraScript(spell_pursuing_spikes);
new spell_impale();
new spell_anubarak_leeching_swarm();
}

View File

@@ -1374,6 +1374,30 @@ public:
}
};
// 66882 - Slime Pool
class spell_jormungars_slime_pool : public AuraScript
{
PrepareAuraScript(spell_jormungars_slime_pool);
bool Validate(SpellInfo const* spellInfo) override
{
return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0)->TriggerSpell });
}
void PeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
int32 const radius = static_cast<int32>(((aurEff->GetTickNumber() / 60.f) * 0.9f + 0.1f) * 10000.f * 2.f / 3.f);
GetTarget()->CastCustomSpell(GetSpellInfo()->GetEffect(aurEff->GetEffIndex())->TriggerSpell, SPELLVALUE_RADIUS_MOD, radius, nullptr, true, nullptr, aurEff);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_jormungars_slime_pool::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
class spell_jormungars_snakes_spray : public SpellScriptLoader
{
public:
@@ -1460,6 +1484,7 @@ void AddSC_boss_northrend_beasts()
new boss_dreadscale();
new npc_slime_pool();
new spell_jormungars_paralytic_toxin();
RegisterAuraScript(spell_jormungars_slime_pool);
new spell_jormungars_snakes_spray("spell_jormungars_burning_spray", SPELL_BURNING_BILE);
new spell_jormungars_snakes_spray("spell_jormungars_paralytic_spray", SPELL_PARALYTIC_TOXIN);
new spell_jormungars_paralysis();

View File

@@ -94,6 +94,7 @@ enum Spells
SPELL_DETONATE_MANA = 27819,
SPELL_MANA_DETONATION_DAMAGE = 27820,
SPELL_FROST_BLAST = 27808,
SPELL_FROST_BLAST_DMG = 29879,
SPELL_CHAINS = 28410,
SPELL_CHAINS_DUMMY = 28408, // this holds the category cooldown - the main chains spell can't have one as it is cast multiple times
@@ -943,6 +944,31 @@ public:
}
};
// 27808 - Frost Blast
class spell_kelthuzad_frost_blast : public AuraScript
{
PrepareAuraScript(spell_kelthuzad_frost_blast);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_FROST_BLAST_DMG });
}
void PeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
// Stuns the target, dealing 26% of the target's maximum health in Frost damage every second for 4 sec.
if (Unit* caster = GetCaster())
caster->CastCustomSpell(SPELL_FROST_BLAST_DMG, SPELLVALUE_BASE_POINT0, int32(GetTarget()->CountPctFromMaxHealth(26)), GetTarget(), true, nullptr, aurEff);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_kelthuzad_frost_blast::PeriodicTick, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
class at_kelthuzad_center : public AreaTriggerScript
{
public:
@@ -995,6 +1021,7 @@ void AddSC_boss_kelthuzad()
new npc_kelthuzad_guardian();
new spell_kelthuzad_chains();
new spell_kelthuzad_detonate_mana();
RegisterAuraScript(spell_kelthuzad_frost_blast);
new at_kelthuzad_center();
new achievement_just_cant_get_enough();
}

View File

@@ -75,6 +75,34 @@ enum WaitEventType
WE_SUMMON = 10
};
uint32 const flameQuillsSpells[] =
{
34269,
34270,
34271,
34272,
34273,
34274,
34275,
34276,
34277,
34278,
34279,
34280,
34281,
34282,
34283,
34284,
34285,
34286,
34287,
34288,
34289,
34314,
34315,
34316
};
class boss_alar : public CreatureScript
{
public:
@@ -558,9 +586,40 @@ class npc_flame_patch_alar : public CreatureScript
}
};
// 34229 - Flame Quills
class spell_alar_flame_quills : public AuraScript
{
PrepareAuraScript(spell_alar_flame_quills);
bool Validate(SpellInfo const* /*spellInfo*/)
{
return ValidateSpellInfo(flameQuillsSpells);
}
bool Load() override
{
return InstanceHasScript(GetUnitOwner(), TheEyeScriptName);
}
void PeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
// cast 24 spells 34269-34289, 34314-34316
for (uint32 spellId : flameQuillsSpells)
GetTarget()->CastSpell(nullptr, spellId, true, nullptr, aurEff);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_alar_flame_quills::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
void AddSC_boss_alar()
{
new boss_alar();
new npc_ember_of_alar();
new npc_flame_patch_alar();
RegisterAuraScript(spell_alar_flame_quills);
}

View File

@@ -1791,6 +1791,29 @@ class spell_gen_moss_covered_feet : public AuraScript
}
};
// 46284 - Negative Energy Periodic
class spell_gen_negative_energy_periodic : public AuraScript
{
PrepareAuraScript(spell_gen_negative_energy_periodic);
bool Validate(SpellInfo const* spellInfo) override
{
return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0)->TriggerSpell });
}
void PeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
GetTarget()->CastCustomSpell(GetSpellInfo()->GetEffect(aurEff->GetEffIndex())->TriggerSpell, SPELLVALUE_MAX_TARGETS, aurEff->GetTickNumber() / 10 + 1, nullptr, true, nullptr, aurEff);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_negative_energy_periodic::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
enum Netherbloom : uint32
{
SPELL_NETHERBLOOM_POLLEN_1 = 28703
@@ -1872,6 +1895,27 @@ class spell_gen_nightmare_vine : public SpellScript
}
};
// 27746 - Nitrous Boost
class spell_gen_nitrous_boost : public AuraScript
{
PrepareAuraScript(spell_gen_nitrous_boost);
void PeriodicTick(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (GetCaster() && GetTarget()->GetPower(POWER_MANA) >= 10)
GetTarget()->ModifyPower(POWER_MANA, -10);
else
Remove();
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_nitrous_boost::PeriodicTick, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
enum ObsidianArmor
{
SPELL_GEN_OBSIDIAN_ARMOR_HOLY = 27536,
@@ -2264,6 +2308,38 @@ class spell_gen_remove_flight_auras : public SpellScript
}
};
// 23493 - Restoration
// 24379 - Restoration
class spell_gen_restoration : public AuraScript
{
PrepareAuraScript(spell_gen_restoration);
void PeriodicTick(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
Unit* caster = GetCaster();
if (!caster)
return;
int32 heal = caster->CountPctFromMaxHealth(10);
HealInfo healInfo(caster, GetTarget(), heal, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
caster->HealBySpell(healInfo);
/// @todo: should proc other auras?
if (int32 mana = caster->GetMaxPower(POWER_MANA))
{
mana /= 10;
caster->EnergizeBySpell(caster, GetId(), mana, POWER_MANA);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_restoration::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
// 38772 Grievous Wound
// 43937 Grievous Wound
// 62331 Impale
@@ -3819,8 +3895,10 @@ void AddSC_generic_spell_scripts()
new spell_gen_lifebloom("spell_faction_champion_dru_lifebloom", SPELL_FACTION_CHAMPIONS_DRU_LIFEBLOOM_FINAL_HEAL);
RegisterSpellScript(spell_gen_mounted_charge);
RegisterAuraScript(spell_gen_moss_covered_feet);
RegisterAuraScript(spell_gen_negative_energy_periodic);
RegisterSpellScript(spell_gen_netherbloom);
RegisterSpellScript(spell_gen_nightmare_vine);
RegisterAuraScript(spell_gen_nitrous_boost);
RegisterAuraScript(spell_gen_obsidian_armor);
RegisterSpellScript(spell_gen_oracle_wolvar_reputation);
RegisterSpellScript(spell_gen_orc_disguise);
@@ -3836,6 +3914,7 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_profession_research);
RegisterSpellScript(spell_gen_pvp_trinket);
RegisterSpellScript(spell_gen_remove_flight_auras);
RegisterAuraScript(spell_gen_restoration);
RegisterSpellAndAuraScriptPair(spell_gen_replenishment, spell_gen_replenishment_aura);
// Running Wild
RegisterSpellAndAuraScriptPair(spell_gen_running_wild, spell_gen_running_wild_aura);

View File

@@ -28,6 +28,7 @@
#include "DB2Stores.h"
#include "Item.h"
#include "Log.h"
#include "LootMgr.h"
#include "Map.h"
#include "ObjectMgr.h"
#include "Player.h"
@@ -109,6 +110,38 @@ class spell_item_aegis_of_preservation : public AuraScript
}
};
enum ZezzaksShard
{
SPELL_EYE_OF_GRILLOK = 38495
};
// 38554 - Absorb Eye of Grillok (31463: Zezzak's Shard)
class spell_item_absorb_eye_of_grillok : public AuraScript
{
PrepareAuraScript(spell_item_absorb_eye_of_grillok);
bool Validate(SpellInfo const* /*spellInfo*/)
{
return ValidateSpellInfo({ SPELL_EYE_OF_GRILLOK });
}
void PeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (!GetCaster() || GetTarget()->GetTypeId() != TYPEID_UNIT)
return;
GetCaster()->CastSpell(GetCaster(), SPELL_EYE_OF_GRILLOK, true, nullptr, aurEff);
GetTarget()->ToCreature()->DespawnOrUnsummon();
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_item_absorb_eye_of_grillok::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
enum AlchemistStone
{
SPELL_ALCHEMIST_STONE_EXTRA_HEAL = 21399,
@@ -758,6 +791,37 @@ class spell_item_echoes_of_light : public SpellScript
}
};
// 30427 - Extract Gas (23821: Zapthrottle Mote Extractor)
class spell_item_extract_gas : public AuraScript
{
PrepareAuraScript(spell_item_extract_gas);
void PeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
// move loot to player inventory and despawn target
if (GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER &&
GetTarget()->GetTypeId() == TYPEID_UNIT &&
GetTarget()->ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_GAS_CLOUD)
{
Player* player = GetCaster()->ToPlayer();
Creature* creature = GetTarget()->ToCreature();
// missing lootid has been reported on startup - just return
if (!creature->GetCreatureTemplate()->SkinLootId)
return;
player->AutoStoreLoot(creature->GetCreatureTemplate()->SkinLootId, LootTemplates_Skinning, ItemContext::NONE, true);
creature->DespawnOrUnsummon();
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_item_extract_gas::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
// 7434 - Fate Rune of Unsurpassed Vigor
enum FateRuneOfUnsurpassedVigor
{
@@ -3986,6 +4050,7 @@ void AddSC_item_spell_scripts()
new spell_item_trigger_spell("spell_item_mithril_mechanical_dragonling", SPELL_MITHRIL_MECHANICAL_DRAGONLING);
RegisterAuraScript(spell_item_aegis_of_preservation);
RegisterAuraScript(spell_item_absorb_eye_of_grillok);
RegisterAuraScript(spell_item_alchemist_stone);
new spell_item_anger_capacitor<8>("spell_item_tiny_abomination_in_a_jar");
new spell_item_anger_capacitor<7>("spell_item_tiny_abomination_in_a_jar_hero");
@@ -4005,6 +4070,7 @@ void AddSC_item_spell_scripts()
RegisterSpellScript(spell_item_deviate_fish);
RegisterAuraScript(spell_item_discerning_eye_beast_dummy);
RegisterSpellScript(spell_item_echoes_of_light);
RegisterAuraScript(spell_item_extract_gas);
RegisterAuraScript(spell_item_fate_rune_of_unsurpassed_vigor);
RegisterSpellScript(spell_item_flask_of_the_north);
RegisterAuraScript(spell_item_frozen_shadoweave);

View File

@@ -1036,6 +1036,26 @@ class spell_sha_t3_6p_bonus : public SpellScriptLoader
}
};
// 28820 - Lightning Shield
class spell_sha_t3_8p_bonus : public AuraScript
{
PrepareAuraScript(spell_sha_t3_8p_bonus);
void PeriodicTick(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
// Need remove self if Lightning Shield not active
if (!GetTarget()->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, flag128(0x400), GetCaster()->GetGUID()))
Remove();
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_sha_t3_8p_bonus::PeriodicTick, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
// 64928 - Item - Shaman T8 Elemental 4P Bonus
class spell_sha_t8_elemental_4p_bonus : public SpellScriptLoader
{
@@ -1282,6 +1302,7 @@ void AddSC_shaman_spell_scripts()
new spell_sha_path_of_flames_spread();
new spell_sha_tidal_waves();
new spell_sha_t3_6p_bonus();
RegisterAuraScript(spell_sha_t3_8p_bonus);
new spell_sha_t8_elemental_4p_bonus();
new spell_sha_t9_elemental_4p_bonus();
new spell_sha_t10_elemental_4p_bonus();