Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
hyjalAI.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/* ScriptData
7SDName: HyjalAI
8SD%Complete: 90
9SDComment:
10SDCategory: Caverns of Time, Mount Hyjal
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "ScriptedCreature.h"
15#include "ScriptedEscortAI.h"
16#include "GridNotifiers.h"
17#include "GridNotifiersImpl.h"
18#include "Cell.h"
19#include "CellImpl.h"
20#include "hyjalAI.h"
21#include "hyjal_trash.h"
22
29
30#define YELL_HURRY "Hurry, we don't have much time"
31
32// Locations for summoning gargoyls and frost wyrms in special cases
34{
35 {5497.08f, -2493.23f, 1535.72f}, //spawn point for the gargoyles near the horde gate
36 {5624.53f, -2548.12f, 1551.54f}, //spawn point for the frost wyrm near the horde gate
37 {5604.41f, -2811.98f, 1547.77f} //spawn point for the gargoyles and wyrms near the horde tower
38};
39
40// Locations for summoning waves in Alliance base
41float AllianceBase[4][3]=
42{
43 {4928.48f, -1526.38f, 1326.83f},
44 {4923.54f, -1514.29f, 1327.98f},
45 {4928.41f, -1510.35f, 1327.99f},
46 {4938.35f, -1521.00f, 1326.69f}
47};
48
49float JainaDummySpawn[2][4]=
50{
51 {5497.01f, -2719.03f, 1483.08f, 2.90426f},
52 {5484.98f, -2721.69f, 1483.39f, 6.00656f}
53};
54
55// Locations for summoning waves in Horde base
56float HordeBase[4][3]=
57{
58 {5458.01f, -2340.27f, 1459.60f},
59 {5466.01f, -2334.69f, 1460.06f},
60 {5468.45f, -2355.13f, 1459.99f},
61 {5479.06f, -2344.16f, 1461.74f}
62};
63
64// Lady Jaina's waypoints when retreathing
65float JainaWPs[2][3]=
66{
67 {5078.56f, -1789.79f, 1320.73f}, //next to the small stairs
68 {5037.38f, -1778.39f, 1322.61f}, //center of alliance base
69};
70
71float InfernalPos[8][3]=//spawn points for the infernals in the horde base
72{
73 {5453.59f, -2764.52f, 1493.50f},
74 {5478.4f, -2781.77f, 1497.52f},
75 {5506.09f, -2780.53f, 1496.32f},
76 {5532.1f, -2763.42f, 1492.37f},
77 {5544.16f, -2733.99f, 1487.14f},
78 {5536.19f, -2708.18f, 1480.01f},
79 {5510.16f, -2691.75f, 1479.66f},
80 {5482.39f, -2689.19f, 1481.09f}
81};
82
83float InfernalSPWP[26][4]=//spawn points for the infernals in the horde base used in the cleaning wave
84{
85 {5490.96f, -2718.72f, 1482.96f, 0.49773f},
86 {5449.51f, -2723.32f, 1485.69f, 2.69685f},
87 {5520.83f, -2624.68f, 1483.82f, 1.20459f},
88 {5558.28f, -2629.26f, 1485.76f, 0.37992f},
89 {5567.97f, -2758.69f, 1494.10f, 5.04125f},
90 {5384.90f, -2793.47f, 1503.90f, 5.55412f},
91 {5495.33f, -2814.06f, 1501.56f, 1.12055f},
92 {5472.63f, -2929.39f, 1538.31f, 1.95777f},
93 {5334.72f, -2952.29f, 1534.34f, 0.50869f},
94 {5398.36f, -2872.46f, 1512.38f, 0.76787f},
95 {5514.39f, -2768.63f, 1492.30f, 1.55721f},
96 {5598.91f, -2703.75f, 1495.64f, 2.56644f},
97 {5467.80f, -2655.93f, 1482.27f, 0.85819f},
98 {5399.83f, -2985.24f, 1545.04f, 5.92559f},
99 {5232.13f, -2967.05f, 1553.09f, 5.41351f},
100 {5272.02f, -3082.52f, 1567.09f, 3.40681f},
101 {5343.26f, -3120.71f, 1582.92f, 3.16727f},
102 {5371.26f, -3175.24f, 1587.41f, 6.10466f},
103 {5434.67f, -3177.91f, 1579.25f, 2.77850f},
104 {5237.39f, -3149.25f, 1593.59f, 0.83855f},
105 {5202.15f, -3016.64f, 1566.28f, 3.31256f},
106 {5302.54f, -2914.37f, 1528.53f, 3.37146f},
107 {5439.04f, -2834.81f, 1508.80f, 2.14231f},
108 {5421.33f, -2771.04f, 1494.28f, 6.06223f},
109 {5549.76f, -2692.93f, 1482.68f, 2.19414f},
110 {5459.78f, -2755.71f, 1490.68f, 1.05139f}
111};
112
113float VeinPos[14][8]=//spawn points of the ancient gem veins
114{
115 {5184.84f, -1982.59f, 1382.66f, 2.58079f, 0, 0, 0.960944f, 0.276742f}, //alliance
116 {5107.66f, -2071.16f, 1368.37f, 2.65148f, 0, 0, 0.970124f, 0.242611f}, //alliance
117 {5040.53f, -2227.65f, 1403.17f, 3.35049f, 0, 0, 0.99455f, -0.104257f}, //alliance
118 {5187.59f, -2453.12f, 1455.51f, 5.87943f, 0, 0, 0.20051f, -0.979692f}, //alliance
119 {5429.43f, -2340.65f, 1465.38f, 4.7681f, 0, 0, 0.687138f, -0.726527f}, //alliance
120 {5463.99f, -2315.95f, 1470.29f, 1.52045f, 0, 0, 0.689084f, 0.724682f}, //alliance
121 {5624.65f, -2495.09f, 1510.11f, 0.0124869f, 0, 0, 0.00624342f, 0.999981f}, //alliance
122 {5285.41f, -3348.32f, 1663.01f, 1.57152f, 0, 0, 0.707362f, 0.706852f}, //horde
123 {5417.69f, -3372.52f, 1656.31f, 0.361993f, 0, 0, 0.18001f, 0.983665f}, //horde
124 {5315.34f, -3238.32f, 1622.88f, 3.03627f, 0, 0, 0.998614f, 0.0526347f}, //horde
125 {5303.4f, -3096.44f, 1596.41f, 1.72073f, 0, 0, 0.758081f, 0.65216f}, //horde
126 {5265.13f, -3177.27f, 1616.22f, 0.813604f, 0, 0, 0.395674f, 0.918391f}, //horde
127 {5374.3f, -3420.59f, 1653.43f, 1.45762f, 0, 0, 0.665981f, 0.745969f}, //horde
128 {5441.54f, -3321.59f, 1651.55f, 0.258306f, 0, 0, 0.128794f, 0.991671f} //horde
129};
130
131float AllianceOverrunGargPos[5][4]=//gargoyle spawn points in the alliance overrun
132{
133 {5279.94f, -2049.68f, 1311.38f, 0}, //garg1
134 {5289.15f, -2219.06f, 1291.12f, 0}, //garg2
135 {5202.07f, -2136.10f, 1305.07f, 2.8f}, //garg3
136 {5071.52f, -2425.63f, 1454.48f, 5.54f}, //garg4
137 {5120.65f, -2467.92f, 1463.93f, 2.54f}//garg5
138};
139
140float AllianceFirePos[92][8]=//spawn points for the fire visuals (GO) in the alliance base
141{
142 {5039.9f, -1796.84f, 1323.88f, 2.59222f, 0, 0, 0.962511f, 0.271243f},
143 {5087.2f, -1795.2f, 1320.68f, 1.03946f, 0, 0, 0.496644f, 0.867954f},
144 {5112.68f, -1806.66f, 1359.93f, 1.37799f, 0, 0, 0.63576f, 0.771887f},
145 {5095.61f, -1793.27f, 1359.78f, 0.580806f, 0, 0, 0.286338f, 0.958129f},
146 {5090.43f, -1784.45f, 1360.44f, 0.796784f, 0, 0, 0.387937f, 0.921686f},
147 {5139.25f, -1783.11f, 1359.39f, 3.30849f, 0, 0, 0.99652f, -0.0833509f},
148 {5112.16f, -1763.72f, 1361.35f, 5.10312f, 0, 0, 0.556388f, -0.830922f},
149 {4981.18f, -1793.98f, 1335.7f, 3.23072f, 0, 0, 0.999007f, -0.0445498f},
150 {4996.57f, -1766.75f, 1341.62f, 3.5331f, 0, 0, 0.980902f, -0.194505f},
151 {4983.74f, -1769.25f, 1345.75f, 3.79228f, 0, 0, 0.947541f, -0.319635f},
152 {4996.01f, -1774.43f, 1330.71f, 3.07364f, 0, 0, 0.999423f, 0.0339693f},
153 {5094.2f, -1726.13f, 1330.55f, 1.56175f, 0, 0, 0.703901f, 0.710298f},
154 {5079.82f, -1721.24f, 1336.26f, 1.18868f, 0, 0, 0.559964f, 0.828517f},
155 {5077.68f, -1717.15f, 1327.78f, 0.0145145f, 0, 0, 0.00725717f, 0.999974f},
156 {5122.27f, -1738.22f, 1341.67f, 0.835256f, 0, 0, 0.405593f, 0.914054f},
157 {5131.88f, -1741.15f, 1335.25f, 2.15472f, 0, 0, 0.880712f, 0.473653f},
158 {5196.93f, -1772.99f, 1345.2f, 0.128397f, 0, 0, 0.0641544f, 0.99794f},
159 {5225.33f, -1756.06f, 1344.17f, 3.04223f, 0, 0, 0.998766f, 0.0496599f},
160 {5224.84f, -1767.05f, 1360.06f, 3.19538f, 0, 0, 0.999638f, -0.0268922f},
161 {5202.05f, -1763.47f, 1361.68f, 2.59455f, 0, 0, 0.962826f, 0.270122f},
162 {5194.74f, -1766.66f, 1356.94f, 0.0734191f, 0, 0, 0.0367013f, 0.999326f},
163 {5159.67f, -1832.97f, 1344.5f, 5.17457f, 0, 0, 0.526356f, -0.850264f},
164 {5096.17f, -1858.73f, 1332.46f, 5.30021f, 0, 0, 0.471939f, -0.881631f},
165 {5110.7f, -1856.59f, 1342.84f, 5.97564f, 0, 0, 0.153167f, -0.9882f},
166 {5109.76f, -1855.3f, 1332.38f, 4.89572f, 0, 0, 0.639411f, -0.768865f},
167 {5068.95f, -1837.37f, 1328.81f, 2.61569f, 0, 0, 0.965628f, 0.25993f},
168 {5064.4f, -1824.77f, 1329.02f, 2.16409f, 0, 0, 0.88292f, 0.469524f},
169 {5059.89f, -1848.79f, 1329.59f, 0.0709955f, 0, 0, 0.0354903f, 0.99937f},
170 {5014.37f, -1851.39f, 1322.56f, 4.66949f, 0, 0, 0.722111f, -0.691777f},
171 {5025.1f, -1848.27f, 1323.39f, 4.44565f, 0, 0, 0.794854f, -0.606801f},
172 {4942.63f, -1890.13f, 1326.59f, 3.28719f, 0, 0, 0.997351f, -0.0727343f},
173 {4937.95f, -1888.71f, 1352.41f, 3.41678f, 0, 0, 0.990549f, -0.13716f},
174 {4922.48f, -1881.92f, 1352.41f, 5.03077f, 0, 0, 0.586075f, -0.810257f},
175 {4915.35f, -1894.32f, 1351.24f, 6.22457f, 0, 0, 0.0293048f, -0.999571f},
176 {4922.71f, -1904.84f, 1352.56f, 1.37866f, 0, 0, 0.63602f, 0.771672f},
177 {4932.89f, -1905.49f, 1352.56f, 1.89702f, 0, 0, 0.812549f, 0.582893f},
178 {5011.83f, -1861.05f, 1345.86f, 4.43777f, 0, 0, 0.797239f, -0.603664f},
179 {5011.83f, -1861.05f, 1363.26f, 4.748f, 0, 0, 0.694406f, -0.719583f},
180 {5021.46f, -1858.35f, 1342.17f, 4.86188f, 0, 0, 0.652329f, -0.757936f},
181 {4995.02f, -1698.3f, 1370.38f, 6.15779f, 0, 0, 0.0626579f, -0.998035f},
182 {5119.85f, -1728.9f, 1336.04f, 5.87112f, 0, 0, 0.204579f, -0.97885f},
183 {5214.75f, -1751.02f, 1342.5f, 5.08965f, 0, 0, 0.561972f, -0.827156f},
184 {5075.04f, -1822.43f, 1328.87f, 3.99951f, 0, 0, 0.9094f, -0.415924f},
185 {5057.09f, -1823.32f, 1350.35f, 3.88169f, 0, 0, 0.93231f, -0.361659f},
186 {4984.6f, -1816.99f, 1329.21f, 3.05308f, 0, 0, 0.999021f, 0.0442417f},
187 {4983.35f, -1811.55f, 1356.82f, 3.33975f, 0, 0, 0.995096f, -0.098917f},
188 {4984.11f, -1825.73f, 1350.76f, 2.26375f, 0, 0, 0.905211f, 0.424962f},
189 {4968.47f, -1786.46f, 1354.09f, 3.07663f, 0, 0, 0.999473f, 0.0324733f},
190 {5061.82f, -1751.16f, 1339.07f, 5.94727f, 0, 0, 0.167171f, -0.985928f},
191 {5063.75f, -1763, 1351.91f, 0.759707f, 0, 0, 0.370784f, 0.928719f},
192 {5078.65f, -1708.26f, 1353.9f, 1.27022f, 0, 0, 0.593264f, 0.805008f},
193 {4983.19f, -1755.96f, 1331.13f, 4.28221f, 0, 0, 0.841733f, -0.539894f},
194 {4972.76f, -1755.3f, 1332.5f, 4.21938f, 0, 0, 0.858276f, -0.513188f},
195 {4961.65f, -1760.82f, 1351.69f, 3.56515f, 0, 0, 0.977659f, -0.210198f},
196 {5086.45f, -1779.83f, 1321.62f, 6.23157f, 0, 0, 0.0258051f, -0.999667f},
197 {5063.15f, -1756.74f, 1328.56f, 0.886926f, 0, 0, 0.42907f, 0.903271f},
198 {5042.45f, -1800.61f, 1323.88f, 2.50093f, 0, 0, 0.949131f, 0.31488f},
199 {5084.74f, -1725.35f, 1327.89f, 1.65034f, 0, 0, 0.734663f, 0.678432f},
200 {4993.25f, -1758.1f, 1331.07f, 3.49995f, 0, 0, 0.98399f, -0.178223f},
201 {5078.53f, -1867.85f, 1348.91f, 5.85612f, 0, 0, 0.211913f, -0.977288f},
202 {5080.74f, -1869.73f, 1333.18f, 6.18206f, 0, 0, 0.0505424f, -0.998722f},
203 {5089.55f, -1894.13f, 1356.08f, 1.52072f, 0, 0, 0.689181f, 0.724589f},
204 {5113.24f, -1899.49f, 1363.77f, 1.50108f, 0, 0, 0.682034f, 0.731321f},
205 {4984.18f, -1907.69f, 1325.62f, 3.82193f, 0, 0, 0.942698f, -0.333646f},
206 {5094.14f, -2432.08f, 1429.38f, 4.70083f, 0, 0, 0.711182f, -0.703007f},
207 {5329.89f, -2113.30f, 1281.06f, 5.60560f, 0, 0, 0.332347f, -0.943157f},
208 {5170.87f, -2148.13f, 1278.32f, 1.63540f, 0, 0, 0.729573f, 0.683903f },
209 {5132.94f, -1960.25f, 1367.8f, 3.69787f, 0, 0, 0.961568f, -0.274566f},
210 {5280.82f, -2351.55f, 1431.57f, 4.46913f, 0, 0, 0.787677f, -0.616088f},
211 {5176.78f, -2121.43f, 1295.27f, 3.24153f, 0, 0, 0.998752f, -0.04995f},
212 {5332.75f, -2101.41f, 1296.37f, 5.50350f, 0, 0, 0.380043f, -0.924969f},
213 {5265.70f, -2050.27f, 1287.57f, 0.50051f, 0, 0, 0.247655f, 0.968848f },
214 {5194.21f, -2129.89f, 1274.04f, 3.08053f, 0, 0, 0.999534f, 0.0305272f},
215 {5225.81f, -1985.50f, 1364.15f, 0.37247f, 0, 0, 0.185163f, 0.982708f },
216 {5339.46f, -2204.47f, 1280.45f, 0.99921f, 0, 0, 0.479081f, 0.877771f },
217 {5269.63f, -2020.57f, 1299.62f, 3.00201f, 0, 0, 0.997566f, 0.0697332f},
218 {5111.54f, -2445.70f, 1435.31f, 2.70983f, 0, 0, 0.976788f, 0.214207f },
219 {5111.24f, -1901.14f, 1355.33f, 1.61028f, 0, 0, 0.720929f, 0.693009f },
220 {5310.42f, -2207.82f, 1277.46f, 0.50441f, 0, 0, 0.249544f, 0.968363f },
221 {5150.81f, -2042.13f, 1394.3f, 2.21031f, 0, 0, 0.893534f, 0.448995f },
222 {5224.84f, -2376.61f, 1366.33f, 5.0621f, 0, 0, 0.573311f, -0.819338f},
223 {5105.41f, -2454.86f, 1446.16f, 4.64584f, 0, 0, 0.730239f, -0.683191f},
224 {5309.65f, -2188.28f, 1266.84f, 5.56631f, 0, 0, 0.350811f, -0.936446f},
225 {5281.46f, -2047.82f, 1287.67f, 2.44909f, 0, 0, 0.940652f, 0.339373f },
226 {5325.45f, -2189.41f, 1309.6f, 6.23783f, 0, 0, 0.0226771f, -0.999743f},
227 {5190.96f, -2142.54f, 1293.03f, 6.25668f, 0, 0, 0.0132544f, -0.999912f},
228 {5089.99f, -2467.49f, 1441.8f, 0.77381f, 0, 0, 0.377326f, 0.92608f },
229 {5195.08f, -2129.01f, 1285.36f, 3.55727f, 0, 0, 0.978480f, -0.206344f},
230 {5353.76f, -2116.28f, 1299.27f, 6.17894f, 0, 0, 0.0521006f, -0.998642f},
231 {5271.14f, -2037.38f, 1299.24f, 4.07879f, 0, 0, 0.892201f, -0.451638f},
232 {5332.5f , -2181.28f, 1279.95f, 4.6906f, 0, 0, 0.714768f, -0.699362f},
233 {5108.2f , -2429.84f, 1427.73f, 4.5194f, 0, 0, 0.771943f, -0.635691f}
234};
235
236float HordeFirePos[65][8]=//spawn points for the fire visuals (GO) in the horde base
237{
238 {5524.11f, -2612.73f, 1483.38f, 1.96198f, 0, 0, 0.831047f, 0.556202f},
239 {5514.42f, -2617.19f, 1505.77f, 1.82453f, 0, 0, 0.790892f, 0.611956f},
240 {5510.21f, -2624.77f, 1485.34f, 1.71065f, 0, 0, 0.754783f, 0.655974f},
241 {5570.72f, -2619.04f, 1487.62f, 0.728898f, 0, 0, 0.356435f, 0.93432f},
242 {5570.29f, -2639.37f, 1487.31f, 1.49308f, 0, 0, 0.679104f, 0.734042f},
243 {5583.56f, -2637.2f, 1503.78f, 1.46559f, 0, 0, 0.668951f, 0.743307f},
244 {5571.53f, -2626.81f, 1510.99f, 0.362107f, 0, 0, 0.180066f, 0.983654f},
245 {5545.97f, -2659.62f, 1489.64f, 5.07055f, 0, 0, 0.569845f, -0.821752f},
246 {5557.44f, -2675.91f, 1482.58f, 1.70118f, 0, 0, 0.751671f, 0.659539f},
247 {5594.98f, -2742.31f, 1495.51f, 4.5993f, 0, 0, 0.74594f, -0.666013f},
248 {5599.65f, -2755.6f, 1505.05f, 1.66896f, 0, 0, 0.740947f, 0.671564f},
249 {5565.95f, -2774.75f, 1499.48f, 6.22425f, 0, 0, 0.0294611f, -0.999566f},
250 {5567.1f, -2769.7f, 1511.17f, 5.99257f, 0, 0, 0.144799f, -0.989461f},
251 {5572.84f, -2774.16f, 1527.06f, 0.836428f, 0, 0, 0.406129f, 0.913816f},
252 {5538.32f, -2805.94f, 1498.87f, 4.30082f, 0, 0, 0.836674f, -0.547701f},
253 {5515.66f, -2801.74f, 1503.53f, 5.57316f, 0, 0, 0.347602f, -0.937642f},
254 {5516.76f, -2827.14f, 1501.15f, 0.35026f, 0, 0, 0.174236f, 0.984704f},
255 {5536.13f, -2813.51f, 1537.21f, 4.51681f, 0, 0, 0.772765f, -0.634692f},
256 {5525.05f, -2825.16f, 1538.53f, 0.489275f, 0, 0, 0.242205f, 0.970225f},
257 {5534.42f, -2815.45f, 1562.84f, 4.62834f, 0, 0, 0.736191f, -0.676774f},
258 {5519.64f, -2831.12f, 1526.46f, 0.611008f, 0, 0, 0.300774f, 0.953696f},
259 {5551.04f, -2827.55f, 1523.5f, 3.35206f, 0, 0, 0.994468f, -0.10504f},
260 {5469.22f, -2802.87f, 1503.5f, 4.99509f, 0, 0, 0.600436f, -0.799673f},
261 {5427.8f, -2737.26f, 1487.12f, 1.78673f, 0, 0, 0.779186f, 0.626793f},
262 {5454.1f, -2709.1f, 1485.92f, 3.03552f, 0, 0, 0.998594f, 0.0530137f},
263 {5436.3f, -2718.2f, 1506.02f, 2.7567f, 0, 0, 0.981539f, 0.191261f},
264 {5412.6f, -2740.55f, 1510.79f, 2.98446f, 0, 0, 0.996915f, 0.0784832f},
265 {5406.12f, -2752.48f, 1521.01f, 2.05769f, 0, 0, 0.856705f, 0.515807f},
266 {5445.24f, -2676.35f, 1521.89f, 2.91378f, 0, 0, 0.99352f, 0.113661f},
267 {5481.4f, -2665.08f, 1482.23f, 4.30001f, 0, 0, 0.836895f, -0.547363f},
268 {5443.51f, -2675.44f, 1487.12f, 2.90986f, 0, 0, 0.993295f, 0.115606f},
269 {5391.72f, -2647.3f, 1528.9f, 3.76987f, 0, 0, 0.951063f, -0.308997f},
270 {5421.09f, -2734.12f, 1521.01f, 2.70567f, 0, 0, 0.97634f, 0.216242f},
271 {5405.39f, -2710.33f, 1533.77f, 2.51324f, 0, 0, 0.951052f, 0.309032f},
272 {5423.96f, -2703.76f, 1516.34f, 2.79206f, 0, 0, 0.984767f, 0.173879f},
273 {5444.75f, -2735.23f, 1486.37f, 2.22657f, 0, 0, 0.897155f, 0.441715f},
274 {5570.98f, -2747.91f, 1495.7f, 5.14433f, 0, 0, 0.53915f, -0.84221f},
275 {5567.79f, -2673.9f, 1484.66f, 2.72529f, 0, 0, 0.978415f, 0.20665f},
276 {5600.71f, -2696.8f, 1500.42f, 0.443704f, 0, 0, 0.220036f, 0.975492f},
277 {5600.7f, -2693.04f, 1515.2f, 5.16003f, 0, 0, 0.532522f, -0.846416f},
278 {5627.56f, -2839.66f, 1510.53f, 5.41527f, 0, 0, 0.420463f, -0.907309f},
279 {5622.02f, -2868.71f, 1516.22f, 2.25482f, 0, 0, 0.903303f, 0.429002f},
280 {5586.61f, -2878.97f, 1510.34f, 4.55604f, 0, 0, 0.76017f, -0.649724f},
281 {5583.78f, -2843.71f, 1509.54f, 5.35715f, 0, 0, 0.44665f, -0.894709f},
282 {5580.95f, -2811.3f, 1513.3f, 3.57587f, 0, 0, 0.976518f, -0.215434f},
283 {5542.52f, -2869.31f, 1523.13f, 5.23304f, 0, 0, 0.501275f, -0.865288f},
284 {5557.35f, -2866.36f, 1518.76f, 4.48299f, 0, 0, 0.783388f, -0.621533f},
285 {5380.91f, -2849.36f, 1512.81f, 3.90962f, 0, 0, 0.927168f, -0.374646f},
286 {5395.76f, -2881.41f, 1521.11f, 4.28426f, 0, 0, 0.84118f, -0.540755f},
287 {5374.87f, -2859.63f, 1528.98f, 3.30252f, 0, 0, 0.996765f, -0.0803745f},
288 {5356.07f, -2854.66f, 1520.34f, 5.83933f, 0, 0, 0.220108f, -0.975475f},
289 {5363.01f, -2975.72f, 1539.02f, 4.13738f, 0, 0, 0.87859f, -0.477576f},
290 {5336.85f, -2980.74f, 1561.24f, 5.11126f, 0, 0, 0.553001f, -0.83318f},
291 {5335.23f, -2974.62f, 1540.05f, 5.04451f, 0, 0, 0.580496f, -0.814263f},
292 {5422.37f, -2998.87f, 1549.98f, 4.51831f, 0, 0, 0.772288f, -0.635272f},
293 {5405.54f, -3014.6f, 1562.16f, 5.86761f, 0, 0, 0.206298f, -0.978489f},
294 {5427.96f, -3019.4f, 1561.58f, 3.53498f, 0, 0, 0.980718f, -0.19543f},
295 {5348.12f, -2977.84f, 1582.47f, 3.94025f, 0, 0, 0.921323f, -0.388799f},
296 {5331.12f, -2993.71f, 1576.14f, 0.0642734f, 0, 0, 0.0321311f, 0.999484f},
297 {5321.63f, -2986.55f, 1552.2f, 5.29503f, 0, 0, 0.474219f, -0.880407f},
298 {5292.1f, -2914.36f, 1529.52f, 2.9742f, 0, 0, 0.996499f, 0.083601f},
299 {5281.77f, -2926.5f, 1530.62f, 1.67829f, 0, 0, 0.744071f, 0.6681f},
300 {5287.19f, -2909.94f, 1543.49f, 3.31192f, 0, 0, 0.996376f, -0.0850591f},
301 {5534.15f, -2679.35f, 1483.61f, 0.428685f, 0, 0, 0.212705f, 0.977116f},
302 {5545.43f, -2647.82f, 1483.05f, 5.38848f, 0, 0, 0.432578f, -0.901596f}
303};
304
306{
307 instance = creature->GetInstanceScript();
308 VeinsSpawned[0] = false;
309 VeinsSpawned[1] = false;
310 for (uint8 i=0; i<14; ++i)
311 VeinGUID[i] = 0;
312 InfernalCount = 0;
313 TeleportTimer = 1000;
314 Overrun = false;
315 Teleported = false;
316 WaitForTeleport = false;
317 OverrunCounter = 0;
318 OverrunCounter2 = 0;
319 InfernalPoint = 0;
320 RespawnTimer = 10000;
321 DoRespawn = false;
322 DoHide = false;
324 DoMassTeleport = false;
325}
326
328{
329 Summons.Summon(summoned);
330}
331
333{
334 Summons.Despawn(summoned);
335}
336
338{
339 IsDummy = false;
340 me->setActive(true);
341 // GUIDs
342 PlayerGUID = 0;
343 BossGUID[0] = 0;
344 BossGUID[1] = 0;
345
346 // Timers
347 NextWaveTimer = 10000;
348 CheckTimer = 0;
349 RetreatTimer = 1000;
350
351 // Misc
352 WaveCount = 0;
353 EnemyCount = 0;
354
355 // Set faction properly based on Creature entry
356 switch (me->GetEntry())
357 {
358 case JAINA:
359 Faction = 0;
361 break;
362
363 case THRALL:
364 Faction = 1;
365 break;
366
367 case TYRANDE:
368 Faction = 2;
369 break;
370 }
371
372 //Bools
373 EventBegun = false;
374 FirstBossDead = false;
375 SecondBossDead = false;
376 Summon = false;
377 bRetreat = false;
378 Debug = false;
379
380 //Flags
382
383 //Initialize spells
384 memset(Spells, 0, sizeof(Spell) * HYJAL_AI_MAX_SPELLS);
385
386 //Reset Instance Data for trash count
387 if (instance)
388 {
389 if ((!instance->GetData(DATA_ALLIANCE_RETREAT) && me->GetEntry() == JAINA) || (instance->GetData(DATA_ALLIANCE_RETREAT) && me->GetEntry() == THRALL))
390 {
391 //Reset World States
392 instance->DoUpdateWorldState(WORLD_STATE_WAVES, 0);
393 instance->DoUpdateWorldState(WORLD_STATE_ENEMY, 0);
394 instance->DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0);
395 instance->SetData(DATA_RESET_TRASH_COUNT, 0);
396 }
397 } else SF_LOG_ERROR("scripts", ERROR_INST_DATA);
398
399 //Visibility
400 DoHide = true;
401}
402
404{
405 if (me->GetEntry() != JAINA)
406 me->RemoveAllAuras();
407 me->DeleteThreatList();
408 me->CombatStop(true);
409 me->LoadCreaturesAddon();
410
411 if (me->IsAlive())
412 me->GetMotionMaster()->MoveTargetedHome();
413
414 me->SetLootRecipient(NULL);
415}
416
418{
419 if (IsDummy)return;
420 for (uint8 i = 0; i < HYJAL_AI_MAX_SPELLS; ++i)
421 if (Spells[i].Cooldown)
422 SpellTimer[i] = Spells[i].Cooldown;
423
424 Talk(ATTACKED);
425}
426
428{
429 if (IsDummy)
430 return;
431
433}
434
435void hyjalAI::SummonCreature(uint32 entry, float Base[4][3])
436{
437 uint32 random = rand()%4;
438 float SpawnLoc[3];
439
440 for (uint8 i = 0; i < 3; ++i)
441 {
442 SpawnLoc[i] = Base[random][i];
443 }
444 Creature* creature = NULL;
445 switch (entry)
446 {
447 case 17906: //GARGOYLE
448
449 if (!FirstBossDead && (WaveCount == 1 || WaveCount == 3))
450 {//summon at tower
451 creature = me->SummonCreature(entry, SpawnPointSpecial[SPAWN_NEAR_TOWER][0] + (std::rand() % 20 + -20), SpawnPointSpecial[SPAWN_NEAR_TOWER][1]+ (std::rand() % 20 + -20), SpawnPointSpecial[SPAWN_NEAR_TOWER][2] + (std::rand() % 10 + -10), 0, TempSummonType::TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
452 if (creature)
453 CAST_AI(hyjal_trashAI, creature->AI())->useFlyPath = true;
454 }
455 else
456 {//summon at gate
457 creature = me->SummonCreature(entry, SpawnPointSpecial[SPAWN_GARG_GATE][0] + (std::rand() % 10 + -10), SpawnPointSpecial[SPAWN_GARG_GATE][1] + (std::rand() % 10 + -10), SpawnPointSpecial[SPAWN_GARG_GATE][2] + (std::rand() % 10 + -10), 0, TempSummonType::TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
458 }
459 break;
460 case 17907: //FROST_WYRM,
461 if (FirstBossDead && WaveCount == 1) //summon at gate
463 else
464 {
466 if (creature)
467 CAST_AI(hyjal_trashAI, creature->AI())->useFlyPath = true;
468 }
469 break;
470 case 17908: //GIANT_INFERNAL
472 if (InfernalCount > 7)
473 InfernalCount = 0;
475 break;
476 default:
477 creature = me->SummonCreature(entry, SpawnLoc[0], SpawnLoc[1], SpawnLoc[2], 0, TempSummonType::TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
478 break;
479 }
480
481 if (creature)
482 {
483 // Increment Enemy Count to be used in World States and instance script
484 ++EnemyCount;
485
486 creature->SetWalk(false);
487 creature->setActive(true);
488 switch (entry)
489 {
490 case NECROMANCER:
491 case ABOMINATION:
492 case GHOUL:
493 case BANSHEE:
494 case CRYPT_FIEND:
495 case GARGOYLE:
496 case FROST_WYRM:
497 case GIANT_INFERNAL:
498 case FEL_STALKER:
499 case RAGE_WINTERCHILL:
500 case ANETHERON:
501 case KAZROGAL:
502 case AZGALOR:
503 CAST_AI(hyjal_trashAI, creature->AI())->IsEvent = true;
504 break;
505 }
506 if (instance)
507 {
508 if (instance->GetData(DATA_RAIDDAMAGE) < MINRAIDDAMAGE)
509 creature->SetDisableReputationGain(true);//no repu for solo farming
510 }
511 // Check if Creature is a boss.
512 if (creature->isWorldBoss())
513 {
514 if (!FirstBossDead) BossGUID[0] = creature->GetGUID();
515 else BossGUID[1] = creature->GetGUID();
516 CheckTimer = 5000;
517 }
518 }
519}
520
521void hyjalAI::SummonNextWave(const Wave wave[18], uint32 Count, float Base[4][3])
522{
523 // 1 in 4 chance we give a rally yell. Not sure if the chance is offilike.
524 if (rand()%4 == 0)
525 Talk(RALLY);
526
527 if (!instance)
528 {
529 SF_LOG_ERROR("scripts", ERROR_INST_DATA);
530 return;
531 }
532 InfernalCount = 0;//reset infernal count every new wave
533
534 EnemyCount = instance->GetData(DATA_TRASH);
535 for (uint8 i = 0; i < 18; ++i)
536 {
537 if (wave[Count].Mob[i])
538 SummonCreature(wave[Count].Mob[i], Base);
539 }
540
541 if (!wave[Count].IsBoss)
542 {
543 uint32 stateValue = Count+1;
544 if (FirstBossDead)
545 stateValue -= 9; // Subtract 9 from it to give the proper wave number if we are greater than 8
546
547 // Set world state to our current wave number
548 instance->DoUpdateWorldState(WORLD_STATE_WAVES, stateValue); // Set world state to our current wave number
549 // Enable world state
550 instance->DoUpdateWorldState(WORLD_STATE_ENEMY, 1); // Enable world state
551
552 instance->SetData(DATA_TRASH, EnemyCount); // Send data for instance script to update count
553
554 if (!Debug)
555 NextWaveTimer = wave[Count].WaveTimer;
556 else
557 {
558 NextWaveTimer = 15000;
559 SF_LOG_DEBUG("scripts", "HyjalAI: debug mode is enabled. Next Wave in 15 seconds");
560 }
561 }
562 else
563 {
564 // Set world state for waves to 0 to disable it.
565 instance->DoUpdateWorldState(WORLD_STATE_WAVES, 0);
566 instance->DoUpdateWorldState(WORLD_STATE_ENEMY, 1);
567
568 // Set World State for enemies invading to 1.
569 instance->DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, 1);
570
571 Summon = false;
572 }
573 CheckTimer = 5000;
574}
575
577{
578 if (!player || IsDummy || !instance)
579 return;
580
581 Talk(BEGIN);
582
583 EventBegun = true;
584 Summon = true;
585
586 NextWaveTimer = 15000;
587 CheckTimer = 5000;
588 PlayerGUID = player->GetGUID();
589
591
592 instance->DoUpdateWorldState(WORLD_STATE_WAVES, 0);
593 instance->DoUpdateWorldState(WORLD_STATE_ENEMY, 0);
594 instance->DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0);
595
596 DeSpawnVeins();
597}
598
600{
601 if (instance)
602 return instance->GetData(Event);
603 else SF_LOG_ERROR("scripts", ERROR_INST_DATA);
604
605 return 0;
606}
607
609{
610 if (instance)
611 {
612 instance->SetData(TYPE_RETREAT, SPECIAL);
613
614 if (Faction == 0)
615 {
616 instance->SetData(DATA_ALLIANCE_RETREAT, 1);
617 AddWaypoint(0, JainaWPs[0][0], JainaWPs[0][1], JainaWPs[0][2]);
618 AddWaypoint(1, JainaWPs[1][0], JainaWPs[1][1], JainaWPs[1][2]);
619 Start(false, false);
620 SetDespawnAtEnd(false);//move to center of alliance base
621 }
622 if (Faction == 1)
623 {
624 instance->SetData(DATA_HORDE_RETREAT, 1);
625 Creature* JainaDummy = me->SummonCreature(JAINA, JainaDummySpawn[0][0], JainaDummySpawn[0][1], JainaDummySpawn[0][2], JainaDummySpawn[0][3], TempSummonType::TEMPSUMMON_TIMED_DESPAWN, 60000);
626 if (JainaDummy)
627 {
629 CAST_AI(hyjalAI, JainaDummy->AI())->IsDummy = true;
630 DummyGuid = JainaDummy->GetGUID();
631 }
633 Start(false, false);
634 SetDespawnAtEnd(false);//move to center of alliance base
635 }
636 }
637 SpawnVeins();
638 Overrun = true;
639 me->RemoveFlag(UNIT_FIELD_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);//cant talk after overrun event started
640}
641
643{
644 if (Faction == 0)
645 {
646 if (VeinsSpawned[0])//prevent any buggers
647 return;
648 for (uint8 i = 0; i<7; ++i)
649 {
650 GameObject* gem = me->SummonGameObject(GO_ANCIENT_VEIN, VeinPos[i][0], VeinPos[i][1], VeinPos[i][2], VeinPos[i][3], VeinPos[i][4], VeinPos[i][5], VeinPos[i][6], VeinPos[i][7], 0);
651 if (gem)
652 VeinGUID[i]=gem->GetGUID();
653 }
654 VeinsSpawned[0] = true;
655 }else{
656 if (VeinsSpawned[1])
657 return;
658 for (uint8 i = 7; i<14; ++i)
659 {
660 GameObject* gem = me->SummonGameObject(GO_ANCIENT_VEIN, VeinPos[i][0], VeinPos[i][1], VeinPos[i][2], VeinPos[i][3], VeinPos[i][4], VeinPos[i][5], VeinPos[i][6], VeinPos[i][7], 0);
661 if (gem)
662 VeinGUID[i]=gem->GetGUID();
663 }
664 VeinsSpawned[1] = true;
665 }
666}
667
669{
670 if (!instance)
671 return;
672 if (Faction == 1)
673 {
675 if (!unit)return;
676 hyjalAI* ai = CAST_AI(hyjalAI, unit->AI());
677 if (!ai)return;
678 for (uint8 i = 0; i<7; ++i)
679 {
680 if (GameObject* gem = instance->instance->GetGameObject(ai->VeinGUID[i]))
681 gem->Delete();
682 }
683 } else if (Faction)
684 {
685 Creature* unit=Unit::GetCreature((*me), instance->GetData64(DATA_THRALL));
686 if (!unit)return;
687 hyjalAI* ai = CAST_AI(hyjalAI, unit->AI());
688 if (!ai)return;
689 for (uint8 i = 7; i<14; ++i)
690 {
691 if (GameObject* gem = instance->instance->GetGameObject(ai->VeinGUID[i]))
692 gem->Delete();
693 }
694 }
695}
696
698{
699 if (IsDummy)
700 {
701 if (MassTeleportTimer < diff && DoMassTeleport)
702 {
704 DoMassTeleport = false;
705 } else MassTeleportTimer -= diff;
706 return;
707 }
708 if (DoHide)
709 {
710 DoHide = false;
711 switch (me->GetEntry())
712 {
713 case JAINA:
714 if (instance && instance->GetData(DATA_ALLIANCE_RETREAT))
715 {
716 me->SetVisible(false);
717 HideNearPos(me->GetPositionX(), me->GetPositionY());
718 HideNearPos(5037.76f, -1889.71f);
719 for (uint8 i = 0; i < 92; ++i)//summon fires
720 me->SummonGameObject(GO_ROARING_FLAME, AllianceFirePos[i][0], AllianceFirePos[i][1], AllianceFirePos[i][2], AllianceFirePos[i][3], AllianceFirePos[i][4], AllianceFirePos[i][5], AllianceFirePos[i][6], AllianceFirePos[i][7], 0);
721 }
722 else me->SetVisible(true);
723 break;
724 case THRALL: //thrall
725 if (instance && instance->GetData(DATA_HORDE_RETREAT))
726 {
727 me->SetVisible(false);
728 HideNearPos(me->GetPositionX(), me->GetPositionY());
729 HideNearPos(5563, -2763.19f);
730 HideNearPos(5542.2f, -2629.36f);
731 for (uint8 i = 0; i < 65; ++i)//summon fires
732 me->SummonGameObject(GO_ROARING_FLAME, HordeFirePos[i][0], HordeFirePos[i][1], HordeFirePos[i][2], HordeFirePos[i][3], HordeFirePos[i][4], HordeFirePos[i][5], HordeFirePos[i][6], HordeFirePos[i][7], 0);
733 }
734 else me->SetVisible(true);
735 break;
736 }
737 }
738 if (DoRespawn)
739 {
740 if (RespawnTimer <= diff)
741 {
742 DoRespawn = false;
743 RespawnNearPos(me->GetPositionX(), me->GetPositionY());
744 if (Faction == 0)
745 {
746 RespawnNearPos(5037.76f, -1889.71f);
747 } else if (Faction == 1)
748 {
749 RespawnNearPos(5563, -2763.19f);
750 RespawnNearPos(5542.2f, -2629.36f);
751 }
752 me->SetVisible(true);
753 }else{
754 RespawnTimer -= diff;
755 me->SetVisible(false);
756 }
757 return;
758 }
759 if (Overrun)
760 DoOverrun(Faction, diff);
761 if (bRetreat)
762 {
763 if (RetreatTimer <= diff)
764 {
765 IsDummy = true;
766 bRetreat = false;
767 HideNearPos(me->GetPositionX(), me->GetPositionY());
768 switch (me->GetEntry())
769 {
770 case JAINA://jaina
771 HideNearPos(5037.76f, -1889.71f);
772 break;
773 case THRALL://thrall
774 HideNearPos(5563, -2763.19f);
775 HideNearPos(5542.2f, -2629.36f);
776 HideNearPos(5603.75f, -2853.12f);
777 break;
778 }
779 me->SetVisible(false);
780 } else RetreatTimer -= diff;
781 }
782
783 if (!EventBegun)
784 return;
785
786 if (Summon)
787 {
788 if (instance && EnemyCount)
789 {
790 EnemyCount = instance->GetData(DATA_TRASH);
791 if (!EnemyCount)
792 NextWaveTimer = 5000;
793 }
794
795 if (NextWaveTimer <= diff)
796 {
797 if (Faction == 0)
799 else if (Faction == 1)
801 ++WaveCount;
802 } else NextWaveTimer -= diff;
803 }
804
805 if (CheckTimer <= diff)
806 {
807 for (uint8 i = 0; i < 2; ++i)
808 {
809 if (BossGUID[i])
810 {
811 Unit* unit = Unit::GetUnit(*me, BossGUID[i]);
812 if (unit && (!unit->IsAlive()))
813 {
814 if (BossGUID[i] == BossGUID[0])
815 {
816 Talk(INCOMING);
817 FirstBossDead = true;
818 }
819 else if (BossGUID[i] == BossGUID[1])
820 {
821 Talk(SUCCESS);
822 SecondBossDead = true;
823 }
824 EventBegun = false;
825 CheckTimer = 0;
827 BossGUID[i] = 0;
828 if (instance)
829 instance->DoUpdateWorldState(WORLD_STATE_ENEMY, 0); // Reset world state for enemies to disable it
830 }
831 }
832 }
833 CheckTimer = 5000;
834 } else CheckTimer -= diff;
835
836 if (!UpdateVictim())
837 return;
838
839 for (uint8 i = 0; i < HYJAL_AI_MAX_SPELLS; ++i)
840 {
841 if (Spells[i].SpellId)
842 {
843 if (SpellTimer[i] <= diff)
844 {
845 if (me->IsNonMeleeSpellCasted(false))
846 me->InterruptNonMeleeSpells(false);
847
848 Unit* target = NULL;
849
850 switch (Spells[i].TargetType)
851 {
852 case TARGETTYPE_SELF:
853 target = me;
854 break;
855
858 break;
859
861 target = me->GetVictim();
862 break;
863 }
864
865 if (target && target->IsAlive())
866 {
867 DoCast(target, Spells[i].SpellId);
868 SpellTimer[i] = Spells[i].Cooldown;
869 }
870 } else SpellTimer[i] -= diff;
871 }
872 }
873
875}
876
877void hyjalAI::JustDied(Unit* /*killer*/)
878{
879 if (IsDummy)return;
880 me->Respawn();
881 me->SetVisible(false);
882 DoRespawn = true;
883 RespawnTimer = 120000;
884 Talk(DEATH);
885 Summons.DespawnAll();//despawn all wave's summons
886 if (instance)
887 {//reset encounter if boss is despawned (ex: thrall is killed, boss despawns, event stucks at inprogress)
892 if (instance->GetData(DATA_KAZROGALEVENT) == IN_PROGRESS)
894 if (instance->GetData(DATA_AZGALOREVENT) == IN_PROGRESS)
896 instance->SetData(DATA_RESET_RAIDDAMAGE, 0);//reset damage on die
897 }
898}
899
900void hyjalAI::HideNearPos(float x, float y)
901{
903 Cell cell(pair);
904 cell.SetNoCreate();
905
906 // First get all creatures.
907 std::list<Creature*> creatures;
909 Skyfire::CreatureListSearcher<Skyfire::AllFriendlyCreaturesInGrid> creature_searcher(me, creatures, creature_check);
910
911 TypeContainerVisitor <Skyfire::CreatureListSearcher<Skyfire::AllFriendlyCreaturesInGrid>, GridTypeMapContainer> creature_visitor(creature_searcher);
912 cell.Visit(pair, creature_visitor, *(me->GetMap()), *me, me->GetGridActivationRange());
913
914 if (!creatures.empty())
915 {
916 for (std::list<Creature*>::const_iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
917 {
918 (*itr)->SetVisible(false);
919 (*itr)->setFaction(35);//make them friendly so mobs won't attack them
920 }
921 }
922}
923
924void hyjalAI::RespawnNearPos(float x, float y)
925{
927 Cell cell(p);
928 cell.SetNoCreate();
929
933 cell.Visit(p, obj_worker, *me->GetMap(), *me, me->GetGridActivationRange());
934}
935
937{
938 if (waypointId == 1 || (waypointId == 0 && me->GetEntry() == THRALL))
939 {
940 me->MonsterYell(YELL_HURRY, Language::LANG_UNIVERSAL, 0);
941 WaitForTeleport = true;
942 TeleportTimer = 20000;
943 if (me->GetEntry() == JAINA)
945 if (me->GetEntry() == THRALL && DummyGuid)
946 {
947 if (Creature* creature = Unit::GetCreature(*me, DummyGuid))
948 {
949 hyjalAI* ai = CAST_AI(hyjalAI, creature->AI());
950 ai->DoMassTeleport = true;
951 ai->MassTeleportTimer = 20000;
952 creature->CastSpell(me, SPELL_MASS_TELEPORT, false);
953 }
954 }
955 //do some talking
956 //all alive guards walk near here
957 CellCoord pair(Skyfire::ComputeCellCoord(me->GetPositionX(), me->GetPositionY()));
958 Cell cell(pair);
959 cell.SetNoCreate();
960
961 // First get all creatures.
962 std::list<Creature*> creatures;
964 Skyfire::CreatureListSearcher<Skyfire::AllFriendlyCreaturesInGrid> creature_searcher(me, creatures, creature_check);
967 GridTypeMapContainer> creature_visitor(creature_searcher);
968
969 cell.Visit(pair, creature_visitor, *(me->GetMap()), *me, me->GetGridActivationRange());
970
971 if (!creatures.empty())
972 {
973 for (std::list<Creature*>::const_iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
974 {
975 if ((*itr) && (*itr)->IsAlive() && (*itr) != me && (*itr)->GetEntry() != JAINA)
976 {
977 if (!(*itr)->IsWithinDist(me, 60))
978 (*itr)->SetWalk(false);
979 float x, y, z;
980 (*itr)->SetDefaultMovementType(IDLE_MOTION_TYPE);
981 (*itr)->GetMotionMaster()->Initialize();
982 float range = 10;
983 if (me->GetEntry() == THRALL)range = 20;
984 me->GetNearPoint(me, x, y, z, range, 0, me->GetAngle((*itr)));
985 (*itr)->GetMotionMaster()->MovePoint(0, x + (std::rand() % 5 + -5), y + (std::rand() % 5 + -5), me->GetPositionZ());
986 }
987 }
988 }
989 }
990}
991void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
992{
994 if (WaitForTeleport)
995 {
996 if (TeleportTimer <= diff)
997 {
998 CellCoord pair(Skyfire::ComputeCellCoord(me->GetPositionX(), me->GetPositionY()));
999 Cell cell(pair);
1000 cell.SetNoCreate();
1001
1002 std::list<Creature*> creatures;
1004 Skyfire::CreatureListSearcher<Skyfire::AllFriendlyCreaturesInGrid> creature_searcher(me, creatures, creature_check);
1007 GridTypeMapContainer> creature_visitor(creature_searcher);
1008
1009 cell.Visit(pair, creature_visitor, *(me->GetMap()), *me, me->GetGridActivationRange());
1010
1011 if (!creatures.empty())
1012 {
1013 for (std::list<Creature*>::const_iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
1014 {
1015 if ((*itr) && (*itr)->IsAlive())
1016 {
1017 (*itr)->CastSpell(*itr, SPELL_TELEPORT_VISUAL, true);
1018 (*itr)->setFaction(35);//make them friendly so mobs won't attack them
1020 }
1021 }
1023 bRetreat = true;
1024 RetreatTimer = 1000;
1025 }
1026
1027 WaitForTeleport = false;
1028 Teleported = true;
1029 }TeleportTimer -= diff;
1030 }
1031 if (!Teleported)
1032 return;
1033 Overrun = false;//execute once
1034 switch (faction)
1035 {
1036 case 0://alliance
1037 for (uint8 i = 0; i < 92; ++i)//summon fires
1038 me->SummonGameObject(GO_ROARING_FLAME, AllianceFirePos[i][0], AllianceFirePos[i][1], AllianceFirePos[i][2], AllianceFirePos[i][3], AllianceFirePos[i][4], AllianceFirePos[i][5], AllianceFirePos[i][6], AllianceFirePos[i][7], 0);
1039
1040 for (uint8 i = 0; i < 25; ++i)//summon 25 ghouls
1041 {
1042 uint8 r = rand()%4;
1043 Creature* unit = me->SummonCreature(GHOUL, AllianceBase[r][0] + (std::rand() % 15 + -15), AllianceBase[r][1] + (std::rand() % 15 + -15), AllianceBase[r][2], 0, TempSummonType::TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
1044 if (unit)
1045 {
1046 CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
1047 CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
1048 CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
1049 unit->setActive(true);
1050 }
1051 }
1052 for (uint8 i = 0; i < 3; ++i)//summon 3 abominations
1053 {
1054 uint8 r = rand()%4;
1055 Creature* unit = me->SummonCreature(ABOMINATION, AllianceBase[r][0] + (std::rand() % 15 + -15), AllianceBase[r][1] + (std::rand() % 15 + -15), AllianceBase[r][2], 0, TempSummonType::TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
1056 if (unit)
1057 {
1058 CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
1059 CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
1060 CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
1061 unit->setActive(true);
1062 }
1063 }
1064 for (uint8 i = 0; i < 5; ++i)//summon 5 gargoyles
1065 {
1067 if (unit)
1068 {
1070 CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
1071 CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
1072 CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
1073 unit->setActive(true);
1074 }
1075 }
1076 break;
1077 case 1://horde
1078 for (uint8 i = 0; i < 65; ++i)//summon fires
1079 me->SummonGameObject(GO_ROARING_FLAME, HordeFirePos[i][0], HordeFirePos[i][1], HordeFirePos[i][2], HordeFirePos[i][3], HordeFirePos[i][4], HordeFirePos[i][5], HordeFirePos[i][6], HordeFirePos[i][7], 0);
1080
1081 for (uint8 i = 0; i < 26; ++i)//summon infernals
1082 {
1083 Creature* unit = me->SummonCreature(GIANT_INFERNAL, InfernalSPWP[i][0], InfernalSPWP[i][1], InfernalSPWP[i][2], InfernalSPWP[i][3], TempSummonType::TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
1084 if (unit)
1085 {
1086 unit->SetHomePosition(InfernalSPWP[i][0], InfernalSPWP[i][1], InfernalSPWP[i][2], InfernalSPWP[i][3]);
1087 CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
1088 CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
1089 CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
1090 unit->setActive(true);
1091 }
1092 }
1093 for (uint8 i = 0; i < 25; ++i)//summon 25 ghouls
1094 {
1095 uint8 r = rand()%4;
1096 Creature* unit = me->SummonCreature(GHOUL, HordeBase[r][0] + (std::rand() % 15 + -15), HordeBase[r][1] + (std::rand() % 15 + -15), HordeBase[r][2], 0, TempSummonType::TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
1097 if (unit)
1098 {
1099 CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
1100 CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
1101 CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
1102 unit->setActive(true);
1103 }
1104 }
1105 for (uint8 i = 0; i < 5; ++i)//summon 5 abominations
1106 {
1107 uint8 r = rand()%4;
1108 Creature* unit = me->SummonCreature(ABOMINATION, HordeBase[r][0] + (std::rand() % 15 + -15), HordeBase[r][1] + (std::rand() % 15 + -15), HordeBase[r][2], 0, TempSummonType::TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
1109 if (unit)
1110 {
1111 CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
1112 CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
1113 CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
1114 unit->setActive(true);
1115 }
1116 }
1117 break;
1118 }
1119}
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
TypeMapContainer< AllGridObjectTypes > GridTypeMapContainer
Definition GridDefines.h:71
CoordPair< TOTAL_NUMBER_OF_CELLS_PER_MAP > CellCoord
@ IN_PROGRESS
@ SPECIAL
@ NOT_STARTED
#define SF_LOG_DEBUG(filterType__,...)
Definition Log.h:134
#define SF_LOG_ERROR(filterType__,...)
Definition Log.h:143
@ IDLE_MOTION_TYPE
@ TEMPSUMMON_MANUAL_DESPAWN
Definition Object.h:75
@ TEMPSUMMON_TIMED_DESPAWN
Definition Object.h:70
@ TEMPSUMMON_TIMED_OR_DEAD_DESPAWN
Definition Object.h:68
#define CAST_AI(a, b)
@ UNIT_NPC_FLAG_GOSSIP
Definition Unit.h:687
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_NPC_FLAGS
@ UNIT_FIELD_FLAGS
static Position SpawnLoc[]
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
void SetHomePosition(float x, float y, float z, float o)
Definition Creature.h:626
bool isWorldBoss() const
void SetDisableReputationGain(bool disable)
Definition Creature.h:648
CreatureAI * AI() const
Definition Creature.h:483
uint64 GetGUID() const
Definition Object.h:119
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition Object.cpp:1280
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
Definition Unit.h:1367
bool IsAlive() const
Definition Unit.h:2032
static Creature * GetCreature(WorldObject &object, uint64 guid)
Definition Unit.cpp:4905
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition Unit.cpp:4895
bool SetWalk(bool enable)
Definition Unit.cpp:9137
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
void setActive(bool isActiveObject)
Definition Object.cpp:1542
@ WORLD_STATE_WAVES
Definition hyjal.h:39
@ WORLD_STATE_ENEMY
Definition hyjal.h:40
@ WORLD_STATE_ENEMYCOUNT
Definition hyjal.h:41
@ KAZROGAL
Definition hyjal.h:64
@ AZGALOR
Definition hyjal.h:65
@ FEL_STALKER
Definition hyjal.h:55
@ TYRANDE
Definition hyjal.h:59
@ BANSHEE
Definition hyjal.h:50
@ ANETHERON
Definition hyjal.h:63
@ GARGOYLE
Definition hyjal.h:52
@ GIANT_INFERNAL
Definition hyjal.h:54
@ FROST_WYRM
Definition hyjal.h:53
@ ABOMINATION
Definition hyjal.h:48
@ JAINA
Definition hyjal.h:57
@ CRYPT_FIEND
Definition hyjal.h:51
@ GHOUL
Definition hyjal.h:49
@ RAGE_WINTERCHILL
Definition hyjal.h:62
@ THRALL
Definition hyjal.h:58
@ NECROMANCER
Definition hyjal.h:47
@ GO_ROARING_FLAME
Definition hyjal.h:76
@ GO_ANCIENT_VEIN
Definition hyjal.h:75
@ TYPE_RETREAT
Definition hyjal.h:34
@ DATA_RAGEWINTERCHILLEVENT
Definition hyjal.h:25
@ DATA_TRASH
Definition hyjal.h:28
@ DATA_RAIDDAMAGE
Definition hyjal.h:32
@ DATA_RESET_RAIDDAMAGE
Definition hyjal.h:33
@ DATA_THRALL
Definition hyjal.h:26
@ DATA_KAZROGALEVENT
Definition hyjal.h:23
@ DATA_AZGALOREVENT
Definition hyjal.h:20
@ DATA_ANETHERONEVENT
Definition hyjal.h:16
@ DATA_JAINAPROUDMOORE
Definition hyjal.h:21
@ DATA_ALLIANCE_RETREAT
Definition hyjal.h:30
@ DATA_HORDE_RETREAT
Definition hyjal.h:31
@ DATA_RESET_TRASH_COUNT
Definition hyjal.h:29
#define MINRAIDDAMAGE
Definition hyjal_trash.h:12
float VeinPos[14][8]
Definition hyjalAI.cpp:113
float AllianceOverrunGargPos[5][4]
Definition hyjalAI.cpp:131
float JainaWPs[2][3]
Definition hyjalAI.cpp:65
float HordeBase[4][3]
Definition hyjalAI.cpp:56
float InfernalPos[8][3]
Definition hyjalAI.cpp:71
float JainaDummySpawn[2][4]
Definition hyjalAI.cpp:49
Spawns
Definition hyjalAI.cpp:24
@ SPAWN_NEAR_TOWER
Definition hyjalAI.cpp:27
@ SPAWN_GARG_GATE
Definition hyjalAI.cpp:25
@ SPAWN_WYRM_GATE
Definition hyjalAI.cpp:26
float InfernalSPWP[26][4]
Definition hyjalAI.cpp:83
float HordeFirePos[65][8]
Definition hyjalAI.cpp:236
float AllianceBase[4][3]
Definition hyjalAI.cpp:41
float SpawnPointSpecial[3][3]
Definition hyjalAI.cpp:33
#define YELL_HURRY
Definition hyjalAI.cpp:30
float AllianceFirePos[92][8]
Definition hyjalAI.cpp:140
TargetType
Definition hyjalAI.h:88
@ TARGETTYPE_RANDOM
Definition hyjalAI.h:90
@ TARGETTYPE_SELF
Definition hyjalAI.h:89
@ TARGETTYPE_VICTIM
Definition hyjalAI.h:91
const Wave HordeWaves[]
Definition hyjalAI.h:62
@ SPELL_TELEPORT_VISUAL
Definition hyjalAI.h:16
@ SPELL_BRILLIANCE_AURA
Definition hyjalAI.h:20
@ SPELL_MASS_TELEPORT
Definition hyjalAI.h:17
const Wave AllianceWaves[]
Definition hyjalAI.h:37
@ ATTACKED
Definition hyjalAI.h:96
@ BEGIN
Definition hyjalAI.h:97
@ INCOMING
Definition hyjalAI.h:98
@ RALLY
Definition hyjalAI.h:99
@ DEATH
Definition hyjalAI.h:102
@ SUCCESS
Definition hyjalAI.h:101
#define HYJAL_AI_MAX_SPELLS
Definition hyjalAI.h:12
#define ERROR_INST_DATA(a)
Definition karazhan.h:52
CellCoord ComputeCellCoord(float x, float y)
Definition Cell.h:37
void SetNoCreate()
Definition Cell.h:66
void Visit(CellCoord const &, TypeContainerVisitor< T, CONTAINER > &visitor, Map &, WorldObject const &, float) const
Definition CellImpl.h:109
Creature * me
Definition hyjalAI.h:31
uint32 WaveTimer
Definition hyjalAI.h:33
bool Debug
Definition hyjalAI.h:164
void RespawnNearPos(float x, float y)
Definition hyjalAI.cpp:924
bool WaitForTeleport
Definition hyjalAI.h:170
void SpawnVeins()
Definition hyjalAI.cpp:642
uint32 RespawnTimer
Definition hyjalAI.h:175
void SummonNextWave(const Wave wave[18], uint32 Count, float Base[4][3])
Definition hyjalAI.cpp:521
bool FirstBossDead
Definition hyjalAI.h:160
void Reset()
Definition hyjalAI.cpp:337
uint32 OverrunCounter2
Definition hyjalAI.h:173
bool Summon
Definition hyjalAI.h:162
bool DoMassTeleport
Definition hyjalAI.h:180
uint32 CheckTimer
Definition hyjalAI.h:154
bool VeinsSpawned[2]
Definition hyjalAI.h:165
void EnterCombat(Unit *)
Definition hyjalAI.cpp:417
bool DoRespawn
Definition hyjalAI.h:176
bool SecondBossDead
Definition hyjalAI.h:161
uint32 RetreatTimer
Definition hyjalAI.h:157
bool bRetreat
Definition hyjalAI.h:163
struct hyjalAI::Spell Spells[HYJAL_AI_MAX_SPELLS]
void StartEvent(Player *player)
Definition hyjalAI.cpp:576
void MoveInLineOfSight(Unit *who)
Definition hyjalAI.cpp:427
uint8 InfernalCount
Definition hyjalAI.h:166
void EnterEvadeMode()
Definition hyjalAI.cpp:403
uint32 EnemyCount
Definition hyjalAI.h:156
uint32 InfernalPoint
Definition hyjalAI.h:174
uint64 PlayerGUID
Definition hyjalAI.h:148
void DeSpawnVeins()
Definition hyjalAI.cpp:668
uint32 MassTeleportTimer
Definition hyjalAI.h:179
void SummonedCreatureDespawn(Creature *summoned)
Definition hyjalAI.cpp:332
void UpdateAI(uint32 diff)
== Triggered Actions Requested ==================
Definition hyjalAI.cpp:697
void HideNearPos(float x, float y)
Definition hyjalAI.cpp:900
SummonList Summons
Definition hyjalAI.h:167
uint32 NextWaveTimer
Definition hyjalAI.h:152
bool EventBegun
Definition hyjalAI.h:159
void Retreat()
Definition hyjalAI.cpp:608
void WaypointReached(uint32 waypointId)
Definition hyjalAI.cpp:936
uint32 GetInstanceData(uint32 Event)
Definition hyjalAI.cpp:599
void JustSummoned(Creature *summoned)
Definition hyjalAI.cpp:327
uint32 OverrunCounter
Definition hyjalAI.h:172
uint64 DummyGuid
Definition hyjalAI.h:181
hyjalAI(Creature *creature)
Definition hyjalAI.cpp:305
void JustDied(Unit *)
Definition hyjalAI.cpp:877
uint32 TeleportTimer
Definition hyjalAI.h:171
uint32 WaveCount
Definition hyjalAI.h:153
InstanceScript * instance
Definition hyjalAI.h:146
void DoOverrun(uint32 faction, const uint32 diff)
Definition hyjalAI.cpp:991
bool Overrun
Definition hyjalAI.h:168
uint64 BossGUID[2]
Definition hyjalAI.h:149
uint32 SpellTimer[3]
Definition hyjalAI.h:191
uint64 VeinGUID[14]
Definition hyjalAI.h:150
void SummonCreature(uint32 entry, float Base[4][3])
Definition hyjalAI.cpp:435
bool Teleported
Definition hyjalAI.h:169
uint32 Faction
Definition hyjalAI.h:155
bool DoHide
Definition hyjalAI.h:177
bool IsDummy
Definition hyjalAI.h:178
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 MoveInLineOfSight(Unit *who) OVERRIDE
void AddWaypoint(uint32 id, float x, float y, float z, uint32 waitTime=0)