mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-02 07:07:29 +01:00
Scripts/DK: Fixed Defender of Azeroth quest
* added graveyard in case someone wants to die there * added serverside spells to handle death gate usage properly (including bind points) * added SmartAI script to Mograine for Defender of Azeroth quest
This commit is contained in:
@@ -4023,6 +4023,96 @@ class spell_gen_impatient_mind : public AuraScript
|
||||
}
|
||||
};
|
||||
|
||||
enum DefenderOfAzerothData
|
||||
{
|
||||
SPELL_DEATH_GATE_TELEPORT_STORMWIND = 316999,
|
||||
SPELL_DEATH_GATE_TELEPORT_ORGRIMMAR = 317000,
|
||||
|
||||
QUEST_DEFENDER_OF_AZEROTH_ALLIANCE = 58902,
|
||||
QUEST_DEFENDER_OF_AZEROTH_HORDE = 58903,
|
||||
|
||||
NPC_NAZGRIM = 161706,
|
||||
NPC_TROLLBANE = 161707,
|
||||
NPC_WHITEMANE = 161708,
|
||||
NPC_MOGRAINE = 161709,
|
||||
};
|
||||
|
||||
struct BindLocation
|
||||
{
|
||||
BindLocation(uint32 mapId, float x, float y, float z, float o, uint32 areaId)
|
||||
: Loc(mapId, x, y, z, o), AreaId(areaId) { }
|
||||
WorldLocation Loc;
|
||||
uint32 AreaId;
|
||||
};
|
||||
|
||||
BindLocation const StormwindInnLoc(0, -8868.1f, 675.82f, 97.9f, 5.164778709411621093f, 5148);
|
||||
BindLocation const OrgrimmarInnLoc(1, 1573.18f, -4441.62f, 16.06f, 1.818284034729003906f, 8618);
|
||||
|
||||
class spell_defender_of_azeroth_death_gate_selector : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_defender_of_azeroth_death_gate_selector);
|
||||
|
||||
bool Validate(SpellInfo const* /*spell*/) override
|
||||
{
|
||||
return ValidateSpellInfo(
|
||||
{
|
||||
SPELL_DEATH_GATE_TELEPORT_STORMWIND,
|
||||
SPELL_DEATH_GATE_TELEPORT_ORGRIMMAR
|
||||
});
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Player* player = GetHitUnit()->ToPlayer();
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
if (player->GetQuestStatus(QUEST_DEFENDER_OF_AZEROTH_ALLIANCE) == QUEST_STATUS_NONE && player->GetQuestStatus(QUEST_DEFENDER_OF_AZEROTH_HORDE) == QUEST_STATUS_NONE)
|
||||
return;
|
||||
|
||||
BindLocation bindLoc = player->GetTeam() == ALLIANCE ? StormwindInnLoc : OrgrimmarInnLoc;
|
||||
player->SetHomebind(bindLoc.Loc, bindLoc.AreaId);
|
||||
player->SendBindPointUpdate();
|
||||
player->SendPlayerBound(player->GetGUID(), bindLoc.AreaId);
|
||||
|
||||
player->CastSpell(player, player->GetTeam() == ALLIANCE ? SPELL_DEATH_GATE_TELEPORT_STORMWIND : SPELL_DEATH_GATE_TELEPORT_ORGRIMMAR);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_defender_of_azeroth_death_gate_selector::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_defender_of_azeroth_speak_with_mograine : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_defender_of_azeroth_speak_with_mograine);
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (!GetCaster())
|
||||
return;
|
||||
|
||||
Player* player = GetCaster()->ToPlayer();
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
if (Creature* nazgrim = GetHitUnit()->FindNearestCreature(NPC_NAZGRIM, 10.0f))
|
||||
nazgrim->HandleEmoteCommand(EMOTE_ONESHOT_POINT, player);
|
||||
if (Creature* trollbane = GetHitUnit()->FindNearestCreature(NPC_TROLLBANE, 10.0f))
|
||||
trollbane->HandleEmoteCommand(EMOTE_ONESHOT_POINT, player);
|
||||
if (Creature* whitemane = GetHitUnit()->FindNearestCreature(NPC_WHITEMANE, 10.0f))
|
||||
whitemane->HandleEmoteCommand(EMOTE_ONESHOT_POINT, player);
|
||||
|
||||
// @TODO: spawntracking - show death gate for casting player
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_defender_of_azeroth_speak_with_mograine::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_generic_spell_scripts()
|
||||
{
|
||||
RegisterAuraScript(spell_gen_absorb0_hitlimit1);
|
||||
@@ -4142,4 +4232,6 @@ void AddSC_generic_spell_scripts()
|
||||
RegisterSpellScript(spell_gen_azgalor_rain_of_fire_hellfire_citadel);
|
||||
RegisterAuraScript(spell_gen_face_rage);
|
||||
RegisterAuraScript(spell_gen_impatient_mind);
|
||||
RegisterSpellScript(spell_defender_of_azeroth_death_gate_selector);
|
||||
RegisterSpellScript(spell_defender_of_azeroth_speak_with_mograine);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user