TrinityCore
Loading...
Searching...
No Matches
blackrock_depths.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 "ScriptMgr.h"
19#include "blackrock_depths.h"
20#include "GameObject.h"
21#include "GameObjectAI.h"
22#include "InstanceScript.h"
23#include "Log.h"
24#include "ObjectAccessor.h"
25#include "Player.h"
26#include "ScriptedEscortAI.h"
27#include "ScriptedGossip.h"
28#include "TemporarySummon.h"
29#include "WorldSession.h"
30
31//go_shadowforge_brazier
33{
34 public:
35 go_shadowforge_brazier() : GameObjectScript("go_shadowforge_brazier") { }
36
38 {
39 go_shadowforge_brazierAI(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
40
42
43 bool OnGossipHello(Player* /*player*/) override
44 {
47 else
49 // If used both braziers, open linked doors (North and South)
51 {
54 }
55
56 return false;
57 }
58 };
59
60 GameObjectAI* GetAI(GameObject* go) const override
61 {
62 return GetBlackrockDepthsAI<go_shadowforge_brazierAI>(go);
63 }
64};
65
66// npc_grimstone
68{
70 NPC_THELDREN = 16059,
71
72 //4 or 6 in total? 1+2+1 / 2+2+2 / 3+3. Depending on this, code should be changed.
74};
75
77{
78 8925, // Dredge Worm
79 8926, // Deep Stinger
80 8927, // Dark Screecher
81 8928, // Burrowing Thundersnout
82 8933, // Cave Creeper
83 8932, // Borer Beetle
84};
85
87{
88 9027, // Gorosh
89 9028, // Grizzle
90 9029, // Eviscerator
91 9030, // Ok'thor
92 9031, // Anub'shiah
93 9032, // Hedrum
94};
95
97{
98public:
99 at_ring_of_law() : AreaTriggerScript("at_ring_of_law") { }
100
101 bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override
102 {
103 if (InstanceScript* instance = player->GetInstanceScript())
104 {
105 if (instance->GetData(TYPE_RING_OF_LAW) == IN_PROGRESS || instance->GetData(TYPE_RING_OF_LAW) == DONE)
106 return false;
107
108 instance->SetData(TYPE_RING_OF_LAW, IN_PROGRESS);
109 player->SummonCreature(NPC_GRIMSTONE, 625.559f, -205.618f, -52.735f, 2.609f, TEMPSUMMON_DEAD_DESPAWN);
110
111 return false;
112 }
113 return false;
114 }
115};
116
117// npc_grimstone
127
128static constexpr uint32 PATH_ESCORT_GRIMSTONE = 80770;
129
132{
133public:
134 npc_grimstone() : CreatureScript("npc_grimstone") { }
135
136 CreatureAI* GetAI(Creature* creature) const override
137 {
138 return GetBlackrockDepthsAI<npc_grimstoneAI>(creature);
139 }
140
141 struct npc_grimstoneAI : public EscortAI
142 {
143 npc_grimstoneAI(Creature* creature) : EscortAI(creature)
144 {
145 Initialize();
146 instance = creature->GetInstanceScript();
147 MobSpawnId = rand32() % 6;
148 }
149
151 {
152 EventPhase = 0;
153 Event_Timer = 1000;
154
155 MobCount = 0;
156 MobDeath_Timer = 0;
157
158 for (uint8 i = 0; i < MAX_NPC_AMOUNT; ++i)
159 RingMobGUID[i].Clear();
160
162
163 CanWalk = false;
164 }
165
167
170
174
177
179
180 void Reset() override
181 {
182 Initialize();
183 }
184
187 {
188 if (Creature* tmp = me->SummonCreature(RingMob[MobSpawnId], 608.960f, -235.322f, -53.907f, 1.857f, TEMPSUMMON_DEAD_DESPAWN))
189 RingMobGUID[MobCount] = tmp->GetGUID();
190
191 ++MobCount;
192
194 MobDeath_Timer = 2500;
195 }
196
199 {
200 if (Creature* tmp = me->SummonCreature(RingBoss[rand32() % 6], 644.300f, -175.989f, -53.739f, 3.418f, TEMPSUMMON_DEAD_DESPAWN))
201 RingBossGUID = tmp->GetGUID();
202
203 MobDeath_Timer = 2500;
204 }
205
206 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
207 {
208 switch (waypointId)
209 {
210 case 0:
212 CanWalk = false;
213 Event_Timer = 5000;
214 break;
215 case 1:
217 CanWalk = false;
218 Event_Timer = 5000;
219 break;
220 case 2:
221 CanWalk = false;
222 break;
223 case 3:
225 break;
226 case 4:
228 CanWalk = false;
229 Event_Timer = 5000;
230 break;
231 case 5:
233 TC_LOG_DEBUG("scripts", "npc_grimstone: event reached end and set complete.");
234 break;
235 }
236 }
237
238 void HandleGameObject(uint32 id, bool open)
239 {
241 }
242
243 void UpdateAI(uint32 diff) override
244 {
245 if (MobDeath_Timer)
246 {
247 if (MobDeath_Timer <= diff)
248 {
249 MobDeath_Timer = 2500;
250
251 if (!RingBossGUID.IsEmpty())
252 {
254 if (boss && !boss->IsAlive() && boss->isDead())
255 {
257 Event_Timer = 5000;
258 MobDeath_Timer = 0;
259 return;
260 }
261 return;
262 }
263
264 for (uint8 i = 0; i < MAX_NPC_AMOUNT; ++i)
265 {
267 if (mob && !mob->IsAlive() && mob->isDead())
268 {
269 RingMobGUID[i].Clear();
270 --MobCount;
271
272 //seems all are gone, so set timer to continue and discontinue this
273 if (!MobCount)
274 {
275 Event_Timer = 5000;
276 MobDeath_Timer = 0;
277 }
278 }
279 }
280 } else MobDeath_Timer -= diff;
281 }
282
283 if (Event_Timer)
284 {
285 if (Event_Timer <= diff)
286 {
287 switch (EventPhase)
288 {
289 case 0:
293 Start(false);
294 CanWalk = true;
295 Event_Timer = 0;
296 break;
297 case 1:
298 CanWalk = true;
299 Event_Timer = 0;
300 break;
301 case 2:
302 Event_Timer = 2000;
303 break;
304 case 3:
306 Event_Timer = 3000;
307 break;
308 case 4:
309 CanWalk = true;
310 me->SetVisible(false);
312 Event_Timer = 8000;
313 break;
314 case 5:
317 Event_Timer = 8000;
318 break;
319 case 6:
321 Event_Timer = 5000;
322 break;
323 case 7:
324 me->SetVisible(true);
327 CanWalk = true;
328 Event_Timer = 5000;
329 break;
330 case 8:
332 Event_Timer = 5000;
333 break;
334 case 9:
335 me->SetVisible(false);
337 Event_Timer = 0;
338 break;
339 case 10:
340 //if quest, complete
344 CanWalk = true;
345 Event_Timer = 0;
346 break;
347 }
348 ++EventPhase;
349 } else Event_Timer -= diff;
350 }
351
352 if (CanWalk)
353 EscortAI::UpdateAI(diff);
354 }
355 };
356};
357
358// npc_phalanx
365
367{
368public:
369 npc_phalanx() : CreatureScript("npc_phalanx") { }
370
371 CreatureAI* GetAI(Creature* creature) const override
372 {
373 return GetBlackrockDepthsAI<npc_phalanxAI>(creature);
374 }
375
376 struct npc_phalanxAI : public BossAI
377 {
379 {
380 Initialize();
381 }
382
384 {
385 ThunderClap_Timer = 12000;
387 MightyBlow_Timer = 15000;
388 }
389
393
394 void Reset() override
395 {
396 _Reset();
397 Initialize();
398 }
399
400 void UpdateAI(uint32 diff) override
401 {
402 //Return since we have no target
403 if (!UpdateVictim())
404 return;
405
406 //ThunderClap_Timer
407 if (ThunderClap_Timer <= diff)
408 {
410 ThunderClap_Timer = 10000;
411 } else ThunderClap_Timer -= diff;
412
413 //FireballVolley_Timer
414 if (HealthBelowPct(51))
415 {
416 if (FireballVolley_Timer <= diff)
417 {
419 FireballVolley_Timer = 15000;
420 } else FireballVolley_Timer -= diff;
421 }
422
423 //MightyBlow_Timer
424 if (MightyBlow_Timer <= diff)
425 {
427 MightyBlow_Timer = 10000;
428 } else MightyBlow_Timer -= diff;
429 }
430 };
431};
432
433// npc_lokhtos_darkbargainer
443
444#define GOSSIP_ITEM_GET_CONTRACT "Get Thorium Brotherhood Contract" // miss in db,maybe wrong
445
447{
448 public:
449 npc_lokhtos_darkbargainer() : CreatureScript("npc_lokhtos_darkbargainer") { }
450
452 {
454
455 bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
456 {
457 uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
458
459 ClearGossipMenuFor(player);
460 if (action == GOSSIP_ACTION_INFO_DEF + 1)
461 {
462 CloseGossipMenuFor(player);
464 }
465 if (action == GOSSIP_ACTION_TRADE)
466 player->GetSession()->SendListInventory(me->GetGUID());
467
468 return true;
469 }
470
494 };
495
496 CreatureAI* GetAI(Creature* creature) const override
497 {
498 return GetBlackrockDepthsAI<npc_lokhtos_darkbargainerAI>(creature);
499 }
500};
501
502// npc_rocknot
510
512{
513public:
514 npc_rocknot() : CreatureScript("npc_rocknot") { }
515
516 struct npc_rocknotAI : public EscortAI
517 {
518 npc_rocknotAI(Creature* creature) : EscortAI(creature)
519 {
520 Initialize();
521 instance = creature->GetInstanceScript();
522 }
523
525 {
526 BreakKeg_Timer = 0;
527 BreakDoor_Timer = 0;
528 }
529
531
534
535 void Reset() override
536 {
538 return;
539
540 Initialize();
541 }
542
543 void DoGo(uint32 id, uint32 state)
544 {
546 go->SetGoState((GOState)state);
547 }
548
549 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
550 {
551 switch (waypointId)
552 {
553 case 1:
555 break;
556 case 2:
558 break;
559 case 3:
561 break;
562 case 4:
564 break;
565 case 5:
567 BreakKeg_Timer = 2000;
568 break;
569 }
570 }
571
572 void UpdateAI(uint32 diff) override
573 {
574 if (BreakKeg_Timer)
575 {
576 if (BreakKeg_Timer <= diff)
577 {
579 BreakKeg_Timer = 0;
580 BreakDoor_Timer = 1000;
581 } else BreakKeg_Timer -= diff;
582 }
583
584 if (BreakDoor_Timer)
585 {
586 if (BreakDoor_Timer <= diff)
587 {
589 DoGo(DATA_GO_BAR_KEG_TRAP, 0); //doesn't work very well, leaving code here for future
590 //spell by trap has effect61, this indicate the bar go hostile
591
593 tmp->SetFaction(FACTION_MONSTER);
594
595 //for later, this event(s) has alot more to it.
596 //optionally, DONE can trigger bar to go hostile.
598
599 BreakDoor_Timer = 0;
600 } else BreakDoor_Timer -= diff;
601 }
602
603 EscortAI::UpdateAI(diff);
604 }
605
606 void OnQuestReward(Player* /*player*/, Quest const* quest, LootItemType /*type*/, uint32 /*item*/) override
607 {
609 return;
610
611 if (quest->GetQuestId() == QUEST_ALE)
612 {
615
617
618 //keep track of amount in instance script, returns SPECIAL if amount ok and event in progress
620 {
623
625 Start(false);
626 }
627 }
628 }
629 };
630
631 CreatureAI* GetAI(Creature* creature) const override
632 {
633 return GetBlackrockDepthsAI<npc_rocknotAI>(creature);
634 }
635};
636
638{
640 new at_ring_of_law();
641 new npc_grimstone();
642 new npc_phalanx();
644 new npc_rocknot();
645}
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
@ IN_PROGRESS
@ DONE
@ SPECIAL
#define TC_LOG_DEBUG(filterType__, message__,...)
Definition Log.h:173
LootItemType
@ TEMPSUMMON_DEAD_DESPAWN
uint32 rand32()
Definition Random.cpp:71
@ STATE_ESCORT_ESCORTING
void AddGossipItemFor(Player *player, GossipOptionNpc optionNpc, std::string text, uint32 sender, uint32 action)
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const &guid)
void ClearGossipMenuFor(Player *player)
void InitGossipMenuFor(Player *player, uint32 menuId)
void CloseGossipMenuFor(Player *player)
@ GOSSIP_SENDER_MAIN
@ GOSSIP_ACTION_TRADE
@ GOSSIP_ACTION_INFO_DEF
@ EMOTE_ONESHOT_KICK
@ EMOTE_ONESHOT_ATTACK_UNARMED
@ REP_FRIENDLY
@ FACTION_MONSTER
GOState
@ SAY_TEXT4
@ SAY_TEXT3
@ SAY_TEXT6
@ SAY_TEXT2
@ SAY_TEXT5
@ SAY_TEXT1
void AddSC_blackrock_depths()
@ MAX_NPC_AMOUNT
@ NPC_THELDREN
@ NPC_GRIMSTONE
@ SPELL_MIGHTYBLOW
@ SPELL_FIREBALLVOLLEY
@ SPELL_THUNDERCLAP
static constexpr uint32 PATH_ESCORT_GRIMSTONE
@ SPELL_DRUNKEN_RAGE
@ QUEST_ALE
@ PATH_ESCORT_ROCKNOT
@ SAY_GOT_BEER
@ SPELL_CREATE_THORIUM_BROTHERHOOD_CONTRACT_DND
@ QUEST_A_BINDING_CONTRACT
@ ITEM_THRORIUM_BROTHERHOOD_CONTRACT
@ ITEM_SULFURON_INGOT
@ GOSSIP_ITEM_SHOW_ACCESS_MID
@ GOSSIP_ITEM_SHOW_ACCESS_OID
uint32 RingMob[]
uint32 RingBoss[]
#define GOSSIP_ITEM_GET_CONTRACT
@ BOSS_PHALANX
@ DATA_PHALANX
@ TYPE_RING_OF_LAW
@ TYPE_BAR
@ DATA_GO_BAR_KEG
@ TYPE_LYCEUM
@ DATA_ARENA3
@ DATA_ARENA2
@ DATA_GOLEM_DOOR_S
@ DATA_GOLEM_DOOR_N
@ DATA_ARENA4
@ DATA_GO_BAR_KEG_TRAP
@ DATA_ARENA1
@ DATA_GO_BAR_DOOR
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void HandleGameObject(ObjectGuid guid, bool open, GameObject *go=nullptr)
virtual ObjectGuid GetGuidData(uint32 type) const override
bool IsEmpty() const
Definition ObjectGuid.h:362
void Clear()
Definition ObjectGuid.h:329
bool GetQuestRewardStatus(uint32 quest_id) const
Definition Player.cpp:15912
bool HasItemCount(uint32 item, uint32 count=1, bool inBankAlso=false) const
Definition Player.cpp:9824
WorldSession * GetSession() const
Definition Player.h:2256
void PrepareQuestMenu(ObjectGuid guid)
Definition Player.cpp:14333
ReputationRank GetReputationRank(uint32 faction_id) const
Definition Player.cpp:6415
std::unique_ptr< PlayerMenu > PlayerTalkClass
Definition Player.h:2556
uint32 GetQuestId() const
Definition QuestDef.h:633
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Definition Unit.h:647
void SetVisible(bool x)
Definition Unit.cpp:8787
bool IsAlive() const
Definition Unit.h:1205
bool IsQuestGiver() const
Definition Unit.h:1024
void HandleEmoteCommand(Emote emoteId, Player *target=nullptr, Trinity::IteratorPair< int32 const * > spellVisualKitIds={}, int32 sequenceVariation=0)
Definition Unit.cpp:1662
bool IsVendor() const
Definition Unit.h:1022
bool isDead() const
Definition Unit.h:1207
InstanceScript * GetInstanceScript() const
Definition Object.cpp:394
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition Object.cpp:1403
void SendListInventory(ObjectGuid guid)
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:99
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:100
bool OnTrigger(Player *player, AreaTriggerEntry const *) override
GameObjectAI * GetAI(GameObject *go) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
void Start(bool isActiveAttacker=true, ObjectGuid playerGUID=ObjectGuid::Empty, Quest const *quest=nullptr, bool instantRespawn=false, bool canLoopPath=false)
bool HasEscortState(uint32 escortState)
void LoadPath(uint32 pathId)
void UpdateAI(uint32 diff) override
bool HealthBelowPct(uint32 pct) const
void WaypointReached(uint32 waypointId, uint32) override
void HandleGameObject(uint32 id, bool open)
void UpdateAI(uint32 diff) override
bool OnGossipSelect(Player *player, uint32, uint32 gossipListId) override
npc_phalanxAI(Creature *creature)
void UpdateAI(uint32 diff) override
void UpdateAI(uint32 diff) override
npc_rocknotAI(Creature *creature)
void DoGo(uint32 id, uint32 state)
void WaypointReached(uint32 waypointId, uint32) override
void OnQuestReward(Player *, Quest const *quest, LootItemType, uint32) override