TrinityCore
Loading...
Searching...
No Matches
BattlefieldTB.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// TO-DO:
19// - Implement proper support for vehicles (Player::VehicleSpellInitialize())
20// - Siege Engine Turret (45564) crashing server (Auras: Unknown Shapeshift Type: 24)
21// - Graveyard spirit phasing, ressurection, Spiritual Immunity aura for players nearby
22// - Warn and teleport players out of the Baradin Hold instance (need sniffs; spell 94964?)
23// - Not sure, but players should probably be able to ressurect from guide spirits when there's no battle
24// - Check and script achievements
25
26#include "BattlefieldTB.h"
27#include "AchievementMgr.h"
28#include "Battleground.h"
29#include "CreatureTextMgr.h"
30#include "GameObject.h"
31#include "GameTime.h"
32#include "ObjectAccessor.h"
33#include "Player.h"
34#include "Random.h"
35#include "ScriptMgr.h"
36#include "TemporarySummon.h"
37#include "World.h"
38#include "WorldStateMgr.h"
39
41
43{
44 m_TypeId = BATTLEFIELD_TB; // See enum BattlefieldTypes
47
49
58
61 m_StartGrouping = false;
62 m_isActive = false;
63
64 KickPosition.Relocate(-605.5f, 1181.31f, 95.96f, 6.177155f);
66
68
70
73
74 // Was there a battle going on or time isn't set yet? Then use m_RestartAfterCrash
76 {
79 }
80
81 // Set timer
83
84 // Defending team isn't set yet? Choose randomly.
87
88 // Set defender team
90
93
99
100 // Create capture points
101 for (uint8 i = 0; i < TB_BASE_COUNT; i++)
102 {
103 //Spawn flag pole
104 if (GameObject* go = SpawnGameObject(TBCapturePoints[i].entryFlagPole[GetDefenderTeam()], TBCapturePoints[i].pos, QuaternionData::fromEulerAnglesZYX(TBCapturePoints[i].pos.GetOrientation(), 0.0f, 0.0f)))
105 {
106 std::unique_ptr<TolBaradCapturePoint> controlZone = std::make_unique<TolBaradCapturePoint>(this, TBCapturePoints[i]);
108 {
109 WorldStateMgr::SetValue(controlZone->GetWorldStateAllianceControlled(), 1, false, GetMap());
110 go->HandleCustomTypeCommand(GameObjectType::SetControlZoneValue(100));
111 go->SetGoArtKit(TB_GO_ARTKIT_FLAG_ALLIANCE);
112 }
113 else if (GetDefenderTeam() == TEAM_HORDE)
114 {
115 WorldStateMgr::SetValue(controlZone->GetWorldStateHordeControlled(), 1, false, GetMap());
116 go->HandleCustomTypeCommand(GameObjectType::SetControlZoneValue(0));
117 go->SetGoArtKit(TB_GO_ARTKIT_FLAG_HORDE);
118 }
119
120 ControlZoneHandlers[go->GetEntry()] = std::move(controlZone);
121 }
122 }
123
124 // Spawn towers
125 for (uint8 i = 0; i < TB_TOWERS_COUNT; i++)
126 if (GameObject* go = SpawnGameObject(TBTowers[i].entry, TBTowers[i].pos, QuaternionData::fromEulerAnglesZYX(TBTowers[i].pos.GetOrientation(), 0.0f, 0.0f)))
127 Towers.insert(go->GetGUID());
128
129 // Init Graveyards
131
132 // Graveyards
133 for (uint8 i = 0; i < BATTLEFIELD_TB_GRAVEYARD_MAX; i++)
134 {
135 BfGraveyard* graveyard = new BfGraveyard(this);
136
137 // When between games, the graveyard is controlled by the defending team
138 graveyard->Initialize(GetDefenderTeam(), TBGraveyards[i].gyid);
139
140 // Spawn spirits
141 for (uint8 team = 0; team < 2; team++)
142 if (Creature* creature = SpawnCreature(TBGraveyards[i].spiritEntry[team], TBGraveyards[i].pos))
143 graveyard->SetSpirit(creature, TeamId(team));
144
145 m_GraveyardList[i] = graveyard;
146 }
147
148 // Time warning vars
149 warnedFiveMinutes = false;
150 warnedTwoMinutes = false;
151 warnedOneMinute = false;
152
154
155 return true;
156}
157
159{
160 bool m_return = Battlefield::Update(diff);
161
162 // Minutes till battle preparation warnings
164 {
166 {
167 warnedFiveMinutes = true;
169 }
170
172 {
173 warnedTwoMinutes = true;
175 }
176
178 {
179 warnedOneMinute = true;
181 }
182 }
183
185 {
186 if (m_updateObjectsTimer <= diff)
187 {
190 }
191 else
192 m_updateObjectsTimer -= diff;
193 }
194
195 return m_return;
196}
197
199{
200 if (!m_isActive)
201 RemoveAurasFromPlayer(player);
202}
203
205{
206 if (!m_isActive)
207 RemoveAurasFromPlayer(player);
208}
209
211{
212 RemoveAurasFromPlayer(player);
213
214 player->SetPvP(true);
215
216 // Bonus damage buff for attackers
217 if (player->GetTeamId() == GetAttackerTeam())
218 {
220 if (towersDestroyed > 0)
222 }
223}
224
229
237
239{
241
243
244 // Teleport players out of questing area
245 for (uint8 team = 0; team < PVP_TEAMS_COUNT; ++team)
246 for (ObjectGuid const& guid : m_players[team])
247 if (Player* player = ObjectAccessor::FindPlayer(guid))
248 if (player->GetAreaId() == TBQuestAreas[m_iCellblockRandom].entry)
249 player->CastSpell(player, TBQuestAreas[m_iCellblockRandom].teleportSpell, true);
250
251 // Should we also teleport players out of Baradin Hold underground area?
252}
253
255{
257
259
262
265
268
271
274
277
280
281 // Towers/spires
282 for (uint8 i = 0; i < TB_TOWERS_COUNT; i++)
283 {
284 WorldStateMgr::SetValue(TBTowers[i].wsIntact[GetDefenderTeam()], 1, false, m_Map);
285 WorldStateMgr::SetValue(TBTowers[i].wsDamaged[GetDefenderTeam()], 0, false, m_Map);
286 WorldStateMgr::SetValue(TBTowers[i].wsDestroyed, 0, false, m_Map);
287 WorldStateMgr::SetValue(TBTowers[i].wsDamaged[GetAttackerTeam()], 0, false, m_Map);
288 WorldStateMgr::SetValue(TBTowers[i].wsIntact[GetAttackerTeam()], 0, false, m_Map);
289 }
290}
291
292void BattlefieldTB::OnBattleEnd(bool endByTimer)
293{
294 if (!endByTimer) // Attackers win (but now they are defenders already)
296 else // Defenders win
298
299 // UpdateNPCsAndGameObjects() must be called 1 minute after battle ends
301 updatedNPCAndObjects = false;
302
303 // Complete quest
305
306 // Rewards
308 for (uint32 i = 0; i < GetData(BATTLEFIELD_TB_DATA_TOWERS_INTACT); i++) // Unsure, for each intact tower or only once for having any tower intact?
311
312 for (uint8 team = 0; team < 2; ++team)
313 {
314 for (ObjectGuid const& guid : m_PlayersInWar[team])
315 if (Player* player = ObjectAccessor::FindPlayer(guid))
316 RemoveAurasFromPlayer(player);
317
318 m_PlayersInWar[team].clear();
319 }
320
321 // Reset time warning vars
322 warnedFiveMinutes = false;
323 warnedTwoMinutes = false;
324 warnedOneMinute = false;
325
328
331
334
340
342
344}
345
347{
348 for (ObjectGuid guid : BattleInactiveNPCs)
349 if (Creature* creature = GetCreature(guid))
350 HideNpc(creature);
351
352 for (ObjectGuid guid : BattleInactiveGOs)
353 if (GameObject* gameobject = GetGameObject(guid))
354 gameobject->SetRespawnTime(RESPAWN_ONE_DAY);
355
356 for (ObjectGuid guid : TemporaryNPCs)
357 if (Creature* creature = GetCreature(guid))
358 creature->RemoveFromWorld();
359 TemporaryNPCs.clear();
360
361 for (ObjectGuid guid : TemporaryGOs)
362 if (GameObject* gameobject = GetGameObject(guid))
363 gameobject->Delete();
364 TemporaryGOs.clear();
365
366 // Tol Barad gates - closed during warmup
368 gates->SetGoState(GetState() == BATTLEFIELD_WARMUP ? GO_STATE_READY : GO_STATE_ACTIVE);
369
370 // Baradin Hold door - open when inactive
373
374 // Decide which cellblock and questgiver will be active.
376
377 // To The Hole gate
380
381 // D-Block gate
384
385 // Cursed Depths gate
388
390 {
391 // Delete capture points
392 ControlZoneHandlers.clear();
393
394 // Create capture points
395 for (uint8 i = 0; i < TB_BASE_COUNT; i++)
396 {
397 if (GameObject* go = SpawnGameObject(TBCapturePoints[i].entryFlagPole[GetDefenderTeam()], TBCapturePoints[i].pos, QuaternionData::fromEulerAnglesZYX(TBCapturePoints[i].pos.GetOrientation(), 0.0f, 0.0f)))
398 {
399 std::unique_ptr<TolBaradCapturePoint> controlZone = std::make_unique<TolBaradCapturePoint>(this, TBCapturePoints[i]);
401 {
402 WorldStateMgr::SetValue(controlZone->GetWorldStateAllianceControlled(), 1, false, GetMap());
403 go->HandleCustomTypeCommand(GameObjectType::SetControlZoneValue(100));
404 go->SetGoArtKit(TB_GO_ARTKIT_FLAG_ALLIANCE);
405 }
406 else if (GetDefenderTeam() == TEAM_HORDE)
407 {
408 WorldStateMgr::SetValue(controlZone->GetWorldStateHordeControlled(), 1, false, GetMap());
409 go->HandleCustomTypeCommand(GameObjectType::SetControlZoneValue(0));
410 go->SetGoArtKit(TB_GO_ARTKIT_FLAG_HORDE);
411 }
412
413 ControlZoneHandlers[go->GetEntry()] = std::move(controlZone);
414 }
415 }
416
417 for (ObjectGuid guid : BattleInactiveNPCs)
418 if (Creature* creature = GetCreature(guid))
419 ShowNpc(creature, true);
420
421 for (ObjectGuid guid : BattleInactiveGOs)
422 if (GameObject* gameobject = GetGameObject(guid))
423 gameobject->SetRespawnTime(RESPAWN_IMMEDIATELY);
424
425 for (uint8 i = 0; i < TB_QUEST_INFANTRY_MAX; i++)
426 {
428 if (Creature* creature = SpawnCreature(entry, TBQuestInfantrySpawnData[i]))
429 TemporaryNPCs.insert(creature->GetGUID());
430 }
431
432 for (uint8 i = 0; i < TB_GUARDS_MAX; i++)
434 TemporaryNPCs.insert(creature->GetGUID());
435
436 for (uint8 i = 0; i < TB_FACTION_NPC_MAX; i++)
438 TemporaryNPCs.insert(creature->GetGUID());
439
441 TemporaryNPCs.insert(creature->GetGUID());
442
443 // Spawn portals
444 for (uint8 i = 0; i < TB_PORTAL_MAX; i++)
446 TemporaryGOs.insert(go->GetGUID());
447
448 // Update towers
449 for (ObjectGuid guid : Towers)
450 if (GameObject* go = GetGameObject(guid))
451 go->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING);
452 }
453 else if (GetState() == BATTLEFIELD_IN_PROGRESS)
454 {
455 for (uint8 i = 0; i < TB_ABANDONED_SIEGE_ENGINE_COUNT; i++)
457 TemporaryNPCs.insert(creature->GetGUID());
458
459 for (ObjectGuid guid : Towers)
460 {
461 if (GameObject* go = GetGameObject(guid))
462 {
463 go->SetDestructibleState(GO_DESTRUCTIBLE_INTACT);
464 if (go->GetGOValue()->Building.DestructibleHitpoint)
465 go->ModifyHealth(go->GetGOValue()->Building.DestructibleHitpoint->GetMaxHealth());
466 }
467 }
468 }
469
470 // Spawn banners
471 for (uint8 i = 0; i < TB_BANNER_MAX; i++)
473 TemporaryGOs.insert(go->GetGUID());
474
475 // Set graveyard controls
476 for (uint8 i = 0; i < BATTLEFIELD_TB_GRAVEYARD_MAX; i++)
477 if (BfGraveyard* graveyard = GetGraveyardById(i))
478 graveyard->GiveControlTo(!IsWarTime() || TBGraveyards[i].defenderControls ? GetDefenderTeam() : GetAttackerTeam());
479}
480
482{
483 switch (creature->GetEntry())
484 {
485 // Store NPCs that need visibility toggling
499 case NPC_CROCOLISK:
500 case NPC_PROBLIM:
501 BattleInactiveNPCs.insert(creature->GetGUID());
502 if (GetState() == BATTLEFIELD_WARMUP) // If battle is about to start, we must hide these.
503 HideNpc(creature);
504 break;
507 creature->CastSpell(creature, SPELL_THICK_LAYER_OF_RUST, true);
508 break;
510 if (Unit* vehiclebase = creature->GetCharmerOrOwner()->GetVehicleBase())
511 creature->EnterVehicle(vehiclebase);
512 break;
514 creature->CastSpell(creature, SPELL_TOWER_RANGE_FINDER_PERIODIC, true);
515 break;
530 creature->CastSpell(creature, SPELL_TB_SPIRITUAL_IMMUNITY, true);
531 break;
532 default:
533 break;
534 }
535}
536
577
579{
580 Battlefield::ProcessEvent(obj, eventId, invoker);
581 if (!IsWarTime())
582 return;
583
584 if (eventId == EVENT_COUNT_CAPTURED_BASE)
585 {
587 return;
588 }
589
590 if (!obj)
591 return;
592
593 GameObject* go = obj->ToGameObject();
594 if (!go)
595 return;
596
597 TBTowerId towerId;
598 switch (go->GetEntry())
599 {
600 case GO_WEST_SPIRE:
601 towerId = TB_TOWER_WEST_SPIRE;
602 break;
603 case GO_EAST_SPIRE:
604 towerId = TB_TOWER_EAST_SPIRE;
605 break;
606 case GO_SOUTH_SPIRE:
607 towerId = TB_TOWER_SOUTH_SPIRE;
608 break;
609 default:
610 return;
611 }
612
614 TowerDamaged(towerId);
616 TowerDestroyed(towerId);
617}
618
620{
621 if (!IsWarTime())
622 return;
623
624 SendWarning(TBTowers[tbTowerId].textDamaged);
625
627
628 WorldStateMgr::SetValue(TBTowers[tbTowerId].wsIntact[GetDefenderTeam()], 0, false, m_Map);
629 WorldStateMgr::SetValue(TBTowers[tbTowerId].wsDamaged[GetDefenderTeam()], 1, false, m_Map);
630
632}
633
635{
636 if (!IsWarTime())
637 return;
638
639 // Add 5 minute bonus time
642
643 SendWarning(TBTowers[tbTowerId].textDestroyed);
644
648
649 WorldStateMgr::SetValue(TBTowers[tbTowerId].wsDamaged[GetDefenderTeam()], 0, false, m_Map);
650 WorldStateMgr::SetValue(TBTowers[tbTowerId].wsDestroyed, 1, false, m_Map);
651
652 // Attack bonus buff
653 for (ObjectGuid const& guid : m_PlayersInWar[GetAttackerTeam()])
654 if (Player* player = ObjectAccessor::FindPlayer(guid))
656
657 // Honor reward
659}
660
662{
663 uint32 numCapturedBases = 0; // How many bases attacker has captured
664
665 // these world states are either 0 or 1
667 {
671 }
672 else if (GetAttackerTeam() == TEAM_HORDE)
673 {
677 }
678
680
681 // Check if attackers won
682 if (numCapturedBases == TB_BASE_COUNT)
683 EndBattle(false);
684}
685
686// Called when player kill a unit in wg zone
688{
689 if (killer == victim || victim->GetTypeId() != TYPEID_PLAYER)
690 return;
691
692 TeamId killerTeam = killer->GetTeamId();
693 for (ObjectGuid const& guid : m_PlayersInWar[killerTeam])
694 if (Player* player = ObjectAccessor::FindPlayer(guid))
695 if (player->GetDistance2d(killer) < 40.0f)
696 PromotePlayer(player);
697}
698
700{
701 if (!m_isActive || killer->HasAura(SPELL_TB_VETERAN))
702 return;
703
704 killer->CastSpell(killer, SPELL_TB_VETERAN, true);
705}
706
708 _textIdHordeCaptured(data.textGained[TEAM_HORDE]), _textIdAllianceCaptured(data.textGained[TEAM_ALLIANCE]),
709 _textIdHordeLost(data.textLost[TEAM_HORDE]), _textIdAllianceLost(data.textLost[TEAM_ALLIANCE]),
710 _worldstateHordeControlled(data.wsControlled[TEAM_HORDE]), _worldstateAllianceControlled(data.wsControlled[TEAM_ALLIANCE]),
711 _worldstateHordeCapturing(data.wsCapturing[TEAM_HORDE]), _worldstateAllianceCapturing(data.wsCapturing[TEAM_ALLIANCE]),
712 _worldstateNeutral(data.wsNeutral)
713{
714}
715
720
725
735
745
753
761
767
769{
770public:
771 Battlefield_tol_barad() : BattlefieldScript("battlefield_tb") { }
772
773 Battlefield* GetBattlefield(Map* map) const override
774 {
775 return new BattlefieldTB(map);
776 }
777};
778
780{
782}
void AddSC_BF_tol_barad()
TBPortalEntry
uint8 const TB_BANNER_MAX
TBCapturePointSpawnData const TBCapturePoints[TB_BASE_COUNT]
TBTowerId
@ TB_TOWERS_COUNT
@ TB_TOWER_EAST_SPIRE
@ TB_TOWER_SOUTH_SPIRE
@ TB_TOWER_WEST_SPIRE
int8 const TB_ABANDONED_SIEGE_ENGINE_COUNT
@ NPC_BARADIN_GUARD
@ NPC_HELLSCREAMS_SENTRY
TBQuestAreaInfo const TBQuestAreas[CELLBLOCK_MAX]
Position const GuardNPCSpawns[TB_GUARDS_MAX]
TBGraveyardInfo const TBGraveyards[BATTLEFIELD_TB_GRAVEYARD_MAX]
@ NPC_ABANDONED_SIEGE_ENGINE
uint8 const TB_GUARDS_MAX
Position const TBAbandonedSiegeEngineSpawnData[TB_ABANDONED_SIEGE_ENGINE_COUNT]
@ TB_TEXT_PREPARATIONS_IN_1_MIN
@ TB_TEXT_FORTRESS_DEFEND_ALLIANCE
@ TB_TEXT_PREPARATIONS_IN_2_MIN
@ TB_TEXT_PREPARATIONS_IN_5_MIN
@ TB_TEXT_FORTRESS_CAPTURE_ALLIANCE
@ TB_TEXT_FORTRESS_CAPTURE_HORDE
@ TB_TEXT_FORTRESS_DEFEND_HORDE
Position const RandomQuestgiverPos
TBFactionNPCInfo const FactionNPCSpawns[TB_FACTION_NPC_MAX]
uint32 const RandomQuestgivers[PVP_TEAMS_COUNT][CELLBLOCK_MAX]
TBTowerInfo const TBTowers[TB_TOWERS_COUNT]
uint8 const TB_PORTAL_MAX
@ TB_GO_ARTKIT_FLAG_NONE
@ TB_GO_ARTKIT_FLAG_HORDE
@ TB_GO_ARTKIT_FLAG_ALLIANCE
@ EVENT_COUNT_CAPTURED_BASE
uint32 const TBBannerEntry[PVP_TEAMS_COUNT]
Position const TBBanners[TB_BANNER_MAX]
@ SPELL_REWARD_TOWER_DESTROYED
@ SPELL_TOWER_RANGE_FINDER_PERIODIC
@ SPELL_VICTORY_HORDE
@ SPELL_REWARD_TOWER_INTACT
@ SPELL_TB_SLOW_FALL
@ SPELL_REWARD_TOWER_DAMAGED
@ SPELL_TOWER_ATTACK_BONUS
@ SPELL_TB_SPIRITUAL_IMMUNITY
@ SPELL_REWARD_VICTORY_ALLIANCE
@ SPELL_REWARD_DEFEAT
@ SPELL_THICK_LAYER_OF_RUST
@ SPELL_TB_VETERAN
@ SPELL_REWARD_VICTORY_HORDE
@ SPELL_VICTORY_ALLIANCE
Position const TolBaradDebugAnnouncerPos
@ GO_GATE_D_BLOCK
@ CELLBLOCK_THE_HOLE
@ CELLBLOCK_D_BLOCK
@ GO_GATE_TO_THE_HOLE
@ GO_CURSED_DEPTHS_GATE
@ CELLBLOCK_CURSED_DEPTHS
@ GO_DUSTY_PRISON_JOURNAL
@ GO_CRATE_OF_CELLBLOCK_RATIONS
@ GO_CURSED_SHACKLES
@ CELLBLOCK_NONE
Position const TBQuestInfantrySpawnData[TB_QUEST_INFANTRY_MAX]
Position const TBPortals[TB_PORTAL_MAX]
@ BATTLEFIELD_TB_DATA_TOWERS_INTACT
@ BATTLEFIELD_TB_DATA_MAX
@ BATTLEFIELD_TB_ZONEID
const uint32 TBFactions[PVP_TEAMS_COUNT]
uint8 const TB_QUEST_INFANTRY_MAX
@ BATTLEFIELD_TB_GRAVEYARD_MAX
uint8 const TB_FACTION_NPC_MAX
uint32 const TB_QUEST_INFANTRY[PVP_TEAMS_COUNT][4]
@ TB_BASE_COUNT
@ GO_TOLBARAD_DOOR
@ GO_TB_INSTANCE_VISUAL_3
@ GO_TB_INSTANCE_VISUAL_4
@ GO_TB_INSTANCE_VISUAL_2
@ GO_WEST_SPIRE
@ GO_TB_INSTANCE_VISUAL_1
@ GO_EAST_SPIRE
@ GO_TB_MEETING_STONE
@ GO_TOLBARAD_GATES
@ GO_SOUTH_SPIRE
@ NPC_TOLBARAD_JAILED_WRATHGUARD
@ NPC_TB_GY_SPIRIT_EAST_SPIRE_H
@ NPC_TB_GY_SPIRIT_IRONCLAD_GARRISON_H
@ NPC_TOLBARAD_EXILED_MAGE
@ NPC_TB_GY_SPIRIT_SOUTH_SPIRE_H
@ NPC_TB_GY_SPIRIT_WARDENS_VIGIL_H
@ NPC_TB_GY_SPIRIT_WEST_SPIRE_H
@ NPC_TOLBARAD_ARCHMAGE_GALUS
@ NPC_TOLBARAD_IMPRISONED_IMP
@ NPC_TOLBARAD_CELL_WATCHER
@ NPC_TB_GY_SPIRIT_BARADIN_HOLD_H
@ NPC_DEBUG_ANNOUNCER
@ NPC_TB_GY_SPIRIT_EAST_SPIRE_A
@ NPC_TOLBARAD_WARDEN_SILVA
@ NPC_TOLBARAD_IMPRISONED_WORKER
@ NPC_TOLBARAD_GHASTLY_CONVICT
@ NPC_TOLBARAD_WARDEN_GUARD
@ NPC_TOLBARAD_CELLBLOCK_OOZE
@ NPC_TOLBARAD_SVARNOS
@ NPC_TB_GY_SPIRIT_SLAGWORKS_H
@ NPC_TB_GY_SPIRIT_SOUTH_SPIRE_A
@ NPC_TB_GY_SPIRIT_SLAGWORKS_A
@ NPC_TOLBARAD_SHIVARRA_DESTROYER
@ NPC_CROCOLISK
@ NPC_TB_GY_SPIRIT_WARDENS_VIGIL_A
@ NPC_TB_GY_SPIRIT_IRONCLAD_GARRISON_A
@ NPC_TOLBARAD_CAPTIVE_SPIRIT
@ NPC_TB_GY_SPIRIT_BARADIN_HOLD_A
@ NPC_SIEGE_ENGINE_TURRET
@ NPC_TB_GY_SPIRIT_WEST_SPIRE_A
@ NPC_TOWER_RANGE_FINDER
@ NPC_PROBLIM
@ BATTLEFIELD_TB
Definition Battlefield.h:30
@ BATTLEFIELD_WARMUP
Definition Battlefield.h:44
@ BATTLEFIELD_IN_PROGRESS
Definition Battlefield.h:45
@ BATTLEFIELD_INACTIVE
Definition Battlefield.h:43
@ BATTLEFIELD_BATTLEID_TB
Definition Battlefield.h:37
@ RESPAWN_IMMEDIATELY
@ RESPAWN_ONE_DAY
@ IN_MILLISECONDS
Definition Common.h:38
@ MINUTE
Definition Common.h:32
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
@ TEAM_ALLIANCE
@ TEAM_HORDE
@ GO_DESTRUCTIBLE_DESTROYED
@ GO_DESTRUCTIBLE_REBUILDING
@ GO_DESTRUCTIBLE_INTACT
@ GO_DESTRUCTIBLE_DAMAGED
uint8 constexpr PVP_TEAMS_COUNT
@ WS_BATTLEFIELD_TB_ALLIANCE_ATTACKING_SHOW
@ WS_BATTLEFIELD_TB_VIGIL_HORDE_CONTROLLED
@ WS_BATTLEFIELD_TB_KEEP_ALLIANCE
@ WS_BATTLEFIELD_TB_SLAGWORKS_ALLIANCE_CONTROLLED
@ WS_BATTLEFIELD_TB_ALLIANCE_CONTROLS_SHOW
@ WS_BATTLEFIELD_TB_KEEP_HORDE
@ WS_BATTLEFIELD_TB_BUILDINGS_CAPTURED_SHOW
@ WS_BATTLEFIELD_TB_BUILDINGS_CAPTURED
@ WS_BATTLEFIELD_TB_TIME_NEXT_BATTLE_SHOW
@ WS_BATTLEFIELD_TB_STATE_PREPARATIONS
@ WS_BATTLEFIELD_TB_TIME_BATTLE_END_SHOW
@ WS_BATTLEFIELD_TB_VIGIL_ALLIANCE_CONTROLLED
@ WS_BATTLEFIELD_TB_GARRISON_ALLIANCE_CONTROLLED
@ WS_BATTLEFIELD_TB_FACTION_CONTROLLING
@ WS_BATTLEFIELD_TB_TOWERS_DESTROYED
@ WS_BATTLEFIELD_TB_HORDE_ATTACKING_SHOW
@ WS_BATTLEFIELD_TB_TOWERS_DESTROYED_SHOW
@ WS_BATTLEFIELD_TB_SLAGWORKS_HORDE_CONTROLLED
@ WS_BATTLEFIELD_TB_STATE_BATTLE
@ WS_BATTLEFIELD_TB_GARRISON_HORDE_CONTROLLED
@ WS_BATTLEFIELD_TB_HORDE_CONTROLS_SHOW
@ WS_BATTLEFIELD_TB_TIME_NEXT_BATTLE
@ WS_BATTLEFIELD_TB_TIME_BATTLE_END
@ GO_STATE_READY
@ GO_STATE_ACTIVE
@ SPELLVALUE_AURA_STACK
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
TypeID GetTypeId() const
Definition BaseEntity.h:166
void OnPlayerLeaveWar(Player *player) override
Called when a player leave the battle.
void RemoveAurasFromPlayer(Player *player)
void OnBattleEnd(bool endByTimer) override
Called at the end of battle.
bool Update(uint32 diff) override
Called every time for update bf data and time.
GuidSet TemporaryNPCs
void ProcessEvent(WorldObject *obj, uint32 eventId, WorldObject *invoker) override
void OnBattleStart() override
Called on start.
void TowerDestroyed(TBTowerId tbTowerId)
void OnPlayerJoinWar(Player *player) override
Called when a player accept to join the battle.
ObjectGuid m_gateCursedDepthsGUID
bool SetupBattlefield() override
Call this to init the Battlefield.
void HandleKill(Player *killer, Unit *victim) override
Called when a Unit is kill in battlefield zone.
void OnStartGrouping() override
Called x minutes before battle start when player in zone are invite to join queue.
GuidSet BattleInactiveNPCs
void OnPlayerEnterZone(Player *player) override
Called when a player enter in battlefield zone.
ObjectGuid TBGatesGUID
void OnGameObjectCreate(GameObject *go) override
void OnCreatureCreate(Creature *creature) override
uint32 m_updateObjectsTimer
void UpdateCapturedBaseCount()
ObjectGuid m_gateDBlockGUID
GuidSet TemporaryGOs
void TowerDamaged(TBTowerId tbTowerId)
bool updatedNPCAndObjects
void OnPlayerLeaveZone(Player *player) override
Called when a player leave battlefield zone.
GuidSet BattleInactiveGOs
uint8 m_iCellblockRandom
void PromotePlayer(Player *killer)
ObjectGuid m_gateToTheHoleGUID
void UpdateNPCsAndGameObjects()
ObjectGuid TBDoorGUID
Battlefield * GetBattlefield(Map *map) const override
uint32 m_Timer
Map * GetMap() const
uint32 m_MapId
GameObject * SpawnGameObject(uint32 entry, Position const &pos, QuaternionData const &rot)
void ProcessEvent(WorldObject *target, uint32 eventId, WorldObject *invoker) override
GraveyardVect m_GraveyardList
GameObject * GetGameObject(ObjectGuid guid)
void ShowNpc(Creature *creature, bool aggressive)
Creature * GetCreature(ObjectGuid guid)
uint32 m_MaxPlayer
std::vector< uint32 > m_Data32
Creature * SpawnCreature(uint32 entry, Position const &pos)
uint32 m_NoWarBattleTime
void EndBattle(bool endByTimer)
uint32 m_BattleTime
bool IsWarTime() const
Return true if battle is start, false if battle is not started.
uint32 m_ZoneId
void InitStalker(uint32 entry, Position const &pos)
uint32 m_TypeId
uint32 m_BattleId
int8 GetState() const
uint32 m_StartGroupingTimer
virtual bool Update(uint32 diff)
Called every time for update bf data and time.
void RegisterZone(uint32 zoneid)
void SetDefenderTeam(TeamId team)
void SendWarning(uint8 id, WorldObject const *target=nullptr)
uint32 m_TimeForAcceptInvite
BfGraveyard * GetGraveyardById(uint32 id) const
GuidUnorderedSet m_PlayersInWar[PVP_TEAMS_COUNT]
void HideNpc(Creature *creature)
uint32 m_RestartAfterCrash
TeamId GetAttackerTeam() const
uint32 m_MinLevel
TeamId GetDefenderTeam() const
void TeamCastSpell(TeamId team, int32 spellId)
uint32 m_MinPlayer
virtual uint32 GetData(uint32 dataId) const override
ControlZoneHandlerMap ControlZoneHandlers
bool m_StartGrouping
WorldLocation KickPosition
void SetGraveyardNumber(uint32 number)
GuidUnorderedSet m_players[PVP_TEAMS_COUNT]
void SetSpirit(Creature *spirit, TeamId team)
void Initialize(TeamId startcontrol, uint32 gy)
virtual void HandleNeutralEventHorde(GameObject *controlZone)
Definition ZoneScript.h:58
virtual void HandleProgressEventAlliance(GameObject *controlZone)
Definition ZoneScript.h:57
virtual void HandleContestedEventAlliance(GameObject *controlZone)
Definition ZoneScript.h:55
virtual void HandleNeutralEventAlliance(GameObject *controlZone)
Definition ZoneScript.h:59
virtual void HandleProgressEventHorde(GameObject *controlZone)
Definition ZoneScript.h:56
virtual void HandleNeutralEvent(GameObject *controlZone)
Definition ZoneScript.h:60
virtual void HandleContestedEventHorde(GameObject *controlZone)
Definition ZoneScript.h:54
void SetGoState(GOState state)
void SetRespawnTime(int32 respawn)
void SetGoArtKit(uint32 artkit)
GameObjectDestructibleState GetDestructibleState() const
Definition GameObject.h:369
Definition Map.h:225
GameObject * ToGameObject()
Definition Object.h:131
uint32 GetEntry() const
Definition Object.h:89
TeamId GetTeamId() const
Definition Player.h:2424
void SetPvP(bool state) override
Definition Player.cpp:24102
void HandleContestedEventAlliance(GameObject *controlZone) override
void HandleNeutralEventHorde(GameObject *controlZone) override
void HandleContestedEventHorde(GameObject *controlZone) override
void HandleNeutralEvent(GameObject *controlZone) override
void HandleNeutralEventAlliance(GameObject *controlZone) override
void HandleProgressEventAlliance(GameObject *controlZone) override
uint32 _worldstateAllianceCapturing
uint32 _worldstateAllianceControlled
TolBaradCapturePoint(BattlefieldTB *battlefield, TBCapturePointSpawnData const &data)
void HandleProgressEventHorde(GameObject *controlZone) override
Definition Unit.h:635
void EnterVehicle(Unit *base, int8 seatId=-1)
Definition Unit.cpp:12749
void SetFaction(uint32 faction) override
Definition Unit.h:872
Unit * GetVehicleBase() const
Definition Unit.cpp:12111
Unit * GetCharmerOrOwner() const
Definition Unit.h:1221
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4804
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
uint32 m_mapId
Definition Position.h:218
Map * GetMap() const
Definition Object.h:411
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
#define sWorld
Definition World.h:916
@ CONFIG_TOLBARAD_BATTLETIME
Definition World.h:389
@ CONFIG_TOLBARAD_PLR_MIN_LVL
Definition World.h:388
@ CONFIG_TOLBARAD_RESTART_AFTER_CRASH
Definition World.h:392
@ CONFIG_TOLBARAD_BONUSTIME
Definition World.h:390
@ CONFIG_TOLBARAD_PLR_MAX
Definition World.h:386
@ CONFIG_TOLBARAD_PLR_MIN
Definition World.h:387
@ CONFIG_TOLBARAD_NOBATTLETIME
Definition World.h:391
@ CONFIG_TOLBARAD_ENABLE
Definition World.h:170
time_t GetGameTime()
Definition GameTime.cpp:52
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
TC_GAME_API void SetValue(int32 worldStateId, int32 value, bool hidden, Map *map)
TC_GAME_API void SetValueAndSaveInDb(int32 worldStateId, int32 value, bool hidden, Map *map)
TC_GAME_API int32 GetValue(int32 worldStateId, Map const *map)
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
constexpr void Relocate(float x, float y)
Definition Position.h:74
static QuaternionData fromEulerAnglesZYX(float Z, float Y, float X)