TrinityCore
Loading...
Searching...
No Matches
zone_ghostlands.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 "AreaTrigger.h"
19#include "AreaTriggerAI.h"
20#include "Containers.h"
21#include "Conversation.h"
22#include "ConversationAI.h"
23#include "CreatureAIImpl.h"
24#include "MotionMaster.h"
25#include "ObjectAccessor.h"
26#include "Player.h"
27#include "ScriptMgr.h"
28#include "ScriptedCreature.h"
29#include "TemporarySummon.h"
30
47
48// 6468 - Conversation
50{
51public:
53
54 void OnCreate(Unit* creator) override
55 {
56 Creature* highElfRanger = creator->FindNearestCreatureWithOptions(20.0f, { .CreatureId = NPC_SUMMONED_HIGH_ELF_RANGER, .IgnorePhases = true, .OwnerGuid = creator->GetGUID() });
57 if (!highElfRanger)
58 return;
59
62 }
63};
64
65// 6478 - Conversation
66// 6635 - Conversation
67template<uint32 ConversationId>
69{
70public:
72
73 void OnStart() override
74 {
76 {
78 if (!player)
79 return;
80
81 Conversation::CreateConversation(ConversationId, player, *player, player->GetGUID(), nullptr, true);
83 }
84};
85
86// 6636 - Conversation
88{
89public:
91
92 static constexpr Position AlleriaMoveToBookPosition = { 7835.05f, -7913.11f, 308.2204f };
93
98
99 void OnCreate(Unit* creator) override
100 {
101 Creature* highElfRanger = creator->FindNearestCreatureWithOptions(20.0f, { .CreatureId = NPC_SUMMONED_HIGH_ELF_RANGER, .IgnorePhases = true, .OwnerGuid = creator->GetGUID() });
102 if (!highElfRanger)
103 return;
104
105 TempSummon* alleriaClone = highElfRanger->SummonPersonalClone(highElfRanger->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer()); // despawn on map change, quest remove, logout
106 if (!alleriaClone)
107 return;
108
110 }
111
123};
124
125// 6471 - Conversation
127{
128public:
130
131 static constexpr Position AlleriaOpenRiftPosition = { 7832.54f, -7913.34f, 308.2204f };
132
137
138 void OnCreate(Unit* creator) override
139 {
140 Creature* alleriaClone = creator->FindNearestCreatureWithOptions(20.0f, { .CreatureId = NPC_SUMMONED_HIGH_ELF_RANGER, .IgnorePhases = true, .PrivateObjectOwnerGuid = creator->GetGUID() });
141 if (!alleriaClone)
142 return;
143
146 }
147
148 void OnStart() override
149 {
151 {
152 Creature* alleriaClone = conversation->GetActorCreature(0);
153 if (!alleriaClone)
154 return;
155
157
159 }
160};
161
162// 100 - Ghostlands - Sanctum of the Moon
163// 101 - Ghostlands - Andilien Estate
164// 102 - Ghostlands - Dawnspair Spire
165// 103 - Ghostlands - Dawnspair Spire second floor
166template<uint32 QuestId, uint32 ConversationId>
168{
170
171 void OnUnitEnter(Unit* unit) override
172 {
173 Player* player = unit->ToPlayer();
174 if (!player || player->GetQuestStatus(QuestId) != QUEST_STATUS_INCOMPLETE)
175 return;
176
177 Conversation::CreateConversation(ConversationId, player, *player, player->GetGUID(), nullptr, true);
178 }
179};
180
@ TEMPSUMMON_MANUAL_DESPAWN
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:150
#define RegisterConversationAI(ai_name)
Definition ScriptMgr.h:1437
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
Conversation *const conversation
ConversationAI(Conversation *c, uint32 scriptId={}) noexcept
void AddActor(int32 actorId, uint32 actorIdx, ObjectGuid const &actorGuid)
LocaleConstant GetPrivateObjectOwnerLocale() const
static Conversation * CreateConversation(uint32 conversationEntry, Unit *creator, Position const &pos, ObjectGuid privateObjectOwner, SpellInfo const *spellInfo=nullptr, bool autoStart=true)
Milliseconds GetLastLineEndTime(LocaleConstant locale) const
Creature * GetActorCreature(uint32 actorIdx) const
void AddEvent(BasicEvent *event, Milliseconds e_time, bool set_addtime=true)
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={}, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
Player * ToPlayer()
Definition Object.h:126
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition Player.cpp:15962
Definition Unit.h:635
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
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
static constexpr Position AlleriaMoveToBookPosition
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
constexpr void GetPosition(float &x, float &y) const
Definition Position.h:92
at_ghostlands_conversation_to_ghostlands(AreaTrigger *areatrigger)
void AddSC_ghostlands()
ToGhostlandsData
@ CONVO_ANDILIEN_ESTATE_FOLLOWUP
@ NPC_SUMMONED_HIGH_ELF_RANGER
@ CONVO_ANDILIEN_ESTATE
@ QUEST_TO_GHOSTLANDS
@ CONVO_SANCTUM_OF_THE_MOON
@ CONVO_DAWNSPAIR_SPIRE
@ CONVO_DAWNSPAIR_SPIRE_UP
@ CONVO_SANCTUM_OF_THE_MOON_FOLLOWUP
@ CONVO_ACTOR_HIGH_ELF_RANGER
@ CONVO_DAWNSPAIR_SPIRE_FOLLOWUP