TrinityCore
Loading...
Searching...
No Matches
OutdoorPvPNA.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "OutdoorPvPNA.h"
19#include "Creature.h"
20#include "GameObject.h"
21#include "Map.h"
22#include "ObjectMgr.h"
23#include "OutdoorPvPMgr.h"
24#include "Player.h"
25#include "ScriptMgr.h"
26#include "WorldStatePackets.h"
27
28uint32 const NA_CREDIT_MARKER = 24867; // kill credit for pks
30uint32 const NA_BUFF_ZONE = 3518;
32uint32 const NA_HALAA_GRAVEYARD_ZONE = 3518; // need to add zone id, not area id
33uint32 const NA_RESPAWN_TIME = 3600000; // one hour to capture after defeating all guards
34uint32 const NA_GUARD_CHECK_TIME = 500; // every half second
36uint32 const FlightPathStartNodes[FLIGHT_NODES_NUM] = { 103, 105, 107, 109 };
37uint32 const FlightPathEndNodes[FLIGHT_NODES_NUM] = { 104, 106, 108, 110 };
38
39// spawned when the alliance is attacking, horde is in control
41{
42 { 182267, 530, { -1815.8000f, 8036.5100f, -26.2354f, -2.897250f }, { 0.0f, 0.0f, 0.992546f, -0.121869f } }, //ALLY_ROOST_SOUTH
43 { 182280, 530, { -1507.9500f, 8132.1000f, -19.5585f, -1.343900f }, { 0.0f, 0.0f, 0.622515f, -0.782608f } }, //ALLY_ROOST_WEST
44 { 182281, 530, { -1384.5200f, 7779.3300f, -11.1663f, -0.575959f }, { 0.0f, 0.0f, 0.284015f, -0.958820f } }, //ALLY_ROOST_NORTH
45 { 182282, 530, { -1650.1100f, 7732.5600f, -15.4505f, -2.809980f }, { 0.0f, 0.0f, 0.986286f, -0.165048f } }, //ALLY_ROOST_EAST
46
47 { 182222, 530, { -1825.4022f, 8039.2602f, -26.0800f, -2.897250f }, { 0.0f, 0.0f, 0.992546f, -0.121869f } }, //HORDE_BOMB_WAGON_SOUTH
48 { 182272, 530, { -1515.3700f, 8136.9100f, -20.4200f, -1.343900f }, { 0.0f, 0.0f, 0.622515f, -0.782608f } }, //HORDE_BOMB_WAGON_WEST
49 { 182273, 530, { -1377.9500f, 7773.4400f, -10.3100f, -0.575959f }, { 0.0f, 0.0f, 0.284015f, -0.958820f } }, //HORDE_BOMB_WAGON_NORTH
50 { 182274, 530, { -1659.8700f, 7733.1500f, -15.7500f, -2.809980f }, { 0.0f, 0.0f, 0.986286f, -0.165048f } }, //HORDE_BOMB_WAGON_EAST
51
52 { 182266, 530, { -1815.8000f, 8036.5100f, -26.2354f, -2.897250f }, { 0.0f, 0.0f, 0.992546f, -0.121869f } }, //DESTROYED_ALLY_ROOST_SOUTH
53 { 182275, 530, { -1507.9500f, 8132.1000f, -19.5585f, -1.343900f }, { 0.0f, 0.0f, 0.622515f, -0.782608f } }, //DESTROYED_ALLY_ROOST_WEST
54 { 182276, 530, { -1384.5200f, 7779.3300f, -11.1663f, -0.575959f }, { 0.0f, 0.0f, 0.284015f, -0.958820f } }, //DESTROYED_ALLY_ROOST_NORTH
55 { 182277, 530, { -1650.1100f, 7732.5600f, -15.4505f, -2.809980f }, { 0.0f, 0.0f, 0.986286f, -0.165048f } } //DESTROYED_ALLY_ROOST_EAST
56};
57
58// spawned when the horde is attacking, alliance is in control
60{
61 { 182301, 530, { -1815.8000f, 8036.5100f, -26.2354f, -2.897250f }, { 0.0f, 0.0f, 0.992546f, -0.121869f } }, //HORDE_ROOST_SOUTH
62 { 182302, 530, { -1507.9500f, 8132.1000f, -19.5585f, -1.343900f }, { 0.0f, 0.0f, 0.622515f, -0.782608f } }, //HORDE_ROOST_WEST
63 { 182303, 530, { -1384.5200f, 7779.3300f, -11.1663f, -0.575959f }, { 0.0f, 0.0f, 0.284015f, -0.958820f } }, //HORDE_ROOST_NORTH
64 { 182304, 530, { -1650.1100f, 7732.5600f, -15.4505f, -2.809980f }, { 0.0f, 0.0f, 0.986286f, -0.165048f } }, //HORDE_ROOST_EAST
65
66 { 182305, 530, { -1825.4022f, 8039.2602f, -26.0800f, -2.897250f }, { 0.0f, 0.0f, 0.992546f, -0.121869f } }, //ALLY_BOMB_WAGON_SOUTH
67 { 182306, 530, { -1515.3700f, 8136.9100f, -20.4200f, -1.343900f }, { 0.0f, 0.0f, 0.622515f, -0.782608f } }, //ALLY_BOMB_WAGON_WEST
68 { 182307, 530, { -1377.9500f, 7773.4400f, -10.3100f, -0.575959f }, { 0.0f, 0.0f, 0.284015f, -0.958820f } }, //ALLY_BOMB_WAGON_NORTH
69 { 182308, 530, { -1659.8700f, 7733.1500f, -15.7500f, -2.809980f }, { 0.0f, 0.0f, 0.986286f, -0.165048f } }, //ALLY_BOMB_WAGON_EAST
70
71 { 182297, 530, { -1815.8000f, 8036.5100f, -26.2354f, -2.897250f }, { 0.0f, 0.0f, 0.992546f, -0.121869f } }, //DESTROYED_HORDE_ROOST_SOUTH
72 { 182298, 530, { -1507.9500f, 8132.1000f, -19.5585f, -1.343900f }, { 0.0f, 0.0f, 0.622515f, -0.782608f } }, //DESTROYED_HORDE_ROOST_WEST
73 { 182299, 530, { -1384.5200f, 7779.3300f, -11.1663f, -0.575959f }, { 0.0f, 0.0f, 0.284015f, -0.958820f } }, //DESTROYED_HORDE_ROOST_NORTH
74 { 182300, 530, { -1650.1100f, 7732.5600f, -15.4505f, -2.809980f }, { 0.0f, 0.0f, 0.986286f, -0.165048f } } //DESTROYED_HORDE_ROOST_EAST
75};
76
78{
79 { 18816, 530, { -1523.92f, 7951.76f, -17.6942f, 3.51172f } },
80 { 18821, 530, { -1527.75f, 7952.46f, -17.6948f, 3.99317f } },
81 { 21474, 530, { -1520.14f, 7927.11f, -20.2527f, 3.39389f } },
82 { 21484, 530, { -1524.84f, 7930.34f, -20.1820f, 3.64050f } },
83 { 21483, 530, { -1570.01f, 7993.80f, -22.4505f, 5.02655f } },
84 { 18192, 530, { -1654.06f, 8000.46f, -26.5900f, 3.37000f } },
85 { 18192, 530, { -1487.18f, 7899.10f, -19.5300f, 0.95400f } },
86 { 18192, 530, { -1480.88f, 7908.79f, -19.1900f, 4.48500f } },
87 { 18192, 530, { -1540.56f, 7995.44f, -20.4500f, 0.94700f } },
88 { 18192, 530, { -1546.95f, 8000.85f, -20.7200f, 6.03500f } },
89 { 18192, 530, { -1595.31f, 7860.53f, -21.5100f, 3.74700f } },
90 { 18192, 530, { -1642.31f, 7995.59f, -25.8000f, 3.31700f } },
91 { 18192, 530, { -1545.46f, 7995.35f, -20.6300f, 1.09400f } },
92 { 18192, 530, { -1487.58f, 7907.99f, -19.2700f, 5.56700f } },
93 { 18192, 530, { -1651.54f, 7988.56f, -26.5289f, 2.98451f } },
94 { 18192, 530, { -1602.46f, 7866.43f, -22.1177f, 4.74729f } },
95 { 18192, 530, { -1591.22f, 7875.29f, -22.3536f, 4.34587f } },
96 { 18192, 530, { -1550.60f, 7944.45f, -21.6300f, 3.55900f } },
97 { 18192, 530, { -1545.57f, 7935.83f, -21.1300f, 3.44800f } },
98 { 18192, 530, { -1550.86f, 7937.56f, -21.7000f, 3.80100f } }
99};
100
102{
103 { 18817, 530, { -1591.18f, 8020.39f, -22.2042f, 4.59022f } },
104 { 18822, 530, { -1588.00f, 8019.00f, -22.2042f, 4.06662f } },
105 { 21485, 530, { -1521.93f, 7927.37f, -20.2299f, 3.24631f } },
106 { 21487, 530, { -1540.33f, 7971.95f, -20.7186f, 3.07178f } },
107 { 21488, 530, { -1570.01f, 7993.80f, -22.4505f, 5.02655f } },
108 { 18256, 530, { -1654.06f, 8000.46f, -26.5900f, 3.37000f } },
109 { 18256, 530, { -1487.18f, 7899.10f, -19.5300f, 0.95400f } },
110 { 18256, 530, { -1480.88f, 7908.79f, -19.1900f, 4.48500f } },
111 { 18256, 530, { -1540.56f, 7995.44f, -20.4500f, 0.94700f } },
112 { 18256, 530, { -1546.95f, 8000.85f, -20.7200f, 6.03500f } },
113 { 18256, 530, { -1595.31f, 7860.53f, -21.5100f, 3.74700f } },
114 { 18256, 530, { -1642.31f, 7995.59f, -25.8000f, 3.31700f } },
115 { 18256, 530, { -1545.46f, 7995.35f, -20.6300f, 1.09400f } },
116 { 18256, 530, { -1487.58f, 7907.99f, -19.2700f, 5.56700f } },
117 { 18256, 530, { -1651.54f, 7988.56f, -26.5289f, 2.98451f } },
118 { 18256, 530, { -1602.46f, 7866.43f, -22.1177f, 4.74729f } },
119 { 18256, 530, { -1591.22f, 7875.29f, -22.3536f, 4.34587f } },
120 { 18256, 530, { -1603.75f, 8000.36f, -24.1800f, 4.51600f } },
121 { 18256, 530, { -1585.73f, 7994.68f, -23.2900f, 4.43900f } },
122 { 18256, 530, { -1595.50f, 7991.27f, -23.5300f, 4.73800f } }
123};
124
126{
128 m_obj = nullptr;
129}
130
132{
133 if (killed->GetTypeId() == TYPEID_PLAYER && player->GetTeam() != killed->ToPlayer()->GetTeam())
134 {
135 player->KilledMonsterCredit(NA_CREDIT_MARKER); // 0 guid, btw it isn't even used in killedmonster function :S
136 if (player->GetTeam() == ALLIANCE)
137 player->CastSpell(player, NA_KILL_TOKEN_ALLIANCE, true);
138 else
139 player->CastSpell(player, NA_KILL_TOKEN_HORDE, true);
140 }
141}
142
144{
145 uint32 cnt = 0;
146 for (std::map<uint32, uint32>::iterator itr = m_Creatures.begin(); itr != m_Creatures.end(); ++itr)
147 {
148 switch (itr->first)
149 {
150 case NA_NPC_GUARD_01:
151 case NA_NPC_GUARD_02:
152 case NA_NPC_GUARD_03:
153 case NA_NPC_GUARD_04:
154 case NA_NPC_GUARD_05:
155 case NA_NPC_GUARD_06:
156 case NA_NPC_GUARD_07:
157 case NA_NPC_GUARD_08:
158 case NA_NPC_GUARD_09:
159 case NA_NPC_GUARD_10:
160 case NA_NPC_GUARD_11:
161 case NA_NPC_GUARD_12:
162 case NA_NPC_GUARD_13:
163 case NA_NPC_GUARD_14:
164 case NA_NPC_GUARD_15:
165 {
166 auto bounds = m_PvP->GetMap()->GetCreatureBySpawnIdStore().equal_range(itr->second);
167 for (auto itr2 = bounds.first; itr2 != bounds.second; ++itr2)
168 if (itr2->second->IsAlive())
169 ++cnt;
170 break;
171 }
172 default:
173 break;
174 }
175 }
176 return cnt;
177}
178
183
185{
186 creature_type const* creatures = nullptr;
187 if (team == ALLIANCE)
188 creatures = AllianceControlNPCs;
189 else if (team == HORDE)
190 creatures = HordeControlNPCs;
191 else
192 return;
193 for (int i = 0; i < NA_CONTROL_NPC_NUM; ++i)
194 AddCreature(i, creatures[i].entry, creatures[i].map, creatures[i].pos, OutdoorPvP::GetTeamIdByTeam(team), 1000000);
195}
196
198{
199 for (int i = 0; i < NA_CONTROL_NPC_NUM; ++i)
200 DelCreature(i);
201}
202
204{
205 go_type const* gos = nullptr;
206 if (team == ALLIANCE)
207 gos = AllianceControlGOs;
208 else if (team == HORDE)
209 gos = HordeControlGOs;
210 else
211 return;
212
213 // roosts and bomb wagons are spawned when someone uses the matching destroyed roost
214 static ControlGOTypes const GoTypes[] =
215 {
220 };
221
222 for (ControlGOTypes goType : GoTypes)
223 AddObject(goType, gos[goType].entry, gos[goType].map, gos[goType].pos, gos[goType].rot);
224}
225
227{
228 for (int i = 0; i < NA_CONTROL_GO_NUM; ++i)
229 {
230 DelObject(i);
231 }
232}
233
235{
238
242 DeSpawnGOs();
243 DeSpawnNPCs();
244 SpawnGOsForTeam(team);
245 SpawnNPCsForTeam(team);
247 m_capturable = false;
248 this->UpdateHalaaWorldState();
249 if (team == ALLIANCE)
250 {
260 }
261 else
262 {
272 }
277}
278
279OPvPCapturePointNA::OPvPCapturePointNA(OutdoorPvP* pvp) : OPvPCapturePoint(pvp), m_capturable(true), m_GuardsAlive(0), m_ControllingFaction(0), m_WyvernStateNorth(0), m_WyvernStateSouth(0), m_WyvernStateEast(0),
280 m_WyvernStateWest(0), m_HalaaState(HALAA_N), m_RespawnTimer(NA_RESPAWN_TIME), m_GuardCheckTimer(NA_GUARD_CHECK_TIME)
281{
282 SetCapturePointData(182210, 530, { -1572.57f, 7945.3f, -22.475f, 2.05949f }, { 0.0f, 0.0f, 0.857167f, 0.515038f });
283}
284
286{
287// m_TypeId = OUTDOOR_PVP_NA; _MUST_ be set in ctor, because of spawns cleanup
288 // add the zones affected by the pvp buff
291
292 // halaa
293 m_obj = new OPvPCapturePointNA(this);
294
296 return true;
297}
298
300{
301 // add buffs
302 if (player->GetTeam() == m_obj->GetControllingFaction())
303 player->CastSpell(player, NA_CAPTURE_BUFF, true);
305}
306
308{
309 // remove buffs
312}
313
318
320{
322 {
323 packet.Worldstates.emplace_back(NA_UI_HORDE_GUARDS_SHOW, 0);
324 packet.Worldstates.emplace_back(NA_UI_ALLIANCE_GUARDS_SHOW, 1);
325 }
326 else if (m_ControllingFaction == HORDE)
327 {
328 packet.Worldstates.emplace_back(NA_UI_HORDE_GUARDS_SHOW, 1);
329 packet.Worldstates.emplace_back(NA_UI_ALLIANCE_GUARDS_SHOW, 0);
330 }
331 else
332 {
333 packet.Worldstates.emplace_back(NA_UI_HORDE_GUARDS_SHOW, 0);
334 packet.Worldstates.emplace_back(NA_UI_ALLIANCE_GUARDS_SHOW, 0);
335 }
336
337 packet.Worldstates.emplace_back(NA_UI_GUARDS_MAX, NA_GUARDS_MAX);
338 packet.Worldstates.emplace_back(NA_UI_GUARDS_LEFT, m_GuardsAlive);
339 packet.Worldstates.emplace_back(NA_MAP_WYVERN_NORTH_NEU_H, (m_WyvernStateNorth & WYVERN_NEU_HORDE) != 0 ? 1 : 0);
341 packet.Worldstates.emplace_back(NA_MAP_WYVERN_NORTH_H, (m_WyvernStateNorth & WYVERN_HORDE) != 0 ? 1 : 0);
342 packet.Worldstates.emplace_back(NA_MAP_WYVERN_NORTH_A, (m_WyvernStateNorth & WYVERN_ALLIANCE) != 0 ? 1 : 0);
343 packet.Worldstates.emplace_back(NA_MAP_WYVERN_SOUTH_NEU_H, (m_WyvernStateSouth & WYVERN_NEU_HORDE) != 0 ? 1 : 0);
345 packet.Worldstates.emplace_back(NA_MAP_WYVERN_SOUTH_H, (m_WyvernStateSouth & WYVERN_HORDE) != 0 ? 1 : 0);
346 packet.Worldstates.emplace_back(NA_MAP_WYVERN_SOUTH_A, (m_WyvernStateSouth & WYVERN_ALLIANCE) != 0 ? 1 : 0);
347 packet.Worldstates.emplace_back(NA_MAP_WYVERN_WEST_NEU_H, (m_WyvernStateWest & WYVERN_NEU_HORDE) != 0 ? 1 : 0);
348 packet.Worldstates.emplace_back(NA_MAP_WYVERN_WEST_NEU_A, (m_WyvernStateWest & WYVERN_NEU_ALLIANCE) != 0 ? 1 : 0);
349 packet.Worldstates.emplace_back(NA_MAP_WYVERN_WEST_H, (m_WyvernStateWest & WYVERN_HORDE) != 0 ? 1 : 0);
350 packet.Worldstates.emplace_back(NA_MAP_WYVERN_WEST_A, (m_WyvernStateWest & WYVERN_ALLIANCE) != 0 ? 1 : 0);
351 packet.Worldstates.emplace_back(NA_MAP_WYVERN_EAST_NEU_H, (m_WyvernStateEast & WYVERN_NEU_HORDE) != 0 ? 1 : 0);
352 packet.Worldstates.emplace_back(NA_MAP_WYVERN_EAST_NEU_A, (m_WyvernStateEast & WYVERN_NEU_ALLIANCE) != 0 ? 1 : 0);
353 packet.Worldstates.emplace_back(NA_MAP_WYVERN_EAST_H, (m_WyvernStateEast & WYVERN_HORDE) != 0 ? 1 : 0);
354 packet.Worldstates.emplace_back(NA_MAP_WYVERN_EAST_A, (m_WyvernStateEast & WYVERN_ALLIANCE) != 0 ? 1 : 0);
355 packet.Worldstates.emplace_back(NA_MAP_HALAA_NEUTRAL, (m_HalaaState & HALAA_N) != 0 ? 1 : 0);
356 packet.Worldstates.emplace_back(NA_MAP_HALAA_NEU_A, (m_HalaaState & HALAA_N_A) != 0 ? 1 : 0);
357 packet.Worldstates.emplace_back(NA_MAP_HALAA_NEU_H, (m_HalaaState & HALAA_N_H) != 0 ? 1 : 0);
358 packet.Worldstates.emplace_back(NA_MAP_HALAA_HORDE, (m_HalaaState & HALAA_H) != 0 ? 1 : 0);
359 packet.Worldstates.emplace_back(NA_MAP_HALAA_ALLIANCE, (m_HalaaState & HALAA_A) != 0 ? 1 : 0);
360}
361
363{
389}
390
392{
393 return m_obj->Update(diff);
394}
395
397{
398 std::vector<uint32> nodes;
399 nodes.resize(2);
400 bool retval = false;
401 switch (spellId)
402 {
405 nodes[1] = FlightPathEndNodes[NA_ROOST_N];
406 player->ActivateTaxiPathTo(nodes);
408 player->UpdatePvP(true, true);
409 retval = true;
410 break;
413 nodes[1] = FlightPathEndNodes[NA_ROOST_S];
414 player->ActivateTaxiPathTo(nodes);
416 player->UpdatePvP(true, true);
417 retval = true;
418 break;
421 nodes[1] = FlightPathEndNodes[NA_ROOST_W];
422 player->ActivateTaxiPathTo(nodes);
424 player->UpdatePvP(true, true);
425 retval = true;
426 break;
429 nodes[1] = FlightPathEndNodes[NA_ROOST_E];
430 player->ActivateTaxiPathTo(nodes);
432 player->UpdatePvP(true, true);
433 retval = true;
434 break;
435 default:
436 break;
437 }
438
439 if (retval)
440 {
441 //Adding items
442 uint32 noSpaceForCount = 0;
443
444 // check space and find places
445 ItemPosCountVec dest;
446
447 int32 count = 10;
448 uint32 itemid = 24538;
449 // bomb id count
450 InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, count, &noSpaceForCount);
451 if (msg != EQUIP_ERR_OK) // convert to possible store amount
452 count -= noSpaceForCount;
453
454 if (count == 0 || dest.empty()) // can't add any
455 {
456 return true;
457 }
458
459 Item* item = player->StoreNewItem(dest, itemid, true);
460
461 if (count > 0 && item)
462 {
463 player->SendNewItem(item, count, true, false);
464 }
465
466 return true;
467 }
468 return false;
469}
470
472{
473 int32 retval = OPvPCapturePoint::HandleOpenGo(player, go);
474 if (retval >= 0)
475 {
476 go_type const* gos = nullptr;
478 gos = AllianceControlGOs;
479 else if (m_ControllingFaction == HORDE)
480 gos = HordeControlGOs;
481 else
482 return -1;
483
484 int32 del = -1;
485 int32 del2 = -1;
486 int32 add = -1;
487 int32 add2 = -1;
488
489 switch (retval)
490 {
493 add = NA_ROOST_S;
494 add2 = NA_BOMB_WAGON_S;
497 else
500 break;
503 add = NA_ROOST_N;
504 add2 = NA_BOMB_WAGON_N;
507 else
510 break;
513 add = NA_ROOST_W;
514 add2 = NA_BOMB_WAGON_W;
517 else
520 break;
523 add = NA_ROOST_E;
524 add2 = NA_BOMB_WAGON_E;
527 else
530 break;
531 case NA_BOMB_WAGON_S:
532 del = NA_BOMB_WAGON_S;
533 del2 = NA_ROOST_S;
537 else
540 break;
541 case NA_BOMB_WAGON_N:
542 del = NA_BOMB_WAGON_N;
543 del2 = NA_ROOST_N;
547 else
550 break;
551 case NA_BOMB_WAGON_W:
552 del = NA_BOMB_WAGON_W;
553 del2 = NA_ROOST_W;
557 else
560 break;
561 case NA_BOMB_WAGON_E:
562 del = NA_BOMB_WAGON_E;
563 del2 = NA_ROOST_E;
567 else
570 break;
571 default:
572 return -1;
573 break;
574 }
575
576 if (del > -1)
577 DelObject(del);
578
579 if (del2 > -1)
580 DelObject(del2);
581
582 if (add > -1)
583 AddObject(add, gos[add].entry, gos[add].map, gos[add].pos, gos[add].rot);
584
585 if (add2 > -1)
586 AddObject(add2, gos[add2].entry, gos[add2].map, gos[add2].pos, gos[add2].rot);
587
588 return retval;
589 }
590 return -1;
591}
592
594{
595 // let the controlling faction advance in phase
596 bool capturable = false;
597 if (m_ControllingFaction == ALLIANCE && m_activePlayers[0].size() > m_activePlayers[1].size())
598 capturable = true;
599 else if (m_ControllingFaction == HORDE && m_activePlayers[0].size() < m_activePlayers[1].size())
600 capturable = true;
601
602 if (m_GuardCheckTimer < diff)
603 {
606 if (cnt != m_GuardsAlive)
607 {
608 m_GuardsAlive = cnt;
609 if (m_GuardsAlive == 0)
610 m_capturable = true;
611 // update the guard count for the players in zone
613 }
614 } else m_GuardCheckTimer -= diff;
615
616 if (m_capturable || capturable)
617 {
618 if (m_RespawnTimer < diff)
619 {
620 // if the guards have been killed, then the challenger has one hour to take over halaa.
621 // in case they fail to do it, the guards are respawned, and they have to start again.
625 } else m_RespawnTimer -= diff;
626
627 return OPvPCapturePoint::Update(diff);
628 }
629 return false;
630}
631
633{
634 uint32 artkit = 21;
635 switch (m_State)
636 {
639 break;
643 artkit = 2;
644 break;
648 artkit = 1;
649 break;
652 break;
655 break;
658 artkit = 2;
659 break;
662 artkit = 1;
663 break;
664 }
665
666 auto bounds = m_PvP->GetMap()->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
667 for (auto itr = bounds.first; itr != bounds.second; ++itr)
668 itr->second->SetGoArtKit(artkit);
669
671}
672
681
683{
684 switch (roost)
685 {
686 case NA_ROOST_S:
691 break;
692 case NA_ROOST_N:
697 break;
698 case NA_ROOST_W:
703 break;
704 case NA_ROOST_E:
709 break;
710 }
711}
712
714{
715 public:
716 OutdoorPvP_nagrand() : OutdoorPvPScript("outdoorpvp_na") { }
717
718 OutdoorPvP* GetOutdoorPvP() const override
719 {
720 return new OutdoorPvPNA();
721 }
722};
723
725{
726 new OutdoorPvP_nagrand();
727}
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
InventoryResult
Definition ItemDefines.h:25
@ EQUIP_ERR_OK
Definition ItemDefines.h:26
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
#define sObjectMgr
Definition ObjectMgr.h:1721
void AddSC_outdoorpvp_na()
uint32 const NA_HALAA_GRAVEYARD_ZONE
uint32 const NA_GUARDS_MAX
uint32 const FlightPathEndNodes[FLIGHT_NODES_NUM]
go_type const HordeControlGOs[NA_CONTROL_GO_NUM]
creature_type const AllianceControlNPCs[NA_CONTROL_NPC_NUM]
go_type const AllianceControlGOs[NA_CONTROL_GO_NUM]
uint32 const NA_HALAA_GRAVEYARD
uint32 const NA_BUFF_ZONE
creature_type const HordeControlNPCs[NA_CONTROL_NPC_NUM]
uint32 const NA_RESPAWN_TIME
uint32 const FlightPathStartNodes[FLIGHT_NODES_NUM]
uint32 const FLIGHT_NODES_NUM
uint32 const NA_CREDIT_MARKER
uint32 const NA_GUARD_CHECK_TIME
@ HALAA_N
@ HALAA_N_A
@ HALAA_H
@ HALAA_A
@ HALAA_N_H
@ WYVERN_NEU_HORDE
@ WYVERN_NEU_ALLIANCE
@ WYVERN_ALLIANCE
@ WYVERN_HORDE
ControlGOTypes
@ NA_ROOST_W
@ NA_BOMB_WAGON_E
@ NA_DESTROYED_ROOST_S
@ NA_BOMB_WAGON_N
@ NA_BOMB_WAGON_W
@ NA_DESTROYED_ROOST_E
@ NA_BOMB_WAGON_S
@ NA_DESTROYED_ROOST_N
@ NA_DESTROYED_ROOST_W
@ NA_ROOST_E
@ NA_CONTROL_GO_NUM
@ NA_ROOST_N
@ NA_ROOST_S
@ NA_SPELL_FLY_SOUTH
@ NA_SPELL_FLY_WEST
@ NA_SPELL_FLY_EAST
@ NA_SPELL_FLY_NORTH
@ NA_NPC_GUARD_10
@ NA_CONTROL_NPC_NUM
@ NA_NPC_GUARD_14
@ NA_NPC_GUARD_03
@ NA_NPC_GUARD_12
@ NA_NPC_GUARD_09
@ NA_NPC_GUARD_11
@ NA_NPC_GUARD_07
@ NA_NPC_GUARD_05
@ NA_NPC_GUARD_08
@ NA_NPC_GUARD_02
@ NA_NPC_GUARD_01
@ NA_NPC_GUARD_13
@ NA_NPC_GUARD_06
@ NA_NPC_GUARD_15
@ NA_NPC_GUARD_04
@ NA_CAPTURE_BUFF
@ NA_KILL_TOKEN_HORDE
@ NA_KILL_TOKEN_ALLIANCE
@ NA_MAP_HALAA_NEU_A
@ NA_MAP_WYVERN_SOUTH_NEU_H
@ NA_MAP_HALAA_HORDE
@ NA_UI_ALLIANCE_GUARDS_SHOW
@ NA_MAP_WYVERN_NORTH_NEU_A
@ NA_MAP_HALAA_NEUTRAL
@ NA_MAP_WYVERN_WEST_NEU_A
@ NA_MAP_WYVERN_SOUTH_NEU_A
@ NA_MAP_WYVERN_WEST_H
@ NA_MAP_WYVERN_NORTH_NEU_H
@ NA_UI_HORDE_GUARDS_SHOW
@ NA_MAP_HALAA_ALLIANCE
@ NA_MAP_WYVERN_EAST_H
@ NA_MAP_WYVERN_SOUTH_A
@ NA_UI_GUARDS_MAX
@ NA_MAP_WYVERN_EAST_A
@ NA_MAP_WYVERN_NORTH_H
@ NA_UI_GUARDS_LEFT
@ NA_MAP_WYVERN_WEST_A
@ NA_MAP_WYVERN_EAST_NEU_A
@ NA_MAP_WYVERN_EAST_NEU_H
@ NA_MAP_HALAA_NEU_H
@ NA_MAP_WYVERN_WEST_NEU_H
@ NA_MAP_WYVERN_NORTH_A
@ NA_MAP_WYVERN_SOUTH_H
@ TEXT_HALAA_TAKEN_ALLIANCE
@ TEXT_HALAA_TAKEN_HORDE
@ OUTDOOR_PVP_NA
Definition OutdoorPvP.h:30
@ OBJECTIVESTATE_HORDE
Definition OutdoorPvP.h:43
@ OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE
Definition OutdoorPvP.h:45
@ OBJECTIVESTATE_ALLIANCE
Definition OutdoorPvP.h:42
@ OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE
Definition OutdoorPvP.h:44
@ OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE
Definition OutdoorPvP.h:47
@ OBJECTIVESTATE_NEUTRAL
Definition OutdoorPvP.h:41
@ OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE
Definition OutdoorPvP.h:46
std::vector< ItemPosCount > ItemPosCountVec
Definition Player.h:624
@ PLAYER_FLAGS_IN_PVP
Definition Player.h:353
@ TEAM_ALLIANCE
@ TEAM_HORDE
@ ALLIANCE
@ HORDE
@ NULL_BAG
Definition Unit.h:61
@ NULL_SLOT
Definition Unit.h:62
@ PLAYER_FLAGS
Definition Item.h:62
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
Definition Map.h:496
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore()
Definition Map.h:492
void ChangeState() override
void UpdateWyvernRoostWorldState(uint32 roost)
bool HandleCustomSpell(Player *player, uint32 spellId, GameObject *go) override
OPvPCapturePointNA(OutdoorPvP *pvp)
int32 HandleOpenGo(Player *player, GameObject *go) override
bool Update(uint32 diff) override
uint32 GetControllingFaction() const
void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates &packet) override
void SpawnGOsForTeam(uint32 team)
void SpawnNPCsForTeam(uint32 team)
void FactionTakeOver(uint32 team)
std::map< uint32, ObjectGuid::LowType > m_Creatures
Definition OutdoorPvP.h:179
OutdoorPvP * m_PvP
Definition OutdoorPvP.h:174
bool AddCreature(uint32 type, uint32 entry, uint32 map, Position const &pos, TeamId teamId=TEAM_NEUTRAL, uint32 spawntimedelay=0)
virtual bool Update(uint32 diff)
ObjectiveStates m_State
Definition OutdoorPvP.h:168
GuidSet m_activePlayers[2]
Definition OutdoorPvP.h:152
ObjectGuid::LowType m_capturePointSpawnId
Definition OutdoorPvP.h:130
bool SetCapturePointData(uint32 entry, uint32 map, Position const &pos, QuaternionData const &rot)
virtual int32 HandleOpenGo(Player *player, GameObject *go)
bool DelCreature(uint32 type)
bool AddObject(uint32 type, uint32 entry, uint32 map, Position const &pos, QuaternionData const &rot)
bool DelObject(uint32 type)
TypeID GetTypeId() const
Definition Object.h:93
void SetFlag(uint16 index, uint32 newFlag)
Definition Object.cpp:760
static Player * ToPlayer(Object *o)
Definition Object.h:180
bool SetupOutdoorPvP() override
void HandleKillImpl(Player *player, Unit *killed) override
void HandlePlayerEnterZone(Player *player, uint32 zone) override
bool Update(uint32 diff) override
void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates &packet) override
OPvPCapturePointNA * m_obj
void HandlePlayerLeaveZone(Player *player, uint32 zone) override
void SendRemoveWorldStates(Player *player) override
OutdoorPvP * GetOutdoorPvP() const override
virtual void HandlePlayerEnterZone(Player *player, uint32 zone)
uint32 m_TypeId
Definition OutdoorPvP.h:273
void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2=0)
void RegisterZone(uint32 zoneid)
static TeamId GetTeamIdByTeam(uint32 team)
Definition OutdoorPvP.h:249
virtual void HandlePlayerLeaveZone(Player *player, uint32 zone)
Map * GetMap() const
Definition OutdoorPvP.h:264
void SendUpdateWorldState(uint32 field, uint32 value)
void SetMapFromZone(uint32 zone)
void SendDefenseMessage(uint32 zoneId, uint32 id)
void AddCapturePoint(OPvPCapturePoint *cp)
Definition OutdoorPvP.h:287
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition Player.cpp:16140
uint32 GetTeam() const
Definition Player.h:1832
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 item, bool update, int32 randomPropertyId=0, GuidSet const &allowedLooters=GuidSet())
Definition Player.cpp:11621
void SendUpdateWorldState(uint32 variable, uint32 value) const
Definition Player.cpp:8493
bool ActivateTaxiPathTo(std::vector< uint32 > const &nodes, Creature *npc=nullptr, uint32 spellid=0)
Definition Player.cpp:21008
void SendNewItem(Item *item, uint32 count, bool received, bool created, bool broadcast=false, bool sendChatMessage=true)
Definition Player.cpp:13856
void UpdatePvP(bool state, bool override=false)
Definition Player.cpp:21687
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition Player.cpp:9989
Definition Unit.h:769
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
std::vector< WorldStateInfo > Worldstates