Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
hyjal_trash.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 "hyjal.h"
9#include "hyjal_trash.h"
10#include "hyjalAI.h"
11
13{
14 SPELL_METEOR = 33814, //infernal visual
17 NPC_TRIGGER = 21987, //World Trigger (Tiny)
18 MODEL_INVIS = 11686, //invisible model
21 SPELL_FRENZY = 31540,
29 SPELL_WEB = 28991,
34};
35
36float HordeWPs[8][3]=//basic waypoints from spawn to leader
37{
38 {5492.91f, -2404.61f, 1462.63f},
39 {5531.76f, -2460.87f, 1469.55f},
40 {5554.58f, -2514.66f, 1476.12f},
41 {5554.16f, -2567.23f, 1479.90f},
42 {5540.67f, -2625.99f, 1480.89f},
43 {5508.16f, -2659.20f, 1480.15f}, //random rush starts from here
44 {5489.62f, -2704.05f, 1482.18f},
45 {5457.04f, -2726.26f, 1485.10f}
46};
47float AllianceWPs[8][3]=//basic waypoints from spawn to leader
48{
49 {4896.08f, -1576.35f, 1333.65f},
50 {4898.68f, -1615.02f, 1329.48f},
51 {4907.12f, -1667.08f, 1321.00f},
52 {4963.18f, -1699.35f, 1340.51f},
53 {4989.16f, -1716.67f, 1335.74f}, //first WP in the base, after the gate
54 {5026.27f, -1736.89f, 1323.02f},
55 {5037.77f, -1770.56f, 1324.36f},
56 {5067.23f, -1789.95f, 1321.17f}
57};
58
59float FrostWyrmWPs[3][3]=//waypoints for the frost wyrms in horde base
60{
61 {5580.82f, -2628.83f, 1528.28f},
62 {5550.90f, -2667.16f, 1505.45f},
63 {5459.64f, -2725.91f, 1484.83f}
64};
65
66float GargoyleWPs[3][3]=//waypoints for the gargoyles in horde base
67{
68 {5533.66f, -2634.32f, 1495.33f},
69 {5517.88f, -2712.05f, 1490.54f},
70 {5459.64f, -2725.91f, 1484.83f}
71};
72
73float FlyPathWPs[3][3]=//waypoints for the gargoyls and frost wyrms in horde base in wave 1/3
74{
75 {5531.96f, -2772.83f, 1516.68f},
76 {5498.32f, -2734.84f, 1497.01f},
77 {5456.67f, -2725.48f, 1493.08f}
78};
79
80float AllianceOverrunWP[55][3]=//waypoints in the alliance base used in the end in the cleaning wave
81{
82 {4976.37f, -1708.02f, 1339.43f}, //0spawn
83 {4994.83f, -1725.52f, 1333.25f}, //1 start
84 {4982.92f, -1753.7f, 1330.69f}, //2 end
85 {4996.75f, -1721.47f, 1332.95f}, //3 start
86 {5015.74f, -1755.05f, 1322.49f}, //4
87 {4998.68f, -1773.44f, 1329.59f}, //5
88 {4994.83f, -1725.52f, 1333.25f}, //6 start
89 {5022.8f, -1735.46f, 1323.53f}, //7
90 {5052.15f, -1729.02f, 1320.88f}, //8
91 {5082.43f, -1726.29f, 1327.87f}, //9
92 {4994.83f, -1725.52f, 1333.25f}, //10 start
93 {5018.92f, -1751.14f, 1322.19f}, //11
94 {5040.09f, -1792.09f, 1322.1f}, //12
95 {4994.83f, -1725.52f, 1333.25f}, //13 start
96 {5023.47f, -1748.1f, 1322.51f}, //14
97 {5013.43f, -1842.39f, 1322.07f}, //15
98 {4994.83f, -1725.52f, 1333.25f}, //16 start
99 {5020.8f, -1756.86f, 1322.2f}, //17
100 {5019.53f, -1824.6f, 1321.96f}, //18
101 {5043.42f, -1853.75f, 1324.52f}, //19
102 {5053.02f, -1864.13f, 1330.36f}, //20
103 {5062.49f, -1852.47f, 1330.49f}, //21
104 {5015.27f, -1738.77f, 1324.83f}, //35//start 22
105 {5027.97f, -1775.25f, 1321.87f}, //34 23
106 {5015.94f, -1821.24f, 1321.86f}, //33 24
107 {4983.25f, -1857.4f, 1320.48f}, //32 25
108 {4981.51f, -1883.7f, 1322.34f}, //31 26
109 {5002.33f, -1893.98f, 1325.88f}, //30 27
110 {5049.32f, -1886.54f, 1331.69f}, //29 28
111 {5089.68f, -1846.88f, 1328.99f}, //28 29
112 {5127.90f, -1825.14f, 1335.58f}, //27 30
113 {5163.27f, -1789.08f, 1337.04f}, //26 31
114 {5138.97f, -1755.88f, 1334.57f}, //25 32
115 {5096.63f, -1742.22f, 1329.61f}, //24 33
116 {5065.81f, -1729.43f, 1325.66f}, //23 34
117 {5049.32f, -1726.31f, 1320.64f}, //22 start
118 {5081.07f, -1902.10f, 1346.36f}, //36 abo start
119 {5107.65f, -1912.03f, 1356.49f}, //37
120 {5132.83f, -1927.07f, 1362.42f}, //38
121 {5147.78f, -1954.41f, 1365.98f}, //39
122 {5164.96f, -1966.48f, 1367.04f}, //40
123 {5189.04f, -1961.06f, 1367.90f}, //41
124 {5212.27f, -1975.30f, 1365.58f}, //42
125 {5221.82f, -1994.18f, 1364.97f}, //43 end1
126 {5202.23f, -1994.94f, 1367.59f}, //44 end2
127 {5279.94f, -2049.68f, 1311.38f}, //45 garg1
128 {5289.15f, -2219.06f, 1291.12f}, //46 garg2
129 {5202.07f, -2136.10f, 1305.07f}, //47 garg3
130 {5071.52f, -2425.63f, 1454.48f}, //48 garg4
131 {5120.65f, -2467.92f, 1463.93f}, //49 garg5
132 {5283.04f, -2043.26f, 1300.11f}, //50 garg target1
133 {5313.22f, -2207.60f, 1290.06f}, //51 garg target2
134 {5180.41f, -2121.87f, 1292.62f}, //52 garg target3
135 {5088.68f, -2432.04f, 1441.73f}, //53 garg target4
136 {5111.26f, -2454.73f, 1449.63f}//54 garg target5
137};
138
139float HordeOverrunWP[21][3]=//waypoints in the horde base used in the end in the cleaning wave
140{
141 {5490.72f, -2702.94f, 1482.14f}, //0 start
142 {5469.77f, -2741.34f, 1486.95f},
143 {5439.47f, -2771.02f, 1494.59f},
144 {5408.85f, -2811.92f, 1505.68f},
145 {5423.87f, -2857.80f, 1515.55f},
146 {5428.19f, -2898.15f, 1524.61f},
147 {5394.59f, -2930.05f, 1528.23f},
148 {5351.11f, -2935.80f, 1532.24f},
149 {5312.37f, -2959.06f, 1536.21f},
150 {5264.93f, -2989.80f, 1545.70f},
151 {5256.63f, -3056.16f, 1559.24f},
152 {5267.32f, -3119.55f, 1575.36f},
153 {5305.61f, -3139.88f, 1586.38f},
154 {5330.56f, -3135.37f, 1588.58f},
155 {5365.87f, -3139.78f, 1583.96f},
156 {5389.39f, -3163.57f, 1582.57f}, //15 end
157 {5500.86f, -2669.89f, 1481.04f}, //16 start
158 {5472.08f, -2715.14f, 1483.55f},
159 {5450.11f, -2721.47f, 1485.61f},
160 {5433.25f, -2712.93f, 1493.02f}, //19 end 1
161 {5429.91f, -2718.44f, 1493.42f}//20 end 2
162};
163
165{
166 instance = creature->GetInstanceScript();
167 IsEvent = false;
168 Delay = 0;
169 LastOverronPos = 0;
170 IsOverrun = false;
171 OverrunType = 0;
172 SetupOverrun = false;
173 faction = 0;
174 useFlyPath = false;
175 damageTaken = 0;
176 Reset();
177}
178
180{
181 if (done_by->GetTypeId() == TypeID::TYPEID_PLAYER || done_by->IsPet())
182 {
183 damageTaken += damage;
184 if (instance)
185 instance->SetData(DATA_RAIDDAMAGE, damage);//store raid's damage
186 }
187}
188
190{
191 if (IsOverrun && !SetupOverrun)
192 {
193 SetupOverrun = true;
194 if (faction == 0)
195 {
196 if (me->GetEntry() == GARGOYLE)
197 {
198 DummyTarget[0] = AllianceOverrunWP[50+OverrunType][0]; //+OverrunType 0 - 4
201 }
202 if (me->GetEntry() == ABOMINATION)
203 {
204 for (uint8 i = 0; i < 4; ++i)
205 AddWaypoint(i, AllianceWPs[i][0]+(std::rand() % 3 + -3), AllianceWPs[i][1]+(std::rand() % 3 + -3), AllianceWPs[i][2]);
206 switch (OverrunType)
207 {
208 case 0:
209 AddWaypoint(4, AllianceOverrunWP[22][0] + (std::rand() % 3 + -3), AllianceOverrunWP[22][1] + (std::rand() % 3 + -3), AllianceOverrunWP[22][2]);
210 AddWaypoint(5, AllianceOverrunWP[23][0] + (std::rand() % 3 + -3), AllianceOverrunWP[23][1] + (std::rand() % 3 + -3), AllianceOverrunWP[23][2]);
211 AddWaypoint(6, AllianceOverrunWP[24][0] + (std::rand() % 3 + -3), AllianceOverrunWP[24][1] + (std::rand() % 3 + -3), AllianceOverrunWP[24][2]);
212 AddWaypoint(7, AllianceOverrunWP[25][0] + (std::rand() % 3 + -3), AllianceOverrunWP[25][1] + (std::rand() % 3 + -3), AllianceOverrunWP[25][2]);
213 AddWaypoint(8, AllianceOverrunWP[26][0] + (std::rand() % 3 + -3), AllianceOverrunWP[26][1] + (std::rand() % 3 + -3), AllianceOverrunWP[26][2]);
214 AddWaypoint(9, AllianceOverrunWP[27][0] + (std::rand() % 3 + -3), AllianceOverrunWP[27][1] + (std::rand() % 3 + -3), AllianceOverrunWP[27][2]);
215 AddWaypoint(10, AllianceOverrunWP[28][0] + (std::rand() % 3 + -3), AllianceOverrunWP[28][1] + (std::rand() % 3 + -3), AllianceOverrunWP[28][2]);
216
217 AddWaypoint(11, AllianceOverrunWP[36][0] + (std::rand() % 3 + -3), AllianceOverrunWP[36][1] + (std::rand() % 3 + -3), AllianceOverrunWP[36][2]);
218 AddWaypoint(12, AllianceOverrunWP[37][0] + (std::rand() % 3 + -3), AllianceOverrunWP[37][1] + (std::rand() % 3 + -3), AllianceOverrunWP[37][2]);
219 AddWaypoint(13, AllianceOverrunWP[38][0] + (std::rand() % 3 + -3), AllianceOverrunWP[38][1] + (std::rand() % 3 + -3), AllianceOverrunWP[38][2]);
220 AddWaypoint(14, AllianceOverrunWP[39][0] + (std::rand() % 3 + -3), AllianceOverrunWP[39][1] + (std::rand() % 3 + -3), AllianceOverrunWP[39][2]);
221 AddWaypoint(15, AllianceOverrunWP[40][0] + (std::rand() % 3 + -3), AllianceOverrunWP[40][1] + (std::rand() % 3 + -3), AllianceOverrunWP[40][2]);
222 AddWaypoint(16, AllianceOverrunWP[41][0] + (std::rand() % 3 + -3), AllianceOverrunWP[41][1] + (std::rand() % 3 + -3), AllianceOverrunWP[41][2]);
223 AddWaypoint(17, AllianceOverrunWP[42][0] + (std::rand() % 3 + -3), AllianceOverrunWP[42][1] + (std::rand() % 3 + -3), AllianceOverrunWP[42][2]);
224 AddWaypoint(18, AllianceOverrunWP[43][0] + (std::rand() % 3 + -3), AllianceOverrunWP[43][1] + (std::rand() % 3 + -3), AllianceOverrunWP[43][2]);
225 me->SetHomePosition(AllianceOverrunWP[43][0] + (std::rand() % 3 + -3), AllianceOverrunWP[43][1] + (std::rand() % 3 + -3), AllianceOverrunWP[43][2], 0);
226 SetDespawnAtEnd(false);
227 LastOverronPos = 18;
228 Start(true, true);
229 break;
230 case 1:
231 AddWaypoint(4, AllianceOverrunWP[22][0] + (std::rand() % 3 + -3), AllianceOverrunWP[22][1] + (std::rand() % 3 + -3), AllianceOverrunWP[22][2]);
232 AddWaypoint(5, AllianceOverrunWP[23][0] + (std::rand() % 3 + -3), AllianceOverrunWP[23][1] + (std::rand() % 3 + -3), AllianceOverrunWP[23][2]);
233 AddWaypoint(6, AllianceOverrunWP[24][0] + (std::rand() % 3 + -3), AllianceOverrunWP[24][1] + (std::rand() % 3 + -3), AllianceOverrunWP[24][2]);
234 AddWaypoint(7, AllianceOverrunWP[25][0] + (std::rand() % 3 + -3), AllianceOverrunWP[25][1] + (std::rand() % 3 + -3), AllianceOverrunWP[25][2]);
235 AddWaypoint(8, AllianceOverrunWP[26][0] + (std::rand() % 3 + -3), AllianceOverrunWP[26][1] + (std::rand() % 3 + -3), AllianceOverrunWP[26][2]);
236 AddWaypoint(9, AllianceOverrunWP[27][0] + (std::rand() % 3 + -3), AllianceOverrunWP[27][1] + (std::rand() % 3 + -3), AllianceOverrunWP[27][2]);
237 AddWaypoint(10, AllianceOverrunWP[28][0] + (std::rand() % 3 + -3), AllianceOverrunWP[28][1] + (std::rand() % 3 + -3), AllianceOverrunWP[28][2]);
238
239 AddWaypoint(11, AllianceOverrunWP[36][0] + (std::rand() % 3 + -3), AllianceOverrunWP[36][1] + (std::rand() % 3 + -3), AllianceOverrunWP[36][2]);
240 AddWaypoint(12, AllianceOverrunWP[37][0] + (std::rand() % 3 + -3), AllianceOverrunWP[37][1] + (std::rand() % 3 + -3), AllianceOverrunWP[37][2]);
241 AddWaypoint(13, AllianceOverrunWP[38][0] + (std::rand() % 3 + -3), AllianceOverrunWP[38][1] + (std::rand() % 3 + -3), AllianceOverrunWP[38][2]);
242 AddWaypoint(14, AllianceOverrunWP[39][0] + (std::rand() % 3 + -3), AllianceOverrunWP[39][1] + (std::rand() % 3 + -3), AllianceOverrunWP[39][2]);
243 AddWaypoint(15, AllianceOverrunWP[40][0] + (std::rand() % 3 + -3), AllianceOverrunWP[40][1] + (std::rand() % 3 + -3), AllianceOverrunWP[40][2]);
244 AddWaypoint(16, AllianceOverrunWP[41][0] + (std::rand() % 3 + -3), AllianceOverrunWP[41][1] + (std::rand() % 3 + -3), AllianceOverrunWP[41][2]);
245 AddWaypoint(17, AllianceOverrunWP[42][0] + (std::rand() % 3 + -3), AllianceOverrunWP[42][1] + (std::rand() % 3 + -3), AllianceOverrunWP[42][2]);
246 AddWaypoint(18, AllianceOverrunWP[44][0] + (std::rand() % 3 + -3), AllianceOverrunWP[44][1] + (std::rand() % 3 + -3), AllianceOverrunWP[44][2]);
247 me->SetHomePosition(AllianceOverrunWP[44][0] + (std::rand() % 3 + -3), AllianceOverrunWP[44][1] + (std::rand() % 3 + -3), AllianceOverrunWP[44][2], 0);
248 SetDespawnAtEnd(false);
249 LastOverronPos = 18;
250 Start(true, true);
251 break;
252 default:
253 for (uint8 i = 22; i < 36; ++i)
254 AddWaypoint(i - 18, AllianceOverrunWP[i][0] + (std::rand() % 3 + -3), AllianceOverrunWP[i][1] + (std::rand() % 3 + -3), AllianceOverrunWP[i][2]);
255
256 SetDespawnAtEnd(true);
257 LastOverronPos = 17;
258 Start(true, true);
259 break;
260 }
261 }
262 if (me->GetEntry() == GHOUL)
263 {
264 for (uint8 i = 0; i < 4; ++i)
265 AddWaypoint(i, AllianceWPs[i][0] + (std::rand() % 3 + -3), AllianceWPs[i][1] + (std::rand() % 3 + -3), AllianceWPs[i][2]);
266 switch (OverrunType)
267 {
268 case 0:
269 AddWaypoint(4, AllianceOverrunWP[1][0] + (std::rand() % 3 + -3), AllianceOverrunWP[1][1] + (std::rand() % 3 + -3), AllianceOverrunWP[1][2]);
270 AddWaypoint(5, AllianceOverrunWP[2][0] + (std::rand() % 3 + -3), AllianceOverrunWP[2][1] + (std::rand() % 3 + -3), AllianceOverrunWP[2][2]);
271 me->SetHomePosition(AllianceOverrunWP[2][0] + (std::rand() % 3 + -3), AllianceOverrunWP[2][1] + (std::rand() % 3 + -3), AllianceOverrunWP[2][2], 0);
272 SetDespawnAtEnd(false);
273 LastOverronPos = 5;
274 Start(true, true);
275 break;
276 case 1:
277 AddWaypoint(4, AllianceOverrunWP[3][0] + (std::rand() % 3 + -3), AllianceOverrunWP[3][1] + (std::rand() % 3 + -3), AllianceOverrunWP[3][2]);
278 AddWaypoint(5, AllianceOverrunWP[4][0] + (std::rand() % 3 + -3), AllianceOverrunWP[4][1] + (std::rand() % 3 + -3), AllianceOverrunWP[4][2]);
279 AddWaypoint(6, AllianceOverrunWP[5][0] + (std::rand() % 3 + -3), AllianceOverrunWP[5][1] + (std::rand() % 3 + -3), AllianceOverrunWP[5][2]);
280 me->SetHomePosition(AllianceOverrunWP[5][0] + (std::rand() % 3 + -3), AllianceOverrunWP[5][1] + (std::rand() % 3 + -3), AllianceOverrunWP[5][2], 0);
281 SetDespawnAtEnd(false);
282 LastOverronPos = 6;
283 Start(true, true);
284 break;
285 case 2:
286 AddWaypoint(4, AllianceOverrunWP[6][0] + (std::rand() % 3 + -3), AllianceOverrunWP[6][1] + (std::rand() % 3 + -3), AllianceOverrunWP[6][2]);
287 AddWaypoint(5, AllianceOverrunWP[7][0] + (std::rand() % 3 + -3), AllianceOverrunWP[7][1] + (std::rand() % 3 + -3), AllianceOverrunWP[7][2]);
288 AddWaypoint(6, AllianceOverrunWP[8][0] + (std::rand() % 3 + -3), AllianceOverrunWP[8][1] + (std::rand() % 3 + -3), AllianceOverrunWP[8][2]);
289 AddWaypoint(7, AllianceOverrunWP[9][0] + (std::rand() % 3 + -3), AllianceOverrunWP[9][1] + (std::rand() % 3 + -3), AllianceOverrunWP[9][2]);
290 me->SetHomePosition(AllianceOverrunWP[9][0] + (std::rand() % 3 + -3), AllianceOverrunWP[9][1] + (std::rand() % 3 + -3), AllianceOverrunWP[9][2], 0);
291 SetDespawnAtEnd(false);
292 LastOverronPos = 7;
293 Start(true, true);
294 break;
295 case 3:
296 AddWaypoint(4, AllianceOverrunWP[10][0] + (std::rand() % 3 + -3), AllianceOverrunWP[10][1] + (std::rand() % 3 + -3), AllianceOverrunWP[10][2]);
297 AddWaypoint(5, AllianceOverrunWP[11][0] + (std::rand() % 3 + -3), AllianceOverrunWP[11][1] + (std::rand() % 3 + -3), AllianceOverrunWP[11][2]);
298 AddWaypoint(6, AllianceOverrunWP[12][0] + (std::rand() % 3 + -3), AllianceOverrunWP[12][1] + (std::rand() % 3 + -3), AllianceOverrunWP[12][2]);
299 me->SetHomePosition(AllianceOverrunWP[12][0] + (std::rand() % 3 + -3), AllianceOverrunWP[12][1] + (std::rand() % 3 + -3), AllianceOverrunWP[12][2], 0);
300 SetDespawnAtEnd(false);
301 LastOverronPos = 6;
302 Start(true, true);
303 break;
304 case 4:
305 AddWaypoint(4, AllianceOverrunWP[13][0] + (std::rand() % 3 + -3), AllianceOverrunWP[13][1] + (std::rand() % 3 + -3), AllianceOverrunWP[13][2]);
306 AddWaypoint(5, AllianceOverrunWP[14][0] + (std::rand() % 3 + -3), AllianceOverrunWP[14][1] + (std::rand() % 3 + -3), AllianceOverrunWP[14][2]);
307 AddWaypoint(6, AllianceOverrunWP[15][0] + (std::rand() % 3 + -3), AllianceOverrunWP[15][1] + (std::rand() % 3 + -3), AllianceOverrunWP[15][2]);
308 me->SetHomePosition(AllianceOverrunWP[15][0] + (std::rand() % 3 + -3), AllianceOverrunWP[15][1] + (std::rand() % 3 + -3), AllianceOverrunWP[15][2], 0);
309 SetDespawnAtEnd(false);
310 LastOverronPos = 6;
311 Start(true, true);
312 break;
313 case 5:
314 AddWaypoint(4, AllianceOverrunWP[16][0] + (std::rand() % 3 + -3), AllianceOverrunWP[16][1] + (std::rand() % 3 + -3), AllianceOverrunWP[16][2]);
315 AddWaypoint(5, AllianceOverrunWP[17][0] + (std::rand() % 3 + -3), AllianceOverrunWP[17][1] + (std::rand() % 3 + -3), AllianceOverrunWP[17][2]);
316 AddWaypoint(6, AllianceOverrunWP[18][0] + (std::rand() % 3 + -3), AllianceOverrunWP[18][1] + (std::rand() % 3 + -3), AllianceOverrunWP[18][2]);
317 AddWaypoint(7, AllianceOverrunWP[19][0] + (std::rand() % 3 + -3), AllianceOverrunWP[19][1] + (std::rand() % 3 + -3), AllianceOverrunWP[19][2]);
318 AddWaypoint(8, AllianceOverrunWP[20][0] + (std::rand() % 3 + -3), AllianceOverrunWP[20][1] + (std::rand() % 3 + -3), AllianceOverrunWP[20][2]);
319 AddWaypoint(9, AllianceOverrunWP[21][0] + (std::rand() % 3 + -3), AllianceOverrunWP[21][1] + (std::rand() % 3 + -3), AllianceOverrunWP[21][2]);
320 me->SetHomePosition(AllianceOverrunWP[21][0] + (std::rand() % 3 + -3), AllianceOverrunWP[21][1] + (std::rand() % 3 + -3), AllianceOverrunWP[21][2], 0);
321 SetDespawnAtEnd(false);
322 LastOverronPos = 9;
323 Start(true, true);
324 break;
325 default:
326 for (uint8 i = 22; i < 36; ++i)
327 AddWaypoint(i-18, AllianceOverrunWP[i][0] + (std::rand() % 3 + -3), AllianceOverrunWP[i][1] + (std::rand() % 3 + -3), AllianceOverrunWP[i][2]);
328 SetDespawnAtEnd(true);
329 LastOverronPos = 17;
330 Start(true, true);
331 break;
332 }
333 }
334 }
335 if (faction == 1)
336 {
337 if (me->GetEntry() == GHOUL)
338 {
339 for (uint8 i = 0; i < 6; ++i)
340 AddWaypoint(i, HordeWPs[i][0] + (std::rand() % 3 + -3), HordeWPs[i][1] + (std::rand() % 3 + -3), HordeWPs[i][2]);
341 switch (OverrunType)
342 {
343 case 0:
344 AddWaypoint(5, HordeOverrunWP[16][0] + (std::rand() % 10 + -10), HordeOverrunWP[16][1] + (std::rand() % 10 + -10), HordeOverrunWP[16][2]);
345 AddWaypoint(6, HordeOverrunWP[17][0] + (std::rand() % 10 + -10), HordeOverrunWP[17][1] + (std::rand() % 10 + -10), HordeOverrunWP[17][2]);
346 AddWaypoint(7, HordeOverrunWP[18][0], HordeOverrunWP[18][1], HordeOverrunWP[18][2]);
347 AddWaypoint(8, HordeOverrunWP[19][0], HordeOverrunWP[19][1], HordeOverrunWP[19][2]);
348 me->SetHomePosition(HordeOverrunWP[19][0], HordeOverrunWP[19][1], HordeOverrunWP[19][2], 0);
349 SetDespawnAtEnd(false);
350 LastOverronPos = 8;
351 Start(true, true);
352 break;
353 case 1:
354 AddWaypoint(5, HordeOverrunWP[16][0] + (std::rand() % 10 + -10), HordeOverrunWP[16][1] + (std::rand() % 10 + -10), HordeOverrunWP[16][2]);
355 AddWaypoint(6, HordeOverrunWP[17][0] + (std::rand() % 10 + -10), HordeOverrunWP[17][1] + (std::rand() % 10 + -10), HordeOverrunWP[17][2]);
356 AddWaypoint(7, HordeOverrunWP[18][0], HordeOverrunWP[18][1], HordeOverrunWP[18][2]);
357 AddWaypoint(8, HordeOverrunWP[20][0], HordeOverrunWP[20][1], HordeOverrunWP[20][2]);
358 me->SetHomePosition(HordeOverrunWP[20][0], HordeOverrunWP[20][1], HordeOverrunWP[20][2], 0);
359 SetDespawnAtEnd(false);
360 LastOverronPos = 8;
361 Start(true, true);
362 break;
363 default:
364 for (uint8 i = 0; i < 16; ++i)
365 AddWaypoint(i+6, HordeOverrunWP[i][0] + (std::rand() % 10 + -10), HordeOverrunWP[i][1] + (std::rand() % 10 + -10), HordeOverrunWP[i][2]);
366 SetDespawnAtEnd(true);
367 LastOverronPos = 21;
368 Start(true, true);
369 break;
370 }
371 }
372 if (me->GetEntry() == ABOMINATION)
373 {
374 for (uint8 i = 0; i < 6; ++i)
375 AddWaypoint(i, HordeWPs[i][0] + (std::rand() % 10 + -10), HordeWPs[i][1] + (std::rand() % 10 + -10), HordeWPs[i][2]);
376 for (uint8 i = 0; i < 16; ++i)
377 AddWaypoint(i+6, HordeOverrunWP[i][0] + (std::rand() % 10 + -10), HordeOverrunWP[i][1] + (std::rand() % 10 + -10), HordeOverrunWP[i][2]);
378 SetDespawnAtEnd(true);
379 LastOverronPos = 21;
380 Start(true, true);
381 }
382 }
383 }
384}
385
387{
388 if (!instance)
389 return;
390
391 if (IsEvent && !me->isWorldBoss())
392 instance->SetData(DATA_TRASH, 0);//signal trash is dead
393
394 if ((instance->GetData(DATA_RAIDDAMAGE) < MINRAIDDAMAGE && !me->isWorldBoss()) || (damageTaken < me->GetMaxHealth()/4 && me->isWorldBoss()))
396}
397
399{
400public:
401 npc_giant_infernal() : CreatureScript("npc_giant_infernal") { }
402
404 {
406 {
407 instance = creature->GetInstanceScript();
408 meteor = false;//call once!
409 CanMove = false;
410 Delay = rand()%30000;
413 me->SetDisplayId(MODEL_INVIS);
414 go = false;
415 Reset();
416 }
417
418 bool meteor;
421 bool go;
424 bool imol;
425
427 {
428 spawnTimer = 2000;
429 FlameBuffetTimer= 2000;
430 imol = false;
431 }
432
433 void EnterCombat(Unit* /*who*/) OVERRIDE { }
434
436 {
437 if (waypointId == 0 && instance && !IsOverrun)
438 {
439 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
440 {
441 Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
442 if (target && target->IsAlive())
443 me->AddThreat(target, 0.0f);
444 }
445 }
446 }
447
449 {
450 if (Delay <= diff)
451 {
452 Delay=0;
453 }else{
454 Delay-=diff;
455 return;
456 }
457 if (!meteor)
458 {
459 float x, y, z;
460 me->GetPosition(x, y, z);
461 Creature* trigger = me->SummonCreature(NPC_TRIGGER, x+8, y+8, z+25+rand()%10, me->GetOrientation(), TempSummonType::TEMPSUMMON_TIMED_DESPAWN, 1000);
462 if (trigger)
463 {
464 trigger->SetVisible(false);
465 trigger->setFaction(me->getFaction());
466 trigger->SetDisableGravity(true);
467 trigger->CastSpell(me, SPELL_METEOR, true);
468 }
469 me->GetMotionMaster()->Clear();
470 meteor = true;
471 } else if (!CanMove){
472 if (spawnTimer <= diff)
473 {
476 me->SetDisplayId(me->GetUInt32Value(UNIT_FIELD_NATIVE_DISPLAY_ID));
477 CanMove = true;
478 if (instance)
479 {
480 if (instance->GetData(DATA_ALLIANCE_RETREAT) && !instance->GetData(DATA_HORDE_RETREAT))
481 {
482 Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
483 if (target && target->IsAlive())
484 me->AddThreat(target, 0.0f);
485 } else if (instance->GetData(DATA_ALLIANCE_RETREAT) && instance->GetData(DATA_HORDE_RETREAT)){
486 //do overrun
487 }
488 }
489 } else spawnTimer -= diff;
490 }
491 if (!CanMove)return;
493 if (IsEvent || IsOverrun)
495 if (IsEvent)
496 {
497 if (!go)
498 {
499 go = true;
500 if (instance)
501 {
502 AddWaypoint(0, HordeWPs[7][0] + (std::rand() % 3 + -3), HordeWPs[7][1] + (std::rand() % 3 + -3), HordeWPs[7][2]);//HordeWPs[7] infront of thrall
503 Start(true, true);
504 SetDespawnAtEnd(false);
505 }
506 }
507 }
508
509 if (!UpdateVictim())
510 return;
511 if (!imol)
512 {
514 imol=true;
515 }
516 if (FlameBuffetTimer <= diff)
517 {
519 FlameBuffetTimer = 7000;
520 } else FlameBuffetTimer -= diff;
522 }
523 };
524
526 {
527 return new npc_giant_infernalAI(creature);
528 }
529};
530
532{
533public:
534 npc_abomination() : CreatureScript("npc_abomination") { }
535
537 {
538 return new npc_abominationAI(creature);
539 }
540
542 {
544 {
545 instance = creature->GetInstanceScript();
546 go = false;
547 Reset();
548 }
549
550 bool go;
553 {
554 KnockDownTimer = 10000;
555 }
556
558 {
559 if (waypointId == 7 && instance && !IsOverrun)
560 {
561 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
562 {
563 Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
564 if (target && target->IsAlive())
565 me->AddThreat(target, 0.0f);
566 }
567 else
568 {
569 Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
570 if (target && target->IsAlive())
571 me->AddThreat(target, 0.0f);
572 }
573 }
574 if (waypointId == LastOverronPos && IsOverrun)
575 {
576 if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21))
577 {
578 me->setDeathState(DeathState::DEAD);
579 me->RemoveCorpse();
580 }
581 }
582 }
583
584 void EnterCombat(Unit* /*who*/) OVERRIDE { }
585
587 {
589 if (IsEvent || IsOverrun)
591 if (IsEvent)
592 {
593 if (!go)
594 {
595 go = true;
596 if (instance)
597 {
598 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
599 {
600 for (uint8 i = 0; i < 8; ++i)
601 AddWaypoint(i, HordeWPs[i][0] + (std::rand() % 3 + -3), HordeWPs[i][1] + (std::rand() % 3 + -3), HordeWPs[i][2]);
602 Start(false, true);
603 SetDespawnAtEnd(false);
604 }else//use alliance WPs
605 {
606 for (uint8 i = 0; i < 8; ++i)
607 AddWaypoint(i, AllianceWPs[i][0] + (std::rand() % 3 + -3), AllianceWPs[i][1] + (std::rand() % 3 + -3), AllianceWPs[i][2]);
608 Start(false, true);
609 SetDespawnAtEnd(false);
610 }
611 }
612 }
613 }
614 if (!me->HasAura(SPELL_DISEASE_CLOUD))
616 if (!UpdateVictim())
617 return;
618 if (KnockDownTimer <= diff)
619 {
621 KnockDownTimer = 15000+rand()%10000;
622 } else KnockDownTimer -= diff;
624 }
625 };
626};
627
629{
630public:
631 npc_ghoul() : CreatureScript("npc_ghoul") { }
632
634 {
635 return new npc_ghoulAI(creature);
636 }
637
639 {
640 npc_ghoulAI(Creature* creature) : hyjal_trashAI(creature)
641 {
642 instance = creature->GetInstanceScript();
643 go = false;
644 Reset();
645 }
646
647 bool go;
652 {
653 FrenzyTimer = 5000+rand()%5000;
654 MoveTimer = 2000;
655 RandomMove = false;
656 }
657
659 {
660 if (waypointId == 7 && instance && !IsOverrun)
661 {
662 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
663 {
664 Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
665 if (target && target->IsAlive())
666 me->AddThreat(target, 0.0f);
667 }
668 else
669 {
670 Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
671 if (target && target->IsAlive())
672 me->AddThreat(target, 0.0f);
673 }
674 }
675 if (waypointId == LastOverronPos && IsOverrun)
676 {
678 if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21))
679 {
680 me->setDeathState(DeathState::DEAD);
681 me->RemoveCorpse();
682 }
683 }
684 }
685
686 void EnterCombat(Unit* /*who*/) OVERRIDE { }
687
689 {
691 if (IsEvent || IsOverrun)
693 if (IsEvent)
694 {
695 if (!go)
696 {
697 go = true;
698 if (instance)
699 {
700 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
701 {
702 for (uint8 i = 0; i < 8; ++i)
703 AddWaypoint(i, HordeWPs[i][0] + (std::rand() % 3 + -3), HordeWPs[i][1] + (std::rand() % 3 + -3), HordeWPs[i][2]);
704 Start(false, true);
705 SetDespawnAtEnd(false);
706 }else//use alliance WPs
707 {
708 for (uint8 i = 0; i < 8; ++i)
709 AddWaypoint(i, AllianceWPs[i][0] + (std::rand() % 3 + -3), AllianceWPs[i][1] + (std::rand() % 3 + -3), AllianceWPs[i][2]);
710 Start(false, true);
711 SetDespawnAtEnd(false);
712 }
713 }
714 }
715 }
716 if (FrenzyTimer <= diff)
717 {
719 FrenzyTimer = 15000+rand()%15000;
720 } else FrenzyTimer -= diff;
721 if (!UpdateVictim())
722 return;
723
725 }
726 };
727};
728
730{
731public:
732 npc_necromancer() : CreatureScript("npc_necromancer") { }
733
735 {
736 return new npc_necromancerAI(creature);
737 }
738
740 {
742 {
743 instance = creature->GetInstanceScript();
744 go = false;
745 Reset();
746 }
747
749 bool go;
751
753 {
754 ShadowBoltTimer = 1000+rand()%5000;
755 summons.DespawnAll();
756 }
757
759 {
760 Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30, true);
761 if (target)
762 summon->Attack(target, false);
763 summons.Summon(summon);
764 }
765
767 {
768 summons.Despawn(summon);
769 }
770
772 {
773 if (waypointId == 7 && instance && !IsOverrun)
774 {
775 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
776 {
777 Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
778 if (target && target->IsAlive())
779 me->AddThreat(target, 0.0f);
780 }
781 else
782 {
783 Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
784 if (target && target->IsAlive())
785 me->AddThreat(target, 0.0f);
786 }
787 }
788 }
789
790 void KilledUnit(Unit* /*victim*/) OVERRIDE
791 {
792 switch (std::rand() % 2)
793 {
794 case 0:
797 break;
798 case 1:
801 break;
802 case 2:
803 DoSpawnCreature(RAND(17902, 17903), 3, 0, 0, 0, TempSummonType::TEMPSUMMON_TIMED_DESPAWN, 60000);
804 break;
805 }
806 }
807
808 void EnterCombat(Unit* /*who*/) OVERRIDE { }
809
811 {
813
814 if (IsEvent || IsOverrun)
816
817 if (IsEvent)
818 {
819 if (!go)
820 {
821 go = true;
822 if (instance)
823 {
824 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
825 {
826 for (uint8 i = 0; i < 8; ++i)
827 AddWaypoint(i, HordeWPs[i][0] + (std::rand() % 3 + -3), HordeWPs[i][1] + (std::rand() % 3 + -3), HordeWPs[i][2]);
828 Start(true, true);
829 SetDespawnAtEnd(false);
830 }else//use alliance WPs
831 {
832 for (uint8 i = 0; i < 8; ++i)
833 AddWaypoint(i, AllianceWPs[i][0] + (std::rand() % 3 + -3), AllianceWPs[i][1] + (std::rand() % 3 + -3), AllianceWPs[i][2]);
834 Start(true, true);
835 SetDespawnAtEnd(false);
836 }
837 }
838 }
839 }
840
841 if (!UpdateVictim())
842 return;
843
844 if (ShadowBoltTimer <= diff)
845 {
847 ShadowBoltTimer = 20000+rand()%10000;
848 } else ShadowBoltTimer -= diff;
849
851 }
852 };
853};
854
856{
857public:
858 npc_banshee() : CreatureScript("npc_banshee") { }
859
861 {
862 return new npc_bansheeAI(creature);
863 }
864
866 {
867 npc_bansheeAI(Creature* creature) : hyjal_trashAI(creature)
868 {
869 instance = creature->GetInstanceScript();
870 go = false;
871 Reset();
872 }
873
874 bool go;
878
880 {
881 CourseTimer = 20000+rand()%5000;
882 WailTimer = 15000+rand()%5000;
883 ShellTimer = 50000+rand()%10000;
884 }
885
887 {
888 if (waypointId == 7 && instance && !IsOverrun)
889 {
890 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
891 {
892 Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
893 if (target && target->IsAlive())
894 me->AddThreat(target, 0.0f);
895 }
896 else
897 {
898 Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
899 if (target && target->IsAlive())
900 me->AddThreat(target, 0.0f);
901 }
902 }
903 }
904
905 void EnterCombat(Unit* /*who*/) OVERRIDE { }
906
908 {
910 if (IsEvent || IsOverrun)
912 if (IsEvent)
913 {
914 if (!go)
915 {
916 go = true;
917 if (instance)
918 {
919 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
920 {
921 for (uint8 i = 0; i < 8; ++i)
922 AddWaypoint(i, HordeWPs[i][0] + (std::rand() % 3 + -3), HordeWPs[i][1] + (std::rand() % 3 + -3), HordeWPs[i][2]);
923 Start(false, true);
924 SetDespawnAtEnd(false);
925 }else//use alliance WPs
926 {
927 for (uint8 i = 0; i < 8; ++i)
928 AddWaypoint(i, AllianceWPs[i][0] + (std::rand() % 3 + -3), AllianceWPs[i][1] + (std::rand() % 3 + -3), AllianceWPs[i][2]);
929 Start(false, true);
930 SetDespawnAtEnd(false);
931 }
932 }
933 }
934 }
935 if (!UpdateVictim())
936 return;
937 if (CourseTimer <= diff)
938 {
940 CourseTimer = 20000+rand()%5000;
941 } else CourseTimer -= diff;
942 if (WailTimer <= diff)
943 {
945 WailTimer = 15000+rand()%5000;
946 } else WailTimer -= diff;
947 if (ShellTimer <= diff)
948 {
950 ShellTimer = 50000+rand()%10000;
951 } else ShellTimer -= diff;
953 }
954 };
955};
956
958{
959public:
960 npc_crypt_fiend() : CreatureScript("npc_crypt_fiend") { }
961
963 {
964 return new npc_crypt_fiendAI(creature);
965 }
966
968 {
970 {
971 instance = creature->GetInstanceScript();
972 go = false;
973 Reset();
974 }
975
976 bool go;
978
980 {
981 WebTimer = 20000+rand()%5000;
982 }
983
985 {
986 if (waypointId == 7 && instance && !IsOverrun)
987 {
988 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
989 {
990 Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
991 if (target && target->IsAlive())
992 me->AddThreat(target, 0.0f);
993 }
994 else
995 {
996 Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
997 if (target && target->IsAlive())
998 me->AddThreat(target, 0.0f);
999 }
1000 }
1001 }
1002
1003 void EnterCombat(Unit* /*who*/) OVERRIDE { }
1004
1006 {
1008 if (IsEvent || IsOverrun)
1010 if (IsEvent)
1011 {
1012 if (!go)
1013 {
1014 go = true;
1015 if (instance)
1016 {
1017 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
1018 {
1019 for (uint8 i = 0; i < 8; ++i)
1020 AddWaypoint(i, HordeWPs[i][0] + (std::rand() % 3 + -3), HordeWPs[i][1] + (std::rand() % 3 + -3), HordeWPs[i][2]);
1021 Start(false, true);
1022 SetDespawnAtEnd(false);
1023 }else//use alliance WPs
1024 {
1025 for (uint8 i = 0; i < 8; ++i)
1026 AddWaypoint(i, AllianceWPs[i][0] + (std::rand() % 3 + -3), AllianceWPs[i][1] + (std::rand() % 3 + -3), AllianceWPs[i][2]);
1027 Start(false, true);
1028 SetDespawnAtEnd(false);
1029 }
1030 }
1031 }
1032 }
1033 if (!UpdateVictim())
1034 return;
1035 if (WebTimer <= diff)
1036 {
1038 WebTimer = 20000+rand()%5000;
1039 } else WebTimer -= diff;
1041 }
1042 };
1043};
1044
1046{
1047public:
1048 npc_fel_stalker() : CreatureScript("npc_fel_stalker") { }
1049
1051 {
1052 return new npc_fel_stalkerAI(creature);
1053 }
1054
1056 {
1058 {
1059 instance = creature->GetInstanceScript();
1060 go = false;
1061 Reset();
1062 }
1063
1064 bool go;
1066
1068 {
1069 ManaBurnTimer = 9000+rand()%5000;
1070 }
1071
1073 {
1074 if (waypointId == 7 && instance && !IsOverrun)
1075 {
1076 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
1077 {
1078 Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
1079 if (target && target->IsAlive())
1080 me->AddThreat(target, 0.0f);
1081 }
1082 else
1083 {
1084 Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
1085 if (target && target->IsAlive())
1086 me->AddThreat(target, 0.0f);
1087 }
1088 }
1089 }
1090
1091 void EnterCombat(Unit* /*who*/) OVERRIDE { }
1092
1094 {
1096 if (IsEvent || IsOverrun)
1098 if (IsEvent)
1099 {
1100 if (!go)
1101 {
1102 go = true;
1103 if (instance)
1104 {
1105 if (instance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
1106 {
1107 for (uint8 i = 0; i < 8; ++i)
1108 AddWaypoint(i, HordeWPs[i][0] + (std::rand() % 3 + -3), HordeWPs[i][1] + (std::rand() % 3 + -3), HordeWPs[i][2]);
1109 Start(false, true);
1110 SetDespawnAtEnd(false);
1111 }else//use alliance WPs
1112 {
1113 for (uint8 i = 0; i < 8; ++i)
1114 AddWaypoint(i, AllianceWPs[i][0] + (std::rand() % 3 + -3), AllianceWPs[i][1] + (std::rand() % 3 + -3), AllianceWPs[i][2]);
1115 Start(false, true);
1116 SetDespawnAtEnd(false);
1117 }
1118 }
1119 }
1120 }
1121 if (!UpdateVictim())
1122 return;
1123 if (ManaBurnTimer <= diff)
1124 {
1126 ManaBurnTimer = 9000+rand()%5000;
1127 } else ManaBurnTimer -= diff;
1129 }
1130 };
1131};
1132
1134{
1135public:
1136 npc_frost_wyrm() : CreatureScript("npc_frost_wyrm") { }
1137
1139 {
1140 return new npc_frost_wyrmAI(creature);
1141 }
1142
1144 {
1146 {
1147 instance = creature->GetInstanceScript();
1148 go = false;
1149 Reset();
1150 }
1151
1152 bool go;
1155
1157 {
1158 FrostBreathTimer = 5000;
1159 MoveTimer = 0;
1160 me->SetDisableGravity(true);
1161 }
1162
1164 {
1165 if (waypointId == 2 && instance && !IsOverrun)
1166 {
1167 Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
1168 if (target && target->IsAlive())
1169 {
1170 me->AddThreat(target, 0.0f);
1171 DoCast(target, SPELL_FROST_BREATH, true);
1172 }
1173 }
1174 }
1175
1176 void JustDied(Unit* /*killer*/) OVERRIDE
1177 {
1178 if (instance && IsEvent)
1179 instance->SetData(DATA_TRASH, 0);//signal trash is dead
1180
1181 float x, y, z;
1182 me->GetPosition(x, y, z);
1183 z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z);
1184 me->GetMotionMaster()->MovePoint(0, x, y, z);
1185 me->SetPosition(x, y, z, 0);
1186 }
1187
1188 void EnterCombat(Unit* /*who*/) OVERRIDE { }
1189
1191 {
1193 if (IsEvent || IsOverrun)
1194 {
1195 CAST_AI(hyjal_trashAI, me->AI())->SetCanAttack(false);
1197 }
1198 if (IsEvent)
1199 {
1200 if (!go)
1201 {
1202 go = true;
1203 if (instance)
1204 {
1205 if (!useFlyPath)
1206 {
1207 for (uint8 i = 0; i < 3; ++i)
1208 AddWaypoint(i, FrostWyrmWPs[i][0], FrostWyrmWPs[i][1], FrostWyrmWPs[i][2]);
1209 Start(false, true);
1210 SetDespawnAtEnd(false);
1211 }else{//fly path FlyPathWPs
1212 for (uint8 i = 0; i < 3; ++i)
1213 AddWaypoint(i, FlyPathWPs[i][0] + (std::rand() % 10 + -10), FlyPathWPs[i][1] + (std::rand() % 10 + -10), FlyPathWPs[i][2]);
1214 Start(false, true);
1215 SetDespawnAtEnd(false);
1216 }
1217 }
1218 }
1219 }
1220 if (!UpdateVictim())
1221 return;
1222 if (!me->IsWithinDist(me->GetVictim(), 25)){
1223 if (MoveTimer <= diff)
1224 {
1225 me->GetMotionMaster()->MoveChase(me->GetVictim());
1226 MoveTimer = 2000;
1227 } else MoveTimer-=diff;
1228 }
1229
1230 if (FrostBreathTimer <= diff)
1231 {
1232 if (!me->IsWithinDist(me->GetVictim(), 25))
1233 {
1235 me->StopMoving();
1236 me->GetMotionMaster()->Clear();
1237 FrostBreathTimer = 4000;
1238 }
1239 } else FrostBreathTimer -= diff;
1240 }
1241 };
1242};
1243
1245{
1246public:
1247 npc_gargoyle() : CreatureScript("npc_gargoyle") { }
1248
1250 {
1251 return new npc_gargoyleAI(creature);
1252 }
1253
1255 {
1257 {
1258 instance = creature->GetInstanceScript();
1259 go = false;
1260 DummyTarget[0] = 0;DummyTarget[1] = 0;DummyTarget[2] = 0;
1261 Reset();
1262 }
1263
1264 bool go;
1267 float Zpos;
1269
1271 {
1272 forcemove = true;
1273 Zpos = 10.0f;
1274 StrikeTimer = 2000+rand()%5000;
1275 MoveTimer = 0;
1276 me->SetDisableGravity(true);
1277 }
1278
1280 {
1281 if (waypointId == 2 && instance && !IsOverrun)
1282 {
1283 Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
1284 if (target && target->IsAlive())
1285 {
1286 me->AddThreat(target, 0.0f);
1287 DoCast(target, SPELL_GARGOYLE_STRIKE, true);
1288 }
1289 }
1290 }
1291
1292 void JustDied(Unit* killer) OVERRIDE
1293 {
1294 float x, y, z;
1295 me->GetPosition(x, y, z);
1296 z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z);
1297 me->GetMotionMaster()->MovePoint(0, x, y, z);
1298 me->SetPosition(x, y, z, 0);
1300 }
1301
1303 {
1305 if (IsEvent || IsOverrun)
1306 {
1307 CAST_AI(hyjal_trashAI, me->AI())->SetCanAttack(false);
1309 }
1310 if (IsEvent)
1311 {
1312 if (!go)
1313 {
1314 go = true;
1315 if (instance)
1316 {
1317 if (!useFlyPath)
1318 {
1319 for (uint8 i = 0; i < 3; ++i)
1320 AddWaypoint(i, GargoyleWPs[i][0] + (std::rand() % 10 + -10), GargoyleWPs[i][1] + (std::rand() % 10 + -10), GargoyleWPs[i][2]);
1321 Start(false, true);
1322 SetDespawnAtEnd(false);
1323 }else{//fly path FlyPathWPs
1324 for (uint8 i = 0; i < 3; ++i)
1325 AddWaypoint(i, FlyPathWPs[i][0] + (std::rand() % 10 + -10), FlyPathWPs[i][1] + (std::rand() % 10 + -10), FlyPathWPs[i][2]);
1326 Start(false, true);
1327 SetDespawnAtEnd(false);
1328 }
1329 }
1330 }
1331 }
1332 if (IsOverrun && !UpdateVictim())
1333 {
1334 if (faction == 0)//alliance
1335 {
1336 if (StrikeTimer <= diff)
1337 {
1338 me->CastSpell(DummyTarget[0], DummyTarget[1], DummyTarget[2], SPELL_GARGOYLE_STRIKE, false);
1339 StrikeTimer = 2000+rand()%1000;
1340 } else StrikeTimer -= diff;
1341 }
1342 }
1343 if (!UpdateVictim())
1344 return;
1345 if (!me->IsWithinDist(me->GetVictim(), 20) || forcemove)
1346 {
1347 forcemove = false;
1348 if (forcemove)
1349 {
1350 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
1351 me->Attack(target, false);
1352 }
1353 if (MoveTimer <= diff)
1354 {
1355 float x, y, z;
1356 me->GetVictim()->GetPosition(x, y, z);
1357 me->GetMotionMaster()->MovePoint(0, x, y, z+Zpos);
1358 Zpos -= 1.0f;
1359 if (Zpos <= 0)
1360 Zpos = 0;
1361 MoveTimer = 2000;
1362 } else MoveTimer-=diff;
1363 }
1364 if (StrikeTimer <= diff)
1365 {
1366 if (me->IsWithinDist(me->GetVictim(), 20))
1367 {
1369 me->StopMoving();
1370 me->GetMotionMaster()->Clear();
1371 StrikeTimer = 2000+rand()%1000;
1372 } else StrikeTimer=0;
1373 } else StrikeTimer -= diff;
1374 }
1375 };
1376};
1377
1379{
1380public:
1381 alliance_rifleman() : CreatureScript("alliance_rifleman") { }
1382
1384 {
1385 return new alliance_riflemanAI(creature);
1386 }
1387
1389 {
1391 {
1392 SetCombatMovement(false);
1393 }
1394
1396
1397 void JustDied(Unit* /*killer*/) OVERRIDE
1398 {
1399 }
1400
1402 {
1403 ExplodeTimer = 5000+rand()%5000;
1404 }
1405
1407
1408 {
1409 if (!who || me->GetVictim())
1410 return;
1411
1412 if (me->IsValidAttackTarget(who))
1413 {
1414 //float attackRadius = me->GetAttackDistance(who);
1415 if (me->IsWithinDistInMap(who, 30))
1416 AttackStart(who);
1417 }
1418 }
1419
1421 {
1422 }
1423
1425 {
1426 //Check if we have a target
1427 if (!UpdateVictim())
1428 return;
1429 if (ExplodeTimer <= diff)
1430 {
1431 if (!me->IsWithinDistInMap(me->GetVictim(), 30))
1432 {
1434 return;
1435 }
1436 int dmg = 500+rand()%700;
1437 me->CastCustomSpell(me->GetVictim(), SPELL_EXPLODING_SHOT, &dmg, 0, 0, false);
1438 ExplodeTimer = 5000+rand()%5000;
1439 } else ExplodeTimer -= diff;
1441 }
1442 };
1443};
1444
1446{
1447 new npc_giant_infernal();
1448 new npc_abomination();
1449 new npc_ghoul();
1450 new npc_necromancer();
1451 new npc_banshee();
1452 new npc_crypt_fiend();
1453 new npc_fel_stalker();
1454 new npc_frost_wyrm();
1455 new npc_gargoyle();
1456 new alliance_rifleman();
1457}
const T & RAND(const T &v1, const T &v2)
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ TYPEID_PLAYER
Definition Object.h:55
@ TEMPSUMMON_TIMED_DESPAWN
Definition Object.h:70
#define CAST_AI(a, b)
@ EMOTE_ONESHOT_ATTACK_UNARMED
@ UNIT_DYNFLAG_LOOTABLE
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ UNIT_FLAG_NOT_SELECTABLE
Definition Unit.h:650
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_NATIVE_DISPLAY_ID
@ UNIT_FIELD_FLAGS
@ UNIT_FIELD_NPC_EMOTESTATE
@ OBJECT_FIELD_DYNAMIC_FLAGS
@ SPELL_IMMOLATION
@ SPELL_FRENZY
@ SPELL_KNOCKDOWN
@ SPELL_SHADOW_BOLT
@ SPELL_FROST_BREATH
bool UpdateVictim()
virtual void EnterEvadeMode()
CreatureScript(const char *name)
TypeID GetTypeId() const
Definition Object.h:131
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
Definition Unit.h:1367
void SetVisible(bool x)
Definition Unit.cpp:4163
void setFaction(uint32 faction)
Definition Unit.h:1699
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
bool IsPet() const
Definition Unit.h:1511
bool IsAlive() const
Definition Unit.h:2032
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition Unit.cpp:4895
bool SetDisableGravity(bool disable, bool packetOnly=false)
Definition Unit.cpp:9156
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) 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
CreatureAI * GetAI(Creature *creature) 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
@ GARGOYLE
Definition hyjal.h:52
@ ABOMINATION
Definition hyjal.h:48
@ GHOUL
Definition hyjal.h:49
@ DATA_TRASH
Definition hyjal.h:28
@ DATA_RAIDDAMAGE
Definition hyjal.h:32
@ DATA_THRALL
Definition hyjal.h:26
@ DATA_JAINAPROUDMOORE
Definition hyjal.h:21
@ DATA_ALLIANCE_RETREAT
Definition hyjal.h:30
@ DATA_HORDE_RETREAT
Definition hyjal.h:31
float FlyPathWPs[3][3]
void AddSC_hyjal_trash()
float FrostWyrmWPs[3][3]
@ SPELL_WEB
@ SPELL_RAISE_DEAD_3
@ SPELL_IMMOLATION
@ SPELL_FROST_BREATH
@ MODEL_INVIS
@ SPELL_BANSHEE_WAIL
@ SPELL_BANSHEE_CURSE
@ SPELL_RAISE_DEAD_2
@ SPELL_GARGOYLE_STRIKE
@ SPELL_RAISE_DEAD_1
@ SPELL_SHADOW_BOLT
@ SPELL_METEOR
@ SPELL_DISEASE_CLOUD
@ SPELL_FRENZY
@ SPELL_ANTI_MAGIC_SHELL
@ SPELL_KNOCKDOWN
@ SPELL_FLAME_BUFFET
@ SPELL_EXPLODING_SHOT
@ NPC_TRIGGER
@ SPELL_MANA_BURN
float AllianceOverrunWP[55][3]
float AllianceWPs[8][3]
float GargoyleWPs[3][3]
float HordeWPs[8][3]
float HordeOverrunWP[21][3]
#define MINRAIDDAMAGE
Definition hyjal_trash.h:12
void Reset() OVERRIDE
void SetCombatMovement(bool allowMovement)
Creature * me
Creature * DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, TempSummonType type, uint32 despawntime)
ScriptedAI(Creature *creature)
void AttackStart(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void MoveInLineOfSight(Unit *who) OVERRIDE
void JustDied(Unit *)
uint32 LastOverronPos
Definition hyjal_trash.h:28
void DamageTaken(Unit *done_by, uint32 &damage)
float DummyTarget[3]
Definition hyjal_trash.h:35
void UpdateAI(uint32 diff)
== Triggered Actions Requested ==================
uint32 damageTaken
Definition hyjal_trash.h:34
InstanceScript * instance
Definition hyjal_trash.h:25
uint32 OverrunType
Definition hyjal_trash.h:31
hyjal_trashAI(Creature *creature)
void EnterCombat(Unit *) OVERRIDE
npc_abominationAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void WaypointReached(uint32 waypointId) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void WaypointReached(uint32 waypointId) OVERRIDE
npc_bansheeAI(Creature *creature)
void EnterCombat(Unit *) OVERRIDE
void WaypointReached(uint32 waypointId) OVERRIDE
npc_crypt_fiendAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
npc_escortAI(Creature *creature)
void SetDespawnAtEnd(bool despawn)
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 AddWaypoint(uint32 id, float x, float y, float z, uint32 waitTime=0)
void WaypointReached(uint32 waypointId) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void WaypointReached(uint32 waypointId) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void EnterCombat(Unit *) OVERRIDE
npc_frost_wyrmAI(Creature *creature)
void JustDied(Unit *killer) OVERRIDE
npc_gargoyleAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void WaypointReached(uint32 waypointId) OVERRIDE
void WaypointReached(uint32 waypointId) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void Reset() OVERRIDE
void EnterCombat(Unit *) OVERRIDE
npc_ghoulAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void WaypointReached(uint32 waypointId) OVERRIDE
void SummonedCreatureDespawn(Creature *summon) OVERRIDE
npc_necromancerAI(Creature *creature)
void WaypointReached(uint32 waypointId) OVERRIDE
void EnterCombat(Unit *) OVERRIDE
void JustSummoned(Creature *summon) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================