129 int points = team_points[team];
233 if (!isInBattleground)
288 uint8 obj = node*8 + type + teamIndex;
301 uint8 obj = node*8 + type + teamIndex;
313 const uint8 plusArray[] = {0, 2, 3, 0, 1};
325 int32 ally = 0, horde = 0;
348 const uint8 plusArray[] = {0, 2, 3, 0, 1};
358 uint8 ally = 0, horde = 0;
372 TC_LOG_ERROR(
"bg.battleground",
"Failed to spawn spirit guide! point: {}, team: {}, ", node, team);
377 uint8 capturedNodes = 0;
382 if (capturedNodes >= 5)
384 if (capturedNodes >= 4)
543 uint8 ally = 0, horde = 0;
552 else if (horde > ally)
572 TC_LOG_ERROR(
"sql.sql",
"BatteGroundAB: Failed to spawn some object Battleground not created!");
577 if (!
AddObject(
BG_AB_OBJECT_GATE_A,
BG_AB_OBJECTID_GATE_A,
BG_AB_DoorPositions[0][0],
BG_AB_DoorPositions[0][1],
BG_AB_DoorPositions[0][2],
BG_AB_DoorPositions[0][3],
BG_AB_DoorPositions[0][4],
BG_AB_DoorPositions[0][5],
BG_AB_DoorPositions[0][6],
BG_AB_DoorPositions[0][7],
RESPAWN_IMMEDIATELY)
578 || !
AddObject(
BG_AB_OBJECT_GATE_H,
BG_AB_OBJECTID_GATE_H,
BG_AB_DoorPositions[1][0],
BG_AB_DoorPositions[1][1],
BG_AB_DoorPositions[1][2],
BG_AB_DoorPositions[1][3],
BG_AB_DoorPositions[1][4],
BG_AB_DoorPositions[1][5],
BG_AB_DoorPositions[1][6],
BG_AB_DoorPositions[1][7],
RESPAWN_IMMEDIATELY))
580 TC_LOG_ERROR(
"sql.sql",
"BatteGroundAB: Failed to spawn door object Battleground not created!");
587 if (!
AddObject(
BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i,
Buff_Entries[0],
BG_AB_BuffPositions[i][0],
BG_AB_BuffPositions[i][1],
BG_AB_BuffPositions[i][2],
BG_AB_BuffPositions[i][3], 0, 0, std::sin(
BG_AB_BuffPositions[i][3]/2), std::cos(
BG_AB_BuffPositions[i][3]/2),
RESPAWN_ONE_DAY)
588 || !
AddObject(
BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1,
Buff_Entries[1],
BG_AB_BuffPositions[i][0],
BG_AB_BuffPositions[i][1],
BG_AB_BuffPositions[i][2],
BG_AB_BuffPositions[i][3], 0, 0, std::sin(
BG_AB_BuffPositions[i][3]/2), std::cos(
BG_AB_BuffPositions[i][3]/2),
RESPAWN_ONE_DAY)
589 || !
AddObject(
BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2,
Buff_Entries[2],
BG_AB_BuffPositions[i][0],
BG_AB_BuffPositions[i][1],
BG_AB_BuffPositions[i][2],
BG_AB_BuffPositions[i][3], 0, 0, std::sin(
BG_AB_BuffPositions[i][3]/2), std::cos(
BG_AB_BuffPositions[i][3]/2),
RESPAWN_ONE_DAY))
590 TC_LOG_ERROR(
"sql.sql",
"BatteGroundAB: Failed to spawn buff object!");
648 std::vector<uint8> nodes;
650 if (
m_Nodes[i] == teamIndex + 3)
660 float mindist = 999999.0f;
661 for (
uint8 i = 0; i < nodes.size(); ++i)
666 float dist = (entry->
Loc.
X - plr_x)*(entry->
Loc.
X - plr_x)+(entry->
Loc.
Y - plr_y)*(entry->
Loc.
Y - plr_y);
Position const BG_AB_NodePositions[BG_AB_DYNAMIC_NODES_COUNT]
#define BG_AB_ABBGWeekendReputationTicks
const uint32 BG_AB_TickPoints[6]
Position const BG_AB_SpiritGuidePos[BG_AB_ALL_NODES_COUNT]
@ BG_AB_OBJECT_BANNER_HORDE
@ BG_AB_OBJECT_BANNER_ALLY
@ BG_AB_OBJECT_AURA_HORDE
@ BG_AB_OBJECT_BANNER_NEUTRAL
@ BG_AB_OBJECT_BANNER_CONT_H
@ BG_AB_OBJECT_SPEEDBUFF_STABLES
@ BG_AB_OBJECT_BANNER_CONT_A
@ BG_AB_OBJECT_AURA_CONTESTED
#define AB_EVENT_START_BATTLE
const float BG_AB_BuffPositions[BG_AB_DYNAMIC_NODES_COUNT][4]
@ BG_AB_TEXT_ALLIANCE_NEAR_VICTORY
@ BG_AB_TEXT_HORDE_NEAR_VICTORY
@ BG_AB_NODE_TYPE_OCCUPIED
@ BG_AB_NODE_STATUS_ALLY_CONTESTED
@ BG_AB_NODE_STATUS_ALLY_OCCUPIED
@ BG_AB_NODE_STATUS_HORDE_OCCUPIED
@ BG_AB_NODE_STATUS_HORDE_CONTESTED
@ BG_AB_NODE_TYPE_NEUTRAL
@ BG_AB_NODE_TYPE_CONTESTED
const uint32 BG_AB_TickIntervals[6]
ABNodeInfo const ABNodes[BG_AB_DYNAMIC_NODES_COUNT]
const float BG_AB_DoorPositions[2][8]
const uint32 BG_AB_GraveyardIds[BG_AB_ALL_NODES_COUNT]
@ BG_AB_OBJECTID_BANNER_CONT_A
@ BG_AB_OBJECTID_BANNER_A
@ BG_AB_OBJECTID_BANNER_H
@ BG_AB_OBJECTID_BANNER_CONT_H
@ BG_AB_DYNAMIC_NODES_COUNT
#define BG_AB_NotABBGWeekendReputationTicks
#define BG_AB_NotABBGWeekendHonorTicks
const uint32 BG_AB_OP_NODEICONS[5]
@ BG_AB_OBJECTID_NODE_BANNER_0
@ BG_AB_FLAG_CAPTURING_TIME
#define BG_AB_ABBGWeekendHonorTicks
@ AB_OBJECTIVE_ASSAULT_BASE
@ AB_OBJECTIVE_DEFEND_BASE
const uint32 BG_AB_OP_NODESTATES[5]
@ BG_AB_OP_RESOURCES_ALLY
@ BG_AB_OP_OCCUPIED_BASES_HORDE
@ BG_AB_OP_RESOURCES_HORDE
@ BG_AB_OP_RESOURCES_WARNING
@ BG_AB_OP_OCCUPIED_BASES_ALLY
@ BG_AB_WARNING_NEAR_VICTORY_SCORE
@ BG_AB_SOUND_NEAR_VICTORY_ALLIANCE
@ BG_AB_SOUND_NODE_CAPTURED_HORDE
@ BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE
@ BG_AB_SOUND_NODE_ASSAULTED_HORDE
@ BG_AB_SOUND_NEAR_VICTORY_HORDE
@ BG_AB_SOUND_NODE_CLAIMED
@ BG_AB_SOUND_NODE_CAPTURED_ALLIANCE
@ BG_CRITERIA_CHECK_RESILIENT_VICTORY
const uint32 Buff_Entries[3]
@ SPELL_HONORABLE_DEFENDER_25Y
@ SPELL_AB_QUEST_REWARD_4_BASES
@ SPELL_AB_QUEST_REWARD_5_BASES
@ ACHIEVEMENT_TIMED_TYPE_EVENT
@ ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE
DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore(WorldSafeLocsEntryfmt)
#define TC_LOG_ERROR(filterType__,...)
uint32 urand(uint32 min, uint32 max)
uint8 constexpr PVP_TEAMS_COUNT
@ CHAT_MSG_BG_SYSTEM_ALLIANCE
@ CHAT_MSG_BG_SYSTEM_HORDE
@ CHAT_MSG_BG_SYSTEM_NEUTRAL
@ FACTION_ALLIANCE_GENERIC
@ AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT
void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates &packet) override
WorldSafeLocsEntry const * GetClosestGraveyard(Player *player) override
void _NodeOccupied(uint8 node, Team team)
bool m_TeamScores500Disadvantage[PVP_TEAMS_COUNT]
bool IsAllNodesControlledByTeam(uint32 team) const override
void StartingEventOpenDoors() override
void StartingEventCloseDoors() override
void EventPlayerClickedOnFlag(Player *source, GameObject *target_obj) override
uint32 GetPrematureWinner() override
bool SetupBattleground() override
void RemovePlayer(Player *player, ObjectGuid guid, uint32 team) override
void _SendNodeUpdate(uint8 node)
uint32 m_NodeTimers[BG_AB_DYNAMIC_NODES_COUNT]
uint8 m_Nodes[BG_AB_DYNAMIC_NODES_COUNT]
uint32 m_HonorScoreTics[PVP_TEAMS_COUNT]
bool CheckAchievementCriteriaMeet(uint32, Player const *, Unit const *=nullptr, uint32=0) override
void HandleAreaTrigger(Player *Source, uint32 Trigger) override
bool m_IsInformedNearVictory
void _CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay)
void _DelBanner(uint8 node, uint8 type, uint8 teamIndex)
uint32 m_ReputationScoreTics[PVP_TEAMS_COUNT]
void PostUpdateImpl(uint32 diff) override
Post-update hook.
uint8 m_prevNodes[BG_AB_DYNAMIC_NODES_COUNT]
bool UpdatePlayerScore(Player *player, uint32 type, uint32 value, bool doAddHonor=true) override
uint32 m_lastTick[PVP_TEAMS_COUNT]
void _NodeDeOccupied(uint8 node)
void AddPlayer(Player *player) override
BG_AB_BannerTimer m_BannerTimers[BG_AB_DYNAMIC_NODES_COUNT]
void EndBattleground(uint32 winner) override
virtual void AddPlayer(Player *player)
BattlegroundTypeId GetTypeID(bool GetRandom=false) const
virtual void EndBattleground(uint32 winner)
virtual Creature * AddCreature(uint32 entry, uint32 type, float x, float y, float z, float o, TeamId teamId=TEAM_NEUTRAL, uint32 respawntime=0, Transport *transport=nullptr)
void RelocateDeadPlayers(ObjectGuid guideGuid)
Relocate all players in ReviveQueue to the closest graveyard.
void CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
static TeamId GetTeamIndexByTeamId(uint32 Team)
void DoorOpen(uint32 type)
bool DelCreature(uint32 type)
void SpawnBGObject(uint32 type, uint32 respawntime)
virtual bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime=0, GOState goState=GO_STATE_READY)
Creature * GetBGCreature(uint32 type, bool logError=true)
BattlegroundMap * GetBgMap() const
virtual bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, TeamId teamId=TEAM_NEUTRAL)
void DoorClose(uint32 type)
int32 m_TeamScores[PVP_TEAMS_COUNT]
bool IsPlayerInBattleground(ObjectGuid guid) const
void SendBroadcastText(uint32 id, ChatMsg msgType, WorldObject const *target=nullptr)
BattlegroundScoreMap PlayerScores
void RewardHonorToTeam(uint32 Honor, uint32 TeamID)
BattlegroundStatus GetStatus() const
virtual bool UpdatePlayerScore(Player *player, uint32 type, uint32 value, bool doAddHonor=true)
virtual void HandleAreaTrigger(Player *, uint32)
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
virtual bool CheckAchievementCriteriaMeet(uint32, Player const *, Unit const *=nullptr, uint32=0)
void UpdateWorldState(uint32 variable, uint32 value)
uint32 GetBonusHonorFromKill(uint32 kills) const
void RewardReputationToTeam(uint32 faction_id, uint32 Reputation, uint32 TeamID)
void PlaySoundToAll(uint32 soundID)
virtual uint32 GetPrematureWinner()
GameObject * GetGameObject(ObjectGuid const &guid)
static ObjectGuid GetGUID(Object const *o)
void LeaveBattleground(bool teleportToEntryPoint=true, bool withoutDeserterDebuff=false)
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, WorldObject *ref=nullptr)
WorldSession * GetSession() const
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0)
void SetFaction(uint32 faction) override
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
std::vector< WorldStateInfo > Worldstates
void SendAreaTriggerMessage(char const *Text,...) ATTR_PRINTF(2
void BuildObjectivesBlock(WorldPackets::Battleground::PVPLogData_Player &playerData) override
float GetPositionX() const
float GetPositionY() const
std::vector< uint32 > Stats