TrinityCore
Loading...
Searching...
No Matches
harandar_chapter_1_of_craves_and_cradles.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 "Conversation.h"
19#include "ConversationAI.h"
20#include "CreatureAI.h"
21#include "CreatureAIImpl.h"
22#include "MotionMaster.h"
23#include "ObjectAccessor.h"
24#include "PhasingHandler.h"
25#include "Player.h"
26#include "ScriptMgr.h"
27#include "ScriptedCreature.h"
28#include "SpellAuras.h"
29#include "SpellScript.h"
30#include "TemporarySummon.h"
31
33{
34namespace Creatures
35{
36 static constexpr uint32 OrweynaFairbreezeVillage = 236704;
37 static constexpr uint32 HalduronFairbreezeVillage = 240715;
38 static constexpr uint32 OrweynaAmirdrassilRoots = 239522;
39 static constexpr uint32 HalduronAmirdrassilRoots = 237858;
40 static constexpr uint32 KupaalAmirdrassilRoots = 237209;
41}
42namespace Conversations
43{
44 namespace Actors
45 {
46 static constexpr uint32 OrweynaActorFairbreezeVillage = 105442;
47 static constexpr uint32 OrweynaActorAmirdrassilRoots = 105508;
48 static constexpr uint32 HalduronActorAmirdrassilRoots = 107891;
49 }
50 namespace Lines
51 {
52 static constexpr uint32 TheRootCauseStart = 78289;
53 }
54}
55namespace Paths
56{
57 static constexpr uint32 OrweynaStartPathToPortal = 23670400;
58 static constexpr uint32 HalduronStartPathToPortal = 24071500;
59 static constexpr uint32 OrweynaPathToHarathir = 23952201;
60 static constexpr uint32 HalduronPathToHarathir = 23785801;
61 static constexpr uint32 KupaalPathToHarathir = 23720900;
62}
63
64// 28444 - Conversation
66{
67public:
69
70 void OnCreate(Unit* creator) override
71 {
72 Creature* orweynaObject = creator->FindNearestCreatureWithOptions(30.0f, { .CreatureId = Creatures::OrweynaFairbreezeVillage, .IgnorePhases = true });
73 if (!orweynaObject)
74 return;
75
76 Creature* halduronObject = creator->FindNearestCreatureWithOptions(30.0f, { .CreatureId = Creatures::HalduronFairbreezeVillage, .IgnorePhases = true });
77 if (!halduronObject)
78 return;
79
80 TempSummon* orweynaClone = orweynaObject->SummonPersonalClone(orweynaObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
81 if (!orweynaClone)
82 return;
83
84 TempSummon* halduronClone = halduronObject->SummonPersonalClone(halduronObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
85 if (!halduronClone)
86 return;
87
89 halduronClone->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
90
93 }
94
95 void OnStart() override
96 {
98
100 {
101 if (Creature* orweynaClone = conversation->GetActorCreature(0))
102 orweynaClone->GetMotionMaster()->MovePath(Paths::OrweynaStartPathToPortal, false);
103
105
107 {
109 if (!player)
110 return;
111
112 Creature* halduronClone = player->FindNearestCreatureWithOptions(20.0f, { .CreatureId = Creatures::HalduronFairbreezeVillage, .IgnorePhases = true, .PrivateObjectOwnerGuid = player->GetGUID() });
113 if (!halduronClone)
114 return;
115
118 }
119};
120
121constexpr Position OrweynaCaveCloneSpawnPos = { -177.722f, -2148.79f, 1176.92f, 3.8025f };
122constexpr Position HalduronCaveCloneSpawnPos = { -174.458f, -2152.74f, 1177.08f, 1.10846f };
123
124// 29720 - Conversation
126{
127public:
129
130 void OnCreate(Unit* creator) override
131 {
132 Creature* orweynaObject = creator->FindNearestCreatureWithOptions(120.0f, { .CreatureId = Creatures::OrweynaAmirdrassilRoots, .StringId = "CloneTarget", .IgnorePhases = true });
133 if (!orweynaObject)
134 return;
135
136 Creature* halduronObject = creator->FindNearestCreatureWithOptions(120.0f, { .CreatureId = Creatures::HalduronAmirdrassilRoots, .StringId = "CloneTarget", .IgnorePhases = true });
137 if (!halduronObject)
138 return;
139
140 TempSummon* orweynaClone = orweynaObject->SummonPersonalClone(OrweynaCaveCloneSpawnPos, TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
141 if (!orweynaClone)
142 return;
143
144 TempSummon* halduronClone = halduronObject->SummonPersonalClone(HalduronCaveCloneSpawnPos, TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
145 if (!halduronClone)
146 return;
147
148 orweynaClone->SetScriptStringId("Cave");
149 halduronClone->SetScriptStringId("Cave");
151 orweynaClone->SetUninteractible(true);
152 halduronClone->SetUninteractible(true);
153
157 }
158};
159
160// 29598 - Conversation
162{
163public:
165
166 void OnCreate(Unit* creator) override
167 {
168 Creature* orweynaObject = creator->FindNearestCreatureWithOptions(20.0f, { .CreatureId = Creatures::OrweynaAmirdrassilRoots, .StringId = "CloneTarget", .IgnorePhases = true });
169 if (!orweynaObject)
170 return;
171
172 Creature* halduronObject = creator->FindNearestCreatureWithOptions(20.0f, { .CreatureId = Creatures::HalduronAmirdrassilRoots, .StringId = "CloneTarget", .IgnorePhases = true });
173 if (!halduronObject)
174 return;
175
176 Creature* kupaalObject = creator->FindNearestCreatureWithOptions(20.0f, { .CreatureId = Creatures::KupaalAmirdrassilRoots, .StringId = "CloneTarget", .IgnorePhases = true });
177 if (!halduronObject)
178 return;
179
180 TempSummon* orweynaClone = orweynaObject->SummonPersonalClone(orweynaObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
181 if (!orweynaClone)
182 return;
183
184 TempSummon* halduronClone = halduronObject->SummonPersonalClone(halduronObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
185 if (!halduronClone)
186 return;
187
188 TempSummon* kupaalClone = kupaalObject->SummonPersonalClone(kupaalObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
189 if (!orweynaClone)
190 return;
191
195 }
196
197 void OnStart() override
198 {
200 {
202 if (!player)
203 return;
204
205 Creature* halduronClone = player->FindNearestCreatureWithOptions(20.0f, { .CreatureId = Creatures::HalduronAmirdrassilRoots, .IgnorePhases = true, .PrivateObjectOwnerGuid = player->GetGUID() });
206 if (!halduronClone)
207 return;
208
209 if (Creature* orweynaClone = conversation->GetActorCreature(0))
210 orweynaClone->GetMotionMaster()->MovePath(Paths::OrweynaPathToHarathir, false, {}, {}, MovementWalkRunSpeedSelectionMode::Default, {}, {}, {}, {}, true, 1000ms);
211
212 if (Creature* kupaalClone = conversation->GetActorCreature(1))
213 kupaalClone->GetMotionMaster()->MovePath(Paths::KupaalPathToHarathir, false, {}, {}, MovementWalkRunSpeedSelectionMode::Default, {}, {}, {}, {}, true, 1000ms);
214
215 halduronClone->GetMotionMaster()->MovePath(Paths::HalduronPathToHarathir, false, {}, {}, MovementWalkRunSpeedSelectionMode::Default, {}, {}, {}, {}, true, 1000ms);
216
218 }
219};
220}
221
LocaleConstant
Definition Common.h:51
uint32_t uint32
Definition Define.h:154
@ TEMPSUMMON_MANUAL_DESPAWN
#define RegisterConversationAI(ai_name)
Definition ScriptMgr.h:1437
@ UNIT_NPC_FLAG_GOSSIP
@ UNIT_NPC_FLAG_QUESTGIVER
Creatures
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
Conversation *const conversation
ConversationAI(Conversation *c, uint32 scriptId={}) noexcept
Milliseconds GetLineEndTime(LocaleConstant locale, int32 lineId) const
void AddActor(int32 actorId, uint32 actorIdx, ObjectGuid const &actorGuid)
LocaleConstant GetPrivateObjectOwnerLocale() const
Milliseconds GetLastLineEndTime(LocaleConstant locale) const
Creature * GetActorCreature(uint32 actorIdx) const
void SetScriptStringId(std::string id)
void AddEvent(BasicEvent *event, Milliseconds e_time, bool set_addtime=true)
void MovePath(uint32 pathId, bool repeatable, Optional< Milliseconds > duration={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< std::pair< Milliseconds, Milliseconds > > waitTimeRangeAtPathEnd={}, Optional< float > wanderDistanceAtPathEnds={}, Optional< bool > followPathBackwardsFromEndToStart={}, Optional< bool > exactSplinePath={}, bool generatePath=true, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
Player * ToPlayer()
Definition Object.h:126
Definition Unit.h:647
MotionMaster * GetMotionMaster()
Definition Unit.h:1750
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:1013
void SetUninteractible(bool apply)
Definition Unit.cpp:8583
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:1426
Creature * FindNearestCreatureWithOptions(float range, FindCreatureOptions const &options) const
Definition Object.cpp:1531
ObjectGuid GetPrivateObjectOwner() const
Definition Object.h:569
EventProcessor m_Events
Definition Object.h:561
void AddSC_harandar_chapter_1_of_caves_and_cradles()
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
constexpr void GetPosition(float &x, float &y) const
Definition Position.h:92