TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
BattlegroundSA Class Reference

Class for manage Strand of Ancient battleground. More...

#include <BattlegroundSA.h>

Public Member Functions

 BattlegroundSA ()
 
 ~BattlegroundSA ()
 
void PostUpdateImpl (uint32 diff) override
 Called every time for update battle data -Update timer -Round switch. More...
 
void AddPlayer (Player *player) override
 Called when a player join battle. More...
 
void StartingEventCloseDoors () override
 Called when battle start. More...
 
void StartingEventOpenDoors () override
 
bool SetupBattleground () override
 Called for ini battleground, after that the first player be entered. More...
 
void Reset () override
 
void FillInitialWorldStates (WorldPackets::WorldState::InitWorldStates &packet) override
 Called for generate packet contain worldstate data. More...
 
void HandleKillUnit (Creature *creature, Player *killer) override
 Called when a player kill a unit in bg. More...
 
WorldSafeLocsEntry constGetClosestGraveYard (Player *player) override
 Return the nearest graveyard where player can respawn. More...
 
void ProcessEvent (WorldObject *, uint32, WorldObject *=NULL) override
 Called when someone activates an event. More...
 
void EventPlayerClickedOnFlag (Player *source, GameObject *go) override
 Called when a player click on flag (graveyard flag) More...
 
void TitanRelicActivated (Player *clicker)
 Called when a player clicked on relic. More...
 
GateInfo constGetGate (uint32 entry)
 Return GateInfo, relative to bg data, according to gameobject entry. More...
 
void EndBattleground (uint32 winner) override
 Called on battleground ending. More...
 
void RemovePlayer (Player *player, ObjectGuid guid, uint32 team) override
 Called when a player leave battleground. More...
 
void HandleAreaTrigger (Player *source, uint32 trigger, bool entered) override
 
bool CheckAchievementCriteriaMeet (uint32 criteriaId, Player const *source, Unit const *target=NULL, uint32 miscValue=0) override
 
bool IsSpellAllowed (uint32 spellId, Player const *player) const override
 
- Public Member Functions inherited from Battleground
 Battleground ()
 
virtual ~Battleground ()
 
void Update (uint32 diff)
 
virtual void ResetBGSubclass ()
 
virtual bool IsAllNodesControlledByTeam (uint32) const
 
void StartTimedAchievement (AchievementCriteriaTimedTypes type, uint32 entry)
 
std::string constGetName () const
 
uint64 GetQueueId () const
 
BattlegroundTypeId GetTypeID (bool GetRandom=false) const
 
BattlegroundBracketId GetBracketId () const
 
uint32 GetInstanceID () const
 
BattlegroundStatus GetStatus () const
 
uint32 GetClientInstanceID () const
 
uint32 GetElapsedTime () const
 
uint32 GetRemainingTime () const
 
uint32 GetLastResurrectTime () const
 
uint32 GetMaxPlayers () const
 
uint32 GetMinPlayers () const
 
uint32 GetMinLevel () const
 
uint32 GetMaxLevel () const
 
uint32 GetMaxPlayersPerTeam () const
 
uint32 GetMinPlayersPerTeam () const
 
int32 GetStartDelayTime () const
 
uint8 GetArenaType () const
 
BattlegroundTeamId GetWinner () const
 
uint32 GetScriptId () const
 
uint32 GetBonusHonorFromKill (uint32 kills) const
 
bool IsRandom () const
 
void SetQueueId (uint64 queueId)
 
void SetName (std::string const &name)
 
void SetTypeID (BattlegroundTypeId TypeID)
 
void SetRandomTypeID (BattlegroundTypeId TypeID)
 
void SetBracket (PvPDifficultyEntry const *bracketEntry)
 
void SetInstanceID (uint32 InstanceID)
 
void SetStatus (BattlegroundStatus Status)
 
void SetClientInstanceID (uint32 InstanceID)
 
void SetElapsedTime (uint32 Time)
 
void SetRemainingTime (uint32 Time)
 
void SetLastResurrectTime (uint32 Time)
 
void SetMaxPlayers (uint32 MaxPlayers)
 
void SetMinPlayers (uint32 MinPlayers)
 
void SetLevelRange (uint32 min, uint32 max)
 
void SetRated (bool state)
 
void SetArenaType (uint8 type)
 
void SetArenaorBGType (bool _isArena)
 
void SetWinner (BattlegroundTeamId winnerTeamId)
 
void SetScriptId (uint32 scriptId)
 
void ModifyStartDelayTime (int diff)
 
void SetStartDelayTime (int Time)
 
void SetMaxPlayersPerTeam (uint32 MaxPlayers)
 
void SetMinPlayersPerTeam (uint32 MinPlayers)
 
void AddToBGFreeSlotQueue ()
 
void RemoveFromBGFreeSlotQueue ()
 
void DecreaseInvitedCount (uint32 team)
 
void IncreaseInvitedCount (uint32 team)
 
void SetRandom (bool isRandom)
 
uint32 GetInvitedCount (uint32 team) const
 
bool HasFreeSlots () const
 
uint32 GetFreeSlotsForTeam (uint32 Team) const
 
bool isArena () const
 
bool isBattleground () const
 
bool isRated () const
 
BattlegroundPlayerMap constGetPlayers () const
 
uint32 GetPlayersSize () const
 
uint32 GetPlayerScoresSize () const
 
uint32 GetReviveQueueSize () const
 
void AddPlayerToResurrectQueue (ObjectGuid npc_guid, ObjectGuid player_guid)
 
void RemovePlayerFromResurrectQueue (ObjectGuid player_guid)
 
void RelocateDeadPlayers (ObjectGuid guideGuid)
 Relocate all players in ReviveQueue to the closest graveyard. More...
 
void StartBattleground ()
 
GameObjectGetBGObject (uint32 type, bool logError=true)
 
CreatureGetBGCreature (uint32 type, bool logError=true)
 
void SetMapId (uint32 MapID)
 
uint32 GetMapId () const
 
void SetBgMap (BattlegroundMap *map)
 
BattlegroundMapGetBgMap () const
 
BattlegroundMapFindBgMap () const
 
void SetTeamStartPosition (TeamId teamId, Position const &pos)
 
Position constGetTeamStartPosition (TeamId teamId) const
 
void SetStartMaxDist (float startMaxDist)
 
float GetStartMaxDist () const
 
void SendPacketToTeam (uint32 TeamID, WorldPacket const *packet, Player *sender=NULL, bool self=true) const
 
void SendPacketToAll (WorldPacket const *packet) const
 
void SendChatMessage (Creature *source, uint8 textId, WorldObject *target=NULL)
 
template<class Do >
void BroadcastWorker (Do &_do)
 
void PlaySoundToTeam (uint32 SoundID, uint32 TeamID)
 
void PlaySoundToAll (uint32 SoundID)
 
void CastSpellOnTeam (uint32 SpellID, uint32 TeamID)
 
void RemoveAuraOnTeam (uint32 SpellID, uint32 TeamID)
 
void RewardHonorToTeam (uint32 Honor, uint32 TeamID)
 
void RewardReputationToTeam (uint32 faction_id, uint32 Reputation, uint32 TeamID)
 
void UpdateWorldState (uint32 variable, uint32 value, bool hidden=false)
 
void BlockMovement (Player *player)
 
void SendMessageToAll (uint32 entry, ChatMsg type, Player const *source=NULL)
 
void PSendMessageToAll (uint32 entry, ChatMsg type, Player const *source,...)
 
void SendMessage2ToAll (uint32 entry, ChatMsg type, Player const *source, uint32 strId1=0, uint32 strId2=0)
 
GroupGetBgRaid (uint32 TeamID) const
 
void SetBgRaid (uint32 TeamID, Group *bg_raid)
 
void BuildPvPLogDataPacket (WorldPackets::Battleground::PVPLogData &pvpLogData)
 
virtual bool UpdatePlayerScore (Player *player, uint32 type, uint32 value, bool doAddHonor=true)
 
uint32 GetPlayersCountByTeam (uint32 Team) const
 
uint32 GetAlivePlayersCountByTeam (uint32 Team) const
 
void UpdatePlayersCountByTeam (uint32 Team, bool remove)
 
virtual void CheckWinConditions ()
 
void SetArenaTeamIdForTeam (uint32 Team, uint32 ArenaTeamId)
 
uint32 GetArenaTeamIdForTeam (uint32 Team) const
 
uint32 GetArenaTeamIdByIndex (uint32 index) const
 
void SetArenaMatchmakerRating (uint32 Team, uint32 MMR)
 
uint32 GetArenaMatchmakerRating (uint32 Team) const
 
virtual void HandleKillPlayer (Player *player, Player *killer)
 
virtual void EventPlayerDroppedFlag (Player *)
 
void EventPlayerLoggedIn (Player *player)
 
void EventPlayerLoggedOut (Player *player)
 
virtual void DoAction (uint32, ObjectGuid)
 
virtual void HandlePlayerResurrect (Player *)
 
void AddOrSetPlayerToCorrectBgGroup (Player *player, uint32 team)
 
virtual void RemovePlayerAtLeave (ObjectGuid guid, bool Transport, bool SendPacket)
 
void HandleTriggerBuff (ObjectGuid go_guid)
 
void SetHoliday (bool is_holiday)
 
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)
 
bool AddObject (uint32 type, uint32 entry, Position const &pos, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime=0, GOState goState=GO_STATE_READY)
 
virtual CreatureAddCreature (uint32 entry, uint32 type, float x, float y, float z, float o, TeamId teamId=TEAM_NEUTRAL, uint32 respawntime=0, Transport *transport=NULL)
 
CreatureAddCreature (uint32 entry, uint32 type, Position const &pos, TeamId teamId=TEAM_NEUTRAL, uint32 respawntime=0, Transport *transport=NULL)
 
bool DelCreature (uint32 type)
 
bool DelObject (uint32 type)
 
virtual bool AddSpiritGuide (uint32 type, float x, float y, float z, float o, TeamId teamId=TEAM_NEUTRAL)
 
bool AddSpiritGuide (uint32 type, Position const &pos, TeamId teamId=TEAM_NEUTRAL)
 
int32 GetObjectType (ObjectGuid guid)
 
void DoorOpen (uint32 type)
 
void DoorClose (uint32 type)
 
virtual bool HandlePlayerUnderMap (Player *)
 
uint32 GetPlayerTeam (ObjectGuid guid) const
 
uint32 GetOtherTeam (uint32 teamId) const
 
bool IsPlayerInBattleground (ObjectGuid guid) const
 
bool ToBeDeleted () const
 
void SetDeleteThis ()
 
void RewardXPAtKill (Player *killer, Player *victim)
 
bool CanAwardArenaPoints () const
 
virtual ObjectGuid GetFlagPickerGUID (int32=-1) const
 
virtual void SetDroppedFlagGUID (ObjectGuid, int32=-1)
 
virtual void HandleQuestComplete (uint32, Player *)
 
virtual bool CanActivateGO (int32, uint32) const
 
uint32 GetTeamScore (uint32 TeamID) const
 
virtual uint32 GetPrematureWinner ()
 
uint8 GetUniqueBracketId () const
 

Private Member Functions

bool ResetObjs ()
 Called on setup and between the two round -Delete all gameobject / creature -Respawn all gameobject / creature to have good faction. More...
 
void StartShips ()
 Called for start ship movement. More...
 
void TeleportPlayers ()
 Called between the two round -Teleport all players to good location. More...
 
void TeleportToEntrancePosition (Player *player)
 
void OverrideGunFaction ()
 Called on start and between the two round -Update faction of all vehicle. More...
 
void DemolisherStartState (bool start)
 Set selectable or not demolisher, called on battle start, when boats arrive to dock. More...
 
bool CanInteractWithObject (uint32 objectId)
 Checks if a player can interact with the given object. More...
 
void UpdateObjectInteractionFlags (uint32 objectId)
 Updates interaction flags of specific objects. More...
 
void UpdateObjectInteractionFlags ()
 
void DestroyGate (Player *player, GameObject *go) override
 Called when a gate is destroy -Give honor to player witch destroy it -Update worldstate -Delete gameobject in front of door (lighting object, with different colours for each door) More...
 
void SendTime ()
 Update timer worldstate. More...
 
void CaptureGraveyard (BG_SA_Graveyards i, Player *Source)
 Called when a graveyard is capture -Update spiritguide -Update gameobject (flag) -Update Worldstate -Send warning for announce this. More...
 
void ToggleTimer ()
 Switch on/off timer worldstate. More...
 
void UpdateDemolisherSpawns ()
 Respawn dead demolisher. More...
 
void SendTransportInit (Player *player)
 Send packet to player for create boats (client part) More...
 
void SendTransportsRemove (Player *player)
 Send packet to player for destroy boats (client part) More...
 

Private Attributes

TeamId Attackers
 Id of attacker team. More...
 
uint32 TotalTime
 Totale elapsed time of current round. More...
 
uint32 EndRoundTimer
 Max time of round. More...
 
bool ShipsStarted
 For know if boats has start moving or not yet. More...
 
BG_SA_GateState GateStatus [MAX_GATES]
 Status of each gate (Destroy/Damage/Intact) More...
 
BG_SA_Status Status
 Statu of battle (Start or not, and what round) More...
 
TeamId GraveyardStatus [BG_SA_MAX_GY]
 Team witch conntrol each graveyard. More...
 
BG_SA_RoundScore RoundScores [2]
 Score of each round. More...
 
bool TimerEnabled
 used for know we are in timer phase or not (used for worldstate update) More...
 
uint32 UpdateWaitTimer
 5secs before starting the 1min countdown for second round More...
 
bool SignaledRoundTwo
 for know if warning about second round start has been sent More...
 
bool SignaledRoundTwoHalfMin
 for know if warning about second round start has been sent More...
 
bool InitSecondRound
 for know if second round has been init More...
 
std::map< uint32, uint32DemoliserRespawnList
 
bool _gateDestroyed
 
bool _allVehiclesAlive [BG_TEAMS_COUNT]
 

Additional Inherited Members

- Public Types inherited from Battleground
typedef std::map< ObjectGuid,
BattlegroundPlayer
BattlegroundPlayerMap
 
typedef std::map< ObjectGuid,
BattlegroundScore * > 
BattlegroundScoreMap
 
- Static Public Member Functions inherited from Battleground
static TeamId GetTeamIndexByTeamId (uint32 Team)
 
- Public Attributes inherited from Battleground
GuidVector BgObjects
 
GuidVector BgCreatures
 
- Protected Member Functions inherited from Battleground
void EndNow ()
 
void PlayerAddedToBGCheckIfBGIsRunning (Player *player)
 
Player_GetPlayer (ObjectGuid guid, bool offlineRemove, const char *context) const
 
Player_GetPlayer (BattlegroundPlayerMap::iterator itr, const char *context)
 
Player_GetPlayer (BattlegroundPlayerMap::const_iterator itr, const char *context) const
 
Player_GetPlayerForTeam (uint32 teamId, BattlegroundPlayerMap::const_iterator itr, const char *context) const
 
virtual bool PreUpdateImpl (uint32)
 Pre-update hook. More...
 
void _ProcessOfflineQueue ()
 
void _ProcessResurrect (uint32 diff)
 
void _ProcessProgress (uint32 diff)
 
void _ProcessLeave (uint32 diff)
 
void _ProcessJoin (uint32 diff)
 
void _CheckSafePositions (uint32 diff)
 
void _ProcessPlayerPositionBroadcast (uint32 diff)
 
virtual void GetPlayerPositionData (std::vector< WorldPackets::Battleground::BattlegroundPlayerPosition > *) const
 
- Protected Attributes inherited from Battleground
BattlegroundScoreMap PlayerScores
 
BattlegroundPlayerMap m_Players
 
std::map< ObjectGuid, GuidVectorm_ReviveQueue
 
uint8 m_Events
 
BattlegroundStartTimeIntervals StartDelayTimes [BG_STARTING_EVENT_COUNT]
 
uint32 StartMessageIds [BG_STARTING_EVENT_COUNT]
 
bool m_BuffChange
 
bool m_IsRandom
 
BGHonorMode m_HonorMode
 
int32 m_TeamScores [BG_TEAMS_COUNT]
 
ArenaTeamScore _arenaTeamScores [BG_TEAMS_COUNT]
 

Detailed Description

Class for manage Strand of Ancient battleground.

Constructor & Destructor Documentation

BattlegroundSA::BattlegroundSA ( )

This is here to prevent an uninitialised variable warning The warning only occurs when SetUpBattleGround fails though. In the future this function should be called BEFORE sending initial worldstates.

28 {
33 
34  BgObjects.resize(BG_SA_MAXOBJ);
36  TimerEnabled = false;
37  UpdateWaitTimer = 0;
38  SignaledRoundTwo = false;
40  InitSecondRound = false;
41  _gateDestroyed = false;
43  TotalTime = 0;
44  EndRoundTimer = 0;
45  ShipsStarted = false;
47 
48  for (uint8 i = 0; i < MAX_GATES; ++i)
50 
51  for (uint8 i = 0; i < 2; i++)
52  {
54  RoundScores[i].time = 0;
55  _allVehiclesAlive[i] = true;
56  }
57 
61  memset(&GraveyardStatus, 0, sizeof(GraveyardStatus));
62 }
bool TimerEnabled
used for know we are in timer phase or not (used for worldstate update)
Definition: BattlegroundSA.h:683
Definition: Battleground.h:199
Definition: BattlegroundSA.h:41
bool ShipsStarted
For know if boats has start moving or not yet.
Definition: BattlegroundSA.h:673
#define MAX_GATES
Definition: BattlegroundSA.h:494
Definition: Battleground.h:200
BG_SA_RoundScore RoundScores[2]
Score of each round.
Definition: BattlegroundSA.h:681
Definition: BattlegroundSA.h:302
BG_SA_Status Status
Statu of battle (Start or not, and what round)
Definition: BattlegroundSA.h:677
uint32 UpdateWaitTimer
5secs before starting the 1min countdown for second round
Definition: BattlegroundSA.h:685
Definition: BattlegroundSA.h:205
Definition: Battleground.h:198
uint32 EndRoundTimer
Max time of round.
Definition: BattlegroundSA.h:671
uint32 TotalTime
Totale elapsed time of current round.
Definition: BattlegroundSA.h:669
GuidVector BgObjects
Definition: Battleground.h:452
GuidVector BgCreatures
Definition: Battleground.h:453
Definition: BattlegroundSA.h:464
Definition: Language.h:1189
uint32 StartMessageIds[BG_STARTING_EVENT_COUNT]
Definition: Battleground.h:556
bool SignaledRoundTwo
for know if warning about second round start has been sent
Definition: BattlegroundSA.h:687
Definition: SharedDefines.h:992
Definition: BattlegroundSA.h:31
bool _allVehiclesAlive[BG_TEAMS_COUNT]
Definition: BattlegroundSA.h:698
bool SignaledRoundTwoHalfMin
for know if warning about second round start has been sent
Definition: BattlegroundSA.h:689
BG_SA_GateState GateStatus[MAX_GATES]
Status of each gate (Destroy/Damage/Intact)
Definition: BattlegroundSA.h:675
TeamId Attackers
Id of attacker team.
Definition: BattlegroundSA.h:666
TeamId GraveyardStatus[BG_SA_MAX_GY]
Team witch conntrol each graveyard.
Definition: BattlegroundSA.h:679
bool InitSecondRound
for know if second round has been init
Definition: BattlegroundSA.h:691
TeamId winner
Definition: BattlegroundSA.h:507
bool _gateDestroyed
Definition: BattlegroundSA.h:695
Definition: Language.h:1191
uint8_t uint8
Definition: Define.h:152
uint32 time
Definition: BattlegroundSA.h:508
Definition: Language.h:1190
Definition: Battleground.h:197
BattlegroundSA::~BattlegroundSA ( )
64 { }

Member Function Documentation

void BattlegroundSA::AddPlayer ( Player player)
overridevirtual

Called when a player join battle.

Reimplemented from Battleground.

479 {
480  Battleground::AddPlayer(player);
481  PlayerScores[player->GetGUID()] = new BattlegroundSAScore(player->GetGUID(), player->GetBGTeam());
482 
483  SendTransportInit(player);
484 
486 }
void TeleportToEntrancePosition(Player *player)
Definition: BattlegroundSA.cpp:523
void SendTransportInit(Player *player)
Send packet to player for create boats (client part)
Definition: BattlegroundSA.cpp:1005
Definition: BattlegroundSA.h:511
virtual void AddPlayer(Player *player)
Definition: Battleground.cpp:1079
BattlegroundScoreMap PlayerScores
Definition: Battleground.h:543

+ Here is the call graph for this function:

bool BattlegroundSA::CanInteractWithObject ( uint32  objectId)
private

Checks if a player can interact with the given object.

732 {
733  switch (objectId)
734  {
735  case BG_SA_TITAN_RELIC:
737  return false;
738  // no break
739  case BG_SA_CENTRAL_FLAG:
741  return false;
742  // no break
743  case BG_SA_LEFT_FLAG:
744  case BG_SA_RIGHT_FLAG:
746  return false;
747  break;
748  default:
749  ABORT();
750  break;
751  }
752 
753  return true;
754 }
Definition: BattlegroundSA.h:277
Definition: BattlegroundSA.h:280
Definition: BattlegroundSA.h:298
Definition: BattlegroundSA.h:282
Definition: BattlegroundSA.h:300
Definition: BattlegroundSA.h:278
Definition: BattlegroundSA.h:281
Definition: BattlegroundSA.h:43
BG_SA_GateState GateStatus[MAX_GATES]
Status of each gate (Destroy/Damage/Intact)
Definition: BattlegroundSA.h:675
Definition: BattlegroundSA.h:279
Definition: BattlegroundSA.h:299
#define ABORT
Definition: Errors.h:56
Definition: BattlegroundSA.h:276

+ Here is the caller graph for this function:

void BattlegroundSA::CaptureGraveyard ( BG_SA_Graveyards  i,
Player Source 
)
private

Called when a graveyard is capture -Update spiritguide -Update gameobject (flag) -Update Worldstate -Send warning for announce this.

Parameters
i: id of graveyard
Source: Player who capture gy
799 {
800  if (GraveyardStatus[i] == Attackers)
801  return;
802 
804  GraveyardStatus[i] = Source->GetTeamId();
805  WorldSafeLocsEntry const* sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
806  if (!sg)
807  {
808  TC_LOG_ERROR("bg.battleground", "BattlegroundSA::CaptureGraveyard: non-existant GY entry: %u", BG_SA_GYEntries[i]);
809  return;
810  }
811 
813  uint32 npc = 0;
814  uint32 flag = 0;
815 
816  switch (i)
817  {
819  flag = BG_SA_LEFT_FLAG;
820  DelObject(flag);
821  AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0 : 1)),
822  BG_SA_ObjSpawnlocs[flag], 0, 0, 0, 0, RESPAWN_ONE_DAY);
823 
824  npc = BG_SA_NPC_RIGSPARK;
825  if (Creature* rigspark = AddCreature(BG_SA_NpcEntries[npc], npc, BG_SA_NpcSpawnlocs[npc], Attackers))
826  rigspark->AI()->Talk(TEXT_SPARKLIGHT_RIGSPARK_SPAWN);
827 
828  for (uint8 j = BG_SA_DEMOLISHER_7; j <= BG_SA_DEMOLISHER_8; j++)
829  {
831 
832  if (Creature* dem = GetBGCreature(j))
833  dem->setFaction(BG_SA_Factions[Attackers]);
834  }
835 
838 
839  if (Creature* c = Source->FindNearestCreature(NPC_WORLD_TRIGGER, 500.0f))
841 
842  break;
844  flag = BG_SA_RIGHT_FLAG;
845  DelObject(flag);
846  AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0 : 1)),
847  BG_SA_ObjSpawnlocs[flag], 0, 0, 0, 0, RESPAWN_ONE_DAY);
848 
849  npc = BG_SA_NPC_SPARKLIGHT;
850  if (Creature* sparklight = AddCreature(BG_SA_NpcEntries[npc], npc, BG_SA_NpcSpawnlocs[npc], Attackers))
851  sparklight->AI()->Talk(TEXT_SPARKLIGHT_RIGSPARK_SPAWN);
852 
853  for (uint8 j = BG_SA_DEMOLISHER_5; j <= BG_SA_DEMOLISHER_6; j++)
854  {
856 
857  if (Creature* dem = GetBGCreature(j))
858  dem->setFaction(BG_SA_Factions[Attackers]);
859  }
860 
863 
864  if (Creature* c = Source->FindNearestCreature(NPC_WORLD_TRIGGER, 500.0f))
866 
867  break;
869  flag = BG_SA_CENTRAL_FLAG;
870  DelObject(flag);
871  AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0 : 1)),
872  BG_SA_ObjSpawnlocs[flag], 0, 0, 0, 0, RESPAWN_ONE_DAY);
873 
876 
877  if (Creature* c = Source->FindNearestCreature(NPC_WORLD_TRIGGER, 500.0f))
879 
880  break;
881  default:
882  ABORT();
883  break;
884  };
885 }
Definition: BattlegroundSA.h:198
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)
Definition: Battleground.cpp:1446
float Z
Definition: DBCEnums.h:36
Definition: BattlegroundSA.h:148
float Y
Definition: DBCEnums.h:35
DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore(WorldSafeLocsfmt)
virtual bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, TeamId teamId=TEAM_NEUTRAL)
Definition: Battleground.cpp:1676
Definition: BattlegroundSA.h:298
uint32 const BG_SA_Factions[2]
Definition: BattlegroundSA.h:451
Definition: BattlegroundSA.h:300
Definition: BattlegroundSA.h:147
Definition: BattlegroundSA.h:176
virtual Creature * AddCreature(uint32 entry, uint32 type, float x, float y, float z, float o, TeamId teamId=TEAM_NEUTRAL, uint32 respawntime=0, Transport *transport=NULL)
Definition: Battleground.cpp:1580
Definition: DBCStructure.h:1434
uint32 const BG_SA_ObjEntries[BG_SA_MAXOBJ+BG_SA_FLAG_AMOUNT]
Definition: BattlegroundSA.h:421
Definition: BattlegroundSA.h:203
Definition: Creature.h:467
bool DelObject(uint32 type)
Definition: Battleground.cpp:1658
Definition: BattlegroundSA.h:201
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2443
Definition: BattlegroundSA.h:205
Definition: BattlegroundSA.h:130
const uint32 BG_SA_GYEntries[BG_SA_MAX_GY]
Definition: BattlegroundSA.h:467
Definition: BattlegroundSA.h:177
Definition: BattlegroundSA.h:166
Definition: BattlegroundSA.h:202
Definition: BattlegroundSA.h:175
Definition: BattlegroundSA.h:83
uint32_t uint32
Definition: Define.h:150
Position const BG_SA_NpcSpawnlocs[BG_SA_MAXNPC]
Definition: BattlegroundSA.h:245
Definition: BattlegroundSA.h:461
Definition: SharedDefines.h:992
Definition: Battleground.h:128
float X
Definition: DBCEnums.h:34
DBCPosition3D Loc
Definition: DBCStructure.h:1438
void SendChatMessage(Creature *source, uint8 textId, WorldObject *target=NULL)
Definition: Battleground.cpp:676
Definition: BattlegroundSA.h:143
TeamId Attackers
Id of attacker team.
Definition: BattlegroundSA.h:666
Definition: BattlegroundSA.h:199
TeamId GraveyardStatus[BG_SA_MAX_GY]
Team witch conntrol each graveyard.
Definition: BattlegroundSA.h:679
Definition: BattlegroundSA.h:463
Definition: BattlegroundSA.h:299
float const BG_SA_GYOrientation[BG_SA_MAX_GY]
Definition: BattlegroundSA.h:476
bool DelCreature(uint32 type)
Definition: Battleground.cpp:1640
uint32 const BG_SA_NpcEntries[BG_SA_MAXNPC]
Definition: BattlegroundSA.h:216
Definition: BattlegroundSA.h:462
#define ABORT
Definition: Errors.h:56
Definition: BattlegroundSA.h:168
uint8_t uint8
Definition: Define.h:152
void UpdateWorldState(uint32 variable, uint32 value, bool hidden=false)
Definition: Battleground.cpp:735
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: BattlegroundSA.h:144
Definition: BattlegroundSA.h:200
Creature * GetBGCreature(uint32 type, bool logError=true)
Definition: Battleground.cpp:1549
Definition: SharedDefines.h:993
Definition: BattlegroundSA.h:145
Definition: BattlegroundSA.h:167
Position const BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ]
Definition: BattlegroundSA.h:305
Definition: BattlegroundSA.h:146

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool BattlegroundSA::CheckAchievementCriteriaMeet ( uint32  criteriaId,
Player const source,
Unit const target = NULL,
uint32  miscValue = 0 
)
overridevirtual

Reimplemented from Battleground.

1038 {
1039  switch (criteriaId)
1040  {
1042  return _allVehiclesAlive[GetTeamIndexByTeamId(source->GetTeam())];
1044  return source->GetTeamId() != Attackers && !_gateDestroyed;
1045  }
1046 
1047  return Battleground::CheckAchievementCriteriaMeet(criteriaId, source, target, miscValue);
1048 }
Definition: Battleground.h:51
static TeamId GetTeamIndexByTeamId(uint32 Team)
Definition: Battleground.h:399
Definition: Battleground.h:52
bool _allVehiclesAlive[BG_TEAMS_COUNT]
Definition: BattlegroundSA.h:698
TeamId Attackers
Id of attacker team.
Definition: BattlegroundSA.h:666
bool _gateDestroyed
Definition: BattlegroundSA.h:695
virtual bool CheckAchievementCriteriaMeet(uint32, Player const *, Unit const *=NULL, uint32=0)
Definition: Battleground.cpp:1939

+ Here is the call graph for this function:

void BattlegroundSA::DemolisherStartState ( bool  start)
private

Set selectable or not demolisher, called on battle start, when boats arrive to dock.

667 {
668  if (!BgCreatures[0])
669  return;
670 
671  // set flags only for the demolishers on the beach, factory ones dont need it
672  for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++)
673  {
674  if (Creature* dem = GetBGCreature(i))
675  {
676  if (start)
678  else
680  }
681  }
682 }
Definition: Unit.h:674
Definition: Creature.h:467
GuidVector BgCreatures
Definition: Battleground.h:453
Definition: UpdateFields.h:109
Definition: BattlegroundSA.h:194
uint8_t uint8
Definition: Define.h:152
Creature * GetBGCreature(uint32 type, bool logError=true)
Definition: Battleground.cpp:1549
Definition: Unit.h:698
Definition: BattlegroundSA.h:197

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void BattlegroundSA::DestroyGate ( Player player,
GameObject go 
)
overrideprivatevirtual

Called when a gate is destroy -Give honor to player witch destroy it -Update worldstate -Delete gameobject in front of door (lighting object, with different colours for each door)

Reimplemented from Battleground.

685 {
686 }
void BattlegroundSA::EndBattleground ( uint32  winner)
overridevirtual

Called on battleground ending.

Reimplemented from Battleground.

961 {
962  // honor reward for winning
963  if (winner == ALLIANCE)
965  else if (winner == HORDE)
967 
968  // complete map_end rewards (even if no team wins)
971 
973 }
uint32 GetBonusHonorFromKill(uint32 kills) const
Definition: Battleground.cpp:907
Definition: SharedDefines.h:1000
void RewardHonorToTeam(uint32 Honor, uint32 TeamID)
Definition: Battleground.cpp:709
Definition: SharedDefines.h:999
virtual void EndBattleground(uint32 winner)
Definition: Battleground.cpp:744

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void BattlegroundSA::EventPlayerClickedOnFlag ( Player source,
GameObject go 
)
overridevirtual

Called when a player click on flag (graveyard flag)

Reimplemented from Battleground.

775 {
776  switch (go->GetEntry())
777  {
778  case 191307:
779  case 191308:
782  break;
783  case 191305:
784  case 191306:
787  break;
788  case 191310:
789  case 191309:
792  break;
793  default:
794  return;
795  };
796 }
Definition: BattlegroundSA.h:298
Definition: BattlegroundSA.h:300
Definition: BattlegroundSA.h:461
Definition: BattlegroundSA.h:463
Definition: BattlegroundSA.h:299
Definition: BattlegroundSA.h:462
bool CanInteractWithObject(uint32 objectId)
Checks if a player can interact with the given object.
Definition: BattlegroundSA.cpp:731
void CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
Called when a graveyard is capture -Update spiritguide -Update gameobject (flag) -Update Worldstate -...
Definition: BattlegroundSA.cpp:798
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:

void BattlegroundSA::FillInitialWorldStates ( WorldPackets::WorldState::InitWorldStates packet)
overridevirtual

Called for generate packet contain worldstate data.

Reimplemented from Battleground.

439 {
440  bool allyAttacks = Attackers == TEAM_ALLIANCE;
441  bool hordeAttacks = Attackers == TEAM_HORDE;
442 
449 
450  packet.Worldstates.emplace_back(uint32(BG_SA_BONUS_TIMER), 0);
451 
452  packet.Worldstates.emplace_back(uint32(BG_SA_HORDE_ATTACKS), int32(hordeAttacks));
453  packet.Worldstates.emplace_back(uint32(BG_SA_ALLY_ATTACKS), int32(allyAttacks));
454 
455  // Time will be sent on first update...
456  packet.Worldstates.emplace_back(uint32(BG_SA_ENABLE_TIMER), int32(TimerEnabled));
457  packet.Worldstates.emplace_back(uint32(BG_SA_TIMER_MINS), 0);
458  packet.Worldstates.emplace_back(uint32(BG_SA_TIMER_SEC_TENS), 0);
459  packet.Worldstates.emplace_back(uint32(BG_SA_TIMER_SEC_DECS), 0);
460 
464 
468 
469  packet.Worldstates.emplace_back(uint32(BG_SA_HORDE_DEFENCE_TOKEN), int32(allyAttacks));
470  packet.Worldstates.emplace_back(uint32(BG_SA_ALLIANCE_DEFENCE_TOKEN), int32(hordeAttacks));
471 
472  packet.Worldstates.emplace_back(uint32(BG_SA_LEFT_ATT_TOKEN_HRD), int32(hordeAttacks));
473  packet.Worldstates.emplace_back(uint32(BG_SA_RIGHT_ATT_TOKEN_HRD), int32(hordeAttacks));
474  packet.Worldstates.emplace_back(uint32(BG_SA_RIGHT_ATT_TOKEN_ALL), int32(allyAttacks));
475  packet.Worldstates.emplace_back(uint32(BG_SA_LEFT_ATT_TOKEN_ALL), int32(allyAttacks));
476 }
bool TimerEnabled
used for know we are in timer phase or not (used for worldstate update)
Definition: BattlegroundSA.h:683
Definition: BattlegroundSA.h:164
Definition: BattlegroundSA.h:277
Definition: BattlegroundSA.h:280
Definition: BattlegroundSA.h:156
Definition: BattlegroundSA.h:169
Definition: BattlegroundSA.h:179
Definition: BattlegroundSA.h:278
std::list< WorldStateInfo > Worldstates
Definition: WorldStatePackets.h:47
Definition: BattlegroundSA.h:171
Definition: BattlegroundSA.h:176
Definition: BattlegroundSA.h:158
Definition: BattlegroundSA.h:157
Definition: BattlegroundSA.h:281
Definition: BattlegroundSA.h:172
Definition: BattlegroundSA.h:170
Definition: BattlegroundSA.h:177
Definition: BattlegroundSA.h:166
Definition: BattlegroundSA.h:159
Definition: BattlegroundSA.h:178
Definition: BattlegroundSA.h:175
Definition: BattlegroundSA.h:173
Definition: BattlegroundSA.h:461
Definition: SharedDefines.h:992
BG_SA_GateState GateStatus[MAX_GATES]
Status of each gate (Destroy/Damage/Intact)
Definition: BattlegroundSA.h:675
TeamId Attackers
Id of attacker team.
Definition: BattlegroundSA.h:666
Definition: BattlegroundSA.h:279
TeamId GraveyardStatus[BG_SA_MAX_GY]
Team witch conntrol each graveyard.
Definition: BattlegroundSA.h:679
Definition: BattlegroundSA.h:463
Definition: BattlegroundSA.h:462
Definition: BattlegroundSA.h:168
int32_t int32
Definition: g3dmath.h:167
Definition: BattlegroundSA.h:160
Definition: BattlegroundSA.h:163
uint32_t uint32
Definition: g3dmath.h:168
Definition: BattlegroundSA.h:165
Definition: BattlegroundSA.h:174
Definition: SharedDefines.h:993
Definition: BattlegroundSA.h:162
Definition: BattlegroundSA.h:276
Definition: BattlegroundSA.h:155
Definition: BattlegroundSA.h:167
Definition: BattlegroundSA.h:161
WorldSafeLocsEntry const * BattlegroundSA::GetClosestGraveYard ( Player player)
overridevirtual

Return the nearest graveyard where player can respawn.

Reimplemented from Battleground.

689 {
690  uint32 safeloc = 0;
691  WorldSafeLocsEntry const* ret;
692  WorldSafeLocsEntry const* closest;
693  float dist, nearest;
694  float x, y, z;
695 
696  player->GetPosition(x, y, z);
697 
698  if (player->GetTeamId() == Attackers)
699  safeloc = BG_SA_GYEntries[BG_SA_BEACH_GY];
700  else
702 
703  closest = sWorldSafeLocsStore.LookupEntry(safeloc);
704  nearest = player->GetExactDistSq(closest->Loc.X, closest->Loc.Y, closest->Loc.Z);
705 
706  for (uint8 i = BG_SA_RIGHT_CAPTURABLE_GY; i < BG_SA_MAX_GY; i++)
707  {
708  if (GraveyardStatus[i] != player->GetTeamId())
709  continue;
710 
711  ret = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
712  dist = player->GetExactDistSq(ret->Loc.X, ret->Loc.Y, ret->Loc.Z);
713  if (dist < nearest)
714  {
715  closest = ret;
716  nearest = dist;
717  }
718  }
719 
720  return closest;
721 }
float Z
Definition: DBCEnums.h:36
float Y
Definition: DBCEnums.h:35
DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore(WorldSafeLocsfmt)
Definition: DBCStructure.h:1434
Definition: BattlegroundSA.h:459
const uint32 BG_SA_GYEntries[BG_SA_MAX_GY]
Definition: BattlegroundSA.h:467
Definition: BattlegroundSA.h:464
G3D::int16 z
Definition: Vector3int16.h:46
uint32_t uint32
Definition: Define.h:150
G3D::int16 y
Definition: Vector2int16.h:38
Definition: BattlegroundSA.h:461
float X
Definition: DBCEnums.h:34
DBCPosition3D Loc
Definition: DBCStructure.h:1438
TeamId Attackers
Id of attacker team.
Definition: BattlegroundSA.h:666
TeamId GraveyardStatus[BG_SA_MAX_GY]
Team witch conntrol each graveyard.
Definition: BattlegroundSA.h:679
Definition: BattlegroundSA.h:460
uint8_t uint8
Definition: Define.h:152
G3D::int16 x
Definition: Vector2int16.h:37
GateInfo const* BattlegroundSA::GetGate ( uint32  entry)
inline

Return GateInfo, relative to bg data, according to gameobject entry.

585  {
586  for (uint8 i = 0; i < MAX_GATES; ++i)
587  if (Gates[i].GameObjectId == entry)
588  return &Gates[i];
589  return NULL;
590  }
#define MAX_GATES
Definition: BattlegroundSA.h:494
arena_t NULL
Definition: jemalloc_internal.h:624
GateInfo const Gates[MAX_GATES]
Definition: BattlegroundSA.h:495
uint8_t uint8
Definition: Define.h:152

+ Here is the caller graph for this function:

void BattlegroundSA::HandleAreaTrigger ( Player source,
uint32  trigger,
bool  entered 
)
overridevirtual

Reimplemented from Battleground.

491 {
492  // this is wrong way to implement these things. On official it done by gameobject spell cast.
493  if (GetStatus() != STATUS_IN_PROGRESS)
494  return;
495 }
Definition: Battleground.h:159
BattlegroundStatus GetStatus() const
Definition: Battleground.h:266

+ Here is the call graph for this function:

void BattlegroundSA::HandleKillUnit ( Creature creature,
Player killer 
)
overridevirtual

Called when a player kill a unit in bg.

Reimplemented from Battleground.

636 {
637  if (creature->GetEntry() == NPC_DEMOLISHER_SA)
638  {
640  _allVehiclesAlive[Attackers] = false;
641  }
642 }
virtual bool UpdatePlayerScore(Player *player, uint32 type, uint32 value, bool doAddHonor=true)
Definition: Battleground.cpp:1381
Definition: BattlegroundScore.h:50
Definition: BattlegroundSA.h:87
bool _allVehiclesAlive[BG_TEAMS_COUNT]
Definition: BattlegroundSA.h:698
TeamId Attackers
Id of attacker team.
Definition: BattlegroundSA.h:666
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:

bool BattlegroundSA::IsSpellAllowed ( uint32  spellId,
Player const player 
) const
overridevirtual

Reimplemented from Battleground.

1051 {
1052  switch (spellId)
1053  {
1055  return Attackers == TEAM_HORDE;
1057  return Attackers == TEAM_ALLIANCE;
1058  case SPELL_PREPARATION:
1060  default:
1061  break;
1062  }
1063 
1064  return true;
1065 }
Definition: BattlegroundSA.h:32
BG_SA_Status Status
Statu of battle (Start or not, and what round)
Definition: BattlegroundSA.h:677
Definition: BattlefieldWG.h:82
Definition: BattlefieldWG.h:83
Definition: SharedDefines.h:992
TeamId Attackers
Id of attacker team.
Definition: BattlegroundSA.h:666
Definition: BattlegroundSA.h:34
Definition: Battleground.h:111
Definition: SharedDefines.h:993
void BattlegroundSA::OverrideGunFaction ( )
private

Called on start and between the two round -Update faction of all vehicle.

649 {
650  if (!BgCreatures[0])
651  return;
652 
653  for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10; i++)
654  {
655  if (Creature* gun = GetBGCreature(i))
656  gun->setFaction(BG_SA_Factions[Attackers ? TEAM_ALLIANCE : TEAM_HORDE]);
657  }
658 
659  for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++)
660  {
661  if (Creature* dem = GetBGCreature(i))
662  dem->setFaction(BG_SA_Factions[Attackers]);
663  }
664 }
Definition: BattlegroundSA.h:184
uint32 const BG_SA_Factions[2]
Definition: BattlegroundSA.h:451
Definition: Creature.h:467
GuidVector BgCreatures
Definition: Battleground.h:453
Definition: SharedDefines.h:992
Definition: BattlegroundSA.h:193
TeamId Attackers
Id of attacker team.
Definition: BattlegroundSA.h:666
Definition: BattlegroundSA.h:194
uint8_t uint8
Definition: Define.h:152
Creature * GetBGCreature(uint32 type, bool logError=true)
Definition: Battleground.cpp:1549
Definition: SharedDefines.h:993
Definition: BattlegroundSA.h:197

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void BattlegroundSA::PostUpdateImpl ( uint32  diff)
overridevirtual

Called every time for update battle data -Update timer -Round switch.

Reimplemented from Battleground.

314 {
315  if (InitSecondRound)
316  {
317  if (UpdateWaitTimer < diff)
318  {
319  if (!SignaledRoundTwo)
320  {
321  SignaledRoundTwo = true;
322  InitSecondRound = false;
324  }
325  }
326  else
327  {
328  UpdateWaitTimer -= diff;
329  return;
330  }
331  }
332  TotalTime += diff;
333 
334  if (Status == BG_SA_WARMUP)
335  {
338  {
341 
342  TotalTime = 0;
343  ToggleTimer();
344  DemolisherStartState(false);
347  }
349  StartShips();
350  return;
351  }
352  else if (Status == BG_SA_SECOND_WARMUP)
353  {
354  if (RoundScores[0].time<BG_SA_ROUNDLENGTH)
356  else
358 
359  if (TotalTime >= 60000)
360  {
363 
364  TotalTime = 0;
365  ToggleTimer();
366  DemolisherStartState(false);
369  // status was set to STATUS_WAIT_JOIN manually for Preparation, set it back now
371  for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
372  if (Player* p = ObjectAccessor::FindPlayer(itr->first))
373  p->RemoveAurasDueToSpell(SPELL_PREPARATION);
374  }
375  if (TotalTime >= 30000)
376  {
378  {
381  }
382  }
383  StartShips();
384  return;
385  }
386  else if (GetStatus() == STATUS_IN_PROGRESS)
387  {
388  if (Status == BG_SA_ROUND_ONE)
389  {
391  {
396  TotalTime = 0;
399  UpdateWaitTimer = 5000;
400  SignaledRoundTwo = false;
401  SignaledRoundTwoHalfMin = false;
402  InitSecondRound = true;
403  ToggleTimer();
404  ResetObjs();
406  return;
407  }
408  }
409  else if (Status == BG_SA_ROUND_TWO)
410  {
411  if (TotalTime >= EndRoundTimer)
412  {
417  if (RoundScores[0].time == RoundScores[1].time)
418  EndBattleground(0);
419  else if (RoundScores[0].time < RoundScores[1].time)
421  else
423  return;
424  }
425  }
427  {
428  SendTime();
430  }
431  }
432 }
Definition: Battleground.h:159
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
Definition: Battleground.cpp:1905
Definition: BattlegroundSA.h:106
void UpdateAreaDependentAuras()
Definition: Map.cpp:3968
Definition: Language.h:1196
bool ResetObjs()
Called on setup and between the two round -Delete all gameobject / creature -Respawn all gameobject /...
Definition: BattlegroundSA.cpp:84
BG_SA_RoundScore RoundScores[2]
Score of each round.
Definition: BattlegroundSA.h:681
void StartShips()
Called for start ship movement.
Definition: BattlegroundSA.cpp:288
BattlegroundStatus GetStatus() const
Definition: Battleground.h:266
Definition: BattlegroundSA.h:73
Definition: DBCEnums.h:183
BattlegroundMap * GetBgMap() const
Definition: Battleground.h:356
Definition: BattlegroundSA.h:32
BG_SA_Status Status
Statu of battle (Start or not, and what round)
Definition: BattlegroundSA.h:677
void SendTime()
Update timer worldstate.
Definition: BattlegroundSA.cpp:723
Definition: Creature.h:467
BattlegroundPlayerMap const & GetPlayers() const
Definition: Battleground.h:331
uint32 UpdateWaitTimer
5secs before starting the 1min countdown for second round
Definition: BattlegroundSA.h:685
uint32 EndRoundTimer
Max time of round.
Definition: BattlegroundSA.h:671
Definition: BattlegroundSA.h:105
uint32 TotalTime
Totale elapsed time of current round.
Definition: BattlegroundSA.h:669
Definition: SharedDefines.h:1000
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
void SendMessageToAll(uint32 entry, ChatMsg type, Player const *source=NULL)
Definition: Battleground.cpp:1706
Definition: SharedDefines.h:4267
void CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
Definition: Battleground.cpp:695
void UpdateDemolisherSpawns()
Respawn dead demolisher.
Definition: BattlegroundSA.cpp:975
void DemolisherStartState(bool start)
Set selectable or not demolisher, called on battle start, when boats arrive to dock.
Definition: BattlegroundSA.cpp:666
bool SignaledRoundTwo
for know if warning about second round start has been sent
Definition: BattlegroundSA.h:687
Definition: SharedDefines.h:992
bool SignaledRoundTwoHalfMin
for know if warning about second round start has been sent
Definition: BattlegroundSA.h:689
Definition: BattlegroundSA.h:126
void SendChatMessage(Creature *source, uint8 textId, WorldObject *target=NULL)
Definition: Battleground.cpp:676
TeamId Attackers
Id of attacker team.
Definition: BattlegroundSA.h:666
Definition: SharedDefines.h:999
Definition: BattlegroundSA.h:34
bool InitSecondRound
for know if second round has been init
Definition: BattlegroundSA.h:691
Definition: BattlegroundSA.h:33
TeamId winner
Definition: BattlegroundSA.h:507
Definition: BattlegroundSA.h:35
Definition: BattlegroundSA.h:204
Definition: BattlegroundSA.h:104
void EndBattleground(uint32 winner) override
Called on battleground ending.
Definition: BattlegroundSA.cpp:960
uint32 time
Definition: BattlegroundSA.h:508
Definition: Language.h:1195
Creature * GetBGCreature(uint32 type, bool logError=true)
Definition: Battleground.cpp:1549
void ToggleTimer()
Switch on/off timer worldstate.
Definition: BattlegroundSA.cpp:954
Definition: Battleground.h:111
Definition: SharedDefines.h:993
void SetStatus(BattlegroundStatus Status)
Definition: Battleground.h:295

+ Here is the call graph for this function:

void BattlegroundSA::ProcessEvent ( WorldObject obj,
uint32  eventId,
WorldObject invoker = NULL 
)
overridevirtual

Called when someone activates an event.

Reimplemented from Battleground.

544 {
545  if (GameObject* go = obj->ToGameObject())
546  {
547  switch (go->GetGoType())
548  {
550  if (invoker)
551  if (eventId == BG_SA_EVENT_TITAN_RELIC_ACTIVATED)
552  TitanRelicActivated(invoker->ToPlayer());
553  break;
555  {
556  if (GateInfo const* gate = GetGate(obj->GetEntry()))
557  {
558  uint8 gateId = gate->GateId;
559 
560  // damaged
561  if (eventId == go->GetGOInfo()->destructibleBuilding.DamagedEvent)
562  {
563  GateStatus[gateId] = BG_SA_GATE_DAMAGED;
564 
565  if (Creature* c = obj->FindNearestCreature(NPC_WORLD_TRIGGER, 500.0f))
566  SendChatMessage(c, gate->DamagedText, invoker);
567 
569  }
570  // destroyed
571  else if (eventId == go->GetGOInfo()->destructibleBuilding.DestroyedEvent)
572  {
573  GateStatus[gate->GateId] = BG_SA_GATE_DESTROYED;
574  _gateDestroyed = true;
575 
576  if (gateId < 5)
577  DelObject(gateId + 14);
578 
579  if (Creature* c = obj->FindNearestCreature(NPC_WORLD_TRIGGER, 500.0f))
580  SendChatMessage(c, gate->DestroyedText, invoker);
581 
583 
584  bool rewardHonor = true;
585  switch (gateId)
586  {
587  case BG_SA_GREEN_GATE:
589  rewardHonor = false;
590  break;
591  case BG_SA_BLUE_GATE:
593  rewardHonor = false;
594  break;
595  case BG_SA_RED_GATE:
597  rewardHonor = false;
598  break;
599  case BG_SA_PURPLE_GATE:
601  rewardHonor = false;
602  break;
603  default:
604  break;
605  }
606 
607  if (invoker)
608  {
609  if (Unit* unit = invoker->ToUnit())
610  {
611  if (Player* player = unit->GetCharmerOrOwnerPlayerOrPlayerItself())
612  {
614  if (rewardHonor)
616  }
617  }
618  }
619 
621  }
622  else
623  break;
624 
625  UpdateWorldState(gate->WorldState, GateStatus[gateId]);
626  }
627  break;
628  }
629  default:
630  break;
631  }
632  }
633 }
Definition: BattlegroundSA.h:120
GateInfo const * GetGate(uint32 entry)
Return GateInfo, relative to bg data, according to gameobject entry.
Definition: BattlegroundSA.h:584
virtual bool UpdatePlayerScore(Player *player, uint32 type, uint32 value, bool doAddHonor=true)
Definition: Battleground.cpp:1381
Definition: BattlegroundSA.h:280
uint32 GetBonusHonorFromKill(uint32 kills) const
Definition: Battleground.cpp:907
Definition: BattlegroundScore.h:51
Definition: BattlegroundSA.h:278
Definition: BattlegroundSA.h:118
Definition: BattlegroundSA.h:43
void UpdateObjectInteractionFlags()
Definition: BattlegroundSA.cpp:767
Definition: Creature.h:467
bool DelObject(uint32 type)
Definition: Battleground.cpp:1658
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2443
GameObject * ToGameObject()
Definition: Object.h:200
Player * ToPlayer()
Definition: Object.h:191
void PlaySoundToAll(uint32 SoundID)
Definition: Battleground.cpp:681
Definition: BattlegroundSA.h:83
Definition: SharedDefines.h:992
Definition: GameObject.h:880
void SendChatMessage(Creature *source, uint8 textId, WorldObject *target=NULL)
Definition: Battleground.cpp:676
BG_SA_GateState GateStatus[MAX_GATES]
Status of each gate (Destroy/Damage/Intact)
Definition: BattlegroundSA.h:675
TeamId Attackers
Id of attacker team.
Definition: BattlegroundSA.h:666
Definition: BattlegroundSA.h:279
Definition: BattlegroundSA.h:66
Definition: BattlegroundScore.h:30
bool _gateDestroyed
Definition: BattlegroundSA.h:695
void TitanRelicActivated(Player *clicker)
Called when a player clicked on relic.
Definition: BattlegroundSA.cpp:887
Definition: SharedDefines.h:2075
Definition: BattlegroundSA.h:485
uint8_t uint8
Definition: Define.h:152
Definition: BattlegroundSA.h:117
void UpdateWorldState(uint32 variable, uint32 value, bool hidden=false)
Definition: Battleground.cpp:735
uint32 GetEntry() const
Definition: Object.h:107
Definition: Unit.h:1305
Definition: SharedDefines.h:2098
Definition: BattlegroundSA.h:276
Definition: BattlegroundSA.h:119
Unit * ToUnit()
Definition: Object.h:197
Definition: BattlegroundSA.h:42

+ Here is the call graph for this function:

void BattlegroundSA::RemovePlayer ( Player player,
ObjectGuid  guid,
uint32  team 
)
overridevirtual

Called when a player leave battleground.

Reimplemented from Battleground.

488 { }
void BattlegroundSA::Reset ( )
overridevirtual

Reimplemented from Battleground.

67 {
68  TotalTime = 0;
69  Attackers = ((urand(0, 1)) ? TEAM_ALLIANCE : TEAM_HORDE);
70  for (uint8 i = 0; i <= 5; i++)
72  ShipsStarted = false;
73  _gateDestroyed = false;
77 }
Definition: BattlegroundSA.h:41
bool ShipsStarted
For know if boats has start moving or not yet.
Definition: BattlegroundSA.h:673
Definition: BattlegroundSA.h:32
BG_SA_Status Status
Statu of battle (Start or not, and what round)
Definition: BattlegroundSA.h:677
uint32 TotalTime
Totale elapsed time of current round.
Definition: BattlegroundSA.h:669
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
Definition: SharedDefines.h:992
bool _allVehiclesAlive[BG_TEAMS_COUNT]
Definition: BattlegroundSA.h:698
BG_SA_GateState GateStatus[MAX_GATES]
Status of each gate (Destroy/Damage/Intact)
Definition: BattlegroundSA.h:675
TeamId Attackers
Id of attacker team.
Definition: BattlegroundSA.h:666
bool _gateDestroyed
Definition: BattlegroundSA.h:695
uint8_t uint8
Definition: Define.h:152
Definition: SharedDefines.h:993

+ Here is the call graph for this function:

bool BattlegroundSA::ResetObjs ( )
private

Called on setup and between the two round -Delete all gameobject / creature -Respawn all gameobject / creature to have good faction.

85 {
86  for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
87  if (Player* player = ObjectAccessor::FindPlayer(itr->first))
88  SendTransportsRemove(player);
89 
92 
93  for (uint8 i = 0; i < BG_SA_MAXOBJ; i++)
94  DelObject(i);
95 
96  for (uint8 i = 0; i < BG_SA_MAXNPC; i++)
97  DelCreature(i);
98 
99  for (uint8 i = BG_SA_MAXNPC; i < BG_SA_MAXNPC + BG_SA_MAX_GY; i++)
100  DelCreature(i);
101 
102  for (uint8 i = 0; i < MAX_GATES; ++i)
104 
105  if (!AddCreature(BG_SA_NpcEntries[BG_SA_NPC_KANRETHAD], BG_SA_NPC_KANRETHAD, BG_SA_NpcSpawnlocs[BG_SA_NPC_KANRETHAD]))
106  {
107  TC_LOG_ERROR("bg.battleground", "SOTA: couldn't spawn Kanrethad, aborted. Entry: %u", BG_SA_NpcEntries[BG_SA_NPC_KANRETHAD]);
108  return false;
109  }
110 
111  for (uint8 i = 0; i <= BG_SA_PORTAL_DEFFENDER_RED; i++)
112  {
113  if (!AddObject(i, BG_SA_ObjEntries[i], BG_SA_ObjSpawnlocs[i], 0, 0, 0, 0, RESPAWN_ONE_DAY))
114  {
115  TC_LOG_ERROR("bg.battleground", "SOTA: couldn't spawn BG_SA_PORTAL_DEFFENDER_RED, Entry: %u", BG_SA_ObjEntries[i]);
116  continue;
117  }
118  }
119 
120  for (uint8 i = BG_SA_BOAT_ONE; i <= BG_SA_BOAT_TWO; i++)
121  {
122  uint32 boatid = 0;
123  switch (i)
124  {
125  case BG_SA_BOAT_ONE:
127  break;
128  case BG_SA_BOAT_TWO:
130  break;
131  default:
132  break;
133  }
134  if (!AddObject(i, boatid, BG_SA_ObjSpawnlocs[i].GetPositionX(),
135  BG_SA_ObjSpawnlocs[i].GetPositionY(),
136  BG_SA_ObjSpawnlocs[i].GetPositionZ() + (Attackers ? -3.750f: 0),
137  BG_SA_ObjSpawnlocs[i].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY))
138  {
139  TC_LOG_ERROR("bg.battleground", "SOTA: couldn't spawn one of the BG_SA_BOAT, Entry: %u", boatid);
140  continue;
141  }
142  }
143 
144  for (uint8 i = BG_SA_SIGIL_1; i <= BG_SA_LEFT_FLAGPOLE; i++)
145  {
146  if (!AddObject(i, BG_SA_ObjEntries[i], BG_SA_ObjSpawnlocs[i], 0, 0, 0, 0, RESPAWN_ONE_DAY))
147  {
148  TC_LOG_ERROR("bg.battleground", "SOTA: couldn't spawn Sigil, Entry: %u", BG_SA_ObjEntries[i]);
149  continue;
150  }
151  }
152 
153  // MAD props for Kiper for discovering those values - 4 hours of his work.
158 
159  //Cannons and demolishers - NPCs are spawned
160  //By capturing GYs.
161  for (uint8 i = 0; i < BG_SA_DEMOLISHER_5; i++)
162  {
164  {
165  TC_LOG_ERROR("bg.battleground", "SOTA: couldn't spawn Cannon or demolisher, Entry: %u, Attackers: %s", BG_SA_NpcEntries[i], Attackers == TEAM_ALLIANCE ? "Horde(1)" : "Alliance(0)");
166  continue;
167  }
168  }
169 
171  DemolisherStartState(true);
172 
173  for (uint8 i = 0; i <= BG_SA_PORTAL_DEFFENDER_RED; i++)
174  {
176  GetBGObject(i)->SetFaction(defF);
177  }
178 
181 
182  TotalTime = 0;
183  ShipsStarted = false;
184 
185  //Graveyards
186  for (uint8 i = 0; i < BG_SA_MAX_GY; i++)
187  {
188  WorldSafeLocsEntry const* sg = NULL;
189  sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
190 
191  if (!sg)
192  {
193  TC_LOG_ERROR("bg.battleground", "SOTA: Can't find GY entry %u", BG_SA_GYEntries[i]);
194  return false;
195  }
196 
197  if (i == BG_SA_BEACH_GY)
198  {
200  AddSpiritGuide(i + BG_SA_MAXNPC, sg->Loc.X, sg->Loc.Y, sg->Loc.Z, BG_SA_GYOrientation[i], Attackers);
201  }
202  else
203  {
205  if (!AddSpiritGuide(i + BG_SA_MAXNPC, sg->Loc.X, sg->Loc.Y, sg->Loc.Z, BG_SA_GYOrientation[i], Attackers == TEAM_HORDE ? TEAM_ALLIANCE : TEAM_HORDE))
206  TC_LOG_ERROR("bg.battleground", "SOTA: couldn't spawn GY: %u", i);
207  }
208  }
209 
210  //GY capture points
211  for (uint8 i = BG_SA_CENTRAL_FLAG; i <= BG_SA_LEFT_FLAG; i++)
212  {
213  if (!AddObject(i, (BG_SA_ObjEntries[i] - (Attackers == TEAM_ALLIANCE ? 1 : 0)), BG_SA_ObjSpawnlocs[i], 0, 0, 0, 0, RESPAWN_ONE_DAY))
214  {
215  TC_LOG_ERROR("bg.battleground", "SOTA: couldn't spawn Central Flag Entry: %u", BG_SA_ObjEntries[i] - (Attackers == TEAM_ALLIANCE ? 1 : 0));
216  continue;
217  }
218  GetBGObject(i)->SetFaction(atF);
219  }
220 
222 
223  for (uint8 i = BG_SA_BOMB; i < BG_SA_MAXOBJ; i++)
224  {
226  {
227  TC_LOG_ERROR("bg.battleground", "SOTA: couldn't spawn SA Bomb Entry: %u", BG_SA_ObjEntries[BG_SA_BOMB] + i);
228  continue;
229  }
230  GetBGObject(i)->SetFaction(atF);
231  }
232 
233  //Player may enter BEFORE we set up BG - lets update his worldstates anyway...
237 
241 
242  if (Attackers == TEAM_ALLIANCE)
243  {
246 
251 
254  }
255  else
256  {
259 
264 
267  }
268 
275 
276  for (int i = BG_SA_BOAT_ONE; i <= BG_SA_BOAT_TWO; i++)
277  for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
278  if (Player* player = ObjectAccessor::FindPlayer(itr->first))
279  SendTransportInit(player);
280 
281  // set status manually so preparation is cast correctly in 2nd round too
283 
284  TeleportPlayers();
285  return true;
286 }
Definition: BattlegroundSA.h:198
Definition: Battleground.h:129
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)
Definition: Battleground.cpp:1446
float Z
Definition: DBCEnums.h:36
Definition: BattlegroundSA.h:164
Definition: BattlegroundSA.h:41
bool ShipsStarted
For know if boats has start moving or not yet.
Definition: BattlegroundSA.h:673
float Y
Definition: DBCEnums.h:35
DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore(WorldSafeLocsfmt)
Definition: BattlegroundSA.h:210
virtual bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, TeamId teamId=TEAM_NEUTRAL)
Definition: Battleground.cpp:1676
Definition: BattlegroundSA.h:298
#define MAX_GATES
Definition: BattlegroundSA.h:494
uint32 const BG_SA_Factions[2]
Definition: BattlegroundSA.h:451
Definition: BattlegroundSA.h:282
Definition: BattlegroundSA.h:288
Definition: BattlegroundSA.h:302
Definition: BattlegroundSA.h:300
Definition: BattlegroundSA.h:169
Definition: BattlegroundSA.h:171
Definition: BattlegroundSA.h:176
void SendTransportsRemove(Player *player)
Send packet to player for destroy boats (client part)
Definition: BattlegroundSA.cpp:1022
Definition: BattlegroundSA.h:158
virtual Creature * AddCreature(uint32 entry, uint32 type, float x, float y, float z, float o, TeamId teamId=TEAM_NEUTRAL, uint32 respawntime=0, Transport *transport=NULL)
Definition: Battleground.cpp:1580
Definition: BattlegroundSA.h:211
GameObject * GetBGObject(uint32 type, bool logError=true)
Definition: Battleground.cpp:1534
Definition: BattlegroundSA.h:287
Definition: DBCStructure.h:1434
arena_t NULL
Definition: jemalloc_internal.h:624
uint32 const BG_SA_ObjEntries[BG_SA_MAXOBJ+BG_SA_FLAG_AMOUNT]
Definition: BattlegroundSA.h:421
void SpawnBGObject(uint32 type, uint32 respawntime)
Definition: Battleground.cpp:1564
void UpdateObjectInteractionFlags()
Definition: BattlegroundSA.cpp:767
Definition: BattlegroundSA.h:289
void Refresh()
Definition: GameObject.cpp:710
BattlegroundPlayerMap const & GetPlayers() const
Definition: Battleground.h:331
bool DelObject(uint32 type)
Definition: Battleground.cpp:1658
Definition: BattlegroundSA.h:212
Definition: BattlegroundSA.h:459
Definition: BattlegroundSA.h:205
Definition: BattlegroundSA.h:301
uint32 TotalTime
Totale elapsed time of current round.
Definition: BattlegroundSA.h:669
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
Definition: BattlegroundSA.h:172
Definition: Battleground.h:158
const uint32 BG_SA_GYEntries[BG_SA_MAX_GY]
Definition: BattlegroundSA.h:467
Definition: BattlegroundSA.h:170
Definition: BattlegroundSA.h:177
Definition: BattlegroundSA.h:166
Definition: BattlegroundSA.h:159
Definition: BattlegroundSA.h:464
Definition: BattlegroundSA.h:175
void DemolisherStartState(bool start)
Set selectable or not demolisher, called on battle start, when boats arrive to dock.
Definition: BattlegroundSA.cpp:666
uint32_t uint32
Definition: Define.h:150
Position const BG_SA_NpcSpawnlocs[BG_SA_MAXNPC]
Definition: BattlegroundSA.h:245
Definition: BattlegroundSA.h:173
Definition: BattlegroundSA.h:213
Definition: BattlegroundSA.h:461
Definition: SharedDefines.h:992
Definition: Battleground.h:128
void SendTransportInit(Player *player)
Send packet to player for create boats (client part)
Definition: BattlegroundSA.cpp:1005
float X
Definition: DBCEnums.h:34
DBCPosition3D Loc
Definition: DBCStructure.h:1438
BG_SA_GateState GateStatus[MAX_GATES]
Status of each gate (Destroy/Damage/Intact)
Definition: BattlegroundSA.h:675
TeamId Attackers
Id of attacker team.
Definition: BattlegroundSA.h:666
TeamId GraveyardStatus[BG_SA_MAX_GY]
Team witch conntrol each graveyard.
Definition: BattlegroundSA.h:679
Definition: BattlegroundSA.h:463
float const BG_SA_GYOrientation[BG_SA_MAX_GY]
Definition: BattlegroundSA.h:476
Definition: BattlegroundSA.h:290
bool DelCreature(uint32 type)
Definition: Battleground.cpp:1640
void OverrideGunFaction()
Called on start and between the two round -Update faction of all vehicle.
Definition: BattlegroundSA.cpp:648
uint32 const BG_SA_NpcEntries[BG_SA_MAXNPC]
Definition: BattlegroundSA.h:216
Definition: BattlegroundSA.h:462
Definition: BattlegroundSA.h:204
Definition: BattlegroundSA.h:168
uint8_t uint8
Definition: Define.h:152
Definition: BattlegroundSA.h:160
void TeleportPlayers()
Called between the two round -Teleport all players to good location.
Definition: BattlegroundSA.cpp:497
Definition: BattlegroundSA.h:163
void UpdateWorldState(uint32 variable, uint32 value, bool hidden=false)
Definition: Battleground.cpp:735
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: BattlegroundSA.h:165
Definition: BattlegroundSA.h:174
Definition: SharedDefines.h:993
Definition: BattlegroundSA.h:162
void SetStatus(BattlegroundStatus Status)
Definition: Battleground.h:295
Definition: BattlegroundSA.h:167
void SetFaction(uint32 faction)
Definition: GameObject.h:1068
Definition: BattlegroundSA.h:161
Position const BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ]
Definition: BattlegroundSA.h:305
void UpdateRotationFields(float rotation2=0.0f, float rotation3=0.0f)
Definition: GameObject.cpp:1943
Definition: BattlegroundSA.h:297

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void BattlegroundSA::SendTime ( )
private

Update timer worldstate.

724 {
725  uint32 end_of_round = (EndRoundTimer - TotalTime);
726  UpdateWorldState(BG_SA_TIMER_MINS, end_of_round/60000);
727  UpdateWorldState(BG_SA_TIMER_SEC_TENS, (end_of_round%60000)/10000);
728  UpdateWorldState(BG_SA_TIMER_SEC_DECS, ((end_of_round%60000)%10000)/1000);
729 }
Definition: BattlegroundSA.h:156
Definition: BattlegroundSA.h:157
uint32 EndRoundTimer
Max time of round.
Definition: BattlegroundSA.h:671
uint32 TotalTime
Totale elapsed time of current round.
Definition: BattlegroundSA.h:669
uint32_t uint32
Definition: Define.h:150
void UpdateWorldState(uint32 variable, uint32 value, bool hidden=false)
Definition: Battleground.cpp:735
Definition: BattlegroundSA.h:155

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void BattlegroundSA::SendTransportInit ( Player player)
private

Send packet to player for create boats (client part)

1006 {
1007  if (!BgObjects[BG_SA_BOAT_ONE].IsEmpty() || !BgObjects[BG_SA_BOAT_TWO].IsEmpty())
1008  {
1009  UpdateData transData(player->GetMapId());
1010  if (!BgObjects[BG_SA_BOAT_ONE].IsEmpty())
1012 
1013  if (!BgObjects[BG_SA_BOAT_TWO].IsEmpty())
1015 
1016  WorldPacket packet;
1017  transData.BuildPacket(&packet);
1018  player->SendDirectMessage(&packet);
1019  }
1020 }
Definition: BattlegroundSA.h:288
GameObject * GetBGObject(uint32 type, bool logError=true)
Definition: Battleground.cpp:1534
Definition: BattlegroundSA.h:289
Definition: UpdateData.h:59
GuidVector BgObjects
Definition: Battleground.h:452
virtual void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const
Definition: Object.cpp:167
Definition: WorldPacket.h:26

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void BattlegroundSA::SendTransportsRemove ( Player player)
private

Send packet to player for destroy boats (client part)

1023 {
1024  if (!BgObjects[BG_SA_BOAT_ONE].IsEmpty() || !BgObjects[BG_SA_BOAT_TWO].IsEmpty())
1025  {
1026  UpdateData transData(player->GetMapId());
1027  if (!BgObjects[BG_SA_BOAT_ONE].IsEmpty())
1029  if (!BgObjects[BG_SA_BOAT_TWO].IsEmpty())
1031  WorldPacket packet;
1032  transData.BuildPacket(&packet);
1033  player->SendDirectMessage(&packet);
1034  }
1035 }
Definition: BattlegroundSA.h:288
GameObject * GetBGObject(uint32 type, bool logError=true)
Definition: Battleground.cpp:1534
Definition: BattlegroundSA.h:289
Definition: UpdateData.h:59
GuidVector BgObjects
Definition: Battleground.h:452
void BuildOutOfRangeUpdateBlock(UpdateData *data) const
Definition: Object.cpp:278
Definition: WorldPacket.h:26

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool BattlegroundSA::SetupBattleground ( )
overridevirtual

Called for ini battleground, after that the first player be entered.

Reimplemented from Battleground.

80 {
81  return ResetObjs();
82 }
bool ResetObjs()
Called on setup and between the two round -Delete all gameobject / creature -Respawn all gameobject /...
Definition: BattlegroundSA.cpp:84

+ Here is the call graph for this function:

void BattlegroundSA::StartingEventCloseDoors ( )
overridevirtual

Called when battle start.

Reimplemented from Battleground.

434 { }
void BattlegroundSA::StartingEventOpenDoors ( )
overridevirtual

Reimplemented from Battleground.

436 { }
void BattlegroundSA::StartShips ( )
private

Called for start ship movement.

289 {
290  if (ShipsStarted)
291  return;
292 
295 
296  for (int i = BG_SA_BOAT_ONE; i <= BG_SA_BOAT_TWO; i++)
297  {
298  for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
299  {
300  if (Player* p = ObjectAccessor::FindPlayer(itr->first))
301  {
302  UpdateData data(p->GetMapId());
303  WorldPacket pkt;
305  data.BuildPacket(&pkt);
306  p->SendDirectMessage(&pkt);
307  }
308  }
309  }
310  ShipsStarted = true;
311 }
bool ShipsStarted
For know if boats has start moving or not yet.
Definition: BattlegroundSA.h:673
Definition: BattlegroundSA.h:288
void BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) const
Definition: Object.cpp:265
GameObject * GetBGObject(uint32 type, bool logError=true)
Definition: Battleground.cpp:1534
Definition: BattlegroundSA.h:289
BattlegroundPlayerMap const & GetPlayers() const
Definition: Battleground.h:331
Definition: UpdateData.h:59
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
void DoorOpen(uint32 type)
Definition: Battleground.cpp:1522
Definition: WorldPacket.h:26

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void BattlegroundSA::TeleportPlayers ( )
private

Called between the two round -Teleport all players to good location.

498 {
499  for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
500  {
501  if (Player* player = ObjectAccessor::FindPlayer(itr->first))
502  {
503  // should remove spirit of redemption
504  if (player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
505  player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
506 
507  if (!player->IsAlive())
508  {
509  player->ResurrectPlayer(1.0f);
510  player->SpawnCorpseBones();
511  }
512 
513  player->ResetAllPowers();
514  player->CombatStopWithPets(true);
515 
516  player->CastSpell(player, SPELL_PREPARATION, true);
517 
519  }
520  }
521 }
BattlegroundPlayerMap const & GetPlayers() const
Definition: Battleground.h:331
void TeleportToEntrancePosition(Player *player)
Definition: BattlegroundSA.cpp:523
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
Definition: SpellAuraDefines.h:236
Definition: SpellAuraDefines.h:96
Definition: Battleground.h:111

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void BattlegroundSA::TeleportToEntrancePosition ( Player player)
private
524 {
525  if (player->GetTeamId() == Attackers)
526  {
527  if (!ShipsStarted)
528  {
529  // player->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
530 
531  if (urand(0, 1))
532  player->TeleportTo(607, 2682.936f, -830.368f, 15.0f, 2.895f, 0);
533  else
534  player->TeleportTo(607, 2577.003f, 980.261f, 15.0f, 0.807f, 0);
535  }
536  else
537  player->TeleportTo(607, 1600.381f, -106.263f, 8.8745f, 3.78f, 0);
538  }
539  else
540  player->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
541 }
bool ShipsStarted
For know if boats has start moving or not yet.
Definition: BattlegroundSA.h:673
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
TeamId Attackers
Id of attacker team.
Definition: BattlegroundSA.h:666

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void BattlegroundSA::TitanRelicActivated ( Player clicker)

Called when a player clicked on relic.

888 {
889  if (!clicker)
890  return;
891 
893  {
894  if (clicker->GetTeamId() == Attackers)
895  {
896  if (clicker->GetTeamId() == TEAM_ALLIANCE)
898  else
900 
901  if (Status == BG_SA_ROUND_ONE)
902  {
905  // Achievement Storm the Beach (1310)
906  for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
907  {
908  if (Player* player = ObjectAccessor::FindPlayer(itr->first))
909  if (player->GetTeamId() == Attackers)
910  player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246);
911  }
912 
915  TotalTime = 0;
916  ToggleTimer();
917 
920 
921  UpdateWaitTimer = 5000;
922  SignaledRoundTwo = false;
923  SignaledRoundTwoHalfMin = false;
924  InitSecondRound = true;
925  ResetObjs();
929  }
930  else if (Status == BG_SA_ROUND_TWO)
931  {
934  ToggleTimer();
935  // Achievement Storm the Beach (1310)
936  for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
937  {
938  if (Player* player = ObjectAccessor::FindPlayer(itr->first))
939  if (player->GetTeamId() == Attackers && RoundScores[1].winner == Attackers)
940  player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246);
941  }
942 
943  if (RoundScores[0].time == RoundScores[1].time)
944  EndBattleground(0);
945  else if (RoundScores[0].time < RoundScores[1].time)
947  else
949  }
950  }
951  }
952 }
void UpdateAreaDependentAuras()
Definition: Map.cpp:3968
Definition: BattlegroundSA.h:282
bool ResetObjs()
Called on setup and between the two round -Delete all gameobject / creature -Respawn all gameobject /...
Definition: BattlegroundSA.cpp:84
BG_SA_RoundScore RoundScores[2]
Score of each round.
Definition: BattlegroundSA.h:681
Definition: Language.h:1193
Definition: BattlegroundSA.h:73
Definition: BattlegroundSA.h:127
BattlegroundMap * GetBgMap() const
Definition: Battleground.h:356
BG_SA_Status Status
Statu of battle (Start or not, and what round)
Definition: BattlegroundSA.h:677
Definition: Creature.h:467
BattlegroundPlayerMap const & GetPlayers() const
Definition: Battleground.h:331
uint32 UpdateWaitTimer
5secs before starting the 1min countdown for second round
Definition: BattlegroundSA.h:685
uint32 TotalTime
Totale elapsed time of current round.
Definition: BattlegroundSA.h:669
Definition: SharedDefines.h:1000
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
void SendMessageToAll(uint32 entry, ChatMsg type, Player const *source=NULL)
Definition: Battleground.cpp:1706
Definition: Language.h:1194
Definition: SharedDefines.h:4267
void CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
Definition: Battleground.cpp:695
bool SignaledRoundTwo
for know if warning about second round start has been sent
Definition: BattlegroundSA.h:687
Definition: SharedDefines.h:992
bool SignaledRoundTwoHalfMin
for know if warning about second round start has been sent
Definition: BattlegroundSA.h:689
void SendChatMessage(Creature *source, uint8 textId, WorldObject *target=NULL)
Definition: Battleground.cpp:676
TeamId Attackers
Id of attacker team.
Definition: BattlegroundSA.h:666
Definition: SharedDefines.h:999
Definition: BattlegroundSA.h:34
bool InitSecondRound
for know if second round has been init
Definition: BattlegroundSA.h:691
Definition: BattlegroundSA.h:33
TeamId winner
Definition: BattlegroundSA.h:507
Definition: BattlegroundSA.h:35
Definition: BattlegroundSA.h:204
void EndBattleground(uint32 winner) override
Called on battleground ending.
Definition: BattlegroundSA.cpp:960
bool CanInteractWithObject(uint32 objectId)
Checks if a player can interact with the given object.
Definition: BattlegroundSA.cpp:731
uint32 time
Definition: BattlegroundSA.h:508
Creature * GetBGCreature(uint32 type, bool logError=true)
Definition: Battleground.cpp:1549
void ToggleTimer()
Switch on/off timer worldstate.
Definition: BattlegroundSA.cpp:954
Definition: SharedDefines.h:993

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void BattlegroundSA::ToggleTimer ( )
private

Switch on/off timer worldstate.

955 {
958 }
bool TimerEnabled
used for know we are in timer phase or not (used for worldstate update)
Definition: BattlegroundSA.h:683
Definition: BattlegroundSA.h:179
void UpdateWorldState(uint32 variable, uint32 value, bool hidden=false)
Definition: Battleground.cpp:735

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void BattlegroundSA::UpdateDemolisherSpawns ( )
private

Respawn dead demolisher.

976 {
977  for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_8; i++)
978  {
979  if (!BgCreatures[i].IsEmpty())
980  {
981  if (Creature* Demolisher = GetBGCreature(i))
982  {
983  if (Demolisher->isDead())
984  {
985  // Demolisher is not in list
986  if (DemoliserRespawnList.find(i) == DemoliserRespawnList.end())
987  {
988  DemoliserRespawnList[i] = getMSTime()+30000;
989  }
990  else
991  {
992  if (DemoliserRespawnList[i] < getMSTime())
993  {
994  Demolisher->Relocate(BG_SA_NpcSpawnlocs[i]);
995  Demolisher->Respawn();
996  DemoliserRespawnList.erase(i);
997  }
998  }
999  }
1000  }
1001  }
1002  }
1003 }
uint32 getMSTime()
Definition: Timer.h:24
Definition: Creature.h:467
Definition: BattlegroundSA.h:201
std::map< uint32, uint32 > DemoliserRespawnList
Definition: BattlegroundSA.h:692
GuidVector BgCreatures
Definition: Battleground.h:453
Position const BG_SA_NpcSpawnlocs[BG_SA_MAXNPC]
Definition: BattlegroundSA.h:245
Definition: BattlegroundSA.h:194
uint8_t uint8
Definition: Define.h:152
Creature * GetBGCreature(uint32 type, bool logError=true)
Definition: Battleground.cpp:1549

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void BattlegroundSA::UpdateObjectInteractionFlags ( uint32  objectId)
private

Updates interaction flags of specific objects.

757 {
758  if (GameObject* go = GetBGObject(objectId))
759  {
760  if (CanInteractWithObject(objectId))
761  go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
762  else
764  }
765 }
Definition: SharedDefines.h:2125
GameObject * GetBGObject(uint32 type, bool logError=true)
Definition: Battleground.cpp:1534
Definition: GameObject.h:880
Definition: UpdateFields.h:319
bool CanInteractWithObject(uint32 objectId)
Checks if a player can interact with the given object.
Definition: BattlegroundSA.cpp:731

+ Here is the call graph for this function:

void BattlegroundSA::UpdateObjectInteractionFlags ( )
private
768 {
769  for (uint8 i = BG_SA_CENTRAL_FLAG; i <= BG_SA_LEFT_FLAG; ++i)
772 }
Definition: BattlegroundSA.h:298
Definition: BattlegroundSA.h:282
Definition: BattlegroundSA.h:300
void UpdateObjectInteractionFlags()
Definition: BattlegroundSA.cpp:767
uint8_t uint8
Definition: Define.h:152

+ Here is the caller graph for this function:

Member Data Documentation

bool BattlegroundSA::_allVehiclesAlive[BG_TEAMS_COUNT]
private
bool BattlegroundSA::_gateDestroyed
private
TeamId BattlegroundSA::Attackers
private

Id of attacker team.

std::map<uint32, uint32> BattlegroundSA::DemoliserRespawnList
private
uint32 BattlegroundSA::EndRoundTimer
private

Max time of round.

BG_SA_GateState BattlegroundSA::GateStatus[MAX_GATES]
private

Status of each gate (Destroy/Damage/Intact)

TeamId BattlegroundSA::GraveyardStatus[BG_SA_MAX_GY]
private

Team witch conntrol each graveyard.

bool BattlegroundSA::InitSecondRound
private

for know if second round has been init

BG_SA_RoundScore BattlegroundSA::RoundScores[2]
private

Score of each round.

bool BattlegroundSA::ShipsStarted
private

For know if boats has start moving or not yet.

bool BattlegroundSA::SignaledRoundTwo
private

for know if warning about second round start has been sent

bool BattlegroundSA::SignaledRoundTwoHalfMin
private

for know if warning about second round start has been sent

BG_SA_Status BattlegroundSA::Status
private

Statu of battle (Start or not, and what round)

bool BattlegroundSA::TimerEnabled
private

used for know we are in timer phase or not (used for worldstate update)

uint32 BattlegroundSA::TotalTime
private

Totale elapsed time of current round.

uint32 BattlegroundSA::UpdateWaitTimer
private

5secs before starting the 1min countdown for second round


The documentation for this class was generated from the following files: