diff options
| author | ariel- <ariel-@users.noreply.github.com> | 2017-12-15 00:14:55 -0300 |
|---|---|---|
| committer | funjoker <funjoker109@gmail.com> | 2021-03-15 20:17:31 +0100 |
| commit | 44c8ccadd701c1a4bc0ce08ee53a7a7ba55289d4 (patch) | |
| tree | 51509fbe5b77c2b6abfadc53e4caf19c9ae71000 /src/server/game | |
| parent | d9b145615dd2bafe1ae74e6dc11c9b86a0fb6f28 (diff) | |
Core/Auras: periodics refactor part 5: ported periodic trigger spell auras to scripts
(cherry picked from commit a36e804ae4639be40be17282e6c79fad9a769517)
Diffstat (limited to 'src/server/game')
| -rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 267 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 39 |
2 files changed, 40 insertions, 266 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 544d3b95933..8132912170a 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -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) { diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 8c2c1f69853..f0d4d14bdd8 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -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) |
