117 int points = team_points[team];
202 uint8 buff = std::rand() % 2;
253 uint8 obj = node * 8 + type + teamIndex;
266 uint8 obj = node * 8 + type + teamIndex;
291 const uint8 plusArray[] = { 0, 2, 3, 0, 1 };
303 uint8 ally = 0, horde = 0;
326 const uint8 plusArray[] = { 0, 2, 3, 0, 1 };
336 uint8 ally = 0, horde = 0;
350 SF_LOG_ERROR(
"bg.battleground",
"Failed to spawn spirit guide! point: %u, team: %u, ", node, team);
355 uint8 capturedNodes = 0;
518 uint8 ally = 0, horde = 0;
527 else if (horde > ally)
537 if (!
AddObject(
GILNEAS_BG_OBJECT_BANNER_NEUTRAL + 8 * i,
GILNEAS_BG_OBJECTID_NODE_BANNER_0 + i,
GILNEAS_BG_NodePositions[i][0],
GILNEAS_BG_NodePositions[i][1],
GILNEAS_BG_NodePositions[i][2],
GILNEAS_BG_NodePositions[i][3], 0, 0, std::sin(
GILNEAS_BG_NodePositions[i][3] / 2), std::cos(
GILNEAS_BG_NodePositions[i][3] / 2),
RESPAWN_ONE_DAY)
538 || !
AddObject(
GILNEAS_BG_OBJECT_BANNER_CONT_A + 8 * i,
GILNEAS_BG_OBJECTID_BANNER_CONT_A,
GILNEAS_BG_NodePositions[i][0],
GILNEAS_BG_NodePositions[i][1],
GILNEAS_BG_NodePositions[i][2],
GILNEAS_BG_NodePositions[i][3], 0, 0, std::sin(
GILNEAS_BG_NodePositions[i][3] / 2), std::cos(
GILNEAS_BG_NodePositions[i][3] / 2),
RESPAWN_ONE_DAY)
539 || !
AddObject(
GILNEAS_BG_OBJECT_BANNER_CONT_H + 8 * i,
GILNEAS_BG_OBJECTID_BANNER_CONT_H,
GILNEAS_BG_NodePositions[i][0],
GILNEAS_BG_NodePositions[i][1],
GILNEAS_BG_NodePositions[i][2],
GILNEAS_BG_NodePositions[i][3], 0, 0, std::sin(
GILNEAS_BG_NodePositions[i][3] / 2), std::cos(
GILNEAS_BG_NodePositions[i][3] / 2),
RESPAWN_ONE_DAY)
540 || !
AddObject(
GILNEAS_BG_OBJECT_BANNER_ALLY + 8 * i,
GILNEAS_BG_OBJECTID_BANNER_A,
GILNEAS_BG_NodePositions[i][0],
GILNEAS_BG_NodePositions[i][1],
GILNEAS_BG_NodePositions[i][2],
GILNEAS_BG_NodePositions[i][3], 0, 0, std::sin(
GILNEAS_BG_NodePositions[i][3] / 2), std::cos(
GILNEAS_BG_NodePositions[i][3] / 2),
RESPAWN_ONE_DAY)
541 || !
AddObject(
GILNEAS_BG_OBJECT_BANNER_HORDE + 8 * i,
GILNEAS_BG_OBJECTID_BANNER_H,
GILNEAS_BG_NodePositions[i][0],
GILNEAS_BG_NodePositions[i][1],
GILNEAS_BG_NodePositions[i][2],
GILNEAS_BG_NodePositions[i][3], 0, 0, std::sin(
GILNEAS_BG_NodePositions[i][3] / 2), std::cos(
GILNEAS_BG_NodePositions[i][3] / 2),
RESPAWN_ONE_DAY)
542 || !
AddObject(
GILNEAS_BG_OBJECT_AURA_ALLY + 8 * i,
GILNEAS_BG_OBJECTID_AURA_A,
GILNEAS_BG_NodePositions[i][0],
GILNEAS_BG_NodePositions[i][1],
GILNEAS_BG_NodePositions[i][2],
GILNEAS_BG_NodePositions[i][3], 0, 0, std::sin(
GILNEAS_BG_NodePositions[i][3] / 2), std::cos(
GILNEAS_BG_NodePositions[i][3] / 2),
RESPAWN_ONE_DAY)
543 || !
AddObject(
GILNEAS_BG_OBJECT_AURA_HORDE + 8 * i,
GILNEAS_BG_OBJECTID_AURA_H,
GILNEAS_BG_NodePositions[i][0],
GILNEAS_BG_NodePositions[i][1],
GILNEAS_BG_NodePositions[i][2],
GILNEAS_BG_NodePositions[i][3], 0, 0, std::sin(
GILNEAS_BG_NodePositions[i][3] / 2), std::cos(
GILNEAS_BG_NodePositions[i][3] / 2),
RESPAWN_ONE_DAY)
544 || !
AddObject(
GILNEAS_BG_OBJECT_AURA_CONTESTED + 8 * i,
GILNEAS_BG_OBJECTID_AURA_C,
GILNEAS_BG_NodePositions[i][0],
GILNEAS_BG_NodePositions[i][1],
GILNEAS_BG_NodePositions[i][2],
GILNEAS_BG_NodePositions[i][3], 0, 0, std::sin(
GILNEAS_BG_NodePositions[i][3] / 2), std::cos(
GILNEAS_BG_NodePositions[i][3] / 2),
RESPAWN_ONE_DAY))
546 SF_LOG_ERROR(
"sql.sql",
"BatteGroundAB: Failed to spawn some object Battleground not created!");
551 if (!
AddObject(
GILNEAS_BG_OBJECT_GATE_A_1,
GILNEAS_BG_OBJECTID_GATE_A_1,
GILNEAS_BG_DoorPositions[0][0],
GILNEAS_BG_DoorPositions[0][1],
GILNEAS_BG_DoorPositions[0][2],
GILNEAS_BG_DoorPositions[0][3],
GILNEAS_BG_DoorPositions[0][4],
GILNEAS_BG_DoorPositions[0][5],
GILNEAS_BG_DoorPositions[0][6],
GILNEAS_BG_DoorPositions[0][7],
RESPAWN_IMMEDIATELY)
552 || !
AddObject(
GILNEAS_BG_OBJECT_GATE_H_1,
GILNEAS_BG_OBJECTID_GATE_H_1,
GILNEAS_BG_DoorPositions[2][0],
GILNEAS_BG_DoorPositions[2][1],
GILNEAS_BG_DoorPositions[2][2],
GILNEAS_BG_DoorPositions[2][3],
GILNEAS_BG_DoorPositions[2][4],
GILNEAS_BG_DoorPositions[2][5],
GILNEAS_BG_DoorPositions[2][6],
GILNEAS_BG_DoorPositions[2][7],
RESPAWN_IMMEDIATELY))
554 SF_LOG_ERROR(
"sql.sql",
"BatteGroundBGF: Failed to spawn door object Battleground not created!");
561 if (!
AddObject(
GILNEAS_BG_OBJECT_SPEEDBUFF_LIGHTHOUSE + 3 * i,
Buff_Entries[0],
GILNEAS_BG_BuffPositions[i][0],
GILNEAS_BG_BuffPositions[i][1],
GILNEAS_BG_BuffPositions[i][2],
GILNEAS_BG_BuffPositions[i][3], 0, 0, sin(
GILNEAS_BG_BuffPositions[i][3] / 2), cos(
GILNEAS_BG_BuffPositions[i][3] / 2),
RESPAWN_ONE_DAY)
562 || !
AddObject(
GILNEAS_BG_OBJECT_SPEEDBUFF_LIGHTHOUSE + 3 * i + 1,
Buff_Entries[1],
GILNEAS_BG_BuffPositions[i][0],
GILNEAS_BG_BuffPositions[i][1],
GILNEAS_BG_BuffPositions[i][2],
GILNEAS_BG_BuffPositions[i][3], 0, 0, sin(
GILNEAS_BG_BuffPositions[i][3] / 2), cos(
GILNEAS_BG_BuffPositions[i][3] / 2),
RESPAWN_ONE_DAY)
563 || !
AddObject(
GILNEAS_BG_OBJECT_SPEEDBUFF_LIGHTHOUSE + 3 * i + 2,
Buff_Entries[2],
GILNEAS_BG_BuffPositions[i][0],
GILNEAS_BG_BuffPositions[i][1],
GILNEAS_BG_BuffPositions[i][2],
GILNEAS_BG_BuffPositions[i][3], 0, 0, sin(
GILNEAS_BG_BuffPositions[i][3] / 2), cos(
GILNEAS_BG_BuffPositions[i][3] / 2),
RESPAWN_ONE_DAY))
564 SF_LOG_ERROR(
"sql.sql",
"BatteGroundBGF: Failed to spawn buff object!");
622 std::vector<uint8> nodes;
624 if (
m_Nodes[i] == teamIndex + 3)
629 if (!nodes.empty()) {
633 float mindist = 999999.0f;
634 for (
uint8 i = 0; i < nodes.size(); ++i) {
638 float dist = (entry->
x - plr_x) * (entry->
x - plr_x) + (entry->
y - plr_y) * (entry->
y - plr_y);
639 if (mindist > dist) {
@ BG_CRITERIA_CHECK_RESILIENT_VICTORY
uint32 const Buff_Entries[3]
@ SPELL_HONORABLE_DEFENDER_25Y
@ BG_STARTING_EVENT_THIRD
@ BG_STARTING_EVENT_SECOND
@ BG_STARTING_EVENT_FIRST
@ BG_STARTING_EVENT_FOURTH
#define GILNEAS_BG_BGWeekendRepTicks
#define GILNEAS_BG_BGWeekendHonorTicks
@ GILNEAS_BG_SOUND_NODE_CAPTURED_HORDE
@ GILNEAS_BG_SOUND_NODE_ASSAULTED_ALLIANCE
@ GILNEAS_BG_SOUND_NODE_CLAIMED
@ GILNEAS_BG_SOUND_NODE_ASSAULTED_HORDE
@ GILNEAS_BG_SOUND_NODE_CAPTURED_ALLIANCE
@ GILNEAS_BG_SOUND_NEAR_VICTORY
const float GILNEAS_BG_BuffPositions[GILNEAS_BG_DYNAMIC_NODES_COUNT][4]
#define BG_EVENT_START_BATTLE
@ GILNEAS_BG_OBJECT_BANNER_NEUTRAL
@ GILNEAS_BG_OBJECT_AURA_CONTESTED
@ GILNEAS_BG_OBJECT_SPEEDBUFF_LIGHTHOUSE
@ GILNEAS_BG_OBJECT_BANNER_HORDE
@ GILNEAS_BG_OBJECT_BANNER_ALLY
@ GILNEAS_BG_OBJECT_GATE_A_1
@ GILNEAS_BG_OBJECT_AURA_HORDE
@ GILNEAS_BG_OBJECT_BANNER_CONT_H
@ GILNEAS_BG_OBJECT_BANNER_CONT_A
@ GILNEAS_BG_OBJECT_AURA_ALLY
@ GILNEAS_BG_OBJECT_GATE_H_1
const float GILNEAS_BG_DoorPositions[4][8]
const uint32 GILNEAS_BG_GraveyardIds[GILNEAS_BG_ALL_NODES_COUNT]
#define GILNEAS_BG_NotBGWeekendHonorTicks
const uint32 GILNEAS_BG_OP_NODESTATES[3]
@ GILNEAS_BG_OBJECTID_NODE_BANNER_0
const float GILNEAS_BG_NodePositions[GILNEAS_BG_DYNAMIC_NODES_COUNT][4]
const uint32 GILNEAS_BG_OP_NODEICONS[3]
const uint32 GILNEAS_BG_TickPoints[4]
@ BG_OBJECTIVE_ASSAULT_BASE
@ BG_OBJECTIVE_DEFEND_BASE
@ GILNEAS_BG_FLAG_CAPTURING_TIME
const float GILNEAS_BG_SpiritGuidePos[GILNEAS_BG_ALL_NODES_COUNT][4]
#define GILNEAS_BG_NotBGWeekendRepTicks
@ GILNEAS_BG_DYNAMIC_NODES_COUNT
@ GILNEAS_BG_SPIRIT_ALIANCE
@ GILNEAS_BG_NODE_WATERWORKS
@ GILNEAS_BG_NODE_LIGHTHOUSE
@ GILNEAS_BG_ALL_NODES_COUNT
@ GILNEAS_BG_SPIRIT_HORDE
@ GILNEAS_BG_OBJECTID_BANNER_CONT_H
@ GILNEAS_BG_OBJECTID_AURA_C
@ GILNEAS_BG_OBJECTID_GATE_H_1
@ GILNEAS_BG_OBJECTID_AURA_A
@ GILNEAS_BG_OBJECTID_AURA_H
@ GILNEAS_BG_OBJECTID_BANNER_A
@ GILNEAS_BG_OBJECTID_BANNER_H
@ GILNEAS_BG_OBJECTID_GATE_A_1
@ GILNEAS_BG_OBJECTID_BANNER_CONT_A
@ GILNEAS_BG_NODE_TYPE_NEUTRAL
@ GILNEAS_BG_NODE_STATUS_HORDE_CONTESTED
@ GILNEAS_BG_NODE_TYPE_CONTESTED
@ GILNEAS_BG_NODE_STATUS_HORDE_OCCUPIED
@ GILNEAS_BG_NODE_STATUS_ALLY_CONTESTED
@ GILNEAS_BG_NODE_TYPE_OCCUPIED
@ GILNEAS_BG_NODE_STATUS_ALLY_OCCUPIED
@ GILNEAS_BG_OP_RESOURCES_HORDE
@ GILNEAS_BG_OP_OCCUPIED_BASES_HORDE
@ GILNEAS_BG_OP_RESOURCES_ALLY
@ GILNEAS_BG_OP_RESOURCES_MAX
@ GILNEAS_BG_OP_RESOURCES_WARNING
@ GILNEAS_BG_OP_OCCUPIED_BASES_ALLY
const uint32 GILNEAS_BG_TickIntervals[4]
@ GILNEAS_BG_WARNING_NEAR_VICTORY_SCORE
@ GILNEAS_BG_MAX_TEAM_SCORE
@ ACHIEVEMENT_TIMED_TYPE_EVENT
@ ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE
DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore(WorldSafeLocsEntryfmt)
@ LANG_BG_BFG_START_HALF_MINUTE
@ LANG_BG_BFG_NODE_WATERWORKS
@ LANG_BG_BFG_NODE_DEFENDED
@ LANG_BG_BFG_START_TWO_MINUTES
@ LANG_BG_BFG_H_NEAR_VICTORY
@ LANG_BG_BFG_START_ONE_MINUTE
@ LANG_BG_BFG_A_NEAR_VICTORY
@ LANG_BG_BFG_NODE_CLAIMED
@ LANG_BG_BFG_NODE_LIGHTHOUSE
@ LANG_BG_BFG_NODE_ASSAULTED
#define SF_LOG_ERROR(filterType__,...)
@ CHAT_MSG_BG_SYSTEM_ALLIANCE
@ CHAT_MSG_BG_SYSTEM_NEUTRAL
@ CHAT_MSG_BG_SYSTEM_HORDE
@ AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT
void RemovePlayer(Player *player, uint64 guid, uint32 team) OVERRIDE
void StartingEventOpenDoors() OVERRIDE
bool m_IsInformedNearVictory
bool IsAllNodesControlledByTeam(uint32 team) const OVERRIDE
bool SetupBattleground() OVERRIDE
bool m_TeamScores500Disadvantage[BG_TEAMS_COUNT]
void StartingEventCloseDoors() OVERRIDE
void _SendNodeUpdate(uint8 node)
uint32 m_NodeTimers[GILNEAS_BG_DYNAMIC_NODES_COUNT]
uint8 m_Nodes[GILNEAS_BG_DYNAMIC_NODES_COUNT]
uint32 m_ReputationScoreTics[BG_TEAMS_COUNT]
bool CheckAchievementCriteriaMeet(uint32, Player const *, Unit const *=NULL, uint32=0) OVERRIDE
void _NodeDeOccupied(uint8 node)
void PostUpdateImpl(uint32 diff) OVERRIDE
Post-update hook.
WorldSafeLocsEntry const * GetClosestGraveYard(Player *player) OVERRIDE
void _CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay)
void EndBattleground(uint32 winner)
void _DelBanner(uint8 node, uint8 type, uint8 teamIndex)
void FillInitialWorldStates(WorldStateBuilder &builder) OVERRIDE
uint8 m_prevNodes[GILNEAS_BG_DYNAMIC_NODES_COUNT]
void AddPlayer(Player *player) OVERRIDE
void HandleAreaTrigger(Player *Source, uint32 Trigger) OVERRIDE
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor=true) OVERRIDE
void _NodeOccupied(uint8 node, Team team)
GILNEAS_BG_BannerTimer m_BannerTimers[GILNEAS_BG_DYNAMIC_NODES_COUNT]
int32 _GetNodeNameId(uint8 node)
uint32 m_HonorScoreTics[BG_TEAMS_COUNT]
uint32 GetPrematureWinner() OVERRIDE
void EventPlayerClickedOnFlag(Player *source, GameObject *target_obj) OVERRIDE
uint32 m_lastTick[BG_TEAMS_COUNT]
virtual void AddPlayer(Player *player)
BattlegroundTypeId GetTypeID(bool GetRandom=false) const
void EndBattleground(uint32 winner)
static TeamId GetTeamIndexByTeamId(uint32 Team)
void DoorOpen(uint32 type)
bool DelCreature(uint32 type)
void SpawnBGObject(uint32 type, uint32 respawntime)
void PlaySoundToAll(uint32 SoundID)
BattlegroundMap * GetBgMap() const
void DoorClose(uint32 type)
void RelocateDeadPlayers(uint64 queueIndex)
Relocate all players in ReviveQueue to the closest graveyard.
void UpdateWorldState(uint32 Field, uint32 Value)
BattlegroundScoreMap PlayerScores
void RewardHonorToTeam(uint32 Honor, uint32 TeamID)
bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, uint32 team)
BattlegroundStatus GetStatus() const
virtual bool CheckAchievementCriteriaMeet(uint32, Player const *, Unit const *=NULL, uint32=0)
virtual void HandleAreaTrigger(Player *, uint32)
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
void SendMessage2ToAll(int32 entry, ChatMsg type, Player const *source, int32 strId1=0, int32 strId2=0)
uint32 GetBonusHonorFromKill(uint32 kills) const
void RewardReputationToTeam(uint32 faction_id, uint32 Reputation, uint32 TeamID)
virtual void UpdatePlayerScore(Player *player, uint32 type, uint32 value, bool doAddHonor=true)
Creature * AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, uint32 respawntime=0)
void SendMessageToAll(int32 entry, ChatMsg type, Player const *source=NULL)
int32 m_TeamScores[BG_TEAMS_COUNT]
Creature * GetBGCreature(uint32 type)
bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime=0)
virtual uint32 GetPrematureWinner()
uint32 StartMessageIds[BG_STARTING_EVENT_COUNT]
GameObject * GetGameObject(uint64 guid)
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint64 miscValue1=0, uint64 miscValue2=0, uint64 miscValue3=0, Unit *unit=NULL)
void setFaction(uint32 faction)
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0)
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true) const
void AppendState(uint32 worldstate, uint32 value)
float GetPositionX() const
float GetPositionY() const