TrinityCore
Loading...
Searching...
No Matches
campaign_visions_of_a_shadowed_sun.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "Containers.h"
19#include "Conversation.h"
20#include "ConversationAI.h"
21#include "MotionMaster.h"
22#include "ObjectAccessor.h"
23#include "Player.h"
24#include "ScriptMgr.h"
25#include "ScriptedCreature.h"
26#include "ScriptedGossip.h"
27#include "TemporarySummon.h"
28
30{
31
32namespace Creatures
33{
34 static constexpr uint32 VereesaWindrunnerOztanIsle = 231042;
35 static constexpr uint32 AratorOztanIsle = 231039;
36 static constexpr uint32 SummonedSilverHandAvenger = 233329;
37}
38
39namespace Mounts
40{
41 static constexpr uint32 VereesaWindrunnerMount = 69274;
42 static constexpr uint32 AratorMount = 14584;
43}
44
45namespace Paths
46{
47 static constexpr uint32 VereesaOztanIslePath = 23104200;
48 static constexpr uint32 AratorOztanIslePath = 23103900;
49}
50
51namespace Actions
52{
53 static constexpr uint32 ActionSkipConversation = 1;
54}
55
56namespace Gossips
57{
58 namespace MenuIds
59 {
60 static constexpr uint32 GossipVereesaOztanIsle = 37102;
61 }
62
63 namespace Options
64 {
65 static constexpr uint32 OptionListenToVereesasTale = 0;
67 }
68}
69
70namespace Conversations
71{
72 namespace Ids
73 {
74 static constexpr uint32 ConversationVereesasTale = 27493;
75 }
76
77 namespace Actors
78 {
79 static constexpr uint32 VereesaActorOztanIsle = 102984;
80 static constexpr uint32 AratorActorOztanIsle = 102985;
81 static constexpr uint32 SummonedSilverHandAvenger = 103060;
82 }
83
84 namespace Lines
85 {
86 static constexpr uint32 VereesaOztanIsleSetFacing = 75392;
87 }
88}
89
90// 231042 - Vereesa Windrunner
92{
94
95 bool OnGossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override
96 {
98 {
99 CloseGossipMenuFor(player);
100
102 }
104 {
105 CloseGossipMenuFor(player);
106
108 if (!clone)
109 return true;
110
112 }
113 return true;
114 }
115};
116
117// 231042 - Vereesa Windrunner
119{
121
122 void DoAction(int32 action) override
123 {
125 {
126 Player* player = me->GetDemonCreatorPlayer();
127 if (!player)
128 return;
129
130 Creature* aratorObject = me->FindNearestCreatureWithOptions(10.0f, { .CreatureId = Creatures::AratorOztanIsle, .IgnorePhases = true });
131 if (!aratorObject)
132 return;
133
134 Creature* aratorClone = aratorObject->SummonPersonalClone(aratorObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, player);
135 if (!aratorClone)
136 return;
137
140
141 _scheduler.Schedule(1s, [this, aratorGuid = aratorClone->GetGUID()](TaskContext& task)
142 {
143 Creature* aratorClone = ObjectAccessor::GetCreature(*me, aratorGuid);
144 if (!aratorClone)
145 return;
146
147 me->SetMountDisplayId(Mounts::VereesaWindrunnerMount);
148 aratorClone->SetMountDisplayId(Mounts::AratorMount);
149 task.Schedule(2s, [this, aratorGuid](TaskContext const& /*task*/)
150 {
151 Creature* aratorClone = ObjectAccessor::GetCreature(*me, aratorGuid);
152 if (!aratorClone)
153 return;
154
155 me->GetMotionMaster()->MovePath(Paths::VereesaOztanIslePath, false);
156 aratorClone->GetMotionMaster()->MovePath(Paths::AratorOztanIslePath, false);
157 });
158 });
159 }
160 }
161
162 void WaypointPathEnded(uint32 /*nodeId*/, uint32 pathId) override
163 {
164 Player* player = me->GetDemonCreatorPlayer();
165 if (!player)
166 return;
167
168 if (pathId == Paths::VereesaOztanIslePath)
169 {
171 me->DespawnOrUnsummon();
172 }
173 }
174
175 void UpdateAI(uint32 diff) override
176 {
177 _scheduler.Update(diff);
178 }
179private:
181};
182
184{
185 if (creature->IsPrivateObject())
187 return new npc_vereesa_windrunner_oztan_isle(creature);
188}
189
190// 27493 - Conversation: Vereesas Tale
192{
193public:
195
196 void OnCreate(Unit* creator) override
197 {
198 Creature* vereesaObject = GetClosestCreatureWithOptions(creator, 10.0f, { .CreatureId = Creatures::VereesaWindrunnerOztanIsle, .IgnorePhases = true });
199 if (!vereesaObject)
200 return;
201
202 Creature* aratorObject = GetClosestCreatureWithOptions(creator, 10.0f, { .CreatureId = Creatures::AratorOztanIsle, .IgnorePhases = true });
203 if (!aratorObject)
204 return;
205
206 TempSummon* vereesaClone = vereesaObject->SummonPersonalClone(vereesaObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
207 if (!vereesaClone)
208 return;
209
210 TempSummon* aratorClone = aratorObject->SummonPersonalClone(aratorObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
211 if (!aratorClone)
212 return;
213
216
217 conversation->AddActor(Conversations::Actors::VereesaActorOztanIsle, 0, vereesaClone->GetGUID());
218 conversation->AddActor(Conversations::Actors::AratorActorOztanIsle, 1, aratorClone->GetGUID());
219 conversation->Start();
220 }
221
222 void OnStart() override
223 {
224 LocaleConstant privateOwnerLocale = conversation->GetPrivateObjectOwnerLocale();
225
226 conversation->m_Events.AddEvent([conversation = conversation]()
227 {
228 Player* player = ObjectAccessor::GetPlayer(*conversation, conversation->GetPrivateObjectOwner());
229 if (!player)
230 return;
231
232 if (Creature* vereesaClone = conversation->GetActorCreature(0))
233 vereesaClone->SetFacingToObject(player);
234
235 }, conversation->GetLineEndTime(privateOwnerLocale, Conversations::Lines::VereesaOztanIsleSetFacing));
236
237 conversation->m_Events.AddEvent([conversation = conversation]()
238 {
239 if (Creature* vereesaClone = conversation->GetActorCreature(0))
240 vereesaClone->SetMountDisplayId(Mounts::VereesaWindrunnerMount);
241
242 if (Creature* aratorClone = conversation->GetActorCreature(1))
243 aratorClone->SetMountDisplayId(Mounts::AratorMount);
244
245 }, conversation->GetLastLineEndTime(privateOwnerLocale));
246
247 conversation->m_Events.AddEvent([conversation = conversation]()
248 {
249 Player* player = ObjectAccessor::GetPlayer(*conversation, conversation->GetPrivateObjectOwner());
250 if (!player)
251 return;
252
253 if (Creature* vereesaClone = conversation->GetActorCreature(0))
254 vereesaClone->GetMotionMaster()->MovePath(Paths::VereesaOztanIslePath, false);
255
256 if (Creature* aratorClone = conversation->GetActorCreature(1))
257 aratorClone->GetMotionMaster()->MovePath(Paths::AratorOztanIslePath, false);
258
259 }, conversation->GetLastLineEndTime(privateOwnerLocale) + 2s);
260 }
261};
262
263// 28287 - Conversation: After Vereesas Ceremony
265{
266public:
268
269 void OnCreate(Unit* creator) override
270 {
271 Creature* summonedAvenger = creator->FindNearestCreatureWithOptions(20.0f, { .CreatureId = Creatures::SummonedSilverHandAvenger, .IgnorePhases = true, .OwnerGuid = creator->GetGUID() });
272 if (!summonedAvenger)
273 return;
274
275 conversation->AddActor(Conversations::Actors::SummonedSilverHandAvenger, 1, summonedAvenger->GetGUID());
276 conversation->Start();
277 }
278};
279}
280
LocaleConstant
Definition Common.h:51
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ TEMPSUMMON_MANUAL_DESPAWN
#define RegisterConversationAI(ai_name)
Definition ScriptMgr.h:1437
Creature * GetClosestCreatureWithOptions(WorldObject *source, float maxSearchRange, FindCreatureOptions const &options)
void CloseGossipMenuFor(Player *player)
NPCFlags
Non Player Character flags.
@ UNIT_NPC_FLAG_GOSSIP
@ UNIT_NPC_FLAG_QUESTGIVER
Creatures
void AddSC_campaign_visions_of_a_shadowed_sun()
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
ConversationAI(Conversation *c, uint32 scriptId={}) noexcept
static Conversation * CreateConversation(uint32 conversationEntry, Unit *creator, Position const &pos, ObjectGuid privateObjectOwner, SpellInfo const *spellInfo=nullptr, bool autoStart=true)
Creature *const me
Definition CreatureAI.h:63
CreatureAI * AI() const
Definition Creature.h:228
Player * ToPlayer()
Definition Object.h:126
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition Player.cpp:16679
TaskScheduler & Schedule(duration_t time, task_handler_t task)
virtual void DoAction(int32 param)
Definition UnitAI.h:73
Definition Unit.h:635
Player * GetDemonCreatorPlayer() const
Definition Unit.cpp:6197
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:998
TempSummon * SummonPersonalClone(Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, Player *privateObjectOwner=nullptr)
Definition Object.cpp:1421
Creature * FindNearestCreatureWithOptions(float range, FindCreatureOptions const &options) const
Definition Object.cpp:1526
bool IsPrivateObject() const
Definition Object.h:568
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
constexpr void GetPosition(float &x, float &y) const
Definition Position.h:92