TrinityCore
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
BattlegroundAV.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 "BattlegroundAV.h"
19#include "BattlegroundPackets.h"
20#include "Creature.h"
21#include "CreatureAI.h"
22#include "DBCStores.h"
23#include "GameObject.h"
24#include "Log.h"
25#include "MotionMaster.h"
26#include "ObjectMgr.h"
27#include "Player.h"
28#include "WorldSession.h"
29#include "WorldStatePackets.h"
30
32{
34}
35
37{
40
41 for (uint8 i = 0; i < 2; i++)
42 {
43 for (uint8 j = 0; j < 9; j++)
44 m_Team_QuestStatus[i][j] = 0;
45 m_Team_Scores[i] = 0;
46 m_IsInformedNearVictory[i] = false;
47 m_CaptainAlive[i] = true;
48 m_CaptainBuffTimer[i] = 0;
49 m_Mine_Owner[i] = 0;
50 m_Mine_PrevOwner[i] = 0;
52 }
53
54 m_Mine_Timer = 0;
55
57 InitNode(i, 0, false);
58
62}
63
65
67{
69 return;
70
71 Battleground::HandleKillPlayer(player, killer);
72 UpdateScore(player->GetTeam(), -1);
73}
74
76{
77 TC_LOG_DEBUG("bg.battleground", "bg_av HandleKillUnit {}", unit->GetEntry());
79 return;
80 uint32 entry = unit->GetEntry();
81 /*
82 uint32 triggerSpawnID = 0;
83 if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN][0])
84 triggerSpawnID = AV_CPLACE_TRIGGER16;
85 else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_BOSS][0])
86 triggerSpawnID = AV_CPLACE_TRIGGER17;
87 else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN][0])
88 triggerSpawnID = AV_CPLACE_TRIGGER18;
89 else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_BOSS][0])
90 triggerSpawnID = AV_CPLACE_TRIGGER19;
91 */
93 {
94 CastSpellOnTeam(23658, HORDE); //this is a spell which finishes a quest where a player has to kill the boss
99 }
100 else if (entry == BG_AV_CreatureInfo[AV_NPC_H_BOSS])
101 {
102 CastSpellOnTeam(23658, ALLIANCE); //this is a spell which finishes a quest where a player has to kill the boss
107 }
108 else if (entry == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN])
109 {
110 if (!m_CaptainAlive[0])
111 {
112 TC_LOG_ERROR("bg.battleground", "Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
113 return;
114 }
115 m_CaptainAlive[0]=false;
119 //spawn destroyed aura
120 for (uint8 i=0; i <= 9; i++)
123
125 herold->AI()->Talk(TEXT_STORMPIKE_GENERAL_DEAD);
126 }
127 else if (entry == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN])
128 {
129 if (!m_CaptainAlive[1])
130 {
131 TC_LOG_ERROR("bg.battleground", "Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
132 return;
133 }
134 m_CaptainAlive[1]=false;
138 //spawn destroyed aura
139 for (uint8 i=0; i <= 9; i++)
142
144 herold->AI()->Talk(TEXT_FROSTWOLF_GENERAL_DEAD);
145 }
150}
151
153{
155 return;//maybe we should log this, cause this must be a cheater or a big bug
156 uint8 team = GetTeamIndexByTeamId(player->GetTeam());
158 TC_LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed", questid);
159 switch (questid)
160 {
165 m_Team_QuestStatus[team][0]+=20;
166 if (m_Team_QuestStatus[team][0] == 500 || m_Team_QuestStatus[team][0] == 1000 || m_Team_QuestStatus[team][0] == 1500) //25, 50, 75 turn ins
167 {
168 TC_LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed starting with unit upgrading..", questid);
170 if (m_Nodes[i].Owner == player->GetTeam() && m_Nodes[i].State == POINT_CONTROLED)
171 {
173 PopulateNode(i);
174 //maybe this is bad, because it will instantly respawn all creatures on every grave..
175 }
176 }
177 break;
180 m_Team_QuestStatus[team][1]++;
181 RewardReputationToTeam(team, 1, player->GetTeam());
182 if (m_Team_QuestStatus[team][1] == 30)
183 TC_LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
184 break;
187 m_Team_QuestStatus[team][2]++;
188 RewardReputationToTeam(team, 1, player->GetTeam());
189 if (m_Team_QuestStatus[team][2] == 60)
190 TC_LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
191 break;
194 m_Team_QuestStatus[team][3]++;
195 RewardReputationToTeam(team, 1, player->GetTeam());
196 if (m_Team_QuestStatus[team][3] == 120)
197 TC_LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
198 break;
199 case AV_QUEST_A_BOSS1:
200 case AV_QUEST_H_BOSS1:
201 m_Team_QuestStatus[team][4] += 9; //you can turn in 10 or 1 item..
202 [[fallthrough]];
203 case AV_QUEST_A_BOSS2:
204 case AV_QUEST_H_BOSS2:
205 m_Team_QuestStatus[team][4]++;
206 if (m_Team_QuestStatus[team][4] >= 200)
207 TC_LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
208 break;
211 m_Team_QuestStatus[team][5]++;
212 if (m_Team_QuestStatus[team][5] == 28)
213 {
214 TC_LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
215 if (m_Team_QuestStatus[team][6] == 7)
216 TC_LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here - ground assault ready", questid);
217 }
218 break;
221 m_Team_QuestStatus[team][6]++;
222 if (m_Team_QuestStatus[team][6] == 7)
223 {
224 TC_LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
225 if (m_Team_QuestStatus[team][5] == 20)
226 TC_LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here - ground assault ready", questid);
227 }
228 break;
231 m_Team_QuestStatus[team][7]++;
232 if (m_Team_QuestStatus[team][7] == 25)
233 {
234 TC_LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
235 if (m_Team_QuestStatus[team][8] == 25)
236 TC_LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here - rider assault ready", questid);
237 }
238 break;
241 m_Team_QuestStatus[team][8]++;
242 if (m_Team_QuestStatus[team][8] == 25)
243 {
244 TC_LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
245 if (m_Team_QuestStatus[team][7] == 25)
246 TC_LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here - rider assault ready", questid);
247 }
248 break;
249 default:
250 TC_LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed but is not interesting at all", questid);
251 return; //was no interesting quest at all
252 break;
253 }
254}
255
257{ //note: to remove reinforcementpoints points must be negative, for adding reinforcements points must be positive
258 ASSERT(team == ALLIANCE || team == HORDE);
259 uint8 teamindex = GetTeamIndexByTeamId(team); //0=ally 1=horde
260 m_Team_Scores[teamindex] += points;
261
263 if (points < 0)
264 {
265 if (m_Team_Scores[teamindex] < 1)
266 {
267 m_Team_Scores[teamindex]=0;
268 EndBattleground(((teamindex == TEAM_HORDE)?ALLIANCE:HORDE));
269 }
270 else if (!m_IsInformedNearVictory[teamindex] && m_Team_Scores[teamindex] < SEND_MSG_NEAR_LOSE)
271 {
272 if (teamindex == TEAM_ALLIANCE)
274 else
277 m_IsInformedNearVictory[teamindex] = true;
278 }
279 }
280}
281
283{
284 bool isStatic = false;
285 Creature* creature = nullptr;
287 if (type >= AV_CPLACE_MAX) //static
288 {
289 type -= AV_CPLACE_MAX;
290 cinfoid = uint16(BG_AV_StaticCreaturePos[type][4]);
291 creature = AddCreature(BG_AV_StaticCreatureInfo[cinfoid],
292 type + AV_CPLACE_MAX,
296 BG_AV_StaticCreaturePos[type][3]);
297 isStatic = true;
298 }
299 else
300 {
301 creature = AddCreature(BG_AV_CreatureInfo[cinfoid], type, BG_AV_CreaturePos[type]);
302 }
303 if (!creature)
304 return nullptr;
307
308 if ((isStatic && cinfoid >= 10 && cinfoid <= 14) || (!isStatic && (cinfoid <= AV_NPC_A_GRAVEDEFENSE3 || (cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3))))
309 {
310 if (!isStatic && (cinfoid <= AV_NPC_A_GRAVEDEFENSE3 || (cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3)))
311 {
312 CreatureData &data = sObjectMgr->NewOrExistCreatureData(creature->GetSpawnId());
313 data.spawnGroupData = sObjectMgr->GetDefaultSpawnGroup();
314 data.wander_distance = 5;
315 }
316 //else wander_distance will be 15, so creatures move maximum=10
317 //creature->SetDefaultMovementType(RANDOM_MOTION_TYPE);
318 creature->GetMotionMaster()->Initialize();
319 creature->setDeathState(JUST_DIED);
320 creature->Respawn();
322 //just copied this code from a gm-command
323 }
324
325 uint32 triggerSpawnID = 0;
326 uint32 newFaction = 0;
327 if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN])
328 {
329 triggerSpawnID = AV_CPLACE_TRIGGER16;
330 newFaction = 84;
331 }
332 else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_BOSS])
333 {
334 triggerSpawnID = AV_CPLACE_TRIGGER17;
335 newFaction = 84;
336 }
337 else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN])
338 {
339 triggerSpawnID = AV_CPLACE_TRIGGER18;
340 newFaction = 83;
341 }
342 else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_BOSS])
343 {
344 triggerSpawnID = AV_CPLACE_TRIGGER19;
345 newFaction = 83;
346 }
347 if (triggerSpawnID && newFaction)
348 {
349 if (Creature* trigger = AddCreature(WORLD_TRIGGER, triggerSpawnID, BG_AV_CreaturePos[triggerSpawnID]))
350 {
351 trigger->SetFaction(newFaction);
352 }
353 }
354
355 return creature;
356}
357
359{
361 {
362 for (uint8 i=0; i <= 1; i++)//0=alliance, 1=horde
363 {
364 if (!m_CaptainAlive[i])
365 continue;
366 if (m_CaptainBuffTimer[i] > diff)
367 m_CaptainBuffTimer[i] -= diff;
368 else
369 {
370 if (i == 0)
371 {
373 if (Creature* creature = GetBGCreature(AV_CPLACE_MAX + 61))
374 creature->AI()->DoAction(ACTION_BUFF_YELL);
375 }
376 else
377 {
379 if (Creature* creature = GetBGCreature(AV_CPLACE_MAX + 59))
380 creature->AI()->DoAction(ACTION_BUFF_YELL);
381 }
382 m_CaptainBuffTimer[i] = 120000 + urand(0, 4)* 60000; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes @todo get the right times
383 }
384 }
385 //add points from mine owning, and look if he neutral team wanrts to reclaim the mine
386 m_Mine_Timer -=diff;
387 for (uint8 mine=0; mine <2; mine++)
388 {
389 if (m_Mine_Owner[mine] == ALLIANCE || m_Mine_Owner[mine] == HORDE)
390 {
391 if (m_Mine_Timer <= 0)
392 UpdateScore(m_Mine_Owner[mine], 1);
393
394 if (m_Mine_Reclaim_Timer[mine] > diff)
395 m_Mine_Reclaim_Timer[mine] -= diff;
396 else{ //we don't need to set this timer to 0 cause this codepart wont get called when this thing is 0
398 }
399 }
400 }
401 if (m_Mine_Timer <= 0)
402 m_Mine_Timer = AV_MINE_TICK_TIMER; //this is at the end, cause we need to update both mines
403
404 //looks for all timers of the nodes and destroy the building (for graveyards the building wont get destroyed, it goes just to the other team
406 if (m_Nodes[i].State == POINT_ASSAULTED) //maybe remove this
407 {
408 if (m_Nodes[i].Timer > diff)
409 m_Nodes[i].Timer -= diff;
410 else
412 }
413 }
414}
415
417{
420}
421
423{
424 TC_LOG_DEBUG("bg.battleground", "BG_AV: start spawning mine stuff");
429 for (uint8 mine = AV_NORTH_MINE; mine <= AV_SOUTH_MINE; mine++) //mine population
430 ChangeMineOwner(mine, AV_NEUTRAL_TEAM, true);
431
434
437
438 // Achievement: The Alterac Blitz
440}
441
443{
444 bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
446 if (!isInBattleground)
447 PlayerScores[player->GetGUID().GetCounter()] = new BattlegroundAVScore(player->GetGUID());
448}
449
451{
452 //calculate bonuskills for both teams:
453 //first towers:
454 uint8 kills[2] = {0, 0}; // 0 = Alliance 1 = Horde
455 uint8 rep[2] = {0, 0}; // 0 = Alliance 1 = Horde
457 {
458 if (m_Nodes[i].State == POINT_CONTROLED)
459 {
460 if (m_Nodes[i].Owner == ALLIANCE)
461 {
463 kills[0] += BG_AV_KILL_SURVIVING_TOWER;
464 }
465 else
466 {
468 kills[1] += BG_AV_KILL_SURVIVING_TOWER;
469 }
470 }
471 }
472
473 for (int i = TEAM_ALLIANCE; i <= TEAM_HORDE; ++i)
474 {
475 if (m_CaptainAlive[i])
476 {
479 }
480 if (rep[i] != 0)
481 RewardReputationToTeam(i == 0 ? 730 : 729, rep[i], i == 0 ? ALLIANCE : HORDE);
482 if (kills[i] != 0)
484 }
485
488}
489
490void BattlegroundAV::RemovePlayer(Player* player, ObjectGuid /*guid*/, uint32 /*team*/)
491{
492 if (!player)
493 {
494 TC_LOG_ERROR("bg.battleground", "bg_AV no player at remove");
495 return;
496 }
501}
502
504{
506 return;
507
508 switch (trigger)
509 {
510 case 95:
511 case 2608:
512 if (player->GetTeam() != ALLIANCE)
513 player->GetSession()->SendAreaTriggerMessage("Only The Alliance can use that portal");
514 else
515 player->LeaveBattleground();
516 break;
517 case 2606:
518 if (player->GetTeam() != HORDE)
519 player->GetSession()->SendAreaTriggerMessage("Only The Horde can use that portal");
520 else
521 player->LeaveBattleground();
522 break;
523 case 3326:
524 case 3327:
525 case 3328:
526 case 3329:
527 case 3330:
528 case 3331:
529 //Source->Unmount();
530 break;
531 default:
532 Battleground::HandleAreaTrigger(player, trigger);
533 break;
534 }
535}
536
537bool BattlegroundAV::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
538{
539 if (!Battleground::UpdatePlayerScore(player, type, value, doAddHonor))
540 return false;
541
542 switch (type)
543 {
546 break;
549 break;
552 break;
555 break;
556 default:
557 break;
558 }
559 return true;
560}
561
563{
564 uint32 object = GetObjectThroughNode(node);
565 TC_LOG_DEBUG("bg.battleground", "bg_av: player destroyed point node {} object {}", node, object);
566
567 //despawn banner
569 DestroyNode(node);
571
572 uint32 owner = m_Nodes[node].Owner;
573 if (IsTower(node))
574 {
576 //despawn marshal
579 else
580 TC_LOG_ERROR("bg.battleground", "BG_AV: playerdestroyedpoint: marshal {} doesn't exist", AV_CPLACE_A_MARSHAL_SOUTH + tmp);
581 //spawn destroyed aura
582 for (uint8 i=0; i <= 9; i++)
584
585 UpdateScore((owner == ALLIANCE) ? HORDE : ALLIANCE, -1 * BG_AV_RES_TOWER);
586 RewardReputationToTeam(owner == ALLIANCE ? 730 : 729, BG_AV_REP_TOWER, owner);
588
591 }
592 else
593 {
594 if (owner == ALLIANCE)
596 else
600 PopulateNode(node);
601 if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy
602 {
603 for (uint8 i = 0; i < 4; i++)
604 {
607 }
608 }
609 }
610
611 if (StaticNodeInfo const* nodeInfo = GetStaticNodeInfo(node))
613 herold->AI()->Talk(owner == ALLIANCE ? nodeInfo->TextIds.AllianceCapture : nodeInfo->TextIds.HordeCapture);
614}
615
616void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
617{
618 // mine=0 northmine mine=1 southmin
619 // changing the owner results in setting respawntim to infinite for current creatures,
620 // spawning new mine owners creatures and changing the chest-objects so that the current owning team can use them
621 ASSERT(mine == AV_NORTH_MINE || mine == AV_SOUTH_MINE);
622 if (team != ALLIANCE && team != HORDE)
623 team = AV_NEUTRAL_TEAM;
624
625 if (m_Mine_Owner[mine] == team && !initial)
626 return;
627 m_Mine_PrevOwner[mine] = m_Mine_Owner[mine];
628 m_Mine_Owner[mine] = team;
629
630 if (!initial)
631 {
632 TC_LOG_DEBUG("bg.battleground", "bg_av depopulating mine {} (0=north, 1=south)", mine);
633 if (mine == AV_SOUTH_MINE)
635 if (BgCreatures[i])
636 DelCreature(i);
638 if (BgCreatures[i])
639 DelCreature(i);
640 }
642
643 TC_LOG_DEBUG("bg.battleground", "bg_av populating mine {} (0=north, 1=south)", mine);
644 uint16 miner;
645 //also neutral team exists.. after a big time, the neutral team tries to conquer the mine
646 if (mine == AV_NORTH_MINE)
647 {
648 if (team == ALLIANCE)
649 miner = AV_NPC_N_MINE_A_1;
650 else if (team == HORDE)
651 miner = AV_NPC_N_MINE_H_1;
652 else
653 miner = AV_NPC_N_MINE_N_1;
654 }
655 else
656 {
657 uint16 cinfo;
658 if (team == ALLIANCE)
659 miner = AV_NPC_S_MINE_A_1;
660 else if (team == HORDE)
661 miner = AV_NPC_S_MINE_H_1;
662 else
663 miner = AV_NPC_S_MINE_N_1;
664 //vermin
665 TC_LOG_DEBUG("bg.battleground", "spawning vermin");
666 if (team == ALLIANCE)
667 cinfo = AV_NPC_S_MINE_A_3;
668 else if (team == HORDE)
669 cinfo = AV_NPC_S_MINE_H_3;
670 else
671 cinfo = AV_NPC_S_MINE_N_S;
673 AddAVCreature(cinfo, i);
674 }
676 AddAVCreature(miner, i);
677 //the next chooses randomly between 2 cretures
679 AddAVCreature(miner+(urand(1, 2)), i);
681
682 if (team == ALLIANCE || team == HORDE)
683 {
685
687 {
688 if (mine == AV_NORTH_MINE)
690 else if (mine == AV_SOUTH_MINE)
692 }
693 }
694 else
695 {
696 if (mine == AV_SOUTH_MINE) //i think this gets called all the time
697 {
699 creature->AI()->Talk(TEXT_SNIVVLE_RANDOM);
700 }
701 }
702 return;
703}
704
706{
707 if (GOId == BG_AV_OBJECTID_MINE_N)
708 return (m_Mine_Owner[AV_NORTH_MINE] == team);
709 if (GOId == BG_AV_OBJECTID_MINE_S)
710 return (m_Mine_Owner[AV_SOUTH_MINE] == team);
711 return true; //cause it's no mine'object it is ok if this is true
712}
713
715{
716 uint32 owner = m_Nodes[node].Owner;
717 ASSERT(owner);
718
719 uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + (4 * node);
720 uint32 creatureid;
721 if (IsTower(node))
723 else
724 {
725 uint8 team2 = GetTeamIndexByTeamId(owner);
726 if (m_Team_QuestStatus[team2][0] < 500)
727 creatureid = (owner == ALLIANCE)? AV_NPC_A_GRAVEDEFENSE0 : AV_NPC_H_GRAVEDEFENSE0;
728 else if (m_Team_QuestStatus[team2][0] < 1000)
729 creatureid = (owner == ALLIANCE)? AV_NPC_A_GRAVEDEFENSE1 : AV_NPC_H_GRAVEDEFENSE1;
730 else if (m_Team_QuestStatus[team2][0] < 1500)
731 creatureid = (owner == ALLIANCE)? AV_NPC_A_GRAVEDEFENSE2 : AV_NPC_H_GRAVEDEFENSE2;
732 else
733 creatureid = (owner == ALLIANCE)? AV_NPC_A_GRAVEDEFENSE3 : AV_NPC_H_GRAVEDEFENSE3;
734 //spiritguide
735 if (BgCreatures[node])
736 DelCreature(node);
737 if (!AddSpiritGuide(node, BG_AV_CreaturePos[node], GetTeamIndexByTeamId(owner)))
738 TC_LOG_ERROR("bg.battleground", "AV: couldn't spawn spiritguide at node {}", node);
739 }
740 for (uint8 i=0; i<4; i++)
741 AddAVCreature(creatureid, c_place+i);
742
743 if (node >= BG_AV_NODES_MAX)//fail safe
744 return;
745 Creature* trigger = GetBGCreature(node + 302, false);//0-302 other creatures
746 if (!trigger)
747 {
748 trigger = AddCreature(WORLD_TRIGGER,
749 node + 302,
750 BG_AV_CreaturePos[node + 302],
751 GetTeamIndexByTeamId(owner));
752 }
753
754 // set correct faction for trigger
755 if (trigger)
756 {
757 if (owner != ALLIANCE && owner != HORDE)//node can be neutral, remove trigger
758 {
759 DelCreature(node + 302);
760 return;
761 }
763 }
764}
766{
767 uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + (4 * node);
768 for (uint8 i=0; i<4; i++)
769 if (BgCreatures[c_place+i])
770 DelCreature(c_place+i);
771 //spiritguide
772 if (!IsTower(node) && BgCreatures[node])
773 DelCreature(node);
774
775 //remove bonus honor aura trigger creature when node is lost
776 if (node < BG_AV_NODES_MAX)//fail safe
777 DelCreature(node + 302);//NULL checks are in DelCreature! 0-302 spirit guides
778}
779
781{
782 TC_LOG_DEBUG("bg.battleground", "bg_AV getnodethroughobject {}", object);
784 return BG_AV_Nodes(object);
786 return BG_AV_Nodes(object - 11);
788 return BG_AV_Nodes(object - 7);
790 return BG_AV_Nodes(object -22);
792 return BG_AV_Nodes(object - 33);
794 return BG_AV_Nodes(object - 29);
797 TC_LOG_ERROR("bg.battleground", "BattlegroundAV: ERROR! GetPlace got a wrong object :(");
798 ABORT();
799 return BG_AV_Nodes(0);
800}
801
803{ //this function is the counterpart to GetNodeThroughObject()
804 TC_LOG_DEBUG("bg.battleground", "bg_AV GetObjectThroughNode {}", node);
805 if (m_Nodes[node].Owner == ALLIANCE)
806 {
807 if (m_Nodes[node].State == POINT_ASSAULTED)
808 {
809 if (node <= BG_AV_NODES_FROSTWOLF_HUT)
810 return node+11;
812 return node+7;
813 }
814 else if (m_Nodes[node].State == POINT_CONTROLED)
816 return node;
817 }
818 else if (m_Nodes[node].Owner == HORDE)
819 {
820 if (m_Nodes[node].State == POINT_ASSAULTED)
821 {
823 return node+22;
824 }
825 else if (m_Nodes[node].State == POINT_CONTROLED)
826 {
827 if (node <= BG_AV_NODES_FROSTWOLF_HUT)
828 return node+33;
830 return node+29;
831 }
832 }
833 else if (m_Nodes[node].Owner == AV_NEUTRAL_TEAM)
835 TC_LOG_ERROR("bg.battleground", "BattlegroundAV: Error! GetPlaceNode couldn't resolve node {}", node);
836 ABORT();
837 return 0;
838}
839
840//called when using banner
841
843{
845 return;
846 int32 object = GetObjectType(target_obj->GetGUID());
847 TC_LOG_DEBUG("bg.battleground", "BG_AV using gameobject {} with type {}", target_obj->GetEntry(), object);
848 if (object < 0)
849 return;
850 switch (target_obj->GetEntry())
851 {
857 EventPlayerAssaultsPoint(source, object);
858 break;
863 EventPlayerDefendsPoint(source, object);
864 break;
865 default:
866 break;
867 }
868}
869
871{
873 BG_AV_Nodes node = GetNodeThroughObject(object);
874
875 uint32 owner = m_Nodes[node].Owner; //maybe should name it prevowner
876 uint32 team = player->GetTeam();
877
878 if (owner == player->GetTeam() || m_Nodes[node].State != POINT_ASSAULTED)
879 return;
880 if (m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM)
881 { //until snowfall doesn't belong to anyone it is better handled in assault-code
882 ASSERT(node == BG_AV_NODES_SNOWFALL_GRAVE); //currently the only neutral grave
883 EventPlayerAssaultsPoint(player, object);
884 return;
885 }
886 TC_LOG_DEBUG("bg.battleground", "player defends point object: {} node: {}", object, node);
887 if (m_Nodes[node].PrevOwner != team)
888 {
889 TC_LOG_ERROR("bg.battleground", "BG_AV: player defends point which doesn't belong to his team {}", node);
890 return;
891 }
892
893 //spawn new go :)
894 if (m_Nodes[node].Owner == ALLIANCE)
895 SpawnBGObject(object+22, RESPAWN_IMMEDIATELY); //spawn horde banner
896 else
897 SpawnBGObject(object-22, RESPAWN_IMMEDIATELY); //spawn alliance banner
898
899 if (!IsTower(node))
900 {
903 }
904 // despawn old go
906
907 DefendNode(node, team);
908 PopulateNode(node);
910
911 if (IsTower(node))
912 {
913 //spawn big flag+aura on top of tower
918 }
919 else if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy
920 {
921 for (uint8 i = 0; i < 4; i++)
922 {
925 }
926 }
927
928 if (StaticNodeInfo const* nodeInfo = GetStaticNodeInfo(node))
930 herold->AI()->Talk(team == ALLIANCE ? nodeInfo->TextIds.AllianceCapture : nodeInfo->TextIds.HordeCapture);
931
932 // update the statistic for the defending player
934}
935
937{
939
940 BG_AV_Nodes node = GetNodeThroughObject(object);
941 uint32 owner = m_Nodes[node].Owner; //maybe name it prevowner
942 uint32 team = player->GetTeam();
943 TC_LOG_DEBUG("bg.battleground", "bg_av: player assaults point object {} node {}", object, node);
944 if (owner == team || team == m_Nodes[node].TotalOwner)
945 return; //surely a gm used this object
946
947 if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall is a bit special in capping + it gets eyecandy stuff
948 {
949 if (object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE) //initial capping
950 {
951 if (!(owner == AV_NEUTRAL_TEAM && m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM))
952 return;
953
954 if (team == ALLIANCE)
956 else
959 }
960 else if (m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM) //recapping, when no team owns this node realy
961 {
962 if (!(m_Nodes[node].State != POINT_CONTROLED))
963 return;
964
965 if (team == ALLIANCE)
967 else
969 }
970 //eyecandy
971 uint32 spawn, despawn;
972 if (team == ALLIANCE)
973 {
976 }
977 else
978 {
981 }
982 for (uint8 i = 0; i < 4; i++)
983 {
984 SpawnBGObject(despawn+i, RESPAWN_ONE_DAY);
986 }
987 }
988
989 //if snowfall gots capped it can be handled like all other graveyards
990 if (m_Nodes[node].TotalOwner != AV_NEUTRAL_TEAM)
991 {
992 ASSERT(m_Nodes[node].Owner != AV_NEUTRAL_TEAM);
993 if (team == ALLIANCE)
995 else
997 if (IsTower(node))
998 { //spawning/despawning of bigflag+aura
1003 }
1004 else
1005 {
1006 //spawning/despawning of aura
1009
1011 }
1012 DePopulateNode(node);
1013 }
1014
1015 SpawnBGObject(object, RESPAWN_ONE_DAY); //delete old banner
1016 AssaultNode(node, team);
1018
1019 if (StaticNodeInfo const* nodeInfo = GetStaticNodeInfo(node))
1021 herold->AI()->Talk(team == ALLIANCE ? nodeInfo->TextIds.AllianceAttack : nodeInfo->TextIds.HordeAttack);
1022
1023 // update the statistic for the assaulting player
1025}
1026
1028{
1029 for (uint8 itr = BG_AV_NODES_FIRSTAID_STATION; itr < BG_AV_NODES_MAX; ++itr)
1030 {
1031 uint16 owner = m_Nodes[itr].Owner;
1032 BG_AV_States state = m_Nodes[itr].State;
1033
1034 packet.Worldstates.emplace_back(BGAVNodeInfo[itr].WorldStateIds.AllianceAssault, (owner == ALLIANCE && state == POINT_ASSAULTED) ? 1 : 0);
1035 packet.Worldstates.emplace_back(BGAVNodeInfo[itr].WorldStateIds.AllianceControl, (owner == ALLIANCE && state >= POINT_DESTROYED) ? 1 : 0);
1036 packet.Worldstates.emplace_back(BGAVNodeInfo[itr].WorldStateIds.HordeAssault, (owner == HORDE && state == POINT_ASSAULTED) ? 1 : 0);
1037 packet.Worldstates.emplace_back(BGAVNodeInfo[itr].WorldStateIds.HordeControl, (owner == HORDE && state >= POINT_DESTROYED) ? 1 : 0);
1038 }
1039
1040 packet.Worldstates.emplace_back(AV_SNOWFALL_N, (m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].Owner == AV_NEUTRAL_TEAM ? 1 : 0));
1041 packet.Worldstates.emplace_back(AV_Alliance_Score, m_Team_Scores[0]);
1042 packet.Worldstates.emplace_back(AV_Horde_Score, m_Team_Scores[1]);
1043
1044 // only if game started the teamscores are displayed
1045 if (GetStatus() == STATUS_IN_PROGRESS) {
1046 packet.Worldstates.emplace_back(AV_SHOW_A_SCORE, 1);
1047 packet.Worldstates.emplace_back(AV_SHOW_H_SCORE, 1);
1048 }
1049 else
1050 {
1051 packet.Worldstates.emplace_back(AV_SHOW_A_SCORE, 0);
1052 packet.Worldstates.emplace_back(AV_SHOW_H_SCORE, 0);
1053 }
1054
1057}
1058
1060{
1061 if (StaticNodeInfo const* nodeInfo = GetStaticNodeInfo(node))
1062 {
1063 uint16 owner = m_Nodes[node].Owner;
1064 BG_AV_States state = m_Nodes[node].State;
1065
1066 UpdateWorldState(nodeInfo->WorldStateIds.AllianceAssault, owner == ALLIANCE && state == POINT_ASSAULTED);
1067 UpdateWorldState(nodeInfo->WorldStateIds.AllianceControl, owner == ALLIANCE && state >= POINT_DESTROYED);
1068 UpdateWorldState(nodeInfo->WorldStateIds.HordeAssault, owner == HORDE && state == POINT_ASSAULTED);
1069 UpdateWorldState(nodeInfo->WorldStateIds.HordeControl, owner == HORDE && state >= POINT_DESTROYED);
1070 }
1071
1072 if (node == BG_AV_NODES_SNOWFALL_GRAVE)
1074}
1075
1077{
1078 ASSERT(mine == AV_NORTH_MINE || mine == AV_SOUTH_MINE);
1079// currently i'm sure, that this works (:
1080// ASSERT(m_Mine_PrevOwner[mine] == ALLIANCE || m_Mine_PrevOwner[mine] == HORDE || m_Mine_PrevOwner[mine] == AV_NEUTRAL_TEAM);
1081// ASSERT(m_Mine_Owner[mine] == ALLIANCE || m_Mine_Owner[mine] == HORDE || m_Mine_Owner[mine] == AV_NEUTRAL_TEAM);
1082
1083 uint8 owner, prevowner, mine2; //those variables are needed to access the right worldstate in the BG_AV_MineWorldStates array
1084 mine2 = (mine == AV_NORTH_MINE)?0:1;
1085 if (m_Mine_PrevOwner[mine] == ALLIANCE)
1086 prevowner = 0;
1087 else if (m_Mine_PrevOwner[mine] == HORDE)
1088 prevowner = 2;
1089 else
1090 prevowner = 1;
1091 if (m_Mine_Owner[mine] == ALLIANCE)
1092 owner = 0;
1093 else if (m_Mine_Owner[mine] == HORDE)
1094 owner = 2;
1095 else
1096 owner = 1;
1097
1098 UpdateWorldState(BG_AV_MineWorldStates[mine2][owner], 1);
1099 if (prevowner != owner)
1100 UpdateWorldState(BG_AV_MineWorldStates[mine2][prevowner], 0);
1101}
1102
1104{
1105 WorldSafeLocsEntry const* pGraveyard = nullptr;
1106 WorldSafeLocsEntry const* entry = nullptr;
1107 float dist = 0;
1108 float minDist = 0;
1109 float x, y;
1110
1111 player->GetPosition(x, y);
1112
1113 pGraveyard = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[GetTeamIndexByTeamId(player->GetTeam())+7]);
1114 minDist = (pGraveyard->Loc.X - x)*(pGraveyard->Loc.X - x)+(pGraveyard->Loc.Y - y)*(pGraveyard->Loc.Y - y);
1115
1117 if (m_Nodes[i].Owner == player->GetTeam() && m_Nodes[i].State == POINT_CONTROLED)
1118 {
1119 entry = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[i]);
1120 if (entry)
1121 {
1122 dist = (entry->Loc.X - x)*(entry->Loc.X - x)+(entry->Loc.Y - y)*(entry->Loc.Y - y);
1123 if (dist < minDist)
1124 {
1125 minDist = dist;
1126 pGraveyard = entry;
1127 }
1128 }
1129 }
1130 return pGraveyard;
1131}
1132
1134{
1135 // Create starting objects
1136 if (// alliance gates
1138 // horde gates
1140 {
1141 TC_LOG_ERROR("sql.sql", "BatteGroundAV: Failed to spawn some object Battleground not created!1");
1142 return false;
1143 }
1144
1145 //spawn node-objects
1147 {
1149 {
1151 BG_AV_ObjectPos[i],
1152 0, 0, std::sin(BG_AV_ObjectPos[i].GetOrientation()/2), std::cos(BG_AV_ObjectPos[i].GetOrientation()/2), RESPAWN_ONE_DAY)
1154 BG_AV_ObjectPos[i],
1155 0, 0, std::sin(BG_AV_ObjectPos[i].GetOrientation()/2), std::cos(BG_AV_ObjectPos[i].GetOrientation()/2), RESPAWN_ONE_DAY)
1157 BG_AV_ObjectPos[i],
1158 0, 0, std::sin(BG_AV_ObjectPos[i].GetOrientation()/2), std::cos(BG_AV_ObjectPos[i].GetOrientation()/2), RESPAWN_ONE_DAY)
1160 BG_AV_ObjectPos[i],
1161 0, 0, std::sin(BG_AV_ObjectPos[i].GetOrientation()/2), std::cos(BG_AV_ObjectPos[i].GetOrientation()/2), RESPAWN_ONE_DAY)
1162 //aura
1164 BG_AV_ObjectPos[i],
1165 0, 0, std::sin(BG_AV_ObjectPos[i].GetOrientation()/2), std::cos(BG_AV_ObjectPos[i].GetOrientation()/2), RESPAWN_ONE_DAY)
1167 BG_AV_ObjectPos[i],
1168 0, 0, std::sin(BG_AV_ObjectPos[i].GetOrientation()/2), std::cos(BG_AV_ObjectPos[i].GetOrientation()/2), RESPAWN_ONE_DAY)
1170 BG_AV_ObjectPos[i],
1171 0, 0, std::sin(BG_AV_ObjectPos[i].GetOrientation()/2), std::cos(BG_AV_ObjectPos[i].GetOrientation()/2), RESPAWN_ONE_DAY))
1172 {
1173 TC_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!2");
1174 return false;
1175 }
1176 }
1177 else //towers
1178 {
1179 if (i <= BG_AV_NODES_STONEHEART_BUNKER) //alliance towers
1180 {
1182 BG_AV_ObjectPos[i],
1183 0, 0, std::sin(BG_AV_ObjectPos[i].GetOrientation()/2), std::cos(BG_AV_ObjectPos[i].GetOrientation()/2), RESPAWN_ONE_DAY)
1185 BG_AV_ObjectPos[i],
1186 0, 0, std::sin(BG_AV_ObjectPos[i].GetOrientation()/2), std::cos(BG_AV_ObjectPos[i].GetOrientation()/2), RESPAWN_ONE_DAY)
1188 BG_AV_ObjectPos[i+8],
1189 0, 0, std::sin(BG_AV_ObjectPos[i+8].GetOrientation()/2), std::cos(BG_AV_ObjectPos[i+8].GetOrientation()/2), RESPAWN_ONE_DAY)
1191 BG_AV_ObjectPos[i+8],
1192 0, 0, std::sin(BG_AV_ObjectPos[i+8].GetOrientation()/2), std::cos(BG_AV_ObjectPos[i+8].GetOrientation()/2), RESPAWN_ONE_DAY)
1194 BG_AV_ObjectPos[i+8],
1195 0, 0, std::sin(BG_AV_ObjectPos[i+8].GetOrientation()/2), std::cos(BG_AV_ObjectPos[i+8].GetOrientation()/2), RESPAWN_ONE_DAY)
1197 BG_AV_ObjectPos[i+8],
1198 0, 0, std::sin(BG_AV_ObjectPos[i+8].GetOrientation()/2), std::cos(BG_AV_ObjectPos[i+8].GetOrientation()/2), RESPAWN_ONE_DAY))
1199 {
1200 TC_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!3");
1201 return false;
1202 }
1203 }
1204 else //horde towers
1205 {
1207 BG_AV_ObjectPos[i],
1208 0, 0, std::sin(BG_AV_ObjectPos[i].GetOrientation()/2), std::cos(BG_AV_ObjectPos[i].GetOrientation()/2), RESPAWN_ONE_DAY)
1210 BG_AV_ObjectPos[i],
1211 0, 0, std::sin(BG_AV_ObjectPos[i].GetOrientation()/2), std::cos(BG_AV_ObjectPos[i].GetOrientation()/2), RESPAWN_ONE_DAY)
1213 BG_AV_ObjectPos[i+8],
1214 0, 0, std::sin(BG_AV_ObjectPos[i+8].GetOrientation()/2), std::cos(BG_AV_ObjectPos[i+8].GetOrientation()/2), RESPAWN_ONE_DAY)
1216 BG_AV_ObjectPos[i+8],
1217 0, 0, std::sin(BG_AV_ObjectPos[i+8].GetOrientation()/2), std::cos(BG_AV_ObjectPos[i+8].GetOrientation()/2), RESPAWN_ONE_DAY)
1219 BG_AV_ObjectPos[i+8],
1220 0, 0, std::sin(BG_AV_ObjectPos[i+8].GetOrientation()/2), std::cos(BG_AV_ObjectPos[i+8].GetOrientation()/2), RESPAWN_ONE_DAY)
1222 BG_AV_ObjectPos[i+8],
1223 0, 0, std::sin(BG_AV_ObjectPos[i+8].GetOrientation()/2), std::cos(BG_AV_ObjectPos[i+8].GetOrientation()/2), RESPAWN_ONE_DAY))
1224 {
1225 TC_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!4");
1226 return false;
1227 }
1228 }
1229 for (uint8 j=0; j <= 9; j++) //burning aura
1230 {
1234 0,
1235 0,
1236 std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j].GetOrientation()/2),
1237 std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j].GetOrientation()/2),
1239 {
1240 TC_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!5.{}", i);
1241 return false;
1242 }
1243 }
1244 }
1245 }
1246 for (uint8 i=0; i<2; i++) //burning aura for buildings
1247 {
1248 for (uint8 j=0; j <= 9; j++)
1249 {
1250 if (j<5)
1251 {
1255 0,
1256 0,
1257 std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j].GetOrientation()/2),
1258 std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j].GetOrientation()/2),
1260 {
1261 TC_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!6.{}", i);
1262 return false;
1263 }
1264 }
1265 else
1266 {
1270 0,
1271 0,
1272 std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j].GetOrientation()/2),
1273 std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j].GetOrientation()/2),
1275 {
1276 TC_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!7.{}", i);
1277 return false;
1278 }
1279 }
1280 }
1281 }
1283 {
1287 0,
1288 0,
1289 std::sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i].GetOrientation()/2),
1290 std::cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i].GetOrientation()/2),
1292 {
1293 TC_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.{}", i);
1294 return false;
1295 }
1296 }
1298 {
1302 0,
1303 0,
1304 std::sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i].GetOrientation()/2),
1305 std::cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i].GetOrientation()/2),
1307 {
1308 TC_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.{}", i);
1309 return false;
1310 }
1311 }
1312
1316 0,
1317 0,
1318 std::sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE].GetOrientation()/2),
1319 std::cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE].GetOrientation()/2),
1321 {
1322 TC_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!8");
1323 return false;
1324 }
1325 for (uint8 i = 0; i < 4; i++)
1326 {
1329 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i].GetOrientation()/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i].GetOrientation()/2), RESPAWN_ONE_DAY)
1332 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i].GetOrientation()/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i].GetOrientation()/2), RESPAWN_ONE_DAY)
1335 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i].GetOrientation()/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i].GetOrientation()/2), RESPAWN_ONE_DAY)
1338 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i].GetOrientation()/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i].GetOrientation()/2), RESPAWN_ONE_DAY))
1339 {
1340 TC_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!9.{}", i);
1341 return false;
1342 }
1343 }
1344
1345 uint16 i;
1346 TC_LOG_DEBUG("bg.battleground", "Alterac Valley: entering state STATUS_WAIT_JOIN ...");
1347 // Initial Nodes
1348 for (i = 0; i < BG_AV_OBJECT_MAX; i++)
1350
1352 {
1355 }
1356
1359
1361 {
1365 }
1366
1368 {
1370 SpawnBGObject(i+16, RESPAWN_IMMEDIATELY); //aura
1371 }
1372
1374 {
1376 SpawnBGObject(i+16, RESPAWN_IMMEDIATELY); //aura
1377 }
1378
1379 //snowfall and the doors
1382
1384
1385 //creatures
1386 TC_LOG_DEBUG("bg.battleground", "BG_AV start poputlating nodes");
1388 {
1389 if (m_Nodes[n].Owner)
1390 PopulateNode(n);
1391 }
1392 //all creatures which don't get despawned through the script are static
1393 TC_LOG_DEBUG("bg.battleground", "BG_AV: start spawning static creatures");
1394 for (i = 0; i < AV_STATICCPLACE_MAX; i++)
1396 //mainspiritguides:
1397 TC_LOG_DEBUG("bg.battleground", "BG_AV: start spawning spiritguides creatures");
1400 //spawn the marshals (those who get deleted, if a tower gets destroyed)
1401 TC_LOG_DEBUG("bg.battleground", "BG_AV: start spawning marshal creatures");
1405 return true;
1406}
1407
1409{
1410 if (m_Nodes[node].TotalOwner == team)
1411 {
1412 TC_LOG_FATAL("bg.battleground", "Assaulting team is TotalOwner of node");
1413 ABORT();
1414 }
1415 if (m_Nodes[node].Owner == team)
1416 {
1417 TC_LOG_FATAL("bg.battleground", "Assaulting team is owner of node");
1418 ABORT();
1419 }
1420 if (m_Nodes[node].State == POINT_DESTROYED)
1421 {
1422 TC_LOG_FATAL("bg.battleground", "Destroyed node is being assaulted");
1423 ABORT();
1424 }
1425 if (m_Nodes[node].State == POINT_ASSAULTED && m_Nodes[node].TotalOwner) //only assault an assaulted node if no totalowner exists
1426 {
1427 TC_LOG_FATAL("bg.battleground", "Assault on an not assaulted node with total owner");
1428 ABORT();
1429 }
1430 //the timer gets another time, if the previous owner was 0 == Neutral
1432 m_Nodes[node].PrevOwner = m_Nodes[node].Owner;
1433 m_Nodes[node].Owner = team;
1434 m_Nodes[node].PrevState = m_Nodes[node].State;
1436}
1437
1439{
1440 ASSERT(m_Nodes[node].State == POINT_ASSAULTED);
1441
1442 m_Nodes[node].TotalOwner = m_Nodes[node].Owner;
1443 m_Nodes[node].PrevOwner = m_Nodes[node].Owner;
1444 m_Nodes[node].PrevState = m_Nodes[node].State;
1446 m_Nodes[node].Timer = 0;
1447}
1448
1449void BattlegroundAV::InitNode(BG_AV_Nodes node, uint16 team, bool tower)
1450{
1451 m_Nodes[node].TotalOwner = team;
1452 m_Nodes[node].Owner = team;
1453 m_Nodes[node].PrevOwner = 0;
1455 m_Nodes[node].PrevState = m_Nodes[node].State;
1457 m_Nodes[node].Timer = 0;
1458 m_Nodes[node].Tower = tower;
1459}
1460
1462{
1463 ASSERT(m_Nodes[node].TotalOwner == team);
1464 ASSERT(m_Nodes[node].Owner != team);
1465 ASSERT(m_Nodes[node].State != POINT_CONTROLED && m_Nodes[node].State != POINT_DESTROYED);
1466 m_Nodes[node].PrevOwner = m_Nodes[node].Owner;
1467 m_Nodes[node].Owner = team;
1468 m_Nodes[node].PrevState = m_Nodes[node].State;
1470 m_Nodes[node].Timer = 0;
1471}
1472
1474{
1475 for (uint8 i=0; i<2; i++) //forloop for both teams (it just make 0 == alliance and 1 == horde also for both mines 0=north 1=south
1476 {
1477 for (uint8 j=0; j<9; j++)
1478 m_Team_QuestStatus[i][j]=0;
1480 m_IsInformedNearVictory[i]=false;
1481 m_CaptainAlive[i] = true;
1482 m_CaptainBuffTimer[i] = 120000 + urand(0, 4)* 60; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes @todo get the right times
1485 }
1486
1487 for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_STONEHEART_GRAVE; ++i) //alliance graves
1488 InitNode(i, ALLIANCE, false);
1489 for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) //alliance towers
1490 InitNode(i, ALLIANCE, true);
1491 for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_GRAVE; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i) //horde graves
1492 InitNode(i, HORDE, false);
1493 for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) //horde towers
1494 InitNode(i, HORDE, true);
1495 InitNode(BG_AV_NODES_SNOWFALL_GRAVE, AV_NEUTRAL_TEAM, false); //give snowfall neutral owner
1496
1499 if (BgCreatures[i])
1500 DelCreature(i);
1501}
1502
1503bool BattlegroundAV::CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target, uint32 miscValue)
1504{
1505 uint32 team = source->GetTeam();
1506 switch (criteriaId)
1507 {
1509 for (uint8 mine = 0; mine < 2; mine++)
1510 if (m_Mine_Owner[mine] != team)
1511 return false;
1512
1513 return true;
1515 {
1516 if (team == ALLIANCE)
1517 {
1518 for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) // alliance towers controlled
1519 {
1520 if (m_Nodes[i].State == POINT_CONTROLED)
1521 {
1522 if (m_Nodes[i].Owner != ALLIANCE)
1523 return false;
1524 }
1525 else
1526 return false;
1527 }
1528
1529 for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // horde towers destroyed
1530 if (m_Nodes[i].State != POINT_DESTROYED)
1531 return false;
1532
1533 if (!m_CaptainAlive[0])
1534 return false;
1535
1536 return true;
1537 }
1538 else if (team == HORDE)
1539 {
1540 for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // horde towers controlled
1541 {
1542 if (m_Nodes[i].State == POINT_CONTROLED)
1543 {
1544 if (m_Nodes[i].Owner != HORDE)
1545 return false;
1546 }
1547 else
1548 return false;
1549 }
1550
1551 for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) // alliance towers destroyed
1552 if (m_Nodes[i].State != POINT_DESTROYED)
1553 return false;
1554
1555 if (!m_CaptainAlive[1])
1556 return false;
1557
1558 return true;
1559 }
1560 }
1561 }
1562
1563 return Battleground::CheckAchievementCriteriaMeet(criteriaId, source, target, miscValue);
1564}
1565
1567{
1570
1571 if (allianceScore > hordeScore)
1572 return ALLIANCE;
1573 else if (hordeScore > allianceScore)
1574 return HORDE;
1575
1577}
@ AV_BUFF_H_CAPTAIN
@ AV_BUFF_ARMOR
@ AV_BUFF_A_CAPTAIN
@ AV_SOUND_NEAR_VICTORY
@ BG_AV_OBJECTID_BANNER_H
@ BG_AV_OBJECTID_BANNER_CONT_A
@ BG_AV_OBJECTID_SMOKE
@ BG_AV_OBJECTID_BANNER_H_B
@ BG_AV_OBJECTID_BANNER_A_B
@ BG_AV_OBJECTID_SNOWFALL_CANDY_A
@ BG_AV_OBJECTID_BANNER_SNOWFALL_N
@ BG_AV_OBJECTID_SNOWFALL_CANDY_PH
@ BG_AV_OBJECTID_FIRE
@ BG_AV_OBJECTID_BANNER_A
@ BG_AV_OBJECTID_TOWER_BANNER_PA
@ BG_AV_OBJECTID_TOWER_BANNER_H
@ BG_AV_OBJECTID_SNOWFALL_CANDY_H
@ BG_AV_OBJECTID_SNOWFALL_CANDY_PA
@ BG_AV_OBJECTID_MINE_N
@ BG_AV_OBJECTID_MINE_S
@ BG_AV_OBJECTID_GATE_H
@ BG_AV_OBJECTID_TOWER_BANNER_PH
@ BG_AV_OBJECTID_AURA_N
@ BG_AV_OBJECTID_AURA_A
@ BG_AV_OBJECTID_BANNER_CONT_H
@ BG_AV_OBJECTID_BANNER_CONT_H_B
@ BG_AV_OBJECTID_BANNER_CONT_A_B
@ BG_AV_OBJECTID_AURA_H
@ BG_AV_OBJECTID_TOWER_BANNER_A
@ BG_AV_OBJECTID_GATE_A
BG_AV_Nodes
@ BG_AV_NODES_SNOWFALL_GRAVE
@ BG_AV_NODES_FIRSTAID_STATION
@ BG_AV_NODES_STONEHEART_GRAVE
@ BG_AV_NODES_ICEBLOOD_TOWER
@ BG_AV_NODES_STONEHEART_BUNKER
@ BG_AV_NODES_MAX
@ BG_AV_NODES_FROSTWOLF_WTOWER
@ BG_AV_NODES_DUNBALDAR_SOUTH
@ BG_AV_NODES_FROSTWOLF_HUT
@ BG_AV_NODES_ICEBLOOD_GRAVE
#define BG_AV_RES_CAPTAIN
Position const BG_AV_ObjectPos[AV_OPLACE_MAX]
BG_AV_States
@ POINT_DESTROYED
@ POINT_CONTROLED
@ POINT_ASSAULTED
#define BG_AV_RES_TOWER
const uint32 BG_AV_StaticCreatureInfo[51]
#define BG_AV_KILL_BOSS
#define BG_AV_KILL_SURVIVING_TOWER
@ ACTION_BUFF_YELL
const uint32 BG_AV_MineWorldStates[2][3]
Position const BG_AV_DoorPositons[2]
#define BG_AV_EVENT_START_BATTLE
#define BG_AV_REP_TOWER
@ AV_OPLACE_BURN_DUNBALDAR_SOUTH
@ AV_OPLACE_MINE_SUPPLY_N_MIN
@ AV_OPLACE_SNOW_1
@ AV_OPLACE_MINE_SUPPLY_S_MIN
@ AV_OPLACE_BURN_BUILDING_A
@ BG_AV_OBJECT_MINE_SUPPLY_N_MIN
@ BG_AV_OBJECT_MINE_SUPPLY_N_MAX
@ BG_AV_OBJECT_MINE_SUPPLY_S_MIN
@ BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT
@ BG_AV_OBJECT_MINE_SUPPLY_S_MAX
@ BG_AV_OBJECT_AURA_N_FIRSTAID_STATION
@ BG_AV_OBJECT_BURN_BUILDING_HORDE
@ BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH
@ BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER
@ BG_AV_OBJECT_DOOR_H
@ BG_AV_OBJECT_FLAG_A_FIRSTAID_STATION
@ BG_AV_OBJECT_FLAG_H_ICEBLOOD_GRAVE
@ BG_AV_OBJECT_FLAG_C_H_SNOWFALL_GRAVE
@ BG_AV_OBJECT_AURA_A_FIRSTAID_STATION
@ BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_HUT
@ BG_AV_OBJECT_FLAG_C_H_STONEHEART_BUNKER
@ BG_AV_OBJECT_MAX
@ BG_AV_OBJECT_TFLAG_H_ICEBLOOD_TOWER
@ BG_AV_OBJECT_BURN_BUILDING_ALLIANCE
@ BG_AV_OBJECT_FLAG_C_A_SNOWFALL_GRAVE
@ BG_AV_OBJECT_SNOW_EYECANDY_A
@ BG_AV_OBJECT_TFLAG_A_STONEHEART_BUNKER
@ BG_AV_OBJECT_AURA_H_FIRSTAID_STATION
@ BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH
@ BG_AV_OBJECT_TFLAG_H_FROSTWOLF_WTOWER
@ BG_AV_OBJECT_FLAG_A_DUNBALDAR_SOUTH
@ BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE
@ BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER
@ BG_AV_OBJECT_AURA_N_SNOWFALL_GRAVE
@ BG_AV_OBJECT_DOOR_A
@ BG_AV_OBJECT_SNOW_EYECANDY_PH
@ BG_AV_OBJECT_SNOW_EYECANDY_H
@ BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH
@ BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH
@ BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_WTOWER
@ BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH
@ BG_AV_OBJECT_SNOW_EYECANDY_PA
@ BG_AV_OBJECT_FLAG_A_STONEHEART_GRAVE
@ AV_MINE_TICK_TIMER
@ AV_MINE_RECLAIM_TIMER
@ AV_NORTH_MINE
@ AV_STATICCPLACE_MAX
@ AV_NEUTRAL_TEAM
@ AV_SOUTH_MINE
Position const BG_AV_CreaturePos[AV_CPLACE_MAX]
#define BG_AV_REP_SURVIVING_CAPTAIN
@ AV_OBJECTIVE_DEFEND_GRAVEYARD
@ AV_OBJECTIVE_ASSAULT_GRAVEYARD
@ AV_OBJECTIVE_ASSAULT_TOWER
@ AV_OBJECTIVE_DEFEND_TOWER
#define BG_AV_REP_BOSS
@ AV_QUEST_A_COMMANDER3
@ AV_QUEST_H_SCRAPS1
@ AV_QUEST_H_BOSS1
@ AV_QUEST_H_RIDER_TAME
@ AV_QUEST_A_COMMANDER1
@ AV_QUEST_A_RIDER_HIDE
@ AV_QUEST_A_SCRAPS1
@ AV_QUEST_H_COMMANDER1
@ AV_QUEST_A_RIDER_TAME
@ AV_QUEST_H_COMMANDER3
@ AV_QUEST_H_NEAR_MINE
@ AV_QUEST_A_COMMANDER2
@ AV_QUEST_A_OTHER_MINE
@ AV_QUEST_A_NEAR_MINE
@ AV_QUEST_H_OTHER_MINE
@ AV_QUEST_A_SCRAPS2
@ AV_QUEST_H_BOSS2
@ AV_QUEST_A_BOSS1
@ AV_QUEST_H_COMMANDER2
@ AV_QUEST_H_RIDER_HIDE
@ AV_QUEST_A_BOSS2
@ AV_QUEST_H_SCRAPS2
const float BG_AV_StaticCreaturePos[AV_STATICCPLACE_MAX][5]
const uint32 BG_AV_GraveyardIds[9]
@ TEXT_FROSTWOLF_GENERAL_DEAD
@ TEXT_STORMPIKE_GENERAL_DEAD
@ TEXT_COLDTOOTH_MINE_HORDE_TAKEN
@ TEXT_IRONDEEP_MINE_ALLIANCE_TAKEN
@ TEXT_IRONDEEP_MINE_HORDE_TAKEN
@ TEXT_COLDTOOTH_MINE_ALLIANCE_TAKEN
@ TEXT_SNIVVLE_RANDOM
#define BG_AV_SNOWFALL_FIRSTCAP
QuaternionData const BG_AV_DoorRotation[2]
@ AV_NPC_H_TOWERDEFENSE
@ AV_NPC_H_MARSHAL_WTOWER
@ AV_NPC_A_GRAVEDEFENSE3
@ AV_NPC_H_GRAVEDEFENSE0
@ AV_NPC_N_MINE_H_1
@ AV_NPC_S_MINE_N_S
@ AV_NPC_S_MINE_N_1
@ AV_NPC_S_MINE_H_4
@ AV_NPC_HERALD
@ AV_NPC_N_MINE_N_1
@ AV_NPC_A_GRAVEDEFENSE1
@ AV_NPC_S_MINE_H_1
@ AV_NPC_N_MINE_A_4
@ AV_NPC_H_CAPTAIN
@ AV_NPC_N_MINE_N_4
@ AV_NPC_H_GRAVEDEFENSE2
@ AV_NPC_S_MINE_N_4
@ AV_NPC_N_MINE_A_1
@ AV_NPC_A_TOWERDEFENSE
@ AV_NPC_A_GRAVEDEFENSE0
@ AV_NPC_S_MINE_A_4
@ AV_NPC_H_BOSS
@ AV_NPC_A_MARSHAL_SOUTH
@ AV_NPC_A_BOSS
@ AV_NPC_H_GRAVEDEFENSE1
@ AV_NPC_N_MINE_H_4
@ AV_NPC_S_MINE_H_3
@ AV_NPC_S_MINE_A_3
@ AV_NPC_S_MINE_A_1
@ AV_NPC_A_GRAVEDEFENSE2
@ AV_NPC_H_GRAVEDEFENSE3
@ AV_NPC_A_CAPTAIN
#define BG_AV_KILL_CAPTAIN
#define BG_AV_REP_SURVIVING_TOWER
const uint32 BG_AV_CreatureInfo[AV_NPC_INFO_MAX]
@ AV_CPLACE_TRIGGER18
@ AV_CPLACE_MINE_S_2_MAX
@ AV_CPLACE_MINE_N_1_MIN
@ AV_CPLACE_TRIGGER19
@ AV_CPLACE_MINE_S_S_MIN
@ AV_CPLACE_MINE_S_2_MIN
@ AV_CPLACE_MINE_S_1_MIN
@ AV_CPLACE_MINE_S_S_MAX
@ AV_CPLACE_TRIGGER17
@ AV_CPLACE_MINE_N_2_MAX
@ AV_CPLACE_TRIGGER16
@ AV_CPLACE_MAX
@ AV_CPLACE_MINE_N_1_MAX
@ AV_CPLACE_A_MARSHAL_SOUTH
@ AV_CPLACE_MINE_S_3
@ AV_CPLACE_MINE_S_1_MAX
@ AV_CPLACE_DEFENSE_STORM_AID
@ AV_CPLACE_MINE_N_3
@ AV_CPLACE_HERALD
@ AV_CPLACE_MINE_N_2_MIN
#define BG_AV_SCORE_INITIAL_POINTS
#define BG_AV_CAPTIME
@ AV_SNOWFALL_N
@ AV_SHOW_A_SCORE
@ AV_Horde_Score
@ AV_Alliance_Score
@ AV_SHOW_H_SCORE
static StaticNodeInfo const BGAVNodeInfo[]
#define SEND_MSG_NEAR_LOSE
#define BG_AV_KILL_SURVIVING_CAPTAIN
#define BG_AV_KILL_TOWER
@ BG_AV_TEXT_ALLIANCE_NEAR_LOSE
@ BG_AV_TEXT_START_HALF_MINUTE
@ BG_AV_TEXT_START_ONE_MINUTE
@ BG_AV_TEXT_HORDE_NEAR_LOSE
@ BG_AV_TEXT_BATTLE_HAS_BEGUN
#define BG_AV_REP_CAPTAIN
@ SCORE_GRAVEYARDS_ASSAULTED
@ SCORE_TOWERS_DEFENDED
@ SCORE_TOWERS_ASSAULTED
@ SCORE_GRAVEYARDS_DEFENDED
@ BG_CRITERIA_CHECK_AV_PERFECTION
Definition: Battleground.h:70
@ BG_CRITERIA_CHECK_EVERYTHING_COUNTS
Definition: Battleground.h:69
@ RESPAWN_IMMEDIATELY
Definition: Battleground.h:160
@ RESPAWN_ONE_DAY
Definition: Battleground.h:159
@ STATUS_IN_PROGRESS
Definition: Battleground.h:187
@ BG_STARTING_EVENT_THIRD
Definition: Battleground.h:226
@ BG_STARTING_EVENT_SECOND
Definition: Battleground.h:225
@ BG_STARTING_EVENT_FOURTH
Definition: Battleground.h:227
@ ACHIEVEMENT_TIMED_TYPE_EVENT
Definition: DBCEnums.h:122
@ ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE
Definition: DBCEnums.h:156
DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore(WorldSafeLocsEntryfmt)
uint8_t uint8
Definition: Define.h:135
int16_t int16
Definition: Define.h:130
int32_t int32
Definition: Define.h:129
uint16_t uint16
Definition: Define.h:134
uint32_t uint32
Definition: Define.h:133
#define ABORT
Definition: Errors.h:74
#define ASSERT
Definition: Errors.h:68
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:156
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:165
#define TC_LOG_FATAL(filterType__,...)
Definition: Log.h:168
#define sObjectMgr
Definition: ObjectMgr.h:1723
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
@ TEAM_ALLIANCE
@ TEAM_HORDE
@ ALLIANCE
@ HORDE
@ CHAT_MSG_BG_SYSTEM_ALLIANCE
@ CHAT_MSG_BG_SYSTEM_HORDE
@ FACTION_ALLIANCE_GENERIC
@ FACTION_HORDE_GENERIC
#define WORLD_TRIGGER
Definition: Unit.h:35
@ JUST_DIED
Definition: Unit.h:212
constexpr std::underlying_type< E >::type AsUnderlyingType(E enumValue)
Definition: Util.h:554
StaticNodeInfo const * GetStaticNodeInfo(BG_AV_Nodes node) const
void PopulateNode(BG_AV_Nodes node)
void StartingEventOpenDoors() override
BG_AV_NodeInfo m_Nodes[BG_AV_NODES_MAX]
void ChangeMineOwner(uint8 mine, uint32 team, bool initial=false)
void InitNode(BG_AV_Nodes node, uint16 team, bool tower)
void EventPlayerAssaultsPoint(Player *player, uint32 object)
bool SetupBattleground() override
int32 m_Team_Scores[2]
bool m_IsInformedNearVictory[2]
void AddPlayer(Player *player) override
uint32 GetObjectThroughNode(BG_AV_Nodes node)
void HandleAreaTrigger(Player *player, uint32 trigger) override
void ResetBGSubclass() override
void DePopulateNode(BG_AV_Nodes node)
void EndBattleground(uint32 winner) override
BG_AV_Nodes GetNodeThroughObject(uint32 object)
void PostUpdateImpl(uint32 diff) override
Post-update hook.
bool UpdatePlayerScore(Player *player, uint32 type, uint32 value, bool doAddHonor=true) override
void HandleKillUnit(Creature *unit, Player *killer) override
void EventPlayerClickedOnFlag(Player *source, GameObject *target_obj) override
bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const *source, Unit const *target=nullptr, uint32 miscvalue1=0) override
uint32 m_CaptainBuffTimer[2]
void HandleQuestComplete(uint32 questid, Player *player) override
bool IsTower(BG_AV_Nodes node)
WorldSafeLocsEntry const * GetClosestGraveyard(Player *player) override
bool CanActivateGO(int32 GOId, uint32 team) const override
void EventPlayerDestroyedPoint(BG_AV_Nodes node)
void StartingEventCloseDoors() override
void HandleKillPlayer(Player *player, Player *killer) override
Creature * AddAVCreature(uint16 cinfoid, uint16 type)
void SendMineWorldStates(uint32 mine)
void RemovePlayer(Player *player, ObjectGuid guid, uint32 team) override
void DefendNode(BG_AV_Nodes node, uint16 team)
void UpdateScore(uint16 team, int16 points)
void AssaultNode(BG_AV_Nodes node, uint16 team)
void UpdateNodeWorldState(BG_AV_Nodes node)
uint32 m_Mine_Reclaim_Timer[2]
uint32 GetPrematureWinner() override
uint32 m_Team_QuestStatus[2][9]
bool m_CaptainAlive[2]
void DestroyNode(BG_AV_Nodes node)
uint32 m_Mine_Owner[2]
void EventPlayerDefendsPoint(Player *player, uint32 object)
void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates &packet) override
uint32 m_Mine_PrevOwner[2]
virtual void AddPlayer(Player *player)
virtual void EndBattleground(uint32 winner)
virtual Creature * AddCreature(uint32 entry, uint32 type, float x, float y, float z, float o, TeamId teamId=TEAM_NEUTRAL, uint32 respawntime=0, Transport *transport=nullptr)
void RelocateDeadPlayers(ObjectGuid guideGuid)
Relocate all players in ReviveQueue to the closest graveyard.
void CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
virtual void HandleKillPlayer(Player *player, Player *killer)
static TeamId GetTeamIndexByTeamId(uint32 Team)
Definition: Battleground.h:410
void DoorOpen(uint32 type)
bool DelCreature(uint32 type)
void SpawnBGObject(uint32 type, uint32 respawntime)
virtual bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime=0, GOState goState=GO_STATE_READY)
int32 GetObjectType(ObjectGuid guid)
GuidVector BgObjects
Definition: Battleground.h:463
Creature * GetBGCreature(uint32 type, bool logError=true)
virtual bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, TeamId teamId=TEAM_NEUTRAL)
void DoorClose(uint32 type)
GuidVector BgCreatures
Definition: Battleground.h:464
bool IsPlayerInBattleground(ObjectGuid guid) const
void SendBroadcastText(uint32 id, ChatMsg msgType, WorldObject const *target=nullptr)
BattlegroundScoreMap PlayerScores
Definition: Battleground.h:535
void RewardHonorToTeam(uint32 Honor, uint32 TeamID)
BattlegroundStatus GetStatus() const
Definition: Battleground.h:278
virtual bool UpdatePlayerScore(Player *player, uint32 type, uint32 value, bool doAddHonor=true)
virtual void HandleAreaTrigger(Player *, uint32)
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
virtual bool CheckAchievementCriteriaMeet(uint32, Player const *, Unit const *=nullptr, uint32=0)
void UpdateWorldState(uint32 variable, uint32 value)
uint32 GetBonusHonorFromKill(uint32 kills) const
void RewardReputationToTeam(uint32 faction_id, uint32 Reputation, uint32 TeamID)
void PlaySoundToAll(uint32 soundID)
virtual uint32 GetPrematureWinner()
uint32 StartMessageIds[BG_STARTING_EVENT_COUNT]
Definition: Battleground.h:548
void Respawn(bool force=false)
Definition: Creature.cpp:2057
void setDeathState(DeathState s) override
Definition: Creature.cpp:1961
void SetRespawnDelay(uint32 delay)
Definition: Creature.h:270
ObjectGuid::LowType GetSpawnId() const
Definition: Creature.h:83
void Initialize()
LowType GetCounter() const
Definition: ObjectGuid.h:158
uint32 GetEntry() const
Definition: Object.h:80
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:77
Definition: Player.h:915
uint32 GetTeam() const
Definition: Player.h:1811
void LeaveBattleground(bool teleportToEntryPoint=true, bool withoutDeserterDebuff=false)
Definition: Player.cpp:22110
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, WorldObject *ref=nullptr)
Definition: Player.cpp:25092
WorldSession * GetSession() const
Definition: Player.h:1712
Definition: Unit.h:769
void SetFaction(uint32 faction) override
Definition: Unit.h:972
MotionMaster * GetMotionMaster()
Definition: Unit.h:1667
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3780
std::vector< WorldStateInfo > Worldstates
void SendAreaTriggerMessage(char const *Text,...) ATTR_PRINTF(2
BG_AV_States State
BG_AV_States PrevState
void BuildObjectivesBlock(WorldPackets::Battleground::PVPLogData_Player &playerData) override
float wander_distance
Definition: CreatureData.h:448
void GetPosition(float &x, float &y) const
Definition: Position.h:84
SpawnGroupTemplateData const * spawnGroupData
Definition: SpawnData.h:88
DBCPosition3D Loc