Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
blackfathom_deeps.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "ScriptMgr.h"
7#include "ScriptedCreature.h"
8#include "ScriptedGossip.h"
9#include "blackfathom_deeps.h"
10#include "ScriptedEscortAI.h"
11#include "Player.h"
12
21
22const Position HomePosition = {-815.817f, -145.299f, -25.870f, 0};
23
25{
26public:
27 go_blackfathom_altar() : GameObjectScript("go_blackfathom_altar") { }
28
29 bool OnGossipHello(Player* player, GameObject* /*go*/) OVERRIDE
30 {
31 if (!player->HasAura(SPELL_BLESSING_OF_BLACKFATHOM))
32 player->AddAura(SPELL_BLESSING_OF_BLACKFATHOM, player);
33 return true;
34 }
35};
36
38{
39public:
40 go_blackfathom_fire() : GameObjectScript("go_blackfathom_fire") { }
41
42 bool OnGossipHello(Player* /*player*/, GameObject* go) OVERRIDE
43 {
44 InstanceScript* instance = go->GetInstanceScript();
45
46 if (instance)
47 {
48 go->SetGoState(GOState::GO_STATE_ACTIVE);
50 instance->SetData(DATA_FIRE, instance->GetData(DATA_FIRE) + 1);
51 return true;
52 }
53 return false;
54 }
55};
56
58{
59public:
60 npc_blackfathom_deeps_event() : CreatureScript("npc_blackfathom_deeps_event") { }
61
63 {
65 {
66 if (creature->IsSummon())
67 {
68 creature->SetHomePosition(HomePosition);
69 AttackPlayer();
70 }
71
72 instance = creature->GetInstanceScript();
73 ravageTimer = 0;
76 Flee = false;
77 }
78
79
81 {
82 Flee = false;
83
84 ravageTimer = std::rand() % 8000 + 5000;
85 frostNovaTimer = std::rand() % 12000 + 9000;
86 frostBoltVolleyTimer = std::rand() % 4000 + 2000;
87 }
88
90 {
91 Map::PlayerList const &PlList = me->GetMap()->GetPlayers();
92
93 if (PlList.isEmpty())
94 return;
95
96 for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i)
97 {
98 if (Player* player = i->GetSource())
99 {
100 if (player->IsGameMaster())
101 continue;
102
103 if (player->IsAlive())
104 {
105 me->SetInCombatWith(player);
106 player->SetInCombatWith(me);
107 me->AddThreat(player, 0.0f);
108 }
109 }
110 }
111 }
112
114 {
115 if (!UpdateVictim())
116 return;
117
118 switch (me->GetEntry())
119 {
121 {
122 if (ravageTimer <= diff)
123 {
125 ravageTimer = std::rand() % 14000 + 9000;
126 } else ravageTimer -= diff;
127 break;
128 }
131 {
132 if (!Flee && HealthBelowPct(15))
133 {
134 Flee = true;
135 me->DoFleeToGetAssistance();
136 }
137 break;
138 }
140 {
141 if (frostBoltVolleyTimer <= diff)
142 {
143 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
145 frostBoltVolleyTimer = std::rand() % 8000 + 5000;
146 }
147 else frostBoltVolleyTimer -= diff;
148
149 if (frostNovaTimer <= diff)
150 {
152 frostNovaTimer = std::rand() % 30000 + 25000;
153 }
154 else frostNovaTimer -= diff;
155 break;
156 }
157 }
158
160 }
161
162 void JustDied(Unit* /*killer*/) OVERRIDE
163 {
164 if (me->IsSummon()) //we are not a normal spawn.
165 if (instance)
166 instance->SetData(DATA_EVENT, instance->GetData(DATA_EVENT) + 1);
167 }
168 private:
170
174
175 bool Flee;
176 };
177
179 {
180 return new npc_blackfathom_deeps_eventAI(creature);
181 }
182};
183
189
191{
192public:
193 npc_morridune() : CreatureScript("npc_morridune") { }
194
196 {
197 npc_morriduneAI(Creature* creature) : npc_escortAI(creature)
198 {
201 Start(false, false, 0);
202 }
203
205 {
206 switch (waypointId)
207 {
208 case 4:
209 SetEscortPaused(true);
210 me->SetFacingTo(1.775791f);
213 break;
214 }
215 }
216
217 void sGossipSelect(Player* player, uint32 /*sender*/, uint32 /*action*/) OVERRIDE
218 {
220 }
221 };
222
224 {
225 return new npc_morriduneAI(creature);
226 }
227};
228
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ GO_STATE_ACTIVE
Definition GameObject.h:576
@ GO_FLAG_NOT_SELECTABLE
@ UNIT_NPC_FLAG_GOSSIP
Definition Unit.h:687
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_NPC_FLAGS
@ GAMEOBJECT_FIELD_FLAGS
@ SAY_MORRIDUNE_2
@ SAY_MORRIDUNE_1
void AddSC_blackfathom_deeps()
@ SPELL_TELEPORT_DARNASSUS
@ SPELL_RAVAGE
@ SPELL_BLESSING_OF_BLACKFATHOM
@ SPELL_FROST_NOVA
@ SPELL_FROST_BOLT_VOLLEY
const Position HomePosition
@ NPC_BARBED_CRUSTACEAN
@ NPC_AKU_MAI_SERVANT
@ NPC_MURKSHALLOW_SOFTSHELL
@ NPC_AKU_MAI_SNAPJAW
@ DATA_EVENT
@ DATA_FIRE
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
GameObjectScript(const char *name)
bool isEmpty() const
Definition LinkedList.h:86
MapRefManager PlayerList
Definition Map.h:406
iterator end()
iterator begin()
LinkedListHead::Iterator< MapReference const > const_iterator
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
void DoCastAOE(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:176
Definition Unit.h:1367
bool IsSummon() const
Definition Unit.h:1503
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:36
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:37
bool OnGossipHello(Player *player, GameObject *) OVERRIDE
bool OnGossipHello(Player *, GameObject *go) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Creature * me
bool HealthBelowPct(uint32 pct) const
ScriptedAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
npc_escortAI(Creature *creature)
void SetEscortPaused(bool on)
void Start(bool isActiveAttacker=true, bool run=false, uint64 playerGUID=0, Quest const *quest=NULL, bool instantRespawn=false, bool canLoopPath=false, bool resetWaypoints=true)
void WaypointReached(uint32 waypointId) OVERRIDE
void sGossipSelect(Player *player, uint32, uint32) OVERRIDE