Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
BattlegroundAV.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "BattlegroundAV.h"
7
8#include "ObjectMgr.h"
9#include "WorldPacket.h"
10
11#include "Formulas.h"
12#include "GameObject.h"
13#include "Language.h"
14#include "Player.h"
15#include "SpellAuras.h"
16#include "WorldSession.h"
17
28
30
35
37{
39 return;
40
41 Battleground::HandleKillPlayer(player, killer);
42 UpdateScore(player->GetTeam(), -1);
43}
44
46{
47 SF_LOG_DEBUG("bg.battleground", "bg_av HandleKillUnit %i", unit->GetEntry());
49 return;
50 uint32 entry = unit->GetEntry();
51 /*
52 uint32 triggerSpawnID = 0;
53 if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN][0])
54 triggerSpawnID = AV_CPLACE_TRIGGER16;
55 else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_BOSS][0])
56 triggerSpawnID = AV_CPLACE_TRIGGER17;
57 else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN][0])
58 triggerSpawnID = AV_CPLACE_TRIGGER18;
59 else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_BOSS][0])
60 triggerSpawnID = AV_CPLACE_TRIGGER19;
61 */
62 if (entry == BG_AV_CreatureInfo[AV_NPC_A_BOSS][0])
63 {
64 CastSpellOnTeam(23658, HORDE); //this is a spell which finishes a quest where a player has to kill the boss
69 }
70 else if (entry == BG_AV_CreatureInfo[AV_NPC_H_BOSS][0])
71 {
72 CastSpellOnTeam(23658, ALLIANCE); //this is a spell which finishes a quest where a player has to kill the boss
77 }
78 else if (entry == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN][0])
79 {
80 if (!m_CaptainAlive[0])
81 {
82 SF_LOG_ERROR("bg.battleground", "Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
83 return;
84 }
85 m_CaptainAlive[0] = false;
89 //spawn destroyed aura
90 for (uint8 i = 0; i <= 9; i++)
93 if (creature)
96 }
97 else if (entry == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN][0])
98 {
99 if (!m_CaptainAlive[1])
100 {
101 SF_LOG_ERROR("bg.battleground", "Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
102 return;
103 }
104 m_CaptainAlive[1] = false;
108 //spawn destroyed aura
109 for (uint8 i = 0; i <= 9; i++)
112 if (creature)
115 }
120}
121
123{
125 return;//maybe we should log this, cause this must be a cheater or a big bug
126 uint8 team = GetTeamIndexByTeamId(player->GetTeam());
128 SF_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed", questid);
129 switch (questid)
130 {
135 m_Team_QuestStatus[team][0] += 20;
136 if (m_Team_QuestStatus[team][0] == 500 || m_Team_QuestStatus[team][0] == 1000 || m_Team_QuestStatus[team][0] == 1500) //25, 50, 75 turn ins
137 {
138 SF_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed starting with unit upgrading..", questid);
140 if (m_Nodes[i].Owner == player->GetTeam() && m_Nodes[i].State == POINT_CONTROLED)
141 {
143 PopulateNode(i);
144 //maybe this is bad, because it will instantly respawn all creatures on every grave..
145 }
146 }
147 break;
150 m_Team_QuestStatus[team][1]++;
151 RewardReputationToTeam(team, 1, player->GetTeam());
152 if (m_Team_QuestStatus[team][1] == 30)
153 SF_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
154 break;
157 m_Team_QuestStatus[team][2]++;
158 RewardReputationToTeam(team, 1, player->GetTeam());
159 if (m_Team_QuestStatus[team][2] == 60)
160 SF_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
161 break;
164 m_Team_QuestStatus[team][3]++;
165 RewardReputationToTeam(team, 1, player->GetTeam());
166 if (m_Team_QuestStatus[team][3] == 120)
167 SF_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
168 break;
169 case AV_QUEST_A_BOSS1:
170 case AV_QUEST_H_BOSS1:
171 m_Team_QuestStatus[team][4] += 9; //you can turn in 10 or 1 item..
172 case AV_QUEST_A_BOSS2:
173 case AV_QUEST_H_BOSS2:
174 m_Team_QuestStatus[team][4]++;
175 if (m_Team_QuestStatus[team][4] >= 200)
176 SF_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
177 break;
180 m_Team_QuestStatus[team][5]++;
181 if (m_Team_QuestStatus[team][5] == 28)
182 {
183 SF_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
184 if (m_Team_QuestStatus[team][6] == 7)
185 SF_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here - ground assault ready", questid);
186 }
187 break;
190 m_Team_QuestStatus[team][6]++;
191 if (m_Team_QuestStatus[team][6] == 7)
192 {
193 SF_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
194 if (m_Team_QuestStatus[team][5] == 20)
195 SF_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here - ground assault ready", questid);
196 }
197 break;
200 m_Team_QuestStatus[team][7]++;
201 if (m_Team_QuestStatus[team][7] == 25)
202 {
203 SF_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
204 if (m_Team_QuestStatus[team][8] == 25)
205 SF_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here - rider assault ready", questid);
206 }
207 break;
210 m_Team_QuestStatus[team][8]++;
211 if (m_Team_QuestStatus[team][8] == 25)
212 {
213 SF_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
214 if (m_Team_QuestStatus[team][7] == 25)
215 SF_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here - rider assault ready", questid);
216 }
217 break;
218 default:
219 SF_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed but is not interesting at all", questid);
220 return; //was no interesting quest at all
221 break;
222 }
223}
224
226{ //note: to remove reinforcementpoints points must be negative, for adding reinforcements points must be positive
227 ASSERT(team == ALLIANCE || team == HORDE);
228 uint8 teamindex = GetTeamIndexByTeamId(team); //0=ally 1=horde
229 m_Team_Scores[teamindex] += points;
230
232 if (points < 0)
233 {
234 if (m_Team_Scores[teamindex] < 1)
235 {
236 m_Team_Scores[teamindex] = 0;
237 EndBattleground(((teamindex == TEAM_HORDE) ? ALLIANCE : HORDE));
238 }
239 else if (!m_IsInformedNearVictory[teamindex] && m_Team_Scores[teamindex] < SEND_MSG_NEAR_LOSE)
240 {
243 m_IsInformedNearVictory[teamindex] = true;
244 }
245 }
246}
247
249{
250 uint8 level;
251 bool isStatic = false;
252 Creature* creature = NULL;
254 if (type >= AV_CPLACE_MAX) //static
255 {
256 type -= AV_CPLACE_MAX;
257 cinfoid = uint16(BG_AV_StaticCreaturePos[type][4]);
258 creature = AddCreature(BG_AV_StaticCreatureInfo[cinfoid][0],
259 (type + AV_CPLACE_MAX),
260 BG_AV_StaticCreatureInfo[cinfoid][1],
264 BG_AV_StaticCreaturePos[type][3]);
265 level = (BG_AV_StaticCreatureInfo[cinfoid][2] == BG_AV_StaticCreatureInfo[cinfoid][3])
266 ? BG_AV_StaticCreatureInfo[cinfoid][2]
267 : std::rand() % BG_AV_StaticCreatureInfo[cinfoid][3] + BG_AV_StaticCreatureInfo[cinfoid][2];
268 isStatic = true;
269 }
270 else
271 {
272 creature = AddCreature(BG_AV_CreatureInfo[cinfoid][0],
273 type,
274 BG_AV_CreatureInfo[cinfoid][1],
275 BG_AV_CreaturePos[type][0],
276 BG_AV_CreaturePos[type][1],
277 BG_AV_CreaturePos[type][2],
278 BG_AV_CreaturePos[type][3]);
279 level = (BG_AV_CreatureInfo[cinfoid][2] == BG_AV_CreatureInfo[cinfoid][3])
280 ? BG_AV_CreatureInfo[cinfoid][2]
281 : std::rand() % BG_AV_CreatureInfo[cinfoid][3] + BG_AV_CreatureInfo[cinfoid][2];
282 }
283 if (!creature)
284 return NULL;
285 if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN][0] || creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN][0])
287
288 if ((isStatic && cinfoid >= 10 && cinfoid <= 14) || (!isStatic && ((cinfoid >= AV_NPC_A_GRAVEDEFENSE0 && cinfoid <= AV_NPC_A_GRAVEDEFENSE3) ||
289 (cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3))))
290 {
291 if (!isStatic && ((cinfoid >= AV_NPC_A_GRAVEDEFENSE0 && cinfoid <= AV_NPC_A_GRAVEDEFENSE3)
292 || (cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3)))
293 {
294 CreatureData& data = sObjectMgr->NewOrExistCreatureData(creature->GetDBTableGUIDLow());
295 data.spawndist = 5;
296 }
297 //else spawndist will be 15, so creatures move maximum=10
298 //creature->SetDefaultMovementType(RANDOM_MOTION_TYPE);
299 creature->GetMotionMaster()->Initialize();
301 creature->Respawn();
303 //just copied this code from a gm-command
304 }
305
306 if (level != 0)
307 level += m_MaxLevel - 60; //maybe we can do this more generic for custom level-range.. actually it's blizzlike
308 creature->SetLevel(level);
309
310 uint32 triggerSpawnID = 0;
311 uint32 newFaction = 0;
312 if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN][0])
313 {
314 triggerSpawnID = AV_CPLACE_TRIGGER16;
315 newFaction = 84;
316 }
317 else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_BOSS][0])
318 {
319 triggerSpawnID = AV_CPLACE_TRIGGER17;
320 newFaction = 84;
321 }
322 else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN][0])
323 {
324 triggerSpawnID = AV_CPLACE_TRIGGER18;
325 newFaction = 83;
326 }
327 else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_BOSS][0])
328 {
329 triggerSpawnID = AV_CPLACE_TRIGGER19;
330 newFaction = 83;
331 }
332 if (triggerSpawnID && newFaction)
333 {
334 if (Creature* trigger = AddCreature(WORLD_TRIGGER,
335 triggerSpawnID,
336 BG_AV_CreatureInfo[creature->GetEntry()][1],
337 BG_AV_CreaturePos[triggerSpawnID][0],
338 BG_AV_CreaturePos[triggerSpawnID][1],
339 BG_AV_CreaturePos[triggerSpawnID][2],
340 BG_AV_CreaturePos[triggerSpawnID][3]))
341 {
342 trigger->setFaction(newFaction);
343 trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
344 }
345 }
346
347 return creature;
348}
349
351{
353 {
354 for (uint8 i = 0; i <= 1; i++)//0=alliance, 1=horde
355 {
356 if (!m_CaptainAlive[i])
357 continue;
358 if (m_CaptainBuffTimer[i] > diff)
359 m_CaptainBuffTimer[i] -= diff;
360 else
361 {
362 if (i == 0)
363 {
365 Creature* creature = GetBGCreature(AV_CPLACE_MAX + 61);
366 if (creature)
368 }
369 else
370 {
372 Creature* creature = GetBGCreature(AV_CPLACE_MAX + 59);
373 if (creature)
375 }
376 m_CaptainBuffTimer[i] = 120000 + (std::rand() % 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
377 }
378 }
379 //add points from mine owning, and look if he neutral team wanrts to reclaim the mine
380 m_Mine_Timer -= diff;
381 for (uint8 mine = 0; mine < 2; mine++)
382 {
383 if (m_Mine_Owner[mine] == ALLIANCE || m_Mine_Owner[mine] == HORDE)
384 {
385 if (m_Mine_Timer <= 0)
386 UpdateScore(m_Mine_Owner[mine], 1);
387
388 if (m_Mine_Reclaim_Timer[mine] > diff)
389 m_Mine_Reclaim_Timer[mine] -= diff;
390 else
391 {
392 //we don't need to set this timer to 0 cause this codepart wont get called when this thing is 0
394 }
395 }
396 }
397 if (m_Mine_Timer <= 0)
398 m_Mine_Timer = AV_MINE_TICK_TIMER; //this is at the end, cause we need to update both mines
399
400 //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
402 if (m_Nodes[i].State == POINT_ASSAULTED) //maybe remove this
403 {
404 if (m_Nodes[i].Timer > diff)
405 m_Nodes[i].Timer -= diff;
406 else
408 }
409 }
410}
411
417
437
439{
441 //create score and add it to map, default values are set in constructor
443 PlayerScores[player->GetGUID()] = sc;
444 if (m_MaxLevel == 0)
445 m_MaxLevel = (player->getLevel() % 10 == 0) ? player->getLevel() : (player->getLevel() - (player->getLevel() % 10)) + 10;
446}
447
449{
450 //calculate bonuskills for both teams:
451 //first towers:
452 uint8 kills[2] = { 0, 0 }; // 0 = Alliance 1 = Horde
453 uint8 rep[2] = { 0, 0 }; // 0 = Alliance 1 = Horde
455 {
456 if (m_Nodes[i].State == POINT_CONTROLED)
457 {
458 if (m_Nodes[i].Owner == ALLIANCE)
459 {
461 kills[0] += BG_AV_KILL_SURVIVING_TOWER;
462 }
463 else
464 {
466 kills[1] += BG_AV_KILL_SURVIVING_TOWER;
467 }
468 }
469 }
470
471 for (int i = TEAM_ALLIANCE; i <= TEAM_HORDE; ++i)
472 {
473 if (m_CaptainAlive[i])
474 {
477 }
478 if (rep[i] != 0)
479 RewardReputationToTeam(i == 0 ? 730 : 729, rep[i], i == 0 ? ALLIANCE : HORDE);
480 if (kills[i] != 0)
481 RewardHonorToTeam(GetBonusHonor(kills[i]), i == 0 ? ALLIANCE : HORDE);
482 }
483
486}
487
488void BattlegroundAV::RemovePlayer(Player* player, uint64 /*guid*/, uint32 /*team*/)
489{
490 if (!player)
491 {
492 SF_LOG_ERROR("bg.battleground", "bg_AV no player at remove");
493 return;
494 }
499}
500
502{
504 return;
505
506 switch (trigger)
507 {
508 case 95:
509 case 2608:
510 if (player->GetTeam() != ALLIANCE)
511 player->GetSession()->SendNotification("Only The Alliance can use that portal");
512 else
513 player->LeaveBattleground();
514 break;
515 case 2606:
516 if (player->GetTeam() != HORDE)
517 player->GetSession()->SendNotification("Only The Horde can use that portal");
518 else
519 player->LeaveBattleground();
520 break;
521 case 3326:
522 case 3327:
523 case 3328:
524 case 3329:
525 case 3330:
526 case 3331:
527 //Source->Unmount();
528 break;
529 default:
530 Battleground::HandleAreaTrigger(player, trigger);
531 break;
532 }
533}
534
535void BattlegroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
536{
537 BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID());
538 if (itr == PlayerScores.end()) // player not found...
539 return;
540
541 switch (type)
542 {
544 ((BattlegroundAVScore*)itr->second)->GraveyardsAssaulted += value;
546 break;
548 ((BattlegroundAVScore*)itr->second)->GraveyardsDefended += value;
550 break;
552 ((BattlegroundAVScore*)itr->second)->TowersAssaulted += value;
554 break;
556 ((BattlegroundAVScore*)itr->second)->TowersDefended += value;
558 break;
560 ((BattlegroundAVScore*)itr->second)->MinesCaptured += value;
561 break;
563 ((BattlegroundAVScore*)itr->second)->LeadersKilled += value;
564 break;
566 ((BattlegroundAVScore*)itr->second)->SecondaryObjectives += value;
567 break;
568 default:
569 Battleground::UpdatePlayerScore(Source, type, value, doAddHonor);
570 break;
571 }
572}
573
575{
576 uint32 object = GetObjectThroughNode(node);
577 SF_LOG_DEBUG("bg.battleground", "bg_av: player destroyed point node %i object %i", node, object);
578
579 //despawn banner
581 DestroyNode(node);
583
584 uint32 owner = m_Nodes[node].Owner;
585 if (IsTower(node))
586 {
588 //despawn marshal
591 else
592 SF_LOG_ERROR("bg.battleground", "BG_AV: playerdestroyedpoint: marshal %i doesn't exist", AV_CPLACE_A_MARSHAL_SOUTH + tmp);
593 //spawn destroyed aura
594 for (uint8 i = 0; i <= 9; i++)
596
597 UpdateScore((owner == ALLIANCE) ? HORDE : ALLIANCE, -1 * BG_AV_RES_TOWER);
598 RewardReputationToTeam(owner == ALLIANCE ? 730 : 729, BG_AV_REP_TOWER, owner);
600
603 }
604 else
605 {
606 if (owner == ALLIANCE)
608 else
612 PopulateNode(node);
613 if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy
614 {
615 for (uint8 i = 0; i < 4; i++)
616 {
619 }
620 }
621 }
622 //send a nice message to all :)
623 char buf[256];
624 if (IsTower(node))
626 else
628
630 if (creature)
631 YellToAll(creature, buf, Language::LANG_UNIVERSAL);
632}
633
634void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
635{
636 // mine=0 northmine mine=1 southmin
637 // changing the owner results in setting respawntim to infinite for current creatures,
638 // spawning new mine owners creatures and changing the chest-objects so that the current owning team can use them
639 ASSERT(mine == AV_NORTH_MINE || mine == AV_SOUTH_MINE);
640 if (team != ALLIANCE && team != HORDE)
641 team = AV_NEUTRAL_TEAM;
642 else
644
645 if (m_Mine_Owner[mine] == team && !initial)
646 return;
647 m_Mine_PrevOwner[mine] = m_Mine_Owner[mine];
648 m_Mine_Owner[mine] = team;
649
650 if (!initial)
651 {
652 SF_LOG_DEBUG("bg.battleground", "bg_av depopulating mine %i (0=north, 1=south)", mine);
653 if (mine == AV_SOUTH_MINE)
655 if (BgCreatures[i])
656 DelCreature(i);
658 if (BgCreatures[i])
659 DelCreature(i);
660 }
662
663 SF_LOG_DEBUG("bg.battleground", "bg_av populating mine %i (0=north, 1=south)", mine);
664 uint16 miner;
665 //also neutral team exists.. after a big time, the neutral team tries to conquer the mine
666 if (mine == AV_NORTH_MINE)
667 {
668 if (team == ALLIANCE)
669 miner = AV_NPC_N_MINE_A_1;
670 else if (team == HORDE)
671 miner = AV_NPC_N_MINE_H_1;
672 else
673 miner = AV_NPC_N_MINE_N_1;
674 }
675 else
676 {
677 uint16 cinfo;
678 if (team == ALLIANCE)
679 miner = AV_NPC_S_MINE_A_1;
680 else if (team == HORDE)
681 miner = AV_NPC_S_MINE_H_1;
682 else
683 miner = AV_NPC_S_MINE_N_1;
684 //vermin
685 SF_LOG_DEBUG("bg.battleground", "spawning vermin");
686 if (team == ALLIANCE)
687 cinfo = AV_NPC_S_MINE_A_3;
688 else if (team == HORDE)
689 cinfo = AV_NPC_S_MINE_H_3;
690 else
691 cinfo = AV_NPC_S_MINE_N_S;
693 AddAVCreature(cinfo, i);
694 }
696 AddAVCreature(miner, i);
697 //the next chooses randomly between 2 cretures
699 AddAVCreature(miner + (std::rand() % 2 + 1), i);
701
702 if (team == ALLIANCE || team == HORDE)
703 {
705 char buf[256];
709 if (creature)
710 YellToAll(creature, buf, Language::LANG_UNIVERSAL);
711 }
712 else
713 {
714 if (mine == AV_SOUTH_MINE) //i think this gets called all the time
715 {
718 }
719 }
720 return;
721}
722
724{
725 if (GOId == BG_AV_OBJECTID_MINE_N)
726 return (m_Mine_Owner[AV_NORTH_MINE] == team);
727 if (GOId == BG_AV_OBJECTID_MINE_S)
728 return (m_Mine_Owner[AV_SOUTH_MINE] == team);
729 return true; //cause it's no mine'object it is ok if this is true
730}
731
733{
734 uint32 owner = m_Nodes[node].Owner;
735 ASSERT(owner);
736
737 uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + (4 * node);
738 uint32 creatureid;
739 if (IsTower(node))
740 creatureid = (owner == ALLIANCE) ? AV_NPC_A_TOWERDEFENSE : AV_NPC_H_TOWERDEFENSE;
741 else
742 {
743 uint8 team2 = GetTeamIndexByTeamId(owner);
744 if (m_Team_QuestStatus[team2][0] < 500)
745 creatureid = (owner == ALLIANCE) ? AV_NPC_A_GRAVEDEFENSE0 : AV_NPC_H_GRAVEDEFENSE0;
746 else if (m_Team_QuestStatus[team2][0] < 1000)
747 creatureid = (owner == ALLIANCE) ? AV_NPC_A_GRAVEDEFENSE1 : AV_NPC_H_GRAVEDEFENSE1;
748 else if (m_Team_QuestStatus[team2][0] < 1500)
749 creatureid = (owner == ALLIANCE) ? AV_NPC_A_GRAVEDEFENSE2 : AV_NPC_H_GRAVEDEFENSE2;
750 else
751 creatureid = (owner == ALLIANCE) ? AV_NPC_A_GRAVEDEFENSE3 : AV_NPC_H_GRAVEDEFENSE3;
752 //spiritguide
753 if (BgCreatures[node])
754 DelCreature(node);
755 if (!AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner))
756 SF_LOG_ERROR("bg.battleground", "AV: couldn't spawn spiritguide at node %i", node);
757 }
758 for (uint8 i = 0; i < 4; i++)
759 AddAVCreature(creatureid, c_place + i);
760
761 if (node >= BG_AV_NODES_MAX)//fail safe
762 return;
763 Creature* trigger = GetBGCreature(node + 302);//0-302 other creatures
764 if (!trigger)
765 {
766 trigger = AddCreature(WORLD_TRIGGER,
767 node + 302,
768 owner,
769 BG_AV_CreaturePos[node + 302][0],
770 BG_AV_CreaturePos[node + 302][1],
771 BG_AV_CreaturePos[node + 302][2],
772 BG_AV_CreaturePos[node + 302][3]);
773 }
774
775 //add bonus honor aura trigger creature when node is accupied
776 //cast bonus aura (+50% honor in 25yards)
777 //aura should only apply to players who have accupied the node, set correct faction for trigger
778 if (trigger)
779 {
780 if (owner != ALLIANCE && owner != HORDE)//node can be neutral, remove trigger
781 {
782 DelCreature(node + 302);
783 return;
784 }
785 trigger->setFaction(owner == ALLIANCE ? 84 : 83);
786 trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
787 }
788}
790{
791 uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + (4 * node);
792 for (uint8 i = 0; i < 4; i++)
793 if (BgCreatures[c_place + i])
794 DelCreature(c_place + i);
795 //spiritguide
796 if (!IsTower(node) && BgCreatures[node])
797 DelCreature(node);
798
799 //remove bonus honor aura trigger creature when node is lost
800 if (node < BG_AV_NODES_MAX)//fail safe
801 DelCreature(node + 302);//NULL checks are in DelCreature! 0-302 spirit guides
802}
803
805{
806 SF_LOG_DEBUG("bg.battleground", "bg_AV getnodethroughobject %i", object);
808 return BG_AV_Nodes(object);
810 return BG_AV_Nodes(object - 11);
812 return BG_AV_Nodes(object - 7);
814 return BG_AV_Nodes(object - 22);
816 return BG_AV_Nodes(object - 33);
818 return BG_AV_Nodes(object - 29);
821 SF_LOG_ERROR("bg.battleground", "BattlegroundAV: ERROR! GetPlace got a wrong object :(");
822 ASSERT(false);
823 return BG_AV_Nodes(0);
824}
825
827{ //this function is the counterpart to GetNodeThroughObject()
828 SF_LOG_DEBUG("bg.battleground", "bg_AV GetObjectThroughNode %i", node);
829 if (m_Nodes[node].Owner == ALLIANCE)
830 {
831 if (m_Nodes[node].State == POINT_ASSAULTED)
832 {
833 if (node <= BG_AV_NODES_FROSTWOLF_HUT)
834 return node + 11;
836 return node + 7;
837 }
838 else if (m_Nodes[node].State == POINT_CONTROLED)
840 return node;
841 }
842 else if (m_Nodes[node].Owner == HORDE)
843 {
844 if (m_Nodes[node].State == POINT_ASSAULTED)
845 {
847 return node + 22;
848 }
849 else if (m_Nodes[node].State == POINT_CONTROLED)
850 {
851 if (node <= BG_AV_NODES_FROSTWOLF_HUT)
852 return node + 33;
854 return node + 29;
855 }
856 }
857 else if (m_Nodes[node].Owner == AV_NEUTRAL_TEAM)
859 SF_LOG_ERROR("bg.battleground", "BattlegroundAV: Error! GetPlaceNode couldn't resolve node %i", node);
860 ASSERT(false);
861 return 0;
862}
863
864//called when using banner
865
867{
869 return;
870 int32 object = GetObjectType(target_obj->GetGUID());
871 SF_LOG_DEBUG("bg.battleground", "BG_AV using gameobject %i with type %i", target_obj->GetEntry(), object);
872 if (object < 0)
873 return;
874 switch (target_obj->GetEntry())
875 {
881 EventPlayerAssaultsPoint(source, object);
882 break;
887 EventPlayerDefendsPoint(source, object);
888 break;
889 default:
890 break;
891 }
892}
893
895{
897 BG_AV_Nodes node = GetNodeThroughObject(object);
898
899 uint32 owner = m_Nodes[node].Owner; //maybe should name it prevowner
900 uint32 team = player->GetTeam();
901
902 if (owner == player->GetTeam() || m_Nodes[node].State != POINT_ASSAULTED)
903 return;
904 if (m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM)
905 { //until snowfall doesn't belong to anyone it is better handled in assault-code
906 ASSERT(node == BG_AV_NODES_SNOWFALL_GRAVE); //currently the only neutral grave
907 EventPlayerAssaultsPoint(player, object);
908 return;
909 }
910 SF_LOG_DEBUG("bg.battleground", "player defends point object: %i node: %i", object, node);
911 if (m_Nodes[node].PrevOwner != team)
912 {
913 SF_LOG_ERROR("bg.battleground", "BG_AV: player defends point which doesn't belong to his team %i", node);
914 return;
915 }
916
917 //spawn new go :)
918 if (m_Nodes[node].Owner == ALLIANCE)
919 SpawnBGObject(object + 22, RESPAWN_IMMEDIATELY); //spawn horde banner
920 else
921 SpawnBGObject(object - 22, RESPAWN_IMMEDIATELY); //spawn alliance banner
922
923 if (!IsTower(node))
924 {
927 }
928 // despawn old go
930
931 DefendNode(node, team);
932 PopulateNode(node);
934
935 if (IsTower(node))
936 {
937 //spawn big flag+aura on top of tower
942 }
943 else if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy
944 {
945 for (uint8 i = 0; i < 4; i++)
946 {
949 }
950 }
951 //send a nice message to all :)
952 char buf[256];
953 snprintf(buf, sizeof(buf), GetSkyFireString((IsTower(node)) ? LANG_BG_AV_TOWER_DEFENDED : LANG_BG_AV_GRAVE_DEFENDED), GetNodeName(node),
956 if (creature)
957 YellToAll(creature, buf, Language::LANG_UNIVERSAL);
958 //update the statistic for the defending player
960 if (IsTower(node))
962 else
964}
965
967{
969
970 BG_AV_Nodes node = GetNodeThroughObject(object);
971 uint32 owner = m_Nodes[node].Owner; //maybe name it prevowner
972 uint32 team = player->GetTeam();
973 SF_LOG_DEBUG("bg.battleground", "bg_av: player assaults point object %i node %i", object, node);
974 if (owner == team || team == m_Nodes[node].TotalOwner)
975 return; //surely a gm used this object
976
977 if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall is a bit special in capping + it gets eyecandy stuff
978 {
979 if (object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE) //initial capping
980 {
981 if (!(owner == AV_NEUTRAL_TEAM && m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM))
982 return;
983
984 if (team == ALLIANCE)
986 else
989 }
990 else if (m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM) //recapping, when no team owns this node realy
991 {
992 if (!(m_Nodes[node].State != POINT_CONTROLED))
993 return;
994
995 if (team == ALLIANCE)
997 else
999 }
1000 //eyecandy
1001 uint32 spawn, despawn;
1002 if (team == ALLIANCE)
1003 {
1006 }
1007 else
1008 {
1011 }
1012 for (uint8 i = 0; i < 4; i++)
1013 {
1014 SpawnBGObject(despawn + i, RESPAWN_ONE_DAY);
1016 }
1017 }
1018
1019 //if snowfall gots capped it can be handled like all other graveyards
1020 if (m_Nodes[node].TotalOwner != AV_NEUTRAL_TEAM)
1021 {
1022 ASSERT(m_Nodes[node].Owner != AV_NEUTRAL_TEAM);
1023 if (team == ALLIANCE)
1024 SpawnBGObject(object - 22, RESPAWN_IMMEDIATELY);
1025 else
1026 SpawnBGObject(object + 22, RESPAWN_IMMEDIATELY);
1027 if (IsTower(node))
1028 { //spawning/despawning of bigflag+aura
1033 }
1034 else
1035 {
1036 //spawning/despawning of aura
1039
1041 }
1042 DePopulateNode(node);
1043 }
1044
1045 SpawnBGObject(object, RESPAWN_ONE_DAY); //delete old banner
1046 AssaultNode(node, team);
1048
1049 //send a nice message to all :)
1050 char buf[256];
1054 if (creature)
1055 YellToAll(creature, buf, Language::LANG_UNIVERSAL);
1056 //update the statistic for the assaulting player
1059}
1060
1062{
1063 bool stateok;
1064 //graveyards
1066 {
1067 for (uint8 j = 1; j <= 3; j += 2)
1068 {//j=1=assaulted j=3=controled
1069 stateok = (m_Nodes[i].State == j);
1070 builder.AppendState(BG_AV_NodeWorldStates[i][GetWorldStateType(j, ALLIANCE)], (m_Nodes[i].Owner == ALLIANCE && stateok) ? 1 : 0);
1071 builder.AppendState(BG_AV_NodeWorldStates[i][GetWorldStateType(j, HORDE)], (m_Nodes[i].Owner == HORDE && stateok) ? 1 : 0);
1072 }
1073 }
1074
1075 //towers
1077 {
1078 for (uint8 j = 1; j <= 3; j += 2)
1079 {//j=1=assaulted j=3=controled //i dont have j=2=destroyed cause destroyed is the same like enemy-team controll
1080 stateok = (m_Nodes[i].State == j || (m_Nodes[i].State == POINT_DESTROYED && j == 3));
1081 builder.AppendState(BG_AV_NodeWorldStates[i][GetWorldStateType(j, ALLIANCE)], m_Nodes[i].Owner == ALLIANCE && stateok ? 1 : 0);
1082 builder.AppendState(BG_AV_NodeWorldStates[i][GetWorldStateType(j, HORDE)], m_Nodes[i].Owner == HORDE && stateok ? 1 : 0);
1083 }
1084 }
1085
1086 if (m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].Owner == AV_NEUTRAL_TEAM) //cause neutral teams aren't handled generic
1087 builder.AppendState(AV_SNOWFALL_N, 1);
1088
1091
1093 { //only if game started the teamscores are displayed
1094 builder.AppendState(AV_SHOW_A_SCORE, 1);
1095 builder.AppendState(AV_SHOW_H_SCORE, 1);
1096 }
1097 else
1098 {
1099 builder.AppendState(AV_SHOW_A_SCORE, 0);
1100 builder.AppendState(AV_SHOW_H_SCORE, 0);
1101 }
1102
1105}
1106
1107uint8 BattlegroundAV::GetWorldStateType(uint8 state, uint16 team) //this is used for node worldstates and returns values which fit good into the worldstatesarray
1108{
1109 //neutral stuff cant get handled (currently its only snowfall)
1110 ASSERT(team != AV_NEUTRAL_TEAM);
1111 //a_c a_a h_c h_a the positions in worldstate-array
1112 if (team == ALLIANCE)
1113 {
1114 if (state == POINT_CONTROLED || state == POINT_DESTROYED)
1115 return 0;
1116 if (state == POINT_ASSAULTED)
1117 return 1;
1118 }
1119 if (team == HORDE)
1120 {
1121 if (state == POINT_DESTROYED || state == POINT_CONTROLED)
1122 return 2;
1123 if (state == POINT_ASSAULTED)
1124 return 3;
1125 }
1126 SF_LOG_ERROR("bg.battleground", "BG_AV: should update a strange worldstate state:%i team:%i", state, team);
1127 return 5; //this will crash the game, but i want to know if something is wrong here
1128}
1129
1131{
1132 UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].State, m_Nodes[node].Owner)], 1);
1133 if (m_Nodes[node].PrevOwner == AV_NEUTRAL_TEAM) //currently only snowfall is supported as neutral node (i don't want to make an extra row (neutral states) in worldstatesarray just for one node
1135 else
1136 UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].PrevState, m_Nodes[node].PrevOwner)], 0);
1137}
1138
1140{
1141 ASSERT(mine == AV_NORTH_MINE || mine == AV_SOUTH_MINE);
1142 // currently i'm sure, that this works (:
1143 // ASSERT(m_Mine_PrevOwner[mine] == ALLIANCE || m_Mine_PrevOwner[mine] == HORDE || m_Mine_PrevOwner[mine] == AV_NEUTRAL_TEAM);
1144 // ASSERT(m_Mine_Owner[mine] == ALLIANCE || m_Mine_Owner[mine] == HORDE || m_Mine_Owner[mine] == AV_NEUTRAL_TEAM);
1145
1146 uint8 owner, prevowner, mine2; //those variables are needed to access the right worldstate in the BG_AV_MineWorldStates array
1147 mine2 = (mine == AV_NORTH_MINE) ? 0 : 1;
1148 if (m_Mine_PrevOwner[mine] == ALLIANCE)
1149 prevowner = 0;
1150 else if (m_Mine_PrevOwner[mine] == HORDE)
1151 prevowner = 2;
1152 else
1153 prevowner = 1;
1154 if (m_Mine_Owner[mine] == ALLIANCE)
1155 owner = 0;
1156 else if (m_Mine_Owner[mine] == HORDE)
1157 owner = 2;
1158 else
1159 owner = 1;
1160
1161 UpdateWorldState(BG_AV_MineWorldStates[mine2][owner], 1);
1162 if (prevowner != owner)
1163 UpdateWorldState(BG_AV_MineWorldStates[mine2][prevowner], 0);
1164}
1165
1167{
1168 WorldSafeLocsEntry const* pGraveyard = NULL;
1169 WorldSafeLocsEntry const* entry = NULL;
1170 float minDist = 0;
1171 float x, y;
1172
1173 player->GetPosition(x, y);
1174
1175 pGraveyard = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[GetTeamIndexByTeamId(player->GetTeam()) + 7]);
1176 minDist = (pGraveyard->x - x) * (pGraveyard->x - x) + (pGraveyard->y - y) * (pGraveyard->y - y);
1177
1179 if (m_Nodes[i].Owner == player->GetTeam() && m_Nodes[i].State == POINT_CONTROLED)
1180 {
1181 entry = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[i]);
1182 if (entry)
1183 {
1184 float dist = (entry->x - x) * (entry->x - x) + (entry->y - y) * (entry->y - y);
1185 if (dist < minDist)
1186 {
1187 minDist = dist;
1188 pGraveyard = entry;
1189 }
1190 }
1191 }
1192 return pGraveyard;
1193}
1194
1196{
1197 // Create starting objects
1198 if (
1199 // alliance gates
1202 0, 0, std::sin(BG_AV_DoorPositons[0][3] / 2), std::cos(BG_AV_DoorPositons[0][3] / 2), RESPAWN_IMMEDIATELY)
1203 // horde gates
1206 0, 0, std::sin(BG_AV_DoorPositons[1][3] / 2), std::cos(BG_AV_DoorPositons[1][3] / 2), RESPAWN_IMMEDIATELY))
1207 {
1208 SF_LOG_ERROR("sql.sql", "BatteGroundAV: Failed to spawn some object Battleground not created!1");
1209 return false;
1210 }
1211
1212 //spawn node-objects
1214 {
1216 {
1219 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), std::cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
1222 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), std::cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
1225 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), std::cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
1228 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), std::cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
1229 //aura
1232 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), std::cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
1235 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), std::cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
1238 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), std::cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY))
1239 {
1240 SF_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!2");
1241 return false;
1242 }
1243 }
1244 else //towers
1245 {
1246 if (i <= BG_AV_NODES_STONEHEART_BUNKER) //alliance towers
1247 {
1250 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), std::cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
1253 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), std::cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
1255 BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3],
1256 0, 0, std::sin(BG_AV_ObjectPos[i + 8][3] / 2), std::cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
1258 BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3],
1259 0, 0, std::sin(BG_AV_ObjectPos[i + 8][3] / 2), std::cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
1261 BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3],
1262 0, 0, std::sin(BG_AV_ObjectPos[i + 8][3] / 2), std::cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
1264 BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3],
1265 0, 0, std::sin(BG_AV_ObjectPos[i + 8][3] / 2), std::cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY))
1266 {
1267 SF_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!3");
1268 return false;
1269 }
1270 }
1271 else //horde towers
1272 {
1275 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), std::cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
1278 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), std::cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
1280 BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3],
1281 0, 0, std::sin(BG_AV_ObjectPos[i + 8][3] / 2), std::cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
1283 BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3],
1284 0, 0, std::sin(BG_AV_ObjectPos[i + 8][3] / 2), std::cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
1286 BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3],
1287 0, 0, std::sin(BG_AV_ObjectPos[i + 8][3] / 2), std::cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
1289 BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3],
1290 0, 0, std::sin(BG_AV_ObjectPos[i + 8][3] / 2), std::cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY))
1291 {
1292 SF_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!4");
1293 return false;
1294 }
1295 }
1296 for (uint8 j = 0; j <= 9; j++) //burning aura
1297 {
1304 0,
1305 0,
1309 {
1310 SF_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!5.%i", i);
1311 return false;
1312 }
1313 }
1314 }
1315 }
1316 for (uint8 i = 0; i < 2; i++) //burning aura for buildings
1317 {
1318 for (uint8 j = 0; j <= 9; j++)
1319 {
1320 if (j < 5)
1321 {
1324 BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][0],
1325 BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][1],
1326 BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][2],
1327 BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3],
1328 0,
1329 0,
1330 std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3] / 2),
1331 std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3] / 2),
1333 {
1334 SF_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!6.%i", i);
1335 return false;
1336 }
1337 }
1338 else
1339 {
1342 BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][0],
1343 BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][1],
1344 BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][2],
1345 BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3],
1346 0,
1347 0,
1348 std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3] / 2),
1349 std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3] / 2),
1351 {
1352 SF_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!7.%i", i);
1353 return false;
1354 }
1355 }
1356 }
1357 }
1359 {
1366 0,
1367 0,
1368 std::sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][3] / 2),
1369 std::cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][3] / 2),
1371 {
1372 SF_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.%i", i);
1373 return false;
1374 }
1375 }
1377 {
1384 0,
1385 0,
1386 std::sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][3] / 2),
1387 std::cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][3] / 2),
1389 {
1390 SF_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.%i", i);
1391 return false;
1392 }
1393 }
1394
1401 0,
1402 0,
1406 {
1407 SF_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!8");
1408 return false;
1409 }
1410 for (uint8 i = 0; i < 4; i++)
1411 {
1414 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), RESPAWN_ONE_DAY)
1417 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), RESPAWN_ONE_DAY)
1420 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), RESPAWN_ONE_DAY)
1423 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), RESPAWN_ONE_DAY))
1424 {
1425 SF_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!9.%i", i);
1426 return false;
1427 }
1428 }
1429
1430 uint16 i;
1431 SF_LOG_DEBUG("bg.battleground", "Alterac Valley: entering state STATUS_WAIT_JOIN ...");
1432 // Initial Nodes
1433 for (i = 0; i < BG_AV_OBJECT_MAX; i++)
1435
1437 {
1440 }
1441
1444
1446 {
1450 }
1451
1453 {
1455 SpawnBGObject(i + 16, RESPAWN_IMMEDIATELY); //aura
1456 }
1457
1459 {
1461 SpawnBGObject(i + 16, RESPAWN_IMMEDIATELY); //aura
1462 }
1463
1464 //snowfall and the doors
1467
1469
1470 //creatures
1471 SF_LOG_DEBUG("bg.battleground", "BG_AV start poputlating nodes");
1473 {
1474 if (m_Nodes[i].Owner)
1475 PopulateNode(i);
1476 }
1477 //all creatures which don't get despawned through the script are static
1478 SF_LOG_DEBUG("bg.battleground", "BG_AV: start spawning static creatures");
1479 for (i = 0; i < AV_STATICCPLACE_MAX; i++)
1481 //mainspiritguides:
1482 SF_LOG_DEBUG("bg.battleground", "BG_AV: start spawning spiritguides creatures");
1485 //spawn the marshals (those who get deleted, if a tower gets destroyed)
1486 SF_LOG_DEBUG("bg.battleground", "BG_AV: start spawning marshal creatures");
1490 return true;
1491}
1492
1494{
1495 switch (node)
1496 {
1512 default:
1513 SF_LOG_ERROR("bg.battleground", "tried to get name for node %u", node);
1514 break;
1515 }
1516
1517 return "Unknown";
1518}
1519
1521{
1522 if (m_Nodes[node].TotalOwner == team)
1523 {
1524 SF_LOG_FATAL("bg.battleground", "Assaulting team is TotalOwner of node");
1525 ASSERT(false);
1526 }
1527 if (m_Nodes[node].Owner == team)
1528 {
1529 SF_LOG_FATAL("bg.battleground", "Assaulting team is owner of node");
1530 ASSERT(false);
1531 }
1532 if (m_Nodes[node].State == POINT_DESTROYED)
1533 {
1534 SF_LOG_FATAL("bg.battleground", "Destroyed node is being assaulted");
1535 ASSERT(false);
1536 }
1537 if (m_Nodes[node].State == POINT_ASSAULTED && m_Nodes[node].TotalOwner) //only assault an assaulted node if no totalowner exists
1538 {
1539 SF_LOG_FATAL("bg.battleground", "Assault on an not assaulted node with total owner");
1540 ASSERT(false);
1541 }
1542 //the timer gets another time, if the previous owner was 0 == Neutral
1543 m_Nodes[node].Timer = (m_Nodes[node].PrevOwner) ? BG_AV_CAPTIME : BG_AV_SNOWFALL_FIRSTCAP;
1544 m_Nodes[node].PrevOwner = m_Nodes[node].Owner;
1545 m_Nodes[node].Owner = team;
1546 m_Nodes[node].PrevState = m_Nodes[node].State;
1547 m_Nodes[node].State = POINT_ASSAULTED;
1548}
1549
1551{
1552 ASSERT(m_Nodes[node].State == POINT_ASSAULTED);
1553
1554 m_Nodes[node].TotalOwner = m_Nodes[node].Owner;
1555 m_Nodes[node].PrevOwner = m_Nodes[node].Owner;
1556 m_Nodes[node].PrevState = m_Nodes[node].State;
1557 m_Nodes[node].State = (m_Nodes[node].Tower) ? POINT_DESTROYED : POINT_CONTROLED;
1558 m_Nodes[node].Timer = 0;
1559}
1560
1561void BattlegroundAV::InitNode(BG_AV_Nodes node, uint16 team, bool tower)
1562{
1563 m_Nodes[node].TotalOwner = team;
1564 m_Nodes[node].Owner = team;
1565 m_Nodes[node].PrevOwner = 0;
1566 m_Nodes[node].State = POINT_CONTROLED;
1567 m_Nodes[node].PrevState = m_Nodes[node].State;
1568 m_Nodes[node].State = POINT_CONTROLED;
1569 m_Nodes[node].Timer = 0;
1570 m_Nodes[node].Tower = tower;
1571}
1572
1574{
1575 ASSERT(m_Nodes[node].TotalOwner == team);
1576 ASSERT(m_Nodes[node].Owner != team);
1577 ASSERT(m_Nodes[node].State != POINT_CONTROLED && m_Nodes[node].State != POINT_DESTROYED);
1578 m_Nodes[node].PrevOwner = m_Nodes[node].Owner;
1579 m_Nodes[node].Owner = team;
1580 m_Nodes[node].PrevState = m_Nodes[node].State;
1581 m_Nodes[node].State = POINT_CONTROLED;
1582 m_Nodes[node].Timer = 0;
1583}
1584
1586{
1587 m_MaxLevel = 0;
1588
1589 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
1590 {
1591 for (uint8 j = 0; j < 9; j++)
1592 m_Team_QuestStatus[i][j] = 0;
1594 m_IsInformedNearVictory[i] = false;
1595 m_CaptainAlive[i] = true;
1596 m_CaptainBuffTimer[i] = 120000 + (std::rand() % 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
1599 }
1600
1601 for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_STONEHEART_GRAVE; ++i) //alliance graves
1602 InitNode(i, ALLIANCE, false);
1603 for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) //alliance towers
1604 InitNode(i, ALLIANCE, true);
1605 for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_GRAVE; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i) //horde graves
1606 InitNode(i, HORDE, false);
1607 for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) //horde towers
1608 InitNode(i, HORDE, true);
1609 InitNode(BG_AV_NODES_SNOWFALL_GRAVE, AV_NEUTRAL_TEAM, false); //give snowfall neutral owner
1610
1612 for (uint16 i = 0; i < AV_CPLACE_MAX + AV_STATICCPLACE_MAX; i++)
1613 if (BgCreatures[i])
1614 DelCreature(i);
1615}
1616
1617bool BattlegroundAV::CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target, uint32 miscValue)
1618{
1619 uint32 team = source->GetTeam();
1620 switch (criteriaId)
1621 {
1623 for (uint8 mine = 0; mine < 2; mine++)
1624 if (m_Mine_Owner[mine] != team)
1625 return false;
1626
1627 return true;
1629 {
1630 if (team == ALLIANCE)
1631 {
1632 for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) // alliance towers controlled
1633 {
1634 if (m_Nodes[i].State == POINT_CONTROLED)
1635 {
1636 if (m_Nodes[i].Owner != ALLIANCE)
1637 return false;
1638 }
1639 else
1640 return false;
1641 }
1642
1643 for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // horde towers destroyed
1644 if (m_Nodes[i].State != POINT_DESTROYED)
1645 return false;
1646
1647 if (!m_CaptainAlive[0])
1648 return false;
1649
1650 return true;
1651 }
1652 else if (team == HORDE)
1653 {
1654 for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // horde towers controlled
1655 {
1656 if (m_Nodes[i].State == POINT_CONTROLED)
1657 {
1658 if (m_Nodes[i].Owner != HORDE)
1659 return false;
1660 }
1661 else
1662 return false;
1663 }
1664
1665 for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) // alliance towers destroyed
1666 if (m_Nodes[i].State != POINT_DESTROYED)
1667 return false;
1668
1669 if (!m_CaptainAlive[1])
1670 return false;
1671
1672 return true;
1673 }
1674 }
1675 }
1676
1677 return Battleground::CheckAchievementCriteriaMeet(criteriaId, source, target, miscValue);
1678}
1679
1681{
1684
1685 if (allianceScore > hordeScore)
1686 return ALLIANCE;
1687 else if (hordeScore > allianceScore)
1688 return HORDE;
1689
1691}
@ BG_CRITERIA_CHECK_AV_PERFECTION
@ BG_CRITERIA_CHECK_EVERYTHING_COUNTS
@ RESPAWN_IMMEDIATELY
@ RESPAWN_ONE_DAY
@ SPELL_HONORABLE_DEFENDER_25Y
@ SCORE_GRAVEYARDS_ASSAULTED
@ SCORE_SECONDARY_OBJECTIVES
@ SCORE_TOWERS_DEFENDED
@ SCORE_TOWERS_ASSAULTED
@ SCORE_MINES_CAPTURED
@ SCORE_LEADERS_KILLED
@ SCORE_GRAVEYARDS_DEFENDED
@ STATUS_IN_PROGRESS
@ BG_STARTING_EVENT_THIRD
@ BG_STARTING_EVENT_SECOND
@ BG_STARTING_EVENT_FIRST
@ BG_STARTING_EVENT_FOURTH
const float BG_AV_DoorPositons[2][4]
@ AV_BUFF_H_CAPTAIN
@ AV_BUFF_ARMOR
@ AV_BUFF_A_CAPTAIN
@ AV_SOUND_HORDE_GOOD
@ AV_SOUND_ALLIANCE_ASSAULTS
@ AV_SOUND_ALLIANCE_GOOD
@ AV_SOUND_BOTH_TOWER_DEFEND
@ AV_SOUND_NEAR_VICTORY
@ AV_SOUND_HORDE_ASSAULTS
@ 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
#define LANG_BG_AV_H_CAPTAIN_BUFF
BG_AV_Nodes
@ BG_AV_NODES_ICEWING_BUNKER
@ BG_AV_NODES_TOWER_POINT
@ BG_AV_NODES_SNOWFALL_GRAVE
@ BG_AV_NODES_FIRSTAID_STATION
@ BG_AV_NODES_FROSTWOLF_GRAVE
@ BG_AV_NODES_STORMPIKE_GRAVE
@ BG_AV_NODES_STONEHEART_GRAVE
@ BG_AV_NODES_ICEBLOOD_TOWER
@ BG_AV_NODES_DUNBALDAR_NORTH
@ BG_AV_NODES_STONEHEART_BUNKER
@ BG_AV_NODES_MAX
@ BG_AV_NODES_FROSTWOLF_WTOWER
@ BG_AV_NODES_FROSTWOLF_ETOWER
@ BG_AV_NODES_DUNBALDAR_SOUTH
@ BG_AV_NODES_FROSTWOLF_HUT
@ BG_AV_NODES_ICEBLOOD_GRAVE
#define BG_AV_RES_CAPTAIN
@ POINT_DESTROYED
@ POINT_CONTROLED
@ POINT_ASSAULTED
#define BG_AV_RES_TOWER
const uint32 BG_AV_CreatureInfo[AV_NPC_INFO_MAX][4]
const float BG_AV_ObjectPos[AV_OPLACE_MAX][4]
#define BG_AV_KILL_BOSS
#define BG_AV_KILL_SURVIVING_TOWER
const float BG_AV_CreaturePos[AV_CPLACE_MAX][4]
#define LANG_BG_AV_A_CAPTAIN_BUFF
const uint32 BG_AV_MineWorldStates[2][3]
#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
#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]
#define BG_AV_SNOWFALL_FIRSTCAP
const uint32 BG_AV_NodeWorldStates[16][4]
#define LANG_BG_AV_S_MINE_BOSS_CLAIMS
@ 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_StaticCreatureInfo[51][4]
@ 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
#define SEND_MSG_NEAR_LOSE
#define BG_AV_KILL_SURVIVING_CAPTAIN
#define BG_AV_KILL_TOWER
#define BG_AV_REP_CAPTAIN
@ ACHIEVEMENT_TIMED_TYPE_EVENT
Definition DBCEnums.h:158
@ ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE
Definition DBCEnums.h:195
DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore(WorldSafeLocsEntryfmt)
std::int32_t int32
Definition Define.h:73
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
std::uint64_t uint64
Definition Define.h:76
std::uint16_t uint16
Definition Define.h:78
std::int16_t int16
Definition Define.h:74
#define ASSERT
Definition Errors.h:29
@ LANG_BG_AV_NODE_GRAVE_SNOW
Definition Language.h:1004
@ LANG_BG_AV_HORDE
Definition Language.h:985
@ LANG_BG_AV_A_NEAR_LOSE
Definition Language.h:1016
@ LANG_BG_AV_H_NEAR_LOSE
Definition Language.h:1017
@ LANG_BG_AV_H_CAPTAIN_DEAD
Definition Language.h:1018
@ LANG_BG_AV_GRAVE_TAKEN
Definition Language.h:989
@ LANG_BG_AV_GRAVE_ASSAULTED
Definition Language.h:991
@ LANG_BG_AV_NODE_GRAVE_FROST
Definition Language.h:1008
@ LANG_BG_AV_NODE_TOWER_STONE
Definition Language.h:1003
@ LANG_BG_AV_START_TWO_MINUTES
Definition Language.h:1020
@ LANG_BG_AV_NODE_TOWER_FROST_E
Definition Language.h:1009
@ LANG_BG_AV_START_ONE_MINUTE
Definition Language.h:1013
@ LANG_BG_AV_NODE_GRAVE_STORMPIKE
Definition Language.h:1000
@ LANG_BG_AV_ALLY
Definition Language.h:984
@ LANG_BG_AV_TOWER_TAKEN
Definition Language.h:986
@ LANG_BG_AV_NODE_GRAVE_ICE
Definition Language.h:1006
@ LANG_BG_AV_NODE_TOWER_ICE
Definition Language.h:1005
@ LANG_BG_AV_NODE_TOWER_POINT
Definition Language.h:1007
@ LANG_BG_AV_MINE_SOUTH
Definition Language.h:995
@ LANG_BG_AV_START_HALF_MINUTE
Definition Language.h:1014
@ LANG_BG_AV_TOWER_ASSAULTED
Definition Language.h:987
@ LANG_BG_AV_NODE_TOWER_ICEWING
Definition Language.h:1001
@ LANG_BG_AV_NODE_TOWER_DUN_S
Definition Language.h:998
@ LANG_BG_AV_NODE_GRAVE_STORM_AID
Definition Language.h:997
@ LANG_BG_AV_MINE_NORTH
Definition Language.h:994
@ LANG_BG_AV_HAS_BEGUN
Definition Language.h:1015
@ LANG_BG_AV_MINE_TAKEN
Definition Language.h:993
@ LANG_BG_AV_A_CAPTAIN_DEAD
Definition Language.h:1019
@ LANG_BG_AV_NODE_TOWER_DUN_N
Definition Language.h:999
@ LANG_BG_AV_NODE_GRAVE_FROST_HUT
Definition Language.h:1011
@ LANG_BG_AV_GRAVE_DEFENDED
Definition Language.h:990
@ LANG_BG_AV_TOWER_DEFENDED
Definition Language.h:988
@ LANG_BG_AV_NODE_GRAVE_STONE
Definition Language.h:1002
@ LANG_BG_AV_NODE_TOWER_FROST_W
Definition Language.h:1010
#define SF_LOG_DEBUG(filterType__,...)
Definition Log.h:134
#define SF_LOG_FATAL(filterType__,...)
Definition Log.h:146
#define SF_LOG_ERROR(filterType__,...)
Definition Log.h:143
bool isStatic(MovementGenerator *mv)
#define sObjectMgr
Definition ObjectMgr.h:1617
@ CHAT_MSG_BG_SYSTEM_ALLIANCE
@ CHAT_MSG_BG_SYSTEM_HORDE
@ TEAM_ALLIANCE
@ TEAM_HORDE
@ ALLIANCE
@ HORDE
#define WORLD_TRIGGER
Definition Unit.h:20
@ JUST_DIED
Definition Unit.h:504
void EventPlayerClickedOnFlag(Player *source, GameObject *target_obj) OVERRIDE
void AddPlayer(Player *player) OVERRIDE
void HandleKillUnit(Creature *unit, Player *killer) OVERRIDE
void ResetBGSubclass() OVERRIDE
void PopulateNode(BG_AV_Nodes node)
bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const *source, Unit const *target=NULL, uint32 miscvalue1=0) OVERRIDE
void HandleAreaTrigger(Player *player, uint32 trigger) OVERRIDE
BG_AV_NodeInfo m_Nodes[BG_AV_NODES_MAX]
bool CanActivateGO(int32 GOId, uint32 team) const OVERRIDE
uint32 GetPrematureWinner() OVERRIDE
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)
void FillInitialWorldStates(WorldStateBuilder &builder) OVERRIDE
bool m_IsInformedNearVictory[2]
uint32 GetObjectThroughNode(BG_AV_Nodes node)
void EndBattleground(uint32 winner)
void HandleQuestComplete(uint32 questid, Player *player) OVERRIDE
void DePopulateNode(BG_AV_Nodes node)
void StartingEventCloseDoors() OVERRIDE
BG_AV_Nodes GetNodeThroughObject(uint32 object)
void PostUpdateImpl(uint32 diff) OVERRIDE
Post-update hook.
char const * GetNodeName(BG_AV_Nodes node)
void StartingEventOpenDoors() OVERRIDE
uint32 m_CaptainBuffTimer[2]
void UpdatePlayerScore(Player *player, uint32 type, uint32 value, bool doAddHonor=true) OVERRIDE
void EventPlayerDestroyedPoint(BG_AV_Nodes node)
void RemovePlayer(Player *player, uint64 guid, uint32 team) OVERRIDE
void HandleKillPlayer(Player *player, Player *killer) OVERRIDE
Creature * AddAVCreature(uint16 cinfoid, uint16 type)
uint16 GetBonusHonor(uint8 kills)
uint8 GetWorldStateType(uint8 state, uint16 team)
void SendMineWorldStates(uint32 mine)
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 m_Team_QuestStatus[2][9]
bool SetupBattleground() OVERRIDE
bool IsTower(BG_AV_Nodes node) const
WorldSafeLocsEntry const * GetClosestGraveYard(Player *player) OVERRIDE
void DestroyNode(BG_AV_Nodes node)
uint32 m_Mine_Owner[2]
void EventPlayerDefendsPoint(Player *player, uint32 object)
uint32 m_Mine_PrevOwner[2]
virtual void AddPlayer(Player *player)
void EndBattleground(uint32 winner)
void CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
virtual void HandleKillPlayer(Player *player, Player *killer)
static TeamId GetTeamIndexByTeamId(uint32 Team)
void DoorOpen(uint32 type)
bool DelCreature(uint32 type)
void SpawnBGObject(uint32 type, uint32 respawntime)
void YellToAll(Creature *creature, const char *text, Language language)
void PlaySoundToAll(uint32 SoundID)
void DoorClose(uint32 type)
void RelocateDeadPlayers(uint64 queueIndex)
Relocate all players in ReviveQueue to the closest graveyard.
int32 GetObjectType(uint64 guid)
BGObjects BgObjects
void UpdateWorldState(uint32 Field, uint32 Value)
const char * GetSkyFireString(int32 entry)
BattlegroundScoreMap PlayerScores
void RewardHonorToTeam(uint32 Honor, uint32 TeamID)
bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, uint32 team)
BattlegroundStatus GetStatus() const
virtual bool CheckAchievementCriteriaMeet(uint32, Player const *, Unit const *=NULL, uint32=0)
virtual void HandleAreaTrigger(Player *, uint32)
BGCreatures BgCreatures
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
void RewardReputationToTeam(uint32 faction_id, uint32 Reputation, uint32 TeamID)
virtual void UpdatePlayerScore(Player *player, uint32 type, uint32 value, bool doAddHonor=true)
Creature * AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, uint32 respawntime=0)
void SendMessageToAll(int32 entry, ChatMsg type, Player const *source=NULL)
Creature * GetBGCreature(uint32 type)
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)
virtual uint32 GetPrematureWinner()
uint32 StartMessageIds[BG_STARTING_EVENT_COUNT]
void Respawn(bool force=false)
uint32 GetDBTableGUIDLow() const
Definition Creature.h:445
void SetRespawnDelay(uint32 delay)
Definition Creature.h:603
void setDeathState(DeathState s) OVERRIDE
uint64 GetGUID() const
Definition Object.h:119
uint32 GetEntry() const
Definition Object.h:125
uint32 GetTeam() const
Definition Player.h:2527
void LeaveBattleground(bool teleportToEntryPoint=true)
Definition Player.cpp:17984
WorldSession * GetSession() const
Definition Player.h:2417
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint64 miscValue1=0, uint64 miscValue2=0, uint64 miscValue3=0, Unit *unit=NULL)
Definition Player.cpp:21033
Definition Unit.h:1367
void setFaction(uint32 faction)
Definition Unit.h:1699
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
void RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID=0, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
MotionMaster * GetMotionMaster()
Definition Unit.h:2605
uint8 getLevel() const
Definition Unit.h:1528
void SetLevel(uint8 lvl)
Definition Unit.cpp:5150
void SendNotification(const char *format,...) ATTR_PRINTF(2
void AppendState(uint32 worldstate, uint32 value)
uint32 hk_honor_at_level(uint8 level, float multiplier=1.0f)
Definition Formulas.h:26
float spawndist
Definition Creature.h:271
void GetPosition(float &x, float &y) const
Definition Object.h:333
float x
float y