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}
39namespace Conversations
40{
41 namespace Actors
42 {
43 static constexpr uint32 OrweynaActorFairbreezeVillage = 105442;
44 }
45 namespace Lines
46 {
47 static constexpr uint32 TheRootCauseStart = 78289;
48 }
49}
50namespace Paths
51{
52 static constexpr uint32 OrweynaStartPathToPortal = 23670400;
53 static constexpr uint32 HalduronStartPathToPortal = 24071500;
54}
55
56// 28444 - Conversation
58{
59public:
61
62 void OnCreate(Unit* creator) override
63 {
64 Creature* orweynaObject = creator->FindNearestCreatureWithOptions(30.0f, { .CreatureId = Creatures::OrweynaFairbreezeVillage, .IgnorePhases = true });
65 if (!orweynaObject)
66 return;
67
68 Creature* halduronObject = creator->FindNearestCreatureWithOptions(30.0f, { .CreatureId = Creatures::HalduronFairbreezeVillage, .IgnorePhases = true });
69 if (!halduronObject)
70 return;
71
72 TempSummon* orweynaClone = orweynaObject->SummonPersonalClone(orweynaObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
73 if (!orweynaClone)
74 return;
75
76 TempSummon* halduronClone = halduronObject->SummonPersonalClone(halduronObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
77 if (!halduronClone)
78 return;
79
81 halduronClone->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
82
85 }
86
87 void OnStart() override
88 {
90
92 {
93 if (Creature* orweynaClone = conversation->GetActorCreature(0))
94 orweynaClone->GetMotionMaster()->MovePath(Paths::OrweynaStartPathToPortal, false);
95
97
99 {
101 if (!player)
102 return;
103
104 Creature* halduronClone = player->FindNearestCreatureWithOptions(20.0f, { .CreatureId = Creatures::HalduronFairbreezeVillage, .IgnorePhases = true, .PrivateObjectOwnerGuid = player->GetGUID() });
105 if (!halduronClone)
106 return;
107
110 }
111};
112}
113
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
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
Creature * GetActorCreature(uint32 actorIdx) const
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:635
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
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
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