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