diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 16 | ||||
-rw-r--r-- | src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp | 36 |
2 files changed, 36 insertions, 16 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index f8b82477a67..a78d02d7666 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3233,22 +3233,6 @@ void Spell::EffectScriptEffect() return; } - case 58418: // Portal to Orgrimmar - case 58420: // Portal to Stormwind - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER || effectInfo->EffectIndex != 0) - return; - - // Effects for 58418 and 58420 are all DIFFICULTY_NONE so always valid - uint32 spellID = m_spellInfo->GetEffect(EFFECT_0).CalcValue(); - uint32 questID = m_spellInfo->GetEffect(EFFECT_1).CalcValue(); - - if (unitTarget->ToPlayer()->GetQuestStatus(questID) == QUEST_STATUS_COMPLETE) - unitTarget->CastSpell(unitTarget, spellID, CastSpellExtraArgs(TRIGGERED_FULL_MASK) - .SetOriginalCastId(m_castId)); - - return; - } case 62482: // Grab Crate { if (!unitCaster) diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index 8e8ca8837b1..e97cfd077d4 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -20,9 +20,12 @@ #include "Map.h" #include "MotionMaster.h" #include "ObjectAccessor.h" +#include "ObjectMgr.h" #include "Player.h" #include "ScriptedEscortAI.h" #include "ScriptedGossip.h" +#include "SpellInfo.h" +#include "SpellScript.h" #include "TemporarySummon.h" #define LESS_MOB // if you do not have a good server and do not want it to be laggy as hell @@ -1664,8 +1667,41 @@ public: }; +// 58418 - Portal to Orgrimmar +// 58420 - Portal to Stormwind +class spell_teleport_leaders_blessing : public SpellScript +{ + PrepareSpellScript(spell_teleport_leaders_blessing); + + bool Validate(SpellInfo const* spellInfo) override + { + return spellInfo->GetEffects().size() > EFFECT_1 + && ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_0).CalcValue()) }) + && sObjectMgr->GetQuestTemplate(spellInfo->GetEffect(EFFECT_1).CalcValue()) != nullptr; + } + + void HandleScriptEffect(SpellEffIndex /* effIndex */) + { + Player* target = GetHitPlayer(); + if (!target) + return; + + uint32 spellID = GetSpellInfo()->GetEffect(EFFECT_0).CalcValue(); + uint32 questID = GetSpellInfo()->GetEffect(EFFECT_1).CalcValue(); + + if (target->GetQuestStatus(questID) == QUEST_STATUS_COMPLETE) + target->CastSpell(target, spellID, true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_teleport_leaders_blessing::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + void AddSC_the_scarlet_enclave_c5() { new npc_highlord_darion_mograine(); new npc_the_lich_king_tirion_dawn(); + RegisterSpellScript(spell_teleport_leaders_blessing); } |