Scripts/Spells: Portal to Orgrimmar & Portal to Stormwind

This commit is contained in:
Sorikoff
2019-06-21 10:54:59 +03:00
parent a8629eb6d1
commit a8055960ee
3 changed files with 33 additions and 14 deletions

View File

@@ -0,0 +1,4 @@
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_teleport_leaders_blessing');
INSERT INTO `spell_script_names` VALUES
(58418,'spell_teleport_leaders_blessing'),
(58420,'spell_teleport_leaders_blessing');

View File

@@ -3666,20 +3666,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
return;
}
case 58418: // Portal to Orgrimmar
case 58420: // Portal to Stormwind
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER || effIndex != 0)
return;
uint32 spellID = m_spellInfo->Effects[EFFECT_0].CalcValue();
uint32 questID = m_spellInfo->Effects[EFFECT_1].CalcValue();
if (unitTarget->ToPlayer()->GetQuestStatus(questID) == QUEST_STATUS_COMPLETE)
unitTarget->CastSpell(unitTarget, spellID, true);
return;
}
case 59317: // Teleporting
{

View File

@@ -1664,8 +1664,37 @@ public:
};
// 58418 - Portal to Orgrimmar
// 58420 - Portal to Stormwind
class spell_teleport_leaders_blessing : public SpellScript
{
PrepareSpellScript(spell_teleport_leaders_blessing);
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
void HandleScriptEffect(SpellEffIndex /* effIndex */)
{
Player* target = GetHitPlayer();
uint32 spellID = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
uint32 questID = GetSpellInfo()->Effects[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);
}