TrinityCore
Loading...
Searching...
No Matches
drustvar_chapter_2_the_burden_of_proof.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 "CreatureAIImpl.h"
21#include "Locales.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 "SpellScript.h"
29#include "TemporarySummon.h"
30
44
45// 5665 - Conversation
47{
48public:
50
51 static constexpr Position BellaIntroSpawnPos = { -390.261f, 1360.479f, 21.509799f, 5.260458f };
52 static constexpr Position MarshalIntroSpawnPos = { -392.267f, 1356.739f, 22.34238f, 5.33823f };
53 static constexpr Position GuardOneIntroSpawnPos = { -402.040f, 1362.930f, 23.69840f, 5.30345f };
54 static constexpr Position GuardTwoIntroSpawnPos = { -398.108f, 1363.3499f, 22.9922f, 5.30345f };
55 static constexpr Position GuardThreeIntroSpawnPos = { -390.244f, 1365.810f, 22.76930f, 5.30345f };
56 static constexpr Position GuardFourIntroSpawnPos = { -386.5169f, 1368.359f, 22.89900f, 5.30345f };
57
62
64 {
65 if (Creature* creature = GetClosestCreatureWithOptions(creator, 50.0f, options))
66 return creature->SummonPersonalClone(position, TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
67 return nullptr;
68 }
69
70 void OnCreate(Unit* creator) override
71 {
72 if (TempSummon* marshalClone = SummonPersonalCloneFromClosestCreatureWithOptions(creator, { .CreatureId = NPC_STANDING_ACCUSED_MARSHAL, .IgnorePhases = true }, MarshalIntroSpawnPos))
73 {
74 marshalClone->GetMotionMaster()->MovePath(PATH_MARSHAL_EVERITE_READE_INTRO, false);
75
76 conversation->AddActor(CONVO_ACTOR_MARSHAL_EVERIT_READE, 2, marshalClone->GetGUID());
78 }
79
80 if (TempSummon* bellaClone = SummonPersonalCloneFromClosestCreatureWithOptions(creator, { .CreatureId = NPC_STANDING_ACCUESED_BELLA, .IgnorePhases = true }, BellaIntroSpawnPos))
81 bellaClone->GetMotionMaster()->MovePath(PATH_BELLA_INTRO, false);
82
83 if (TempSummon* guardClone = SummonPersonalCloneFromClosestCreatureWithOptions(creator, { .CreatureId = NPC_STANDING_ACCUSED_GUARD, .StringId = "GuardOne", .IgnorePhases = true }, GuardOneIntroSpawnPos))
84 guardClone->GetMotionMaster()->MovePath(PATH_WAYCREST_GUARD_ONE_INTRO, false);
85
86 if (TempSummon* guardClone = SummonPersonalCloneFromClosestCreatureWithOptions(creator, { .CreatureId = NPC_STANDING_ACCUSED_GUARD, .StringId = "GuardTwo", .IgnorePhases = true }, GuardTwoIntroSpawnPos))
87 guardClone->GetMotionMaster()->MovePath(PATH_WAYCREST_GUARD_TWO_INTRO, false);
88
89 if (TempSummon* guardClone = SummonPersonalCloneFromClosestCreatureWithOptions(creator, { .CreatureId = NPC_STANDING_ACCUSED_GUARD, .StringId = "GuardThree", .IgnorePhases = true }, GuardThreeIntroSpawnPos))
90 guardClone->GetMotionMaster()->MovePath(PATH_WAYCREST_GUARD_THREE_INTRO, false);
91
92 if (TempSummon* guardClone = SummonPersonalCloneFromClosestCreatureWithOptions(creator, { .CreatureId = NPC_STANDING_ACCUSED_GUARD, .StringId = "GuardFour", .IgnorePhases = true }, GuardFourIntroSpawnPos))
93 guardClone->GetMotionMaster()->MovePath(PATH_WAYCREST_GUARD_FOUR_INTRO, false);
94
96 }
97
98 void OnStart() override
99 {
101 {
102 if (Creature* marshalClone = conversation->GetActorCreature(2))
103 marshalClone->DespawnOrUnsummon();
104
106 }
107};
108
150
151// 5685 - Conversation
153{
154public:
156
157 void OnCreate(Unit* creator) override
158 {
159 Creature* constableObject = creator->FindNearestCreatureWithOptions(20.0f, { .CreatureId = NPC_CONSTABLE_HENRY_FRAMER, .IgnorePhases = true });
160 if (!constableObject)
161 return;
162
163 TempSummon* constableClone = constableObject->SummonPersonalClone(constableObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer());
164 if (!constableClone)
165 return;
166
167 constableClone->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
168
169 conversation->AddActor(CONVO_ACTOR_CONSTABLE, 0, constableClone->GetGUID());
171 }
172
173 void OnStart() override
174 {
176
178 {
179 if (Creature* constableClone = conversation->GetActorCreature(0))
180 constableClone->GetMotionMaster()->MovePath(PATH_CONSTABLE_START_TRIAL, false);
181
183
185 {
187 if (!player)
188 return;
189
190 Creature* constableClone = conversation->GetActorCreature(0);
191 if (!constableClone)
192 return;
193
195 constableClone->DespawnOrUnsummon();
196
197 }, conversation->GetLastLineEndTime(privateOwnerLocale));
198 }
199};
200
201// 250118 - Ping Lucille
203{
204 bool Validate(SpellInfo const* /*spellInfo*/) override
205 {
207 }
208
222
227};
228
229// 248808 - Cut Onions
247
248// 5694 - Conversation
249// 5695 - Conversation
250// 5696 - Conversation
252{
253public:
255
256 void SummonClones(Unit* creator)
257 {
258 if (Creature* constableObject = creator->FindNearestCreatureWithOptions(20.0f, { .CreatureId = NPC_CONSTABLE_HENRY_FRAMER, .IgnorePhases = true }))
259 {
260 if (TempSummon* constableClone = constableObject->SummonPersonalClone(constableObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer()))
261 {
262 _constableCloneGUID = constableClone->GetGUID();
263 constableClone->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
264 }
265 }
266
267 if (Creature* lucilleObject = creator->FindNearestCreatureWithOptions(20.0f, { .CreatureId = NPC_LUCILLE_WAYCREST, .IgnorePhases = true }))
268 {
269 if (TempSummon* lucilleClone = lucilleObject->SummonPersonalClone(lucilleObject->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN, 0s, 0, 0, creator->ToPlayer()))
270 {
271 _lucilleCloneGUID = lucilleClone->GetGUID();
272 lucilleClone->RemoveNpcFlag(UNIT_NPC_FLAG_SPELLCLICK);
273 }
274 }
275 }
276
277 void ScheduleEvents(uint32 pathId, int32 lineId, uint32 creditEntry) const
278 {
280
281 conversation->m_Events.AddEvent([this, pathId]()
282 {
283 if (Creature* constableClone = GetConstableClone())
284 constableClone->GetMotionMaster()->MovePath(pathId, false);
285
286 }, conversation->GetLineEndTime(privateOwnerLocale, lineId));
287
288 conversation->m_Events.AddEvent([this, creditEntry, conversation = conversation]()
289 {
291 if (!player)
292 return;
293
294 player->KilledMonsterCredit(creditEntry);
295
296 if (Creature* constableClone = GetConstableClone())
297 constableClone->DespawnOrUnsummon();
298
299 if (Creature* lucilleClone = GetLucilleClone())
300 lucilleClone->DespawnOrUnsummon();
301
302 }, conversation->GetLastLineEndTime(privateOwnerLocale));
303 }
304
309
314
315protected:
318};
319
320// 5694 - Conversation
322{
323public:
324 using conversation_burden_of_proof_base::conversation_burden_of_proof_base;
325
326 void OnCreate(Unit* creator) override
327 {
328 SummonClones(creator);
329
330 Creature* constableClone = GetConstableClone();
331 if (!constableClone)
332 return;
333
334 Creature* lucilleClone = GetLucilleClone();
335 if (!lucilleClone)
336 return;
337
339
340 conversation->AddActor(CONVO_ACTOR_CONSTABLE, 1, constableClone->GetGUID());
341 conversation->AddActor(CONVO_ACTOR_LUCILLE, 2, lucilleClone->GetGUID());
343 }
344
349};
350
351// 249108 - Release Bloodflies
369
370// 5695 - Conversation
372{
373public:
374 using conversation_burden_of_proof_base::conversation_burden_of_proof_base;
375
376 void OnCreate(Unit* creator) override
377 {
378 SummonClones(creator);
379
380 Creature* constableClone = GetConstableClone();
381 if (!constableClone)
382 return;
383
384 Creature* lucilleClone = GetLucilleClone();
385 if (!lucilleClone)
386 return;
387
389
390 conversation->AddActor(CONVO_ACTOR_CONSTABLE, 2, constableClone->GetGUID());
391 conversation->AddActor(CONVO_ACTOR_LUCILLE, 0, lucilleClone->GetGUID());
393 }
394
399};
400
401// 249110 - Administering Venom
419
420// 5696 - Conversation
422{
423public:
424 using conversation_burden_of_proof_base::conversation_burden_of_proof_base;
425
426 void OnCreate(Unit* creator) override
427 {
428 SummonClones(creator);
429
430 Creature* constableClone = GetConstableClone();
431 if (!constableClone)
432 return;
433
434 Creature* lucilleClone = GetLucilleClone();
435 if (!lucilleClone)
436 return;
437
439
440 conversation->AddActor(CONVO_ACTOR_CONSTABLE, 3, constableClone->GetGUID());
441 conversation->AddActor(CONVO_ACTOR_LUCILLE, 0, lucilleClone->GetGUID());
443 }
444
449};
450
LocaleConstant
Definition Common.h:51
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ TEMPSUMMON_MANUAL_DESPAWN
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
#define RegisterConversationAI(ai_name)
Definition ScriptMgr.h:1437
Creature * GetClosestCreatureWithOptions(WorldObject *source, float maxSearchRange, FindCreatureOptions const &options)
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
#define SpellEffectFn(F, I, N)
@ UNIT_NPC_FLAG_GOSSIP
@ UNIT_NPC_FLAG_SPELLCLICK
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 DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void AddEvent(BasicEvent *event, Milliseconds e_time, bool set_addtime=true)
Player * ToPlayer()
Definition Object.h:126
static bool OnConditionChange(WorldObject *object, bool updateVisibility=true)
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition Player.cpp:16679
int32 GetQuestObjectiveData(uint32 questId, uint32 objectiveId) const
Definition Player.cpp:16440
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHitTarget
Definition Unit.h:635
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
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
EventProcessor m_Events
Definition Object.h:561
void ScheduleEvents(uint32 pathId, int32 lineId, uint32 creditEntry) const
static TempSummon * SummonPersonalCloneFromClosestCreatureWithOptions(Unit *creator, FindCreatureOptions const &options, Position const &position)
void AddSC_drustvar_chapter_2_the_burden_of_proof()
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
TriggerCastFlags TriggerFlags
constexpr void GetPosition(float &x, float &y) const
Definition Position.h:92