Scripts/Stormwind: Implement RP Event for quest "Ancient Curses" (#29780)

This commit is contained in:
Naddley
2024-03-25 23:19:05 +01:00
committed by GitHub
parent 28c9474337
commit ee0858d859
2 changed files with 272 additions and 0 deletions

View File

@@ -325,14 +325,186 @@ class spell_kultiras_skip_intro : public SpellScript
}
};
enum AncientCursesData
{
QUEST_ANCIENT_CURSES = 75891,
NPC_ARKONARIN_STARSHADE = 207353,
NPC_LYSANDER_STARSHADE = 202700,
DISPLAY_ID_STARSHADE_MOUNT = 63626,
CONVERSATION_ANCIENT_CURSES = 22025,
POINT_LYSANDER_STEP_TO_DOOR = 1,
PATH_ARKONARIN_WALK_TO_MOUNT_UP = 20735300,
PATH_ARKONARIN_FLY_TO_FELWOOD = 20735301,
PATH_LYSANDER_WALK_TO_MOUNT_UP = 20270001,
PATH_LYSANDER_FLY_TO_FELWOOD = 20270002
};
Position const LysanderWalkToTheDoor = { -8051.493f, 820.21704f, 68.30904f };
// 207353 - Arko'narin Starshade
struct npc_arkonarin_starshade_ancient_curses : public ScriptedAI
{
npc_arkonarin_starshade_ancient_curses(Creature* creature) : ScriptedAI(creature) { }
void OnQuestAccept(Player* player, Quest const* quest) override
{
if (quest->GetQuestId() == QUEST_ANCIENT_CURSES)
{
PhasingHandler::OnConditionChange(player);
Conversation::CreateConversation(CONVERSATION_ANCIENT_CURSES, player, *player, player->GetGUID(), nullptr, false);
}
}
void WaypointPathEnded(uint32 /*nodeId*/, uint32 pathId) override
{
if (pathId == PATH_ARKONARIN_WALK_TO_MOUNT_UP)
{
me->SetDisableGravity(true, true);
me->SetMountDisplayId(DISPLAY_ID_STARSHADE_MOUNT);
_scheduler.Schedule(2s + 500ms, [this](TaskContext /*context*/)
{
me->GetMotionMaster()->MovePath(PATH_ARKONARIN_FLY_TO_FELWOOD, false);
me->DespawnOrUnsummon(5s);
});
}
}
void UpdateAI(uint32 diff) override
{
_scheduler.Update(diff);
}
private:
TaskScheduler _scheduler;
};
// 202700 - Lysander Starshade
struct npc_lysande_starshade_ancient_curses : public ScriptedAI
{
npc_lysande_starshade_ancient_curses(Creature* creature) : ScriptedAI(creature) { }
void WaypointPathEnded(uint32 /*nodeId*/, uint32 pathId) override
{
if (pathId == PATH_LYSANDER_WALK_TO_MOUNT_UP)
{
me->SetDisableGravity(true, true);
me->SetMountDisplayId(DISPLAY_ID_STARSHADE_MOUNT);
_scheduler.Schedule(2s + 500ms, [this](TaskContext /*context*/)
{
me->GetMotionMaster()->MovePath(PATH_LYSANDER_FLY_TO_FELWOOD, false);
me->DespawnOrUnsummon(5s);
});
}
}
void UpdateAI(uint32 diff) override
{
_scheduler.Update(diff);
}
private:
TaskScheduler _scheduler;
};
// 22025 - Conversation
class conversation_quest_ancient_curses_accept : public ConversationScript
{
public:
conversation_quest_ancient_curses_accept() : ConversationScript("conversation_quest_ancient_curses_accept") { }
enum AncientCursesConversationEvents
{
EVENT_ARKONARIN_START_PATH = 1,
EVENT_LYSANDER_START_PATH = 2
};
enum AncientCursesConversationData
{
CONVO_LINE_ARKONARIN_START_PATH = 58685,
CONVO_LINE_LYSANDER_START_PATH = 60113,
};
void OnConversationCreate(Conversation* conversation, Unit* creator) override
{
Creature* arkonarinObject = GetClosestCreatureWithOptions(creator, 20.0f, { .CreatureId = NPC_ARKONARIN_STARSHADE, .IgnorePhases = true });
Creature* lysanderObject = GetClosestCreatureWithOptions(creator, 20.0f, { .CreatureId = NPC_LYSANDER_STARSHADE, .IgnorePhases = true });
if (!arkonarinObject || !lysanderObject)
return;
TempSummon* arkonarinClone = arkonarinObject->SummonPersonalClone(arkonarinObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
TempSummon* lysanderClone = lysanderObject->SummonPersonalClone(lysanderObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
if (!arkonarinClone || !lysanderClone)
return;
arkonarinClone->RemoveNpcFlag(NPCFlags(UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER));
lysanderClone->RemoveNpcFlag(NPCFlags(UNIT_NPC_FLAG_GOSSIP));
lysanderClone->SetWalk(true);
lysanderClone->GetMotionMaster()->MovePoint(POINT_LYSANDER_STEP_TO_DOOR, LysanderWalkToTheDoor);
conversation->AddActor(CONVERSATION_ANCIENT_CURSES, 1, arkonarinClone->GetGUID());
conversation->AddActor(CONVERSATION_ANCIENT_CURSES, 2, lysanderClone->GetGUID());
conversation->Start();
}
void OnConversationStart(Conversation* conversation) override
{
LocaleConstant privateOwnerLocale = conversation->GetPrivateObjectOwnerLocale();
if (Milliseconds const* lysanderPathStartTime = conversation->GetLineStartTime(privateOwnerLocale, CONVO_LINE_ARKONARIN_START_PATH))
_events.ScheduleEvent(EVENT_ARKONARIN_START_PATH, *lysanderPathStartTime + 2s);
if (Milliseconds const* lysanderPathStartTime = conversation->GetLineStartTime(privateOwnerLocale, CONVO_LINE_LYSANDER_START_PATH))
_events.ScheduleEvent(EVENT_LYSANDER_START_PATH, *lysanderPathStartTime);
}
void OnConversationUpdate(Conversation* conversation, uint32 diff) override
{
_events.Update(diff);
switch (_events.ExecuteEvent())
{
case EVENT_ARKONARIN_START_PATH:
{
Creature* arkonarinClone = conversation->GetActorCreature(1);
if (!arkonarinClone)
break;
arkonarinClone->GetMotionMaster()->MovePath(PATH_ARKONARIN_WALK_TO_MOUNT_UP, false);
break;
}
case EVENT_LYSANDER_START_PATH:
{
Creature* lysanderClone = conversation->GetActorCreature(2);
if (!lysanderClone)
break;
lysanderClone->GetMotionMaster()->MovePath(PATH_LYSANDER_WALK_TO_MOUNT_UP, false);
break;
}
default:
break;
}
}
private:
EventMap _events;
};
void AddSC_stormwind_city()
{
// Creature
RegisterCreatureAI(npc_jaina_proudmoore_tides_of_war);
RegisterCreatureAI(npc_anduin_wrynn_nation_of_kultiras);
RegisterCreatureAI(npc_arkonarin_starshade_ancient_curses);
RegisterCreatureAI(npc_lysande_starshade_ancient_curses);
// Conversation
new conversation_start_council_tides_of_war();
new conversation_quest_ancient_curses_accept();
// PlayerScript
new player_conv_after_movie_tides_of_war();