aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2022-07-10 18:59:29 +0200
committerShauren <shauren.trinity@gmail.com>2022-07-10 18:59:29 +0200
commit5dbfaecd5c020fd4c3b3dfc235580849c39ce7db (patch)
tree144b55215757a8174969a90967debd809119fc55 /src/server
parent377799fd3cd8d129b1b6afc146d7c40b70160ad9 (diff)
Core/WorldStates: Migrate battleground worldstates to new system
Diffstat (limited to 'src/server')
-rw-r--r--src/server/game/Battlegrounds/Arena.cpp7
-rw-r--r--src/server/game/Battlegrounds/Arena.h13
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp17
-rw-r--r--src/server/game/Battlegrounds/Battleground.h21
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp117
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAB.h100
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp126
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAV.h237
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp8
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundBE.h1
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp8
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundDS.h1
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp60
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundEY.h8
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp42
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundIC.h41
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp8
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundNA.h1
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp8
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundRL.h1
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp8
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundRV.h3
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp108
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundSA.h38
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp110
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundWS.h38
-rw-r--r--src/server/game/Entities/Player/Player.cpp306
-rw-r--r--src/server/scripts/World/achievement_scripts.cpp196
28 files changed, 381 insertions, 1251 deletions
diff --git a/src/server/game/Battlegrounds/Arena.cpp b/src/server/game/Battlegrounds/Arena.cpp
index ae555480031..26c36466567 100644
--- a/src/server/game/Battlegrounds/Arena.cpp
+++ b/src/server/game/Battlegrounds/Arena.cpp
@@ -25,7 +25,6 @@
#include "Player.h"
#include "World.h"
#include "WorldSession.h"
-#include "WorldStatePackets.h"
Arena::Arena(BattlegroundTemplate const* battlegroundTemplate) : Battleground(battlegroundTemplate)
{
@@ -74,12 +73,6 @@ void Arena::RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*
CheckWinConditions();
}
-void Arena::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet)
-{
- packet.Worldstates.emplace_back(ARENA_WORLD_STATE_ALIVE_PLAYERS_GREEN, GetAlivePlayersCountByTeam(HORDE));
- packet.Worldstates.emplace_back(ARENA_WORLD_STATE_ALIVE_PLAYERS_GOLD, GetAlivePlayersCountByTeam(ALLIANCE));
-}
-
void Arena::UpdateArenaWorldState()
{
UpdateWorldState(ARENA_WORLD_STATE_ALIVE_PLAYERS_GREEN, GetAlivePlayersCountByTeam(HORDE));
diff --git a/src/server/game/Battlegrounds/Arena.h b/src/server/game/Battlegrounds/Arena.h
index b0b561964ab..2ba7b04a536 100644
--- a/src/server/game/Battlegrounds/Arena.h
+++ b/src/server/game/Battlegrounds/Arena.h
@@ -41,8 +41,16 @@ enum ArenaSpellIds
enum ArenaWorldStates
{
- ARENA_WORLD_STATE_ALIVE_PLAYERS_GREEN = 3600,
- ARENA_WORLD_STATE_ALIVE_PLAYERS_GOLD = 3601
+ ARENA_WORLD_STATE_ALIVE_PLAYERS_GREEN = 3600,
+ ARENA_WORLD_STATE_ALIVE_PLAYERS_GOLD = 3601,
+ ARENA_WORLD_STATE_SHOW_ALIVE_PLAYERS = 3610,
+ ARENA_WORLD_STATE_TIME_REMAINING = 8529,
+ ARENA_WORLD_STATE_SHOW_TIME_REMAINING = 8524,
+ ARENA_WORLD_STATE_GREEN_TEAM_EXTRA_LIVES = 15480,
+ ARENA_WORLD_STATE_GOLD_TEAM_EXTRA_LIVES = 15481,
+ ARENA_WORLD_STATE_SHOW_EXTRA_LIVES = 13401,
+ ARENA_WORLD_STATE_SOLO_SHUFFLE_ROUND = 21427,
+ ARENA_WORLD_STATE_SHOW_SOLO_SHUFFLE_ROUND = 21322,
};
class TC_GAME_API Arena : public Battleground
@@ -53,7 +61,6 @@ class TC_GAME_API Arena : public Battleground
void AddPlayer(Player* player) override;
void RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/) override;
- void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override;
void UpdateArenaWorldState();
void HandleKillPlayer(Player* player, Player* killer) override;
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index a00d39ccba0..1bcb8964dfd 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -43,6 +43,7 @@
#include "TemporarySummon.h"
#include "Transport.h"
#include "Util.h"
+#include "WorldStateMgr.h"
#include "WorldStatePackets.h"
#include <cstdarg>
@@ -686,13 +687,9 @@ void Battleground::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
}
}
-void Battleground::UpdateWorldState(uint32 variable, uint32 value, bool hidden /*= false*/)
+void Battleground::UpdateWorldState(int32 worldStateId, int32 value, bool hidden /*= false*/)
{
- WorldPackets::WorldState::UpdateWorldState worldstate;
- worldstate.VariableID = variable;
- worldstate.Value = value;
- worldstate.Hidden = hidden;
- SendPacketToAll(worldstate.Write());
+ sWorldStateMgr->SetValue(worldStateId, value, hidden, GetBgMap());
}
void Battleground::EndBattleground(uint32 winner)
@@ -1014,8 +1011,6 @@ void Battleground::Reset()
delete itr->second;
PlayerScores.clear();
- ResetBGSubclass();
-
_playerPositions.clear();
}
@@ -1968,12 +1963,6 @@ void Battleground::HandleAreaTrigger(Player* player, uint32 trigger, bool /*ente
trigger, player->GetMapId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
}
-bool Battleground::CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* /*source*/, Unit const* /*target*/, uint32 /*miscvalue1*/)
-{
- TC_LOG_ERROR("bg.battleground", "Battleground::CheckAchievementCriteriaMeet: No implementation for criteria %u", criteriaId);
- return false;
-}
-
char const* Battleground::GetName() const
{
return _battlegroundTemplate->BattlemasterEntry->Name[sWorld->GetDefaultDbcLocale()];
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index f8bf078651e..a065d49462f 100644
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -47,22 +47,8 @@ namespace WorldPackets
struct BattlegroundPlayerPosition;
}
- namespace WorldState
- {
- class InitWorldStates;
- }
}
-enum BattlegroundCriteriaId
-{
- BG_CRITERIA_CHECK_RESILIENT_VICTORY,
- BG_CRITERIA_CHECK_SAVE_THE_DAY,
- BG_CRITERIA_CHECK_EVERYTHING_COUNTS,
- BG_CRITERIA_CHECK_AV_PERFECTION,
- BG_CRITERIA_CHECK_DEFENSE_OF_THE_ANCIENTS,
- BG_CRITERIA_CHECK_NOT_EVEN_A_SCRATCH,
-};
-
enum BattlegroundBroadcastTexts
{
BG_TEXT_ALLIANCE_WINS = 10633,
@@ -282,14 +268,10 @@ class TC_GAME_API Battleground
virtual void Reset(); // resets all common properties for battlegrounds, must be implemented and called in BG subclass
virtual void StartingEventCloseDoors() { }
virtual void StartingEventOpenDoors() { }
- virtual void ResetBGSubclass() { } // must be implemented in BG subclass
virtual void DestroyGate(Player* /*player*/, GameObject* /*go*/) { }
- /* achievement req. */
- virtual bool IsAllNodesControlledByTeam(uint32 /*team*/) const { return false; }
void TriggerGameEvent(uint32 gameEventId);
- virtual bool CheckAchievementCriteriaMeet(uint32 /*criteriaId*/, Player const* /*player*/, Unit const* /*target*/ = nullptr, uint32 /*miscvalue1*/ = 0);
/* Battleground */
// Get methods:
@@ -386,7 +368,6 @@ class TC_GAME_API Battleground
// Packet Transfer
// method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!)
- virtual void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& /*packet*/) { }
void SendPacketToTeam(uint32 teamId, WorldPacket const* packet, Player* except = nullptr) const;
void SendPacketToAll(WorldPacket const* packet) const;
@@ -402,7 +383,7 @@ class TC_GAME_API Battleground
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 UpdateWorldState(int32 worldStateId, int32 value, bool hidden = false);
virtual void EndBattleground(uint32 winner);
void BlockMovement(Player* player);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
index dbdc498df01..7e34b5a30d4 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
@@ -25,8 +25,6 @@
#include "Player.h"
#include "Random.h"
#include "SpellInfo.h"
-#include "WorldSession.h"
-#include "WorldStatePackets.h"
BattlegroundAB::BattlegroundAB(BattlegroundTemplate const* battlegroundTemplate) : Battleground(battlegroundTemplate)
{
@@ -50,7 +48,6 @@ BattlegroundAB::BattlegroundAB(BattlegroundTemplate const* battlegroundTemplate)
m_lastTick[i] = 0;
m_HonorScoreTics[i] = 0;
m_ReputationScoreTics[i] = 0;
- m_TeamScores500Disadvantage[i] = false;
}
m_HonorTics = 0;
@@ -164,14 +161,19 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff)
m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE;
if (team == TEAM_ALLIANCE)
- UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]);
+ UpdateWorldState(BG_AB_WS_RESOURCES_ALLY, m_TeamScores[team]);
else
- UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]);
+ UpdateWorldState(BG_AB_WS_RESOURCES_HORDE, m_TeamScores[team]);
// update achievement flags
// we increased m_TeamScores[team] so we just need to check if it is 500 more than other teams resources
uint8 otherTeam = (team + 1) % PVP_TEAMS_COUNT;
if (m_TeamScores[team] > m_TeamScores[otherTeam] + 500)
- m_TeamScores500Disadvantage[otherTeam] = true;
+ {
+ if (team == TEAM_ALLIANCE)
+ UpdateWorldState(BG_AB_WS_HAD_500_DISADVANTAGE_HORDE, 1);
+ else
+ UpdateWorldState(BG_AB_WS_HAD_500_DISADVANTAGE_ALLIANCE, 1);
+ }
}
}
@@ -294,51 +296,49 @@ void BattlegroundAB::_DelBanner(uint8 node, uint8 type, uint8 teamIndex)
SpawnBGObject(obj, RESPAWN_ONE_DAY);
}
-void BattlegroundAB::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet)
-{
- const uint8 plusArray[] = {0, 2, 3, 0, 1};
-
- // Node icons
- for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
- packet.Worldstates.emplace_back(BG_AB_OP_NODEICONS[node], (m_Nodes[node] == 0) ? 1 : 0);
-
- // Node occupied states
- for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
- for (uint8 itr = 1; itr < BG_AB_DYNAMIC_NODES_COUNT; ++itr)
- packet.Worldstates.emplace_back(BG_AB_OP_NODESTATES[node] + plusArray[itr], (m_Nodes[node] == itr) ? 1 : 0);
-
- // How many bases each team owns
- int32 ally = 0, horde = 0;
- for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
- if (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_OCCUPIED)
- ++ally;
- else if (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
- ++horde;
-
- packet.Worldstates.emplace_back(BG_AB_OP_OCCUPIED_BASES_ALLY, ally);
- packet.Worldstates.emplace_back(BG_AB_OP_OCCUPIED_BASES_HORDE, horde);
-
- // Team scores
- packet.Worldstates.emplace_back(BG_AB_OP_RESOURCES_MAX, BG_AB_MAX_TEAM_SCORE);
- packet.Worldstates.emplace_back(BG_AB_OP_RESOURCES_WARNING, BG_AB_WARNING_NEAR_VICTORY_SCORE);
- packet.Worldstates.emplace_back(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[TEAM_ALLIANCE]);
- packet.Worldstates.emplace_back(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[TEAM_HORDE]);
-
- // other unknown BG_AB_UNK_01
- packet.Worldstates.emplace_back(1861, 2);
-}
-
void BattlegroundAB::_SendNodeUpdate(uint8 node)
{
// Send node owner state update to refresh map icons on client
- const uint8 plusArray[] = {0, 2, 3, 0, 1};
+ constexpr int32 idPlusArray[] = {0, 2, 3, 0, 1};
+ constexpr int32 statePlusArray[] = {0, 2, 0, 2, 0};
if (m_prevNodes[node])
- UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_prevNodes[node]], 0);
+ UpdateWorldState(BG_AB_OP_NODESTATES[node] + idPlusArray[m_prevNodes[node]], 0);
else
UpdateWorldState(BG_AB_OP_NODEICONS[node], 0);
- UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_Nodes[node]], 1);
+ UpdateWorldState(BG_AB_OP_NODESTATES[node] + idPlusArray[m_Nodes[node]], 1);
+
+ switch (node)
+ {
+ case BG_AB_NODE_STABLES:
+ UpdateWorldState(BG_AB_WS_STABLES_ICON_NEW, m_Nodes[node] + statePlusArray[m_Nodes[node]]);
+ UpdateWorldState(BG_AB_WS_STABLES_HORDE_CONTROL_STATE, m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED ? 2 : (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED ? 1 : 0));
+ UpdateWorldState(BG_AB_WS_STABLES_ALLIANCE_CONTROL_STATE, m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_OCCUPIED ? 2 : (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED ? 1 : 0));
+ break;
+ case BG_AB_NODE_BLACKSMITH:
+ UpdateWorldState(BG_AB_WS_BLACKSMITH_ICON_NEW, m_Nodes[node] + statePlusArray[m_Nodes[node]]);
+ UpdateWorldState(BG_AB_WS_BLACKSMITH_HORDE_CONTROL_STATE, m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED ? 2 : (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED ? 1 : 0));
+ UpdateWorldState(BG_AB_WS_BLACKSMITH_ALLIANCE_CONTROL_STATE, m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_OCCUPIED ? 2 : (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED ? 1 : 0));
+ break;
+ case BG_AB_NODE_FARM:
+ UpdateWorldState(BG_AB_WS_FARM_ICON_NEW, m_Nodes[node] + statePlusArray[m_Nodes[node]]);
+ UpdateWorldState(BG_AB_WS_FARM_HORDE_CONTROL_STATE, m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED ? 2 : (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED ? 1 : 0));
+ UpdateWorldState(BG_AB_WS_FARM_ALLIANCE_CONTROL_STATE, m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_OCCUPIED ? 2 : (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED ? 1 : 0));
+ break;
+ case BG_AB_NODE_LUMBER_MILL:
+ UpdateWorldState(BG_AB_WS_LUMBER_MILL_ICON_NEW, m_Nodes[node] + statePlusArray[m_Nodes[node]]);
+ UpdateWorldState(BG_AB_WS_LUMBER_MILL_HORDE_CONTROL_STATE, m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED ? 2 : (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED ? 1 : 0));
+ UpdateWorldState(BG_AB_WS_LUMBER_MILL_ALLIANCE_CONTROL_STATE, m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_OCCUPIED ? 2 : (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED ? 1 : 0));
+ break;
+ case BG_AB_NODE_GOLD_MINE:
+ UpdateWorldState(BG_AB_WS_GOLD_MINE_ICON_NEW, m_Nodes[node] + statePlusArray[m_Nodes[node]]);
+ UpdateWorldState(BG_AB_WS_GOLD_MINE_HORDE_CONTROL_STATE, m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED ? 2 : (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED ? 1 : 0));
+ UpdateWorldState(BG_AB_WS_GOLD_MINE_ALLIANCE_CONTROL_STATE, m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_OCCUPIED ? 2 : (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED ? 1 : 0));
+ break;
+ default:
+ break;
+ }
// How many bases each team owns
uint8 ally = 0, horde = 0;
@@ -348,8 +348,8 @@ void BattlegroundAB::_SendNodeUpdate(uint8 node)
else if (m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
++horde;
- UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_ALLY, ally);
- UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_HORDE, horde);
+ UpdateWorldState(BG_AB_WS_OCCUPIED_BASES_ALLY, ally);
+ UpdateWorldState(BG_AB_WS_OCCUPIED_BASES_HORDE, horde);
}
void BattlegroundAB::_NodeOccupied(uint8 node, Team team)
@@ -576,6 +576,9 @@ bool BattlegroundAB::SetupBattleground()
TC_LOG_ERROR("sql.sql", "BatteGroundAB: Failed to spawn buff object!");
}
+ UpdateWorldState(BG_AB_WS_RESOURCES_MAX, BG_AB_MAX_TEAM_SCORE);
+ UpdateWorldState(BG_AB_WS_RESOURCES_WARNING, BG_AB_WARNING_NEAR_VICTORY_SCORE);
+
return true;
}
@@ -596,8 +599,6 @@ void BattlegroundAB::Reset()
bool isBGWeekend = sBattlegroundMgr->IsBGWeekend(GetTypeID());
m_HonorTics = (isBGWeekend) ? BG_AB_ABBGWeekendHonorTicks : BG_AB_NotABBGWeekendHonorTicks;
m_ReputationTics = (isBGWeekend) ? BG_AB_ABBGWeekendReputationTicks : BG_AB_NotABBGWeekendReputationTicks;
- m_TeamScores500Disadvantage[TEAM_ALLIANCE] = false;
- m_TeamScores500Disadvantage[TEAM_HORDE] = false;
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
{
@@ -688,25 +689,3 @@ bool BattlegroundAB::UpdatePlayerScore(Player* player, uint32 type, uint32 value
}
return true;
}
-
-bool BattlegroundAB::IsAllNodesControlledByTeam(uint32 team) const
-{
- uint32 count = 0;
- for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
- if ((team == ALLIANCE && m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED) ||
- (team == HORDE && m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED))
- ++count;
-
- return count == BG_AB_DYNAMIC_NODES_COUNT;
-}
-
-bool BattlegroundAB::CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* player, Unit const* target, uint32 miscvalue)
-{
- switch (criteriaId)
- {
- case BG_CRITERIA_CHECK_RESILIENT_VICTORY:
- return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(GetPlayerTeam(player->GetGUID()))];
- }
-
- return Battleground::CheckAchievementCriteriaMeet(criteriaId, player, target, miscvalue);
-}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
index 5a331520ab4..5bdf9fb159b 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
@@ -24,45 +24,63 @@
enum BG_AB_WorldStates
{
- BG_AB_OP_OCCUPIED_BASES_HORDE = 1778,
- BG_AB_OP_OCCUPIED_BASES_ALLY = 1779,
- BG_AB_OP_RESOURCES_ALLY = 1776,
- BG_AB_OP_RESOURCES_HORDE = 1777,
- BG_AB_OP_RESOURCES_MAX = 1780,
- BG_AB_OP_RESOURCES_WARNING = 1955
-/*
- BG_AB_OP_STABLE_ICON = 1842, //Stable map icon (NONE)
- BG_AB_OP_STABLE_STATE_ALIENCE = 1767, //Stable map state (ALIENCE)
- BG_AB_OP_STABLE_STATE_HORDE = 1768, //Stable map state (HORDE)
- BG_AB_OP_STABLE_STATE_CON_ALI = 1769, //Stable map state (CON ALIENCE)
- BG_AB_OP_STABLE_STATE_CON_HOR = 1770, //Stable map state (CON HORDE)
- BG_AB_OP_FARM_ICON = 1845, //Farm map icon (NONE)
- BG_AB_OP_FARM_STATE_ALIENCE = 1772, //Farm state (ALIENCE)
- BG_AB_OP_FARM_STATE_HORDE = 1773, //Farm state (HORDE)
- BG_AB_OP_FARM_STATE_CON_ALI = 1774, //Farm state (CON ALIENCE)
- BG_AB_OP_FARM_STATE_CON_HOR = 1775, //Farm state (CON HORDE)
-
- BG_AB_OP_BLACKSMITH_ICON = 1846, //Blacksmith map icon (NONE)
- BG_AB_OP_BLACKSMITH_STATE_ALIENCE = 1782, //Blacksmith map state (ALIENCE)
- BG_AB_OP_BLACKSMITH_STATE_HORDE = 1783, //Blacksmith map state (HORDE)
- BG_AB_OP_BLACKSMITH_STATE_CON_ALI = 1784, //Blacksmith map state (CON ALIENCE)
- BG_AB_OP_BLACKSMITH_STATE_CON_HOR = 1785, //Blacksmith map state (CON HORDE)
- BG_AB_OP_LUMBERMILL_ICON = 1844, //Lumber Mill map icon (NONE)
- BG_AB_OP_LUMBERMILL_STATE_ALIENCE = 1792, //Lumber Mill map state (ALIENCE)
- BG_AB_OP_LUMBERMILL_STATE_HORDE = 1793, //Lumber Mill map state (HORDE)
- BG_AB_OP_LUMBERMILL_STATE_CON_ALI = 1794, //Lumber Mill map state (CON ALIENCE)
- BG_AB_OP_LUMBERMILL_STATE_CON_HOR = 1795, //Lumber Mill map state (CON HORDE)
- BG_AB_OP_GOLDMINE_ICON = 1843, //Gold Mine map icon (NONE)
- BG_AB_OP_GOLDMINE_STATE_ALIENCE = 1787, //Gold Mine map state (ALIENCE)
- BG_AB_OP_GOLDMINE_STATE_HORDE = 1788, //Gold Mine map state (HORDE)
- BG_AB_OP_GOLDMINE_STATE_CON_ALI = 1789, //Gold Mine map state (CON ALIENCE
- BG_AB_OP_GOLDMINE_STATE_CON_HOR = 1790, //Gold Mine map state (CON HORDE)
-*/
+ BG_AB_WS_OCCUPIED_BASES_HORDE = 1778,
+ BG_AB_WS_OCCUPIED_BASES_ALLY = 1779,
+ BG_AB_WS_RESOURCES_ALLY = 1776,
+ BG_AB_WS_RESOURCES_HORDE = 1777,
+ BG_AB_WS_RESOURCES_MAX = 1780,
+ BG_AB_WS_RESOURCES_WARNING = 1955,
+
+ BG_AB_WS_STABLE_ICON = 1842, // Stable map icon (NONE)
+ BG_AB_WS_STABLE_STATE_ALIENCE = 1767, // Stable map state (ALIENCE)
+ BG_AB_WS_STABLE_STATE_HORDE = 1768, // Stable map state (HORDE)
+ BG_AB_WS_STABLE_STATE_CON_ALI = 1769, // Stable map state (CON ALIENCE)
+ BG_AB_WS_STABLE_STATE_CON_HOR = 1770, // Stable map state (CON HORDE)
+ BG_AB_WS_FARM_ICON = 1845, // Farm map icon (NONE)
+ BG_AB_WS_FARM_STATE_ALIENCE = 1772, // Farm state (ALIENCE)
+ BG_AB_WS_FARM_STATE_HORDE = 1773, // Farm state (HORDE)
+ BG_AB_WS_FARM_STATE_CON_ALI = 1774, // Farm state (CON ALIENCE)
+ BG_AB_WS_FARM_STATE_CON_HOR = 1775, // Farm state (CON HORDE)
+ BG_AB_WS_BLACKSMITH_ICON = 1846, // Blacksmith map icon (NONE)
+ BG_AB_WS_BLACKSMITH_STATE_ALIENCE = 1782, // Blacksmith map state (ALIENCE)
+ BG_AB_WS_BLACKSMITH_STATE_HORDE = 1783, // Blacksmith map state (HORDE)
+ BG_AB_WS_BLACKSMITH_STATE_CON_ALI = 1784, // Blacksmith map state (CON ALIENCE)
+ BG_AB_WS_BLACKSMITH_STATE_CON_HOR = 1785, // Blacksmith map state (CON HORDE)
+ BG_AB_WS_LUMBERMILL_ICON = 1844, // Lumber Mill map icon (NONE)
+ BG_AB_WS_LUMBERMILL_STATE_ALIENCE = 1792, // Lumber Mill map state (ALIENCE)
+ BG_AB_WS_LUMBERMILL_STATE_HORDE = 1793, // Lumber Mill map state (HORDE)
+ BG_AB_WS_LUMBERMILL_STATE_CON_ALI = 1794, // Lumber Mill map state (CON ALIENCE)
+ BG_AB_WS_LUMBERMILL_STATE_CON_HOR = 1795, // Lumber Mill map state (CON HORDE)
+ BG_AB_WS_GOLDMINE_ICON = 1843, // Gold Mine map icon (NONE)
+ BG_AB_WS_GOLDMINE_STATE_ALIENCE = 1787, // Gold Mine map state (ALIENCE)
+ BG_AB_WS_GOLDMINE_STATE_HORDE = 1788, // Gold Mine map state (HORDE)
+ BG_AB_WS_GOLDMINE_STATE_CON_ALI = 1789, // Gold Mine map state (CON ALIENCE
+ BG_AB_WS_GOLDMINE_STATE_CON_HOR = 1790, // Gold Mine map state (CON HORDE)
+
+ BG_AB_WS_HAD_500_DISADVANTAGE_ALLIANCE = 3644,
+ BG_AB_WS_HAD_500_DISADVANTAGE_HORDE = 3645,
+
+ BG_AB_WS_FARM_ICON_NEW = 8808, // Farm map icon
+ BG_AB_WS_LUMBER_MILL_ICON_NEW = 8805, // Lumber Mill map icon
+ BG_AB_WS_BLACKSMITH_ICON_NEW = 8799, // Blacksmith map icon
+ BG_AB_WS_GOLD_MINE_ICON_NEW = 8809, // Gold Mine map icon
+ BG_AB_WS_STABLES_ICON_NEW = 5834, // Stable map icon
+
+ BG_AB_WS_FARM_HORDE_CONTROL_STATE = 17328,
+ BG_AB_WS_FARM_ALLIANCE_CONTROL_STATE = 17325,
+ BG_AB_WS_LUMBER_MILL_HORDE_CONTROL_STATE = 17330,
+ BG_AB_WS_LUMBER_MILL_ALLIANCE_CONTROL_STATE = 17326,
+ BG_AB_WS_BLACKSMITH_HORDE_CONTROL_STATE = 17327,
+ BG_AB_WS_BLACKSMITH_ALLIANCE_CONTROL_STATE = 17324,
+ BG_AB_WS_GOLD_MINE_HORDE_CONTROL_STATE = 17329,
+ BG_AB_WS_GOLD_MINE_ALLIANCE_CONTROL_STATE = 17323,
+ BG_AB_WS_STABLES_HORDE_CONTROL_STATE = 17331,
+ BG_AB_WS_STABLES_ALLIANCE_CONTROL_STATE = 17322,
};
-const uint32 BG_AB_OP_NODESTATES[5] = {1767, 1782, 1772, 1792, 1787};
+const int32 BG_AB_OP_NODESTATES[5] = {1767, 1782, 1772, 1792, 1787};
-const uint32 BG_AB_OP_NODEICONS[5] = {1842, 1846, 1845, 1844, 1843};
+const int32 BG_AB_OP_NODEICONS[5] = {1842, 1846, 1845, 1844, 1843};
/* Note: code uses that these IDs follow each other */
enum BG_AB_NodeObjectId
@@ -131,7 +149,7 @@ enum BG_AB_Timers
enum BG_AB_Score
{
BG_AB_WARNING_NEAR_VICTORY_SCORE = 1400,
- BG_AB_MAX_TEAM_SCORE = 1600
+ BG_AB_MAX_TEAM_SCORE = 1500
};
/* do NOT change the order, else wrong behaviour */
@@ -329,15 +347,9 @@ class BattlegroundAB : public Battleground
/* Scorekeeping */
bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
- void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override;
-
/* Nodes occupying */
void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj) override;
- /* achievement req. */
- bool IsAllNodesControlledByTeam(uint32 team) const override;
- bool CheckAchievementCriteriaMeet(uint32 /*criteriaId*/, Player const* /*player*/, Unit const* /*target*/ = nullptr, uint32 /*miscvalue1*/ = 0) override;
-
uint32 GetPrematureWinner() override;
private:
void PostUpdateImpl(uint32 diff) override;
@@ -367,7 +379,5 @@ class BattlegroundAB : public Battleground
bool m_IsInformedNearVictory;
uint32 m_HonorTics;
uint32 m_ReputationTics;
- // need for achievements
- bool m_TeamScores500Disadvantage[PVP_TEAMS_COUNT];
};
#endif
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
index 3c6e769f44f..c942c82493a 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
@@ -24,8 +24,6 @@
#include "MotionMaster.h"
#include "ObjectMgr.h"
#include "Player.h"
-#include "WorldSession.h"
-#include "WorldStatePackets.h"
BattlegroundAV::BattlegroundAV(BattlegroundTemplate const* battlegroundTemplate) : Battleground(battlegroundTemplate)
{
@@ -85,6 +83,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer)
*/
if (entry == BG_AV_CreatureInfo[AV_NPC_A_BOSS])
{
+ UpdateWorldState(AV_WS_VANDAAR_ALIVE, 0);
CastSpellOnTeam(23658, HORDE); //this is a spell which finishes a quest where a player has to kill the boss
RewardReputationToTeam(729, BG_AV_REP_BOSS, HORDE);
RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_BOSS), HORDE);
@@ -93,6 +92,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer)
}
else if (entry == BG_AV_CreatureInfo[AV_NPC_H_BOSS])
{
+ UpdateWorldState(AV_WS_DREKTHAR_ALIVE, 0);
CastSpellOnTeam(23658, ALLIANCE); //this is a spell which finishes a quest where a player has to kill the boss
RewardReputationToTeam(730, BG_AV_REP_BOSS, ALLIANCE);
RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_BOSS), ALLIANCE);
@@ -107,6 +107,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer)
return;
}
m_CaptainAlive[0]=false;
+ UpdateWorldState(AV_WS_BALINDA_ALIVE, 0);
RewardReputationToTeam(729, BG_AV_REP_CAPTAIN, HORDE);
RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_CAPTAIN), HORDE);
UpdateScore(ALLIANCE, (-1)*BG_AV_RES_CAPTAIN);
@@ -126,6 +127,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer)
return;
}
m_CaptainAlive[1]=false;
+ UpdateWorldState(AV_WS_GALVAGAR_ALIVE, 0);
RewardReputationToTeam(730, BG_AV_REP_CAPTAIN, ALLIANCE);
RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_CAPTAIN), ALLIANCE);
UpdateScore(HORDE, (-1)*BG_AV_RES_CAPTAIN);
@@ -193,13 +195,14 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
break;
case AV_QUEST_A_BOSS1:
case AV_QUEST_H_BOSS1:
- m_Team_QuestStatus[teamIndex][4] += 9; //you can turn in 10 or 1 item..
+ m_Team_QuestStatus[teamIndex][4] += 4; //you can turn in 5 or 1 item..
[[fallthrough]];
case AV_QUEST_A_BOSS2:
case AV_QUEST_H_BOSS2:
m_Team_QuestStatus[teamIndex][4]++;
if (m_Team_QuestStatus[teamIndex][4] >= 200)
TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
+ UpdateWorldState(teamIndex == TEAM_ALLIANCE ? AV_WS_IVUS_STORM_CRYSTAL_COUNT : AV_WS_LOKHOLAR_STORMPIKE_SOLDIERS_BLOOD_COUNT, m_Team_QuestStatus[teamIndex][4]);
break;
case AV_QUEST_A_NEAR_MINE:
case AV_QUEST_H_NEAR_MINE:
@@ -254,13 +257,13 @@ void BattlegroundAV::UpdateScore(uint16 team, int16 points)
uint8 teamindex = GetTeamIndexByTeamId(team); //0=ally 1=horde
m_Team_Scores[teamindex] += points;
- UpdateWorldState(((teamindex == TEAM_HORDE)?AV_Horde_Score:AV_Alliance_Score), m_Team_Scores[teamindex]);
+ UpdateWorldState(teamindex == TEAM_HORDE ? AV_WS_HORDE_REINFORCEMENTS : AV_WS_ALLIANCE_REINFORCEMENTS, m_Team_Scores[teamindex]);
if (points < 0)
{
if (m_Team_Scores[teamindex] < 1)
{
- m_Team_Scores[teamindex]=0;
- EndBattleground(((teamindex == TEAM_HORDE)?ALLIANCE:HORDE));
+ m_Team_Scores[teamindex] = 0;
+ EndBattleground(teamindex == TEAM_HORDE ? ALLIANCE : HORDE);
}
else if (!m_IsInformedNearVictory[teamindex] && m_Team_Scores[teamindex] < SEND_MSG_NEAR_LOSE)
{
@@ -425,8 +428,8 @@ void BattlegroundAV::StartingEventOpenDoors()
for (uint8 mine = AV_NORTH_MINE; mine <= AV_SOUTH_MINE; mine++) //mine population
ChangeMineOwner(mine, AV_NEUTRAL_TEAM, true);
- UpdateWorldState(AV_SHOW_H_SCORE, 1);
- UpdateWorldState(AV_SHOW_A_SCORE, 1);
+ UpdateWorldState(AV_WS_SHOW_HORDE_REINFORCEMENTS, 1);
+ UpdateWorldState(AV_WS_SHOW_ALLIANCE_REINFORCEMENTS, 1);
DoorOpen(BG_AV_OBJECT_DOOR_H);
DoorOpen(BG_AV_OBJECT_DOOR_A);
@@ -1015,38 +1018,6 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
UpdatePlayerScore(player, (IsTower(node)) ? SCORE_TOWERS_ASSAULTED : SCORE_GRAVEYARDS_ASSAULTED, 1);
}
-void BattlegroundAV::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet)
-{
- for (uint8 itr = BG_AV_NODES_FIRSTAID_STATION; itr < BG_AV_NODES_MAX; ++itr)
- {
- uint16 owner = m_Nodes[itr].Owner;
- BG_AV_States state = m_Nodes[itr].State;
-
- packet.Worldstates.emplace_back(BGAVNodeInfo[itr].WorldStateIds.AllianceAssault, (owner == ALLIANCE && state == POINT_ASSAULTED) ? 1 : 0);
- packet.Worldstates.emplace_back(BGAVNodeInfo[itr].WorldStateIds.AllianceControl, (owner == ALLIANCE && state >= POINT_DESTROYED) ? 1 : 0);
- packet.Worldstates.emplace_back(BGAVNodeInfo[itr].WorldStateIds.HordeAssault, (owner == HORDE && state == POINT_ASSAULTED) ? 1 : 0);
- packet.Worldstates.emplace_back(BGAVNodeInfo[itr].WorldStateIds.HordeControl, (owner == HORDE && state >= POINT_DESTROYED) ? 1 : 0);
- }
-
- packet.Worldstates.emplace_back(AV_SNOWFALL_N, (m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].Owner == AV_NEUTRAL_TEAM ? 1 : 0));
- packet.Worldstates.emplace_back(AV_Alliance_Score, m_Team_Scores[0]);
- packet.Worldstates.emplace_back(AV_Horde_Score, m_Team_Scores[1]);
-
- // only if game started the teamscores are displayed
- if (GetStatus() == STATUS_IN_PROGRESS) {
- packet.Worldstates.emplace_back(AV_SHOW_A_SCORE, 1);
- packet.Worldstates.emplace_back(AV_SHOW_H_SCORE, 1);
- }
- else
- {
- packet.Worldstates.emplace_back(AV_SHOW_A_SCORE, 0);
- packet.Worldstates.emplace_back(AV_SHOW_H_SCORE, 0);
- }
-
- SendMineWorldStates(AV_NORTH_MINE);
- SendMineWorldStates(AV_SOUTH_MINE);
-}
-
void BattlegroundAV::UpdateNodeWorldState(BG_AV_Nodes node)
{
if (StaticNodeInfo const* nodeInfo = GetStaticNodeInfo(node))
@@ -1058,10 +1029,12 @@ void BattlegroundAV::UpdateNodeWorldState(BG_AV_Nodes node)
UpdateWorldState(nodeInfo->WorldStateIds.AllianceControl, owner == ALLIANCE && state >= POINT_DESTROYED);
UpdateWorldState(nodeInfo->WorldStateIds.HordeAssault, owner == HORDE && state == POINT_ASSAULTED);
UpdateWorldState(nodeInfo->WorldStateIds.HordeControl, owner == HORDE && state >= POINT_DESTROYED);
+ if (nodeInfo->WorldStateIds.Owner)
+ UpdateWorldState(nodeInfo->WorldStateIds.Owner, owner == HORDE ? 2 : owner == ALLIANCE ? 1 : 0);
}
if (node == BG_AV_NODES_SNOWFALL_GRAVE)
- UpdateWorldState(AV_SNOWFALL_N, m_Nodes[node].Owner == AV_NEUTRAL_TEAM);
+ UpdateWorldState(AV_WS_SNOWFALL_GRAVEYARD_UNCONTROLLED, m_Nodes[node].Owner == AV_NEUTRAL_TEAM);
}
void BattlegroundAV::SendMineWorldStates(uint32 mine)
@@ -1089,6 +1062,8 @@ void BattlegroundAV::SendMineWorldStates(uint32 mine)
UpdateWorldState(BG_AV_MineWorldStates[mine2][owner], 1);
if (prevowner != owner)
UpdateWorldState(BG_AV_MineWorldStates[mine2][prevowner], 0);
+
+ UpdateWorldState(BG_AV_MineWorldStates[mine2][3], m_Mine_Owner[mine] == HORDE ? 2 : m_Mine_Owner[mine] == ALLIANCE ? 1 : 0);
}
WorldSafeLocsEntry const* BattlegroundAV::GetClosestGraveyard(Player* player)
@@ -1461,13 +1436,15 @@ void BattlegroundAV::DefendNode(BG_AV_Nodes node, uint16 team)
m_Nodes[node].Timer = 0;
}
-void BattlegroundAV::ResetBGSubclass()
+void BattlegroundAV::Reset()
{
+ Battleground::Reset();
+
for (uint8 i=0; i<2; i++) //forloop for both teams (it just make 0 == alliance and 1 == horde also for both mines 0=north 1=south
{
for (uint8 j=0; j<9; j++)
m_Team_QuestStatus[i][j]=0;
- m_Team_Scores[i]=BG_AV_SCORE_INITIAL_POINTS;
+ m_Team_Scores[i] = BG_AV_SCORE_INITIAL_POINTS;
m_IsInformedNearVictory[i]=false;
m_CaptainAlive[i] = true;
m_CaptainBuffTimer[i] = 120000 + urand(0, 4)* 60; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes @todo get the right times
@@ -1491,69 +1468,6 @@ void BattlegroundAV::ResetBGSubclass()
DelCreature(i);
}
-bool BattlegroundAV::CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target, uint32 miscValue)
-{
- uint32 team = GetPlayerTeam(source->GetGUID());
- switch (criteriaId)
- {
- case BG_CRITERIA_CHECK_EVERYTHING_COUNTS:
- for (uint8 mine = 0; mine < 2; mine++)
- if (m_Mine_Owner[mine] != team)
- return false;
-
- return true;
- case BG_CRITERIA_CHECK_AV_PERFECTION:
- {
- if (team == ALLIANCE)
- {
- for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) // alliance towers controlled
- {
- if (m_Nodes[i].State == POINT_CONTROLED)
- {
- if (m_Nodes[i].Owner != ALLIANCE)
- return false;
- }
- else
- return false;
- }
-
- for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // horde towers destroyed
- if (m_Nodes[i].State != POINT_DESTROYED)
- return false;
-
- if (!m_CaptainAlive[0])
- return false;
-
- return true;
- }
- else if (team == HORDE)
- {
- for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // horde towers controlled
- {
- if (m_Nodes[i].State == POINT_CONTROLED)
- {
- if (m_Nodes[i].Owner != HORDE)
- return false;
- }
- else
- return false;
- }
-
- for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) // alliance towers destroyed
- if (m_Nodes[i].State != POINT_DESTROYED)
- return false;
-
- if (!m_CaptainAlive[1])
- return false;
-
- return true;
- }
- }
- }
-
- return Battleground::CheckAchievementCriteriaMeet(criteriaId, source, target, miscValue);
-}
-
uint32 BattlegroundAV::GetPrematureWinner()
{
uint32 allianceScore = m_Team_Scores[GetTeamIndexByTeamId(ALLIANCE)];
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
index e6920e5d533..24cdced6cc3 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
@@ -26,7 +26,7 @@
#define BG_AV_CAPTIME 240000 //4:00
#define BG_AV_SNOWFALL_FIRSTCAP 300000 //5:00 but i also have seen 4:05
-#define BG_AV_SCORE_INITIAL_POINTS 600
+#define BG_AV_SCORE_INITIAL_POINTS 700
#define SEND_MSG_NEAR_LOSE 120
#define BG_AV_KILL_BOSS 4
@@ -1343,122 +1343,136 @@ enum BG_AV_States
enum BG_AV_WorldStates
{
- AV_Alliance_Score = 3127,
- AV_Horde_Score = 3128,
- AV_SHOW_H_SCORE = 3133,
- AV_SHOW_A_SCORE = 3134,
-
-/*
- //the comments behind the state shows which icon overlaps the other.. but is, until now, unused and maybe not a good solution (but give few performance (:)
+ AV_WS_ALLIANCE_REINFORCEMENTS = 3127,
+ AV_WS_HORDE_REINFORCEMENTS = 3128,
+ AV_WS_SHOW_HORDE_REINFORCEMENTS = 3133,
+ AV_WS_SHOW_ALLIANCE_REINFORCEMENTS = 3134,
+ AV_WS_MAX_REINFORCEMENTS = 3136,
// Graves
-
// Alliance
//Stormpike first aid station
- AV_AID_A_C = 1325,
- AV_AID_A_A = 1326,
- AV_AID_H_C = 1327,
- AV_AID_H_A = 1328,
+ AV_WS_STORMPIKE_AID_STATION_ALLIANCE_CONTROLLED = 1325,
+ AV_WS_STORMPIKE_AID_STATION_IN_CONFLICT_ALLIANCE_ATTACKING = 1326,
+ AV_WS_STORMPIKE_AID_STATION_HORDE_CONTROLLED = 1327,
+ AV_WS_STORMPIKE_AID_STATION_IN_CONFLICT_HORDE_ATTACKING = 1328,
//Stormpike Graveyard
- AV_PIKEGRAVE_A_C = 1333,
- AV_PIKEGRAVE_A_A = 1335,
- AV_PIKEGRAVE_H_C = 1334,
- AV_PIKEGRAVE_H_A = 1336,
+ AV_WS_STORMPIKE_GRAVEYARD_ALLIANCE_CONTROLLED = 1333,
+ AV_WS_STORMPIKE_GRAVEYARD_IN_CONFLICT_ALLIANCE_ATTACKING = 1335,
+ AV_WS_STORMPIKE_GRAVEYARD_HORDE_CONTROLLED = 1334,
+ AV_WS_STORMPIKE_GRAVEYARD_IN_CONFLICT_HORDE_ATTACKING = 1336,
//Stoneheart Grave
- AV_STONEHEART_A_C = 1302,
- AV_STONEHEART_A_A = 1304, //over hc
- AV_STONEHEART_H_C = 1301, //over ac
- AV_STONEHEART_H_A = 1303, //over aa
+ AV_WS_STONEHEARTH_GRAVEYARD_ALLIANCE_CONTROLLED = 1302,
+ AV_WS_STONEHEARTH_GRAVEYARD_IN_CONFLICT_ALLIANCE_ATTACKING = 1304,
+ AV_WS_STONEHEARTH_GRAVEYARD_HORDE_CONTROLLED = 1301,
+ AV_WS_STONEHEARTH_GRAVEYARD_IN_CONFLICT_HORDE_ATTACKING = 1303,
//Neutral
//Snowfall Grave
-*/
- AV_SNOWFALL_N = 1966 //over aa
-/*
- AV_SNOWFALL_A_C = 1341, //over hc
- AV_SNOWFALL_A_A = 1343, //over ha
- AV_SNOWFALL_H_C = 1342,
- AV_SNOWFALL_H_A = 1344, //over ac
+ AV_WS_SNOWFALL_GRAVEYARD_UNCONTROLLED = 1966,
+ AV_WS_SNOWFALL_GRAVEYARD_ALLIANCE_CONTROLLED = 1341,
+ AV_WS_SNOWFALL_GRAVEYARD_IN_CONFLICT_ALLIANCE_ATTACKING = 1343,
+ AV_WS_SNOWFALL_GRAVEYARD_HORDE_CONTROLLED = 1342,
+ AV_WS_SNOWFALL_GRAVEYARD_IN_CONFLICT_HORDE_ATTACKING = 1344,
//Horde
//Iceblood grave
- AV_ICEBLOOD_A_C = 1346, //over hc
- AV_ICEBLOOD_A_A = 1348, //over ac
- AV_ICEBLOOD_H_C = 1347,
- AV_ICEBLOOD_H_A = 1349, //over aa
+ AV_WS_ICEBLOOD_GRAVEYARD_ALLIANCE_CONTROLLED = 1346,
+ AV_WS_ICEBLOOD_GRAVEYARD_IN_CONFLICT_ALLIANCE_ATTACKING = 1348,
+ AV_WS_ICEBLOOD_GRAVEYARD_HORDE_CONTROLLED = 1347,
+ AV_WS_ICEBLOOD_GRAVEYARD_IN_CONFLICT_HORDE_ATTACKING = 1349,
//Frostwolf Grave
- AV_FROSTWOLF_A_C = 1337, //over hc
- AV_FROSTWOLF_A_A = 1339, //over ac
- AV_FROSTWOLF_H_C = 1338,
- AV_FROSTWOLF_H_A = 1340, //over aa
+ AV_WS_FROSTWOLF_GRAVEYARD_ALLIANCE_CONTROLLED = 1337,
+ AV_WS_FROSTWOLF_GRAVEYARD_IN_CONFLICT_ALLIANCE_ATTACKING = 1339,
+ AV_WS_FROSTWOLF_GRAVEYARD_HORDE_CONTROLLED = 1338,
+ AV_WS_FROSTWOLF_GRAVEYARD_IN_CONFLICT_HORDE_ATTACKING = 1340,
//Frostwolf Hut
- AV_FROSTWOLFHUT_A_C = 1329, //over hc
- AV_FROSTWOLFHUT_A_A = 1331, //over ha
- AV_FROSTWOLFHUT_H_C = 1330,
- AV_FROSTWOLFHUT_H_A = 1332, //over ac
+ AV_WS_FROSTWOLF_RELIEF_HUT_ALLIANCE_CONTROLLED = 1329,
+ AV_WS_FROSTWOLF_RELIEF_HUT_IN_CONFLICT_ALLIANCE_ATTACKING = 1331,
+ AV_WS_FROSTWOLF_RELIEF_HUT_HORDE_CONTROLLED = 1330,
+ AV_WS_FROSTWOLF_RELIEF_HUT_IN_CONFLICT_HORDE_ATTACKING = 1332,
//Towers
//Alliance
//Dunbaldar South Bunker
- AV_DUNS_CONTROLLED = 1361,
- AV_DUNS_DESTROYED = 1370,
- AV_DUNS_ASSAULTED = 1378,
+ AV_WS_DUN_BALDAR_SOUTH_BUNKER_OWNER = 1181,
+ AV_WS_DUN_BALDAR_SOUTH_BUNKER_ALLIANCE_CONTROLLED = 1361,
+ AV_WS_DUN_BALDAR_SOUTH_BUNKER_DESTROYED = 1370,
+ AV_WS_DUN_BALDAR_SOUTH_BUNKER_IN_CONFLICT_HORDE_ATTACKING = 1378,
+ AV_WS_DUN_BALDAR_SOUTH_BUNKER_IN_CONFLICT_ALLIANCE_ATTACKING = 1374, // unused
//Dunbaldar North Bunker
- AV_DUNN_CONTROLLED = 1362,
- AV_DUNN_DESTROYED = 1371,
- AV_DUNN_ASSAULTED = 1379,
+ AV_WS_DUN_BALDAR_NORTH_BUNKER_OWNER = 1182,
+ AV_WS_DUN_BALDAR_NORTH_BUNKER_ALLIANCE_CONTROLLED = 1362,
+ AV_WS_DUN_BALDAR_NORTH_BUNKER_DESTROYED = 1371,
+ AV_WS_DUN_BALDAR_NORTH_BUNKER_IN_CONFLICT_HORDE_ATTACKING = 1379,
+ AV_WS_DUN_BALDAR_NORTH_BUNKER_IN_CONFLICT_ALLIANCE_ATTACKING = 1375, // unused
//Icewing Bunker
- AV_ICEWING_CONTROLLED = 1363,
- AV_ICEWING_DESTROYED = 1372,
- AV_ICEWING_ASSAULTED = 1380,
+ AV_WS_ICEWING_BUNKER_OWNER = 1183,
+ AV_WS_ICEWING_BUNKER_ALLIANCE_CONTROLLED = 1363,
+ AV_WS_ICEWING_BUNKER_DESTROYED = 1372,
+ AV_WS_ICEWING_BUNKER_IN_CONFLICT_HORDE_ATTACKING = 1380,
+ AV_WS_ICEWING_BUNKER_IN_CONFLICT_ALLIANCE_ATTACKING = 1376, // unused
//Stoneheart Bunker
- AV_STONEH_CONTROLLED = 1364,
- AV_STONEH_DESTROYED = 1373,
- AV_STONEH_ASSAULTED = 1381,
+ AV_WS_STONEHEARTH_BUNKER_OWNER = 1184,
+ AV_WS_STONEHEARTH_BUNKER_ALLIANCE_CONTROLLED = 1364,
+ AV_WS_STONEHEARTH_BUNKER_DESTROYED = 1373,
+ AV_WS_STONEHEARTH_BUNKER_IN_CONFLICT_HORDE_ATTACKING = 1381,
+ AV_WS_STONEHEARTH_BUNKER_IN_CONFLICT_ALLIANCE_ATTACKING = 1377, // unused
//Horde
//Iceblood Tower
- AV_ICEBLOOD_CONTROLLED = 1385,
- AV_ICEBLOOD_DESTROYED = 1368,
- AV_ICEBLOOD_ASSAULTED = 1390,
+ AV_WS_ICEBLOOD_TOWER_OWNER = 1187,
+ AV_WS_ICEBLOOD_TOWER_DESTROYED = 1368,
+ AV_WS_ICEBLOOD_TOWER_HORDE_CONTROLLED = 1385,
+ AV_WS_ICEBLOOD_TOWER_IN_CONFLICT_ALLIANCE_ATTACKING = 1390,
+ AV_WS_ICEBLOOD_TOWER_IN_CONFLICT_HORDE_ATTACKING = 1395, // unused
//Tower Point
- AV_TOWERPOINT_CONTROLLED = 1384,
- AV_TOWERPOINT_DESTROYED = 1367, //goes over controlled
- AV_TOWERPOINT_ASSAULTED = 1389, //goes over destroyed
+ AV_WS_TOWER_POINT_OWNER = 1188,
+ AV_WS_TOWER_POINT_DESTROYED = 1367,
+ AV_WS_TOWER_POINT_HORDE_CONTROLLED = 1384,
+ AV_WS_TOWER_POINT_IN_CONFLICT_ALLIANCE_ATTACKING = 1389,
+ AV_WS_TOWER_POINT_IN_CONFLICT_HORDE_ATTACKING = 1394, // unused
//Frostwolf West
- AV_FROSTWOLFW_CONTROLLED = 1382,
- AV_FROSTWOLFW_DESTROYED = 1365, //over controlled
- AV_FROSTWOLFW_ASSAULTED = 1387, //over destroyed
+ AV_WS_WEST_FROSTWOLF_TOWER_OWNER = 1185,
+ AV_WS_WEST_FROSTWOLF_TOWER_DESTROYED = 1365,
+ AV_WS_WEST_FROSTWOLF_TOWER_HORDE_CONTROLLED = 1382,
+ AV_WS_WEST_FROSTWOLF_TOWER_IN_CONFLICT_ALLIANCE_ATTACKING = 1387,
+ AV_WS_WEST_FROSTWOLF_TOWER_IN_CONFLICT_HORDE_ATTACKING = 1392, // unused
//Frostwolf East
- AV_FROSTWOLFE_CONTROLLED = 1383,
- AV_FROSTWOLFE_DESTROYED = 1366,
- AV_FROSTWOLFE_ASSAULTED = 1388,
-
-//mines
-
- AV_N_MINE_N = 1360,
- AV_N_MINE_A = 1358,
- AV_N_MINE_H = 1359,
-
- AV_S_MINE_N = 1357,
- AV_S_MINE_A = 1355,
- AV_S_MINE_H = 1356,
-
-//towers assaulted by own team (unused)
- AV_STONEH_UNUSED = 1377,
- AV_ICEWING_UNUSED = 1376,
- AV_DUNS_UNUSED = 1375,
- AV_DUNN_UNUSED = 1374,
-
- AV_ICEBLOOD_UNUSED = 1395,
- AV_TOWERPOINT_UNUSED = 1394,
- AV_FROSTWOLFE_UNUSED = 1393,
- AV_FROSTWOLFW_UNUSED = 1392
-*/
+ AV_WS_EAST_FROSTWOLF_TOWER_OWNER = 1186,
+ AV_WS_EAST_FROSTWOLF_TOWER_DESTROYED = 1366,
+ AV_WS_EAST_FROSTWOLF_TOWER_HORDE_CONTROLLED = 1383,
+ AV_WS_EAST_FROSTWOLF_TOWER_IN_CONFLICT_ALLIANCE_ATTACKING = 1388,
+ AV_WS_EAST_FROSTWOLF_TOWER_IN_CONFLICT_HORDE_ATTACKING = 1393, // unused
+
+//Mines
+ AV_WS_IRONDEEP_MINE_OWNER = 801,
+ AV_WS_IRONDEEP_MINE_TROGG_CONTROLLED = 1360,
+ AV_WS_IRONDEEP_MINE_ALLIANCE_CONTROLLED = 1358,
+ AV_WS_IRONDEEP_MINE_HORDE_CONTROLLED = 1359,
+
+ AV_WS_COLDTOOTH_MINE_OWNER = 804,
+ AV_WS_COLDTOOTH_MINE_KOBOLD_CONTROLLED = 1357,
+ AV_WS_COLDTOOTH_MINE_ALLIANCE_CONTROLLED = 1355,
+ AV_WS_COLDTOOTH_MINE_HORDE_CONTROLLED = 1356,
+
+//Turnins
+ AV_WS_IVUS_STORM_CRYSTAL_COUNT = 1043,
+ AV_WS_IVUS_STORM_CRYSTAL_MAX = 1044,
+ AV_WS_LOKHOLAR_STORMPIKE_SOLDIERS_BLOOD_COUNT = 923,
+ AV_WS_LOKHOLAR_STORMPIKE_SOLDIERS_BLOOD_MAX = 922,
+
+//Bosses
+ AV_WS_DREKTHAR_ALIVE = 601,
+ AV_WS_VANDAAR_ALIVE = 602,
+
+//Captains
+ AV_WS_GALVAGAR_ALIVE = 1352,
+ AV_WS_BALINDA_ALIVE = 1351,
};
//alliance_control neutral_control horde_control
-const uint32 BG_AV_MineWorldStates[2][3] =
+const uint32 BG_AV_MineWorldStates[2][4] =
{
- {1358, 1360, 1359},
- {1355, 1357, 1356}
+ {AV_WS_IRONDEEP_MINE_ALLIANCE_CONTROLLED, AV_WS_IRONDEEP_MINE_TROGG_CONTROLLED, AV_WS_IRONDEEP_MINE_HORDE_CONTROLLED, AV_WS_IRONDEEP_MINE_OWNER},
+ {AV_WS_COLDTOOTH_MINE_ALLIANCE_CONTROLLED, AV_WS_COLDTOOTH_MINE_KOBOLD_CONTROLLED, AV_WS_COLDTOOTH_MINE_HORDE_CONTROLLED, AV_WS_COLDTOOTH_MINE_OWNER}
};
enum BG_AV_QuestIds
@@ -1510,30 +1524,31 @@ struct StaticNodeInfo
struct
{
- uint32 AllianceControl;
- uint32 AllianceAssault;
- uint32 HordeControl;
- uint32 HordeAssault;
+ int32 AllianceControl;
+ int32 AllianceAssault;
+ int32 HordeControl;
+ int32 HordeAssault;
+ int32 Owner;
} WorldStateIds;
};
static StaticNodeInfo const BGAVNodeInfo[] =
{
- { BG_AV_NODES_FIRSTAID_STATION, { 47, 48, 45, 46 }, { 1325, 1326, 1327, 1328 } }, // Stormpike First Aid Station
- { BG_AV_NODES_STORMPIKE_GRAVE, { 1, 2, 3, 4 }, { 1333, 1335, 1334, 1336 } }, // Stormpike Graveyard
- { BG_AV_NODES_STONEHEART_GRAVE, { 55, 56, 53, 54 }, { 1302, 1304, 1301, 1303 } }, // Stoneheart Graveyard
- { BG_AV_NODES_SNOWFALL_GRAVE, { 5, 6, 7, 8 }, { 1341, 1343, 1342, 1344 } }, // Snowfall Graveyard
- { BG_AV_NODES_ICEBLOOD_GRAVE, { 59, 60, 57, 58 }, { 1346, 1348, 1347, 1349 } }, // Iceblood Graveyard
- { BG_AV_NODES_FROSTWOLF_GRAVE, { 9, 10, 11, 12 }, { 1337, 1339, 1338, 1340 } }, // Frostwolf Graveyard
- { BG_AV_NODES_FROSTWOLF_HUT, { 51, 52, 49, 50 }, { 1329, 1331, 1330, 1332 } }, // Frostwolf Hut
- { BG_AV_NODES_DUNBALDAR_SOUTH, { 16, 15, 14, 13 }, { 1361, 1375, 1370, 1378 } }, // Dunbaldar South Bunker
- { BG_AV_NODES_DUNBALDAR_NORTH, { 20, 19, 18, 17 }, { 1362, 1374, 1371, 1379 } }, // Dunbaldar North Bunker
- { BG_AV_NODES_ICEWING_BUNKER, { 24, 23, 22, 21 }, { 1363, 1376, 1372, 1380 } }, // Icewing Bunker
- { BG_AV_NODES_STONEHEART_BUNKER, { 28, 27, 26, 25 }, { 1364, 1377, 1373, 1381 } }, // Stoneheart Bunker
- { BG_AV_NODES_ICEBLOOD_TOWER, { 44, 43, 42, 41 }, { 1368, 1390, 1385, 1395 } }, // Iceblood Tower
- { BG_AV_NODES_TOWER_POINT, { 40, 39, 38, 37 }, { 1367, 1389, 1384, 1394 } }, // Tower Point
- { BG_AV_NODES_FROSTWOLF_ETOWER, { 36, 35, 34, 33 }, { 1366, 1388, 1383, 1393 } }, // Frostwolf East Tower
- { BG_AV_NODES_FROSTWOLF_WTOWER, { 32, 31, 30, 29 }, { 1365, 1387, 1382, 1392 } }, // Frostwolf West Tower
+ { BG_AV_NODES_FIRSTAID_STATION, { 47, 48, 45, 46 }, { 1325, 1326, 1327, 1328, 0 } }, // Stormpike First Aid Station
+ { BG_AV_NODES_STORMPIKE_GRAVE, { 1, 2, 3, 4 }, { 1333, 1335, 1334, 1336, 0 } }, // Stormpike Graveyard
+ { BG_AV_NODES_STONEHEART_GRAVE, { 55, 56, 53, 54 }, { 1302, 1304, 1301, 1303, 0 } }, // Stoneheart Graveyard
+ { BG_AV_NODES_SNOWFALL_GRAVE, { 5, 6, 7, 8 }, { 1341, 1343, 1342, 1344, 0 } }, // Snowfall Graveyard
+ { BG_AV_NODES_ICEBLOOD_GRAVE, { 59, 60, 57, 58 }, { 1346, 1348, 1347, 1349, 0 } }, // Iceblood Graveyard
+ { BG_AV_NODES_FROSTWOLF_GRAVE, { 9, 10, 11, 12 }, { 1337, 1339, 1338, 1340, 0 } }, // Frostwolf Graveyard
+ { BG_AV_NODES_FROSTWOLF_HUT, { 51, 52, 49, 50 }, { 1329, 1331, 1330, 1332, 0 } }, // Frostwolf Hut
+ { BG_AV_NODES_DUNBALDAR_SOUTH, { 16, 15, 14, 13 }, { 1361, 1375, 1370, 1378, 1181 } }, // Dunbaldar South Bunker
+ { BG_AV_NODES_DUNBALDAR_NORTH, { 20, 19, 18, 17 }, { 1362, 1374, 1371, 1379, 1182 } }, // Dunbaldar North Bunker
+ { BG_AV_NODES_ICEWING_BUNKER, { 24, 23, 22, 21 }, { 1363, 1376, 1372, 1380, 1183 } }, // Icewing Bunker
+ { BG_AV_NODES_STONEHEART_BUNKER, { 28, 27, 26, 25 }, { 1364, 1377, 1373, 1381, 1184 } }, // Stoneheart Bunker
+ { BG_AV_NODES_ICEBLOOD_TOWER, { 44, 43, 42, 41 }, { 1368, 1390, 1385, 1395, 1188 } }, // Iceblood Tower
+ { BG_AV_NODES_TOWER_POINT, { 40, 39, 38, 37 }, { 1367, 1389, 1384, 1394, 1187 } }, // Tower Point
+ { BG_AV_NODES_FROSTWOLF_ETOWER, { 36, 35, 34, 33 }, { 1366, 1388, 1383, 1393, 1186 } }, // Frostwolf East Tower
+ { BG_AV_NODES_FROSTWOLF_WTOWER, { 32, 31, 30, 29 }, { 1365, 1387, 1382, 1392, 1185 } }, // Frostwolf West Tower
};
enum Texts
@@ -1642,7 +1657,7 @@ class BattlegroundAV : public Battleground
void RemovePlayer(Player* player, ObjectGuid guid, uint32 team) override;
void HandleAreaTrigger(Player* player, uint32 trigger, bool entered) override;
bool SetupBattleground() override;
- void ResetBGSubclass() override;
+ void Reset() override;
/*general stuff*/
void UpdateScore(uint16 team, int16 points);
@@ -1660,9 +1675,6 @@ class BattlegroundAV : public Battleground
WorldSafeLocsEntry const* GetClosestGraveyard(Player* player) override;
WorldSafeLocsEntry const* GetExploitTeleportLocation(Team team) override;
- // Achievement: Av perfection and Everything counts
- bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target = nullptr, uint32 miscvalue1 = 0) override;
-
uint32 GetPrematureWinner() override;
private:
@@ -1697,7 +1709,6 @@ class BattlegroundAV : public Battleground
void ChangeMineOwner(uint8 mine, uint32 team, bool initial = false);
/*worldstates*/
- void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override;
void SendMineWorldStates(uint32 mine);
void UpdateNodeWorldState(BG_AV_Nodes node);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
index dc0e96b2d52..9c6c7658824 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
@@ -18,7 +18,6 @@
#include "BattlegroundBE.h"
#include "Log.h"
#include "Player.h"
-#include "WorldStatePackets.h"
BattlegroundBE::BattlegroundBE(BattlegroundTemplate const* battlegroundTemplate) : Arena(battlegroundTemplate)
{
@@ -81,13 +80,6 @@ void BattlegroundBE::HandleAreaTrigger(Player* player, uint32 trigger, bool ente
}
}
-void BattlegroundBE::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet)
-{
- packet.Worldstates.emplace_back(2547, 1); // BATTLEGROUND_BLADES_EDGE_ARENA_SHOW
-
- Arena::FillInitialWorldStates(packet);
-}
-
bool BattlegroundBE::SetupBattleground()
{
// gates
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h
index d61905e5a8d..ec28b5e2bab 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h
@@ -60,7 +60,6 @@ class BattlegroundBE : public Arena
void HandleAreaTrigger(Player* source, uint32 trigger, bool entered) override;
bool SetupBattleground() override;
- void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override;
private:
void PostUpdateImpl(uint32 diff) override;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
index 3c65e03a2df..3041072c9c6 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
@@ -19,7 +19,6 @@
#include "Creature.h"
#include "Log.h"
#include "Player.h"
-#include "WorldStatePackets.h"
BattlegroundDS::BattlegroundDS(BattlegroundTemplate const* battlegroundTemplate) : Arena(battlegroundTemplate)
{
@@ -144,13 +143,6 @@ void BattlegroundDS::HandleAreaTrigger(Player* player, uint32 trigger, bool ente
}
}
-void BattlegroundDS::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet)
-{
- packet.Worldstates.emplace_back(3610, 1); // ARENA_WORLD_STATE_ALIVE_PLAYERS_SHOW
-
- Arena::FillInitialWorldStates(packet);
-}
-
bool BattlegroundDS::SetupBattleground()
{
// gates
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
index c6f910c2e73..74de658eca6 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
@@ -100,7 +100,6 @@ class BattlegroundDS : public Arena
void HandleAreaTrigger(Player* source, uint32 trigger, bool entered) override;
bool SetupBattleground() override;
- void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override;
private:
void PostUpdateImpl(uint32 diff) override;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
index dd80d7fb4d6..91d7cf0aa99 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
@@ -19,7 +19,6 @@
#include "BattlegroundMgr.h"
#include "BattlegroundPackets.h"
#include "Creature.h"
-#include "DB2Stores.h"
#include "GameObject.h"
#include "Log.h"
#include "Map.h"
@@ -29,7 +28,6 @@
#include "Random.h"
#include "SpellInfo.h"
#include "Util.h"
-#include "WorldStatePackets.h"
// these variables aren't used outside of this file, so declare them only here
uint32 BG_EY_HonorScoreTicks[BG_HONOR_MODE_NUM] =
@@ -549,6 +547,8 @@ bool BattlegroundEY::SetupBattleground()
return false;
}
+ UpdateWorldState(EY_MAX_RESOURCES, BG_EY_MAX_TEAM_SCORE);
+
return true;
}
@@ -856,52 +856,6 @@ bool BattlegroundEY::UpdatePlayerScore(Player* player, uint32 type, uint32 value
return true;
}
-void BattlegroundEY::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet)
-{
- packet.Worldstates.emplace_back(EY_HORDE_BASE, m_TeamPointsCount[TEAM_HORDE]);
- packet.Worldstates.emplace_back(EY_ALLIANCE_BASE, m_TeamPointsCount[TEAM_ALLIANCE]);
- packet.Worldstates.emplace_back(2742, 0); // Mage Tower - Horde conflict
- packet.Worldstates.emplace_back(2741, 0); // Mage Tower - Alliance conflict
- packet.Worldstates.emplace_back(2740, 0); // Fel Reaver - Horde conflict
- packet.Worldstates.emplace_back(2739, 0); // Fel Reaver - Alliance conflict
- packet.Worldstates.emplace_back(2738, 0); // Draenei - Alliance conflict
- packet.Worldstates.emplace_back(2737, 0); // Draenei - Horde conflict
- packet.Worldstates.emplace_back(2736, 0); // unk (0 at start)
- packet.Worldstates.emplace_back(2735, 0); // unk (0 at start)
-
- packet.Worldstates.emplace_back(DRAENEI_RUINS_HORDE_CONTROL, (m_PointOwnedByTeam[DRAENEI_RUINS] == HORDE && m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL) ? 1 : 0);
- packet.Worldstates.emplace_back(DRAENEI_RUINS_ALLIANCE_CONTROL, (m_PointOwnedByTeam[DRAENEI_RUINS] == ALLIANCE && m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL) ? 1 : 0);
- packet.Worldstates.emplace_back(DRAENEI_RUINS_UNCONTROL, (m_PointState[DRAENEI_RUINS] != EY_POINT_UNDER_CONTROL) ? 1 : 0);
- packet.Worldstates.emplace_back(MAGE_TOWER_ALLIANCE_CONTROL, (m_PointOwnedByTeam[MAGE_TOWER] == ALLIANCE && m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL) ? 1 : 0);
- packet.Worldstates.emplace_back(MAGE_TOWER_HORDE_CONTROL, (m_PointOwnedByTeam[MAGE_TOWER] == HORDE && m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL) ? 1 : 0);
- packet.Worldstates.emplace_back(MAGE_TOWER_UNCONTROL, (m_PointState[MAGE_TOWER] != EY_POINT_UNDER_CONTROL) ? 1 : 0);
- packet.Worldstates.emplace_back(FEL_REAVER_HORDE_CONTROL, (m_PointOwnedByTeam[FEL_REAVER] == HORDE && m_PointState[FEL_REAVER] == EY_POINT_UNDER_CONTROL) ? 1 : 0);
- packet.Worldstates.emplace_back(FEL_REAVER_ALLIANCE_CONTROL, (m_PointOwnedByTeam[FEL_REAVER] == ALLIANCE && m_PointState[FEL_REAVER] == EY_POINT_UNDER_CONTROL) ? 1 : 0);
- packet.Worldstates.emplace_back(FEL_REAVER_UNCONTROL, (m_PointState[FEL_REAVER] != EY_POINT_UNDER_CONTROL) ? 1 : 0);
- packet.Worldstates.emplace_back(BLOOD_ELF_HORDE_CONTROL, (m_PointOwnedByTeam[BLOOD_ELF] == HORDE && m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL) ? 1 : 0);
- packet.Worldstates.emplace_back(BLOOD_ELF_ALLIANCE_CONTROL, (m_PointOwnedByTeam[BLOOD_ELF] == ALLIANCE && m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL) ? 1 : 0);
- packet.Worldstates.emplace_back(BLOOD_ELF_UNCONTROL, (m_PointState[BLOOD_ELF] != EY_POINT_UNDER_CONTROL) ? 1 : 0);
- packet.Worldstates.emplace_back(NETHERSTORM_FLAG, (m_FlagState == BG_EY_FLAG_STATE_ON_BASE) ? 1 : 0);
-
- packet.Worldstates.emplace_back(NETHERSTORM_FLAG_STATE_HORDE, 1); // Horde top-stats (1 - show, 0 - hide) // 02 -> horde picked up the flag
- packet.Worldstates.emplace_back(NETHERSTORM_FLAG_STATE_ALLIANCE, 1); // Alliance top-stats (1 - show, 0 - hide) // 02 -> alliance picked up the flag
- packet.Worldstates.emplace_back(EY_HORDE_RESOURCES, GetTeamScore(TEAM_HORDE)); // Horde resources
- packet.Worldstates.emplace_back(EY_ALLIANCE_RESOURCES, GetTeamScore(TEAM_ALLIANCE)); // Alliance resources
- packet.Worldstates.emplace_back(EY_MAX_RESOURCES, BG_EY_MAX_TEAM_SCORE); // Max resources
- packet.Worldstates.emplace_back(2565, 142); // unk, constant?
- packet.Worldstates.emplace_back(PROGRESS_BAR_PERCENT_GREY, 0); // Capturing progress-bar (100 -> empty (only grey), 0 -> blue|red (no grey), default 0)
- packet.Worldstates.emplace_back(PROGRESS_BAR_STATUS, 0); // Capturing progress-bar (0 - left, 100 - right)
- packet.Worldstates.emplace_back(PROGRESS_BAR_SHOW, 0); // Capturing progress-bar (1 - show, 0 - hide)
- packet.Worldstates.emplace_back(3085, 379); // unk, constant?
-
- for (uint8 point = 0; point < EY_POINTS_MAX; ++point)
- {
- BattlegroundPointCaptureStatus captureStatus = GetPointCaptureStatus(point);
- packet.Worldstates.emplace_back(m_PointsIconStruct[point].WorldStateAllianceStatusBarIcon, captureStatus == BattlegroundPointCaptureStatus::AllianceControlled ? 2 : (captureStatus == BattlegroundPointCaptureStatus::AllianceCapturing ? 1 : 0));
- packet.Worldstates.emplace_back(m_PointsIconStruct[point].WorldStateHordeStatusBarIcon, captureStatus == BattlegroundPointCaptureStatus::HordeControlled ? 2 : (captureStatus == BattlegroundPointCaptureStatus::HordeCapturing ? 1 : 0));
- }
-}
-
WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveyard(Player* player)
{
uint32 g_id = 0;
@@ -965,16 +919,6 @@ WorldSafeLocsEntry const* BattlegroundEY::GetExploitTeleportLocation(Team team)
return sObjectMgr->GetWorldSafeLoc(team == ALLIANCE ? EY_EXPLOIT_TELEPORT_LOCATION_ALLIANCE : EY_EXPLOIT_TELEPORT_LOCATION_HORDE);
}
-bool BattlegroundEY::IsAllNodesControlledByTeam(uint32 team) const
-{
- uint32 count = 0;
- for (int i = 0; i < EY_POINTS_MAX; ++i)
- if (m_PointOwnedByTeam[i] == team && m_PointState[i] == EY_POINT_UNDER_CONTROL)
- ++count;
-
- return count == EY_POINTS_MAX;
-}
-
uint32 BattlegroundEY::GetPrematureWinner()
{
if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE))
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
index a11383c5659..3f77ab0afde 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
@@ -51,7 +51,7 @@ enum BG_EY_WorldStates
PROGRESS_BAR_PERCENT_GREY = 2720, //100 = empty (only grey), 0 = blue|red (no grey)
PROGRESS_BAR_STATUS = 2719, //50 init!, 48 ... hordak bere .. 33 .. 0 = full 100% hordacky, 100 = full alliance
PROGRESS_BAR_SHOW = 2718, //1 init, 0 druhy send - bez messagu, 1 = controlled aliance
- NETHERSTORM_FLAG = 2757,
+ NETHERSTORM_FLAG = 8863,
//set to 2 when flag is picked up, and to 1 if it is dropped
NETHERSTORM_FLAG_STATE_ALLIANCE = 9808,
NETHERSTORM_FLAG_STATE_HORDE = 9809,
@@ -244,7 +244,7 @@ enum EYBattlegroundObjectTypes
enum BG_EY_Score
{
BG_EY_WARNING_NEAR_VICTORY_SCORE = 1400,
- BG_EY_MAX_TEAM_SCORE = 1600
+ BG_EY_MAX_TEAM_SCORE = 1500
};
enum BG_EY_FlagState
@@ -442,7 +442,6 @@ class BattlegroundEY : public Battleground
void UpdateTeamScore(uint32 Team);
void EndBattleground(uint32 winner) override;
bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override;
- void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override;
void SetDroppedFlagGUID(ObjectGuid guid, int32 /*TeamID*/ = -1) override { m_DroppedFlagGUID = guid; }
ObjectGuid GetDroppedFlagGUID() const { return m_DroppedFlagGUID; }
@@ -450,9 +449,6 @@ class BattlegroundEY : public Battleground
void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj) override;
void EventPlayerDroppedFlag(Player* Source) override;
- /* achievement req. */
- bool IsAllNodesControlledByTeam(uint32 team) const override;
-
uint32 GetPrematureWinner() override;
protected:
void PostUpdateImpl(uint32 diff) override;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
index f27c00e387b..ac0e24b2ddc 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
@@ -25,7 +25,6 @@
#include "Transport.h"
#include "UnitAI.h"
#include "Vehicle.h"
-#include "WorldStatePackets.h"
BattlegroundIC::BattlegroundIC(BattlegroundTemplate const* battlegroundTemplate) : Battleground(battlegroundTemplate)
{
@@ -207,7 +206,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
{
factionReinforcements[nodePoint[i].faction] += 1;
RewardHonorToTeam(RESOURCE_HONOR_AMOUNT, nodePoint[i].faction == TEAM_ALLIANCE ? ALLIANCE : HORDE);
- UpdateWorldState((nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_ALLIANCE_RENFORT : BG_IC_HORDE_RENFORT), factionReinforcements[nodePoint[i].faction]);
+ UpdateWorldState((nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_ALLIANCE_REINFORCEMENTS : BG_IC_HORDE_REINFORCEMENTS), factionReinforcements[nodePoint[i].faction]);
}
}
resourceTimer = IC_RESOURCE_TIME;
@@ -287,23 +286,6 @@ void BattlegroundIC::HandleAreaTrigger(Player* player, uint32 trigger, bool ente
}
}
-void BattlegroundIC::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet)
-{
- packet.Worldstates.emplace_back(BG_IC_ALLIANCE_RENFORT_SET, 1);
- packet.Worldstates.emplace_back(BG_IC_HORDE_RENFORT_SET, 1);
- packet.Worldstates.emplace_back(BG_IC_ALLIANCE_RENFORT, factionReinforcements[TEAM_ALLIANCE]);
- packet.Worldstates.emplace_back(BG_IC_HORDE_RENFORT, factionReinforcements[TEAM_HORDE]);
-
- for (uint8 itr = 0; itr < MAX_FORTRESS_GATES_SPAWNS; ++itr)
- {
- int32 worldState = GetWorldStateFromGateEntry(BG_IC_ObjSpawnlocs[itr].entry, (GateStatus[GetGateIDFromEntry(BG_IC_ObjSpawnlocs[itr].entry)] == BG_IC_GATE_DESTROYED ? true : false));
- packet.Worldstates.emplace_back(worldState, 1);
- }
-
- for (uint8 itr = 0; itr < MAX_NODE_TYPES; ++itr)
- packet.Worldstates.emplace_back(nodePoint[itr].worldStates[nodePoint[itr].nodeState], 1);
-}
-
bool BattlegroundIC::SetupBattleground()
{
for (uint8 i = 0; i < MAX_NORMAL_GAMEOBJECTS_SPAWNS; ++i)
@@ -409,7 +391,7 @@ void BattlegroundIC::HandleKillPlayer(Player* player, Player* killer)
TeamId victimTeamId = GetTeamIndexByTeamId(GetPlayerTeam(player->GetGUID()));
factionReinforcements[victimTeamId] -= 1;
- UpdateWorldState((GetPlayerTeam(player->GetGUID()) == ALLIANCE ? BG_IC_ALLIANCE_RENFORT : BG_IC_HORDE_RENFORT), factionReinforcements[victimTeamId]);
+ UpdateWorldState((GetPlayerTeam(player->GetGUID()) == ALLIANCE ? BG_IC_ALLIANCE_REINFORCEMENTS : BG_IC_HORDE_REINFORCEMENTS), factionReinforcements[victimTeamId]);
// we must end the battleground
if (factionReinforcements[victimTeamId] < 1)
@@ -512,7 +494,7 @@ void BattlegroundIC::UpdateNodeWorldState(ICNodePoint* node)
else if (node->gameobject_entry == node->banners[BANNER_H_CONTESTED])
node->nodeState = NODE_STATE_CONFLICT_H;
- uint32 worldstate = node->worldStates[node->nodeState];
+ int32 worldstate = node->worldStates[node->nodeState];
// with this we are sure we dont bug the client
for (uint8 i = 0; i < 5; ++i)
@@ -523,6 +505,7 @@ void BattlegroundIC::UpdateNodeWorldState(ICNodePoint* node)
}
UpdateWorldState(worldstate, 1);
+ UpdateWorldState(node->worldStates[5], node->nodeState == NODE_STATE_CONTROLLED_H ? 2 : node->nodeState == NODE_STATE_CONTROLLED_A ? 1 : 0);
}
uint32 BattlegroundIC::GetNextBanner(ICNodePoint* node, uint32 team, bool returnDefinitve)
@@ -797,8 +780,8 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* node, bool recapture)
void BattlegroundIC::DestroyGate(Player* player, GameObject* go)
{
GateStatus[GetGateIDFromEntry(go->GetEntry())] = BG_IC_GATE_DESTROYED;
- uint32 uws_open = GetWorldStateFromGateEntry(go->GetEntry(), true);
- uint32 uws_close = GetWorldStateFromGateEntry(go->GetEntry(), false);
+ int32 uws_open = GetWorldStateFromGateEntry(go->GetEntry(), true);
+ int32 uws_close = GetWorldStateFromGateEntry(go->GetEntry(), false);
if (uws_open)
{
UpdateWorldState(uws_close, 0);
@@ -905,19 +888,6 @@ WorldSafeLocsEntry const * BattlegroundIC::GetExploitTeleportLocation(Team team)
return sObjectMgr->GetWorldSafeLoc(team == ALLIANCE ? IC_EXPLOIT_TELEPORT_LOCATION_ALLIANCE : IC_EXPLOIT_TELEPORT_LOCATION_HORDE);
}
-bool BattlegroundIC::IsAllNodesControlledByTeam(uint32 team) const
-{
- uint32 count = 0;
- ICNodeState controlledState = team == ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H;
- for (int i = 0; i < NODE_TYPE_WORKSHOP; ++i)
- {
- if (nodePoint[i].nodeState == controlledState)
- ++count;
- }
-
- return count == NODE_TYPE_WORKSHOP;
-}
-
bool BattlegroundIC::IsSpellAllowed(uint32 spellId, Player const* player) const
{
switch (spellId)
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
index fb60b87c851..dd4b7776572 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
@@ -186,7 +186,7 @@ enum gameobjectsIC
GO_ALLIANCE_GUNSHIP = 195121
};
-#define MAX_REINFORCEMENTS 300
+#define MAX_REINFORCEMENTS 400
enum Times
{
@@ -734,10 +734,12 @@ enum BG_IC_Objectives
enum ICWorldStates
{
- BG_IC_ALLIANCE_RENFORT_SET = 4221,
- BG_IC_HORDE_RENFORT_SET = 4222,
- BG_IC_ALLIANCE_RENFORT = 4226,
- BG_IC_HORDE_RENFORT = 4227,
+ BG_IC_ALLIANCE_REINFORCEMENTS_SET = 4221,
+ BG_IC_HORDE_REINFORCEMENTS_SET = 4222,
+ BG_IC_ALLIANCE_REINFORCEMENTS = 4226,
+ BG_IC_HORDE_REINFORCEMENTS = 4227,
+ BG_IC_MAX_REINFORCEMENTS = 17377,
+
BG_IC_GATE_FRONT_H_WS_CLOSED = 4317,
BG_IC_GATE_WEST_H_WS_CLOSED = 4318,
BG_IC_GATE_EAST_H_WS_CLOSED = 4319,
@@ -751,30 +753,35 @@ enum ICWorldStates
BG_IC_GATE_WEST_A_WS_OPEN = 4324,
BG_IC_GATE_EAST_A_WS_OPEN = 4325,
+ BG_IC_DOCKS_OWNER = 4235,
BG_IC_DOCKS_UNCONTROLLED = 4301,
BG_IC_DOCKS_CONFLICT_A = 4305,
BG_IC_DOCKS_CONFLICT_H = 4302,
BG_IC_DOCKS_CONTROLLED_A = 4304,
BG_IC_DOCKS_CONTROLLED_H = 4303,
+ BG_IC_HANGAR_OWNER = 4234,
BG_IC_HANGAR_UNCONTROLLED = 4296,
BG_IC_HANGAR_CONFLICT_A = 4300,
BG_IC_HANGAR_CONFLICT_H = 4297,
BG_IC_HANGAR_CONTROLLED_A = 4299,
BG_IC_HANGAR_CONTROLLED_H = 4298,
+ BG_IC_QUARRY_OWNER = 4289,
BG_IC_QUARRY_UNCONTROLLED = 4306,
BG_IC_QUARRY_CONFLICT_A = 4310,
BG_IC_QUARRY_CONFLICT_H = 4307,
BG_IC_QUARRY_CONTROLLED_A = 4309,
BG_IC_QUARRY_CONTROLLED_H = 4308,
+ BG_IC_REFINERY_OWNER = 4287,
BG_IC_REFINERY_UNCONTROLLED = 4311,
BG_IC_REFINERY_CONFLICT_A = 4315,
BG_IC_REFINERY_CONFLICT_H = 4312,
BG_IC_REFINERY_CONTROLLED_A = 4314,
BG_IC_REFINERY_CONTROLLED_H = 4313,
+ BG_IC_WORKSHOP_OWNER = 4232,
BG_IC_WORKSHOP_UNCONTROLLED = 4294,
BG_IC_WORKSHOP_CONFLICT_A = 4228,
BG_IC_WORKSHOP_CONFLICT_H = 4293,
@@ -892,19 +899,19 @@ struct ICNodePoint
bool needChange; // this is used for the 1 minute time period after the point is captured
uint32 timer; // the same use for needChange
uint32 last_entry; // the last gameobject_entry
- uint32 worldStates[5]; // the worldstates that represent the node in the map
+ int32 worldStates[6]; // the worldstates that represent the node in the map
ICNodeState nodeState;
};
const ICNodePoint nodePointInitial[MAX_NODE_TYPES] =
{
- {BG_IC_GO_REFINERY_BANNER, GO_REFINERY_BANNER, TEAM_NEUTRAL, NODE_TYPE_REFINERY, {GO_ALLIANCE_BANNER_REFINERY, GO_ALLIANCE_BANNER_REFINERY_CONT, GO_HORDE_BANNER_REFINERY, GO_HORDE_BANNER_REFINERY_CONT}, false, 0, 0, {BG_IC_REFINERY_UNCONTROLLED, BG_IC_REFINERY_CONFLICT_A, BG_IC_REFINERY_CONFLICT_H, BG_IC_REFINERY_CONTROLLED_A, BG_IC_REFINERY_CONTROLLED_H}, NODE_STATE_UNCONTROLLED},
- {BG_IC_GO_QUARRY_BANNER, GO_QUARRY_BANNER, TEAM_NEUTRAL, NODE_TYPE_QUARRY, {GO_ALLIANCE_BANNER_QUARRY, GO_ALLIANCE_BANNER_QUARRY_CONT, GO_HORDE_BANNER_QUARRY, GO_HORDE_BANNER_QUARRY_CONT}, false, 0, 0, {BG_IC_QUARRY_UNCONTROLLED, BG_IC_QUARRY_CONFLICT_A, BG_IC_QUARRY_CONFLICT_H, BG_IC_QUARRY_CONTROLLED_A, BG_IC_QUARRY_CONTROLLED_H}, NODE_STATE_UNCONTROLLED},
- {BG_IC_GO_DOCKS_BANNER, GO_DOCKS_BANNER, TEAM_NEUTRAL, NODE_TYPE_DOCKS, {GO_ALLIANCE_BANNER_DOCK, GO_ALLIANCE_BANNER_DOCK_CONT, GO_HORDE_BANNER_DOCK, GO_HORDE_BANNER_DOCK_CONT}, false, 0, 0, {BG_IC_DOCKS_UNCONTROLLED, BG_IC_DOCKS_CONFLICT_A, BG_IC_DOCKS_CONFLICT_H, BG_IC_DOCKS_CONTROLLED_A, BG_IC_DOCKS_CONTROLLED_H}, NODE_STATE_UNCONTROLLED},
- {BG_IC_GO_HANGAR_BANNER, GO_HANGAR_BANNER, TEAM_NEUTRAL, NODE_TYPE_HANGAR, {GO_ALLIANCE_BANNER_HANGAR, GO_ALLIANCE_BANNER_HANGAR_CONT, GO_HORDE_BANNER_HANGAR, GO_HORDE_BANNER_HANGAR_CONT}, false, 0, 0, {BG_IC_HANGAR_UNCONTROLLED, BG_IC_HANGAR_CONFLICT_A, BG_IC_HANGAR_CONFLICT_H, BG_IC_HANGAR_CONTROLLED_A, BG_IC_HANGAR_CONTROLLED_H}, NODE_STATE_UNCONTROLLED},
- {BG_IC_GO_WORKSHOP_BANNER, GO_WORKSHOP_BANNER, TEAM_NEUTRAL, NODE_TYPE_WORKSHOP, {GO_ALLIANCE_BANNER_WORKSHOP, GO_ALLIANCE_BANNER_WORKSHOP_CONT, GO_HORDE_BANNER_WORKSHOP, GO_HORDE_BANNER_WORKSHOP_CONT}, false, 0, 0, {BG_IC_WORKSHOP_UNCONTROLLED, BG_IC_WORKSHOP_CONFLICT_A, BG_IC_WORKSHOP_CONFLICT_H, BG_IC_WORKSHOP_CONTROLLED_A, BG_IC_WORKSHOP_CONTROLLED_H}, NODE_STATE_UNCONTROLLED},
- {BG_IC_GO_ALLIANCE_BANNER, GO_ALLIANCE_BANNER, TEAM_ALLIANCE, NODE_TYPE_GRAVEYARD_A, {GO_ALLIANCE_BANNER_GRAVEYARD_A, GO_ALLIANCE_BANNER_GRAVEYARD_A_CONT, GO_HORDE_BANNER_GRAVEYARD_A, GO_HORDE_BANNER_GRAVEYARD_A_CONT}, false, 0, 0, {BG_IC_ALLIANCE_KEEP_UNCONTROLLED, BG_IC_ALLIANCE_KEEP_CONFLICT_A, BG_IC_ALLIANCE_KEEP_CONFLICT_H, BG_IC_ALLIANCE_KEEP_CONTROLLED_A, BG_IC_ALLIANCE_KEEP_CONTROLLED_H}, NODE_STATE_CONTROLLED_A},
- {BG_IC_GO_HORDE_BANNER, GO_HORDE_BANNER, TEAM_HORDE, NODE_TYPE_GRAVEYARD_H, {GO_ALLIANCE_BANNER_GRAVEYARD_H, GO_ALLIANCE_BANNER_GRAVEYARD_H_CONT, GO_HORDE_BANNER_GRAVEYARD_H, GO_HORDE_BANNER_GRAVEYARD_H_CONT}, false, 0, 0, {BG_IC_HORDE_KEEP_UNCONTROLLED, BG_IC_HORDE_KEEP_CONFLICT_A, BG_IC_HORDE_KEEP_CONFLICT_H, BG_IC_HORDE_KEEP_CONTROLLED_A, BG_IC_HORDE_KEEP_CONTROLLED_H}, NODE_STATE_CONTROLLED_H}
+ {BG_IC_GO_REFINERY_BANNER, GO_REFINERY_BANNER, TEAM_NEUTRAL, NODE_TYPE_REFINERY, {GO_ALLIANCE_BANNER_REFINERY, GO_ALLIANCE_BANNER_REFINERY_CONT, GO_HORDE_BANNER_REFINERY, GO_HORDE_BANNER_REFINERY_CONT}, false, 0, 0, {BG_IC_REFINERY_UNCONTROLLED, BG_IC_REFINERY_CONFLICT_A, BG_IC_REFINERY_CONFLICT_H, BG_IC_REFINERY_CONTROLLED_A, BG_IC_REFINERY_CONTROLLED_H, BG_IC_REFINERY_OWNER}, NODE_STATE_UNCONTROLLED},
+ {BG_IC_GO_QUARRY_BANNER, GO_QUARRY_BANNER, TEAM_NEUTRAL, NODE_TYPE_QUARRY, {GO_ALLIANCE_BANNER_QUARRY, GO_ALLIANCE_BANNER_QUARRY_CONT, GO_HORDE_BANNER_QUARRY, GO_HORDE_BANNER_QUARRY_CONT}, false, 0, 0, {BG_IC_QUARRY_UNCONTROLLED, BG_IC_QUARRY_CONFLICT_A, BG_IC_QUARRY_CONFLICT_H, BG_IC_QUARRY_CONTROLLED_A, BG_IC_QUARRY_CONTROLLED_H, BG_IC_QUARRY_OWNER}, NODE_STATE_UNCONTROLLED},
+ {BG_IC_GO_DOCKS_BANNER, GO_DOCKS_BANNER, TEAM_NEUTRAL, NODE_TYPE_DOCKS, {GO_ALLIANCE_BANNER_DOCK, GO_ALLIANCE_BANNER_DOCK_CONT, GO_HORDE_BANNER_DOCK, GO_HORDE_BANNER_DOCK_CONT}, false, 0, 0, {BG_IC_DOCKS_UNCONTROLLED, BG_IC_DOCKS_CONFLICT_A, BG_IC_DOCKS_CONFLICT_H, BG_IC_DOCKS_CONTROLLED_A, BG_IC_DOCKS_CONTROLLED_H, BG_IC_DOCKS_OWNER}, NODE_STATE_UNCONTROLLED},
+ {BG_IC_GO_HANGAR_BANNER, GO_HANGAR_BANNER, TEAM_NEUTRAL, NODE_TYPE_HANGAR, {GO_ALLIANCE_BANNER_HANGAR, GO_ALLIANCE_BANNER_HANGAR_CONT, GO_HORDE_BANNER_HANGAR, GO_HORDE_BANNER_HANGAR_CONT}, false, 0, 0, {BG_IC_HANGAR_UNCONTROLLED, BG_IC_HANGAR_CONFLICT_A, BG_IC_HANGAR_CONFLICT_H, BG_IC_HANGAR_CONTROLLED_A, BG_IC_HANGAR_CONTROLLED_H, BG_IC_HANGAR_OWNER}, NODE_STATE_UNCONTROLLED},
+ {BG_IC_GO_WORKSHOP_BANNER, GO_WORKSHOP_BANNER, TEAM_NEUTRAL, NODE_TYPE_WORKSHOP, {GO_ALLIANCE_BANNER_WORKSHOP, GO_ALLIANCE_BANNER_WORKSHOP_CONT, GO_HORDE_BANNER_WORKSHOP, GO_HORDE_BANNER_WORKSHOP_CONT}, false, 0, 0, {BG_IC_WORKSHOP_UNCONTROLLED, BG_IC_WORKSHOP_CONFLICT_A, BG_IC_WORKSHOP_CONFLICT_H, BG_IC_WORKSHOP_CONTROLLED_A, BG_IC_WORKSHOP_CONTROLLED_H, BG_IC_WORKSHOP_OWNER}, NODE_STATE_UNCONTROLLED},
+ {BG_IC_GO_ALLIANCE_BANNER, GO_ALLIANCE_BANNER, TEAM_ALLIANCE, NODE_TYPE_GRAVEYARD_A, {GO_ALLIANCE_BANNER_GRAVEYARD_A, GO_ALLIANCE_BANNER_GRAVEYARD_A_CONT, GO_HORDE_BANNER_GRAVEYARD_A, GO_HORDE_BANNER_GRAVEYARD_A_CONT}, false, 0, 0, {BG_IC_ALLIANCE_KEEP_UNCONTROLLED, BG_IC_ALLIANCE_KEEP_CONFLICT_A, BG_IC_ALLIANCE_KEEP_CONFLICT_H, BG_IC_ALLIANCE_KEEP_CONTROLLED_A, BG_IC_ALLIANCE_KEEP_CONTROLLED_H, 0}, NODE_STATE_CONTROLLED_A},
+ {BG_IC_GO_HORDE_BANNER, GO_HORDE_BANNER, TEAM_HORDE, NODE_TYPE_GRAVEYARD_H, {GO_ALLIANCE_BANNER_GRAVEYARD_H, GO_ALLIANCE_BANNER_GRAVEYARD_H_CONT, GO_HORDE_BANNER_GRAVEYARD_H, GO_HORDE_BANNER_GRAVEYARD_H_CONT}, false, 0, 0, {BG_IC_HORDE_KEEP_UNCONTROLLED, BG_IC_HORDE_KEEP_CONFLICT_A, BG_IC_HORDE_KEEP_CONFLICT_H, BG_IC_HORDE_KEEP_CONTROLLED_A, BG_IC_HORDE_KEEP_CONTROLLED_H, 0}, NODE_STATE_CONTROLLED_H}
};
enum HonorRewards
@@ -977,14 +984,10 @@ class BattlegroundIC : public Battleground
WorldSafeLocsEntry const* GetExploitTeleportLocation(Team team) override;
/* Scorekeeping */
- void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override;
-
void HandlePlayerResurrect(Player* player) override;
uint32 GetNodeState(uint8 nodeType) const { return (uint8)nodePoint[nodeType].nodeState; }
- bool IsAllNodesControlledByTeam(uint32 team) const override;
-
bool IsSpellAllowed(uint32 spellId, Player const* player) const override;
private:
@@ -1017,9 +1020,9 @@ class BattlegroundIC : public Battleground
return i;
}
- uint32 GetWorldStateFromGateEntry(uint32 id, bool open)
+ int32 GetWorldStateFromGateEntry(uint32 id, bool open)
{
- uint32 uws = 0;
+ int32 uws = 0;
switch (id)
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
index 0482be0812c..510f6caed99 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
@@ -18,7 +18,6 @@
#include "BattlegroundNA.h"
#include "Log.h"
#include "Player.h"
-#include "WorldStatePackets.h"
BattlegroundNA::BattlegroundNA(BattlegroundTemplate const* battlegroundTemplate) : Arena(battlegroundTemplate)
{
@@ -78,13 +77,6 @@ void BattlegroundNA::HandleAreaTrigger(Player* player, uint32 trigger, bool ente
}
}
-void BattlegroundNA::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet)
-{
- packet.Worldstates.emplace_back(2577, 1); // BATTLEGROUND_NAGRAND_ARENA_SHOW
-
- Arena::FillInitialWorldStates(packet);
-}
-
bool BattlegroundNA::SetupBattleground()
{
// gates
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h
index 1436c78f6d1..d8c7903005d 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h
@@ -59,7 +59,6 @@ class BattlegroundNA : public Arena
void HandleAreaTrigger(Player* source, uint32 trigger, bool entered) override;
bool SetupBattleground() override;
- void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override;
private:
void PostUpdateImpl(uint32 diff) override;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
index f4d13b28d45..a6559edd804 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
@@ -18,7 +18,6 @@
#include "BattlegroundRL.h"
#include "Log.h"
#include "Player.h"
-#include "WorldStatePackets.h"
BattlegroundRL::BattlegroundRL(BattlegroundTemplate const* battlegroundTemplate) : Arena(battlegroundTemplate)
{
@@ -78,13 +77,6 @@ void BattlegroundRL::HandleAreaTrigger(Player* player, uint32 trigger, bool ente
}
}
-void BattlegroundRL::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet)
-{
- packet.Worldstates.emplace_back(3002, 1); // BATTELGROUND_RUINS_OF_LORDAERNON_SHOW
-
- Arena::FillInitialWorldStates(packet);
-}
-
bool BattlegroundRL::SetupBattleground()
{
// gates
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h
index 4c2f94d2566..7941f5d3a48 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h
@@ -50,7 +50,6 @@ class BattlegroundRL : public Arena
BattlegroundRL(BattlegroundTemplate const* battlegroundTemplate);
/* inherited from BattlegroundClass */
- void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override;
void StartingEventCloseDoors() override;
void StartingEventOpenDoors() override;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp
index 143bb9231d7..722b977e87c 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp
@@ -20,7 +20,6 @@
#include "Log.h"
#include "ObjectAccessor.h"
#include "Player.h"
-#include "WorldStatePackets.h"
BattlegroundRV::BattlegroundRV(BattlegroundTemplate const* battlegroundTemplate) : Arena(battlegroundTemplate)
{
@@ -100,13 +99,6 @@ void BattlegroundRV::HandleAreaTrigger(Player* player, uint32 trigger, bool ente
}
}
-void BattlegroundRV::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet)
-{
- packet.Worldstates.emplace_back(BG_RV_WORLD_STATE, 1);
-
- Arena::FillInitialWorldStates(packet);
-}
-
bool BattlegroundRV::SetupBattleground()
{
// elevators
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h
index ff1c1f2da0e..ca0f183270a 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h
@@ -85,8 +85,6 @@ enum BattlegroundRVData
BG_RV_FIRE_TO_PILLAR_TIMER = 20000,
BG_RV_CLOSE_FIRE_TIMER = 5000,
BG_RV_FIRST_TIMER = 20133,
-
- BG_RV_WORLD_STATE = 0xe1a
};
class BattlegroundRV : public Arena
@@ -96,7 +94,6 @@ class BattlegroundRV : public Arena
/* inherited from BattlegroundClass */
void StartingEventOpenDoors() override;
- void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override;
void HandleAreaTrigger(Player* source, uint32 trigger, bool entered) override;
bool SetupBattleground() override;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
index aa2647ce944..6fd8d4ad30e 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
@@ -28,7 +28,7 @@
#include "Player.h"
#include "Random.h"
#include "UpdateData.h"
-#include "WorldStatePackets.h"
+#include "WorldStateMgr.h"
BattlegroundSA::BattlegroundSA(BattlegroundTemplate const* battlegroundTemplate) : Battleground(battlegroundTemplate)
{
@@ -41,7 +41,6 @@ BattlegroundSA::BattlegroundSA(BattlegroundTemplate const* battlegroundTemplate)
SignaledRoundTwo = false;
SignaledRoundTwoHalfMin = false;
InitSecondRound = false;
- _gateDestroyed = false;
Attackers = TEAM_ALLIANCE;
TotalTime = 0;
EndRoundTimer = 0;
@@ -49,13 +48,12 @@ BattlegroundSA::BattlegroundSA(BattlegroundTemplate const* battlegroundTemplate)
Status = BG_SA_NOT_STARTED;
for (uint8 i = 0; i < MAX_GATES; ++i)
- GateStatus[i] = BG_SA_GATE_OK;
+ GateStatus[i] = BG_SA_HORDE_GATE_OK;
for (uint8 i = 0; i < 2; i++)
{
RoundScores[i].winner = TEAM_ALLIANCE;
RoundScores[i].time = 0;
- _allVehiclesAlive[i] = true;
}
//! This is here to prevent an uninitialised variable warning
@@ -71,11 +69,8 @@ void BattlegroundSA::Reset()
TotalTime = 0;
Attackers = ((urand(0, 1)) ? TEAM_ALLIANCE : TEAM_HORDE);
for (uint8 i = 0; i <= 5; i++)
- GateStatus[i] = BG_SA_GATE_OK;
+ GateStatus[i] = BG_SA_HORDE_GATE_OK;
ShipsStarted = false;
- _gateDestroyed = false;
- _allVehiclesAlive[TEAM_ALLIANCE] = true;
- _allVehiclesAlive[TEAM_HORDE] = true;
Status = BG_SA_WARMUP;
}
@@ -103,7 +98,7 @@ bool BattlegroundSA::ResetObjs()
DelCreature(i);
for (uint8 i = 0; i < MAX_GATES; ++i)
- GateStatus[i] = BG_SA_GATE_OK;
+ GateStatus[i] = Attackers == TEAM_HORDE ? BG_SA_ALLIANCE_GATE_OK : BG_SA_HORDE_GATE_OK;
if (!AddCreature(BG_SA_NpcEntries[BG_SA_NPC_KANRETHAD], BG_SA_NPC_KANRETHAD, BG_SA_NpcSpawnlocs[BG_SA_NPC_KANRETHAD]))
{
@@ -268,6 +263,7 @@ bool BattlegroundSA::ResetObjs()
UpdateWorldState(BG_SA_ALLIANCE_DEFENCE_TOKEN, 1);
}
+ UpdateWorldState(BG_SA_ATTACKER_TEAM, Attackers);
UpdateWorldState(BG_SA_PURPLE_GATEWS, 1);
UpdateWorldState(BG_SA_RED_GATEWS, 1);
UpdateWorldState(BG_SA_BLUE_GATEWS, 1);
@@ -292,8 +288,8 @@ void BattlegroundSA::StartShips()
if (ShipsStarted)
return;
- DoorOpen(BG_SA_BOAT_ONE);
- DoorOpen(BG_SA_BOAT_TWO);
+ GetBGObject(BG_SA_BOAT_ONE)->SetGoState(GO_STATE_TRANSPORT_STOPPED);
+ GetBGObject(BG_SA_BOAT_TWO)->SetGoState(GO_STATE_TRANSPORT_STOPPED);
for (int i = BG_SA_BOAT_ONE; i <= BG_SA_BOAT_TWO; i++)
{
@@ -336,6 +332,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
if (Status == BG_SA_WARMUP)
{
EndRoundTimer = BG_SA_ROUNDLENGTH;
+ UpdateWorldState(BG_SA_TIMER, GameTime::GetGameTime() + EndRoundTimer);
if (TotalTime >= BG_SA_WARMUPLENGTH)
{
if (Creature* c = GetBGCreature(BG_SA_NPC_KANRETHAD))
@@ -358,6 +355,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
else
EndRoundTimer = BG_SA_ROUNDLENGTH;
+ UpdateWorldState(BG_SA_TIMER, GameTime::GetGameTime() + EndRoundTimer);
if (TotalTime >= 60000)
{
if (Creature* c = GetBGCreature(BG_SA_NPC_KANRETHAD))
@@ -426,54 +424,10 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
}
}
if (Status == BG_SA_ROUND_ONE || Status == BG_SA_ROUND_TWO)
- {
- SendTime();
UpdateDemolisherSpawns();
- }
}
}
-void BattlegroundSA::StartingEventCloseDoors() { }
-
-void BattlegroundSA::StartingEventOpenDoors() { }
-
-void BattlegroundSA::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet)
-{
- bool const allyAttacks = Attackers == TEAM_ALLIANCE;
- bool const hordeAttacks = Attackers == TEAM_HORDE;
-
- packet.Worldstates.emplace_back(BG_SA_ANCIENT_GATEWS, GateStatus[BG_SA_ANCIENT_GATE]);
- packet.Worldstates.emplace_back(BG_SA_YELLOW_GATEWS, GateStatus[BG_SA_YELLOW_GATE]);
- packet.Worldstates.emplace_back(BG_SA_GREEN_GATEWS, GateStatus[BG_SA_GREEN_GATE]);
- packet.Worldstates.emplace_back(BG_SA_BLUE_GATEWS, GateStatus[BG_SA_BLUE_GATE]);
- packet.Worldstates.emplace_back(BG_SA_RED_GATEWS, GateStatus[BG_SA_RED_GATE]);
- packet.Worldstates.emplace_back(BG_SA_PURPLE_GATEWS, GateStatus[BG_SA_PURPLE_GATE]);
-
- packet.Worldstates.emplace_back(BG_SA_BONUS_TIMER, 0);
- packet.Worldstates.emplace_back(BG_SA_HORDE_ATTACKS, hordeAttacks);
- packet.Worldstates.emplace_back(BG_SA_ALLY_ATTACKS, allyAttacks);
-
- // Time will be sent on first update...
- packet.Worldstates.emplace_back(BG_SA_ENABLE_TIMER, TimerEnabled);
- packet.Worldstates.emplace_back(BG_SA_TIMER_MINS, 0);
- packet.Worldstates.emplace_back(BG_SA_TIMER_SEC_TENS, 0);
- packet.Worldstates.emplace_back(BG_SA_TIMER_SEC_DECS, 0);
-
- packet.Worldstates.emplace_back(BG_SA_RIGHT_GY_HORDE, (GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE) ? 1 : 0);
- packet.Worldstates.emplace_back(BG_SA_LEFT_GY_HORDE, (GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE) ? 1 : 0);
- packet.Worldstates.emplace_back(BG_SA_CENTER_GY_HORDE, (GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE) ? 1 : 0);
- packet.Worldstates.emplace_back(BG_SA_RIGHT_GY_ALLIANCE, (GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE) ? 1 : 0);
- packet.Worldstates.emplace_back(BG_SA_LEFT_GY_ALLIANCE, (GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE) ? 1 : 0);
- packet.Worldstates.emplace_back(BG_SA_CENTER_GY_ALLIANCE, (GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE) ? 1 : 0);
-
- packet.Worldstates.emplace_back(BG_SA_HORDE_DEFENCE_TOKEN, allyAttacks);
- packet.Worldstates.emplace_back(BG_SA_ALLIANCE_DEFENCE_TOKEN, hordeAttacks);
- packet.Worldstates.emplace_back(BG_SA_LEFT_ATT_TOKEN_HRD, hordeAttacks);
- packet.Worldstates.emplace_back(BG_SA_RIGHT_ATT_TOKEN_HRD, hordeAttacks);
- packet.Worldstates.emplace_back(BG_SA_RIGHT_ATT_TOKEN_ALL, allyAttacks);
- packet.Worldstates.emplace_back(BG_SA_LEFT_ATT_TOKEN_ALL, allyAttacks);
-}
-
void BattlegroundSA::AddPlayer(Player* player)
{
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
@@ -562,7 +516,7 @@ void BattlegroundSA::ProcessEvent(WorldObject* obj, uint32 eventId, WorldObject*
// damaged
if (eventId == go->GetGOInfo()->destructibleBuilding.DamagedEvent)
{
- GateStatus[gateId] = BG_SA_GATE_DAMAGED;
+ GateStatus[gateId] = Attackers == TEAM_HORDE ? BG_SA_ALLIANCE_GATE_DAMAGED : BG_SA_HORDE_GATE_DAMAGED;
if (Creature* c = obj->FindNearestCreature(NPC_WORLD_TRIGGER, 500.0f))
SendChatMessage(c, gate->DamagedText, invoker);
@@ -572,8 +526,7 @@ void BattlegroundSA::ProcessEvent(WorldObject* obj, uint32 eventId, WorldObject*
// destroyed
else if (eventId == go->GetGOInfo()->destructibleBuilding.DestroyedEvent)
{
- GateStatus[gate->GateId] = BG_SA_GATE_DESTROYED;
- _gateDestroyed = true;
+ GateStatus[gate->GateId] = Attackers == TEAM_HORDE ? BG_SA_ALLIANCE_GATE_DESTROYED : BG_SA_HORDE_GATE_DESTROYED;
if (gateId < 5)
DelObject(gateId + 14);
@@ -587,19 +540,19 @@ void BattlegroundSA::ProcessEvent(WorldObject* obj, uint32 eventId, WorldObject*
switch (gateId)
{
case BG_SA_GREEN_GATE:
- if (GateStatus[BG_SA_BLUE_GATE] == BG_SA_GATE_DESTROYED)
+ if (IsGateDestroyed(BG_SA_BLUE_GATE))
rewardHonor = false;
break;
case BG_SA_BLUE_GATE:
- if (GateStatus[BG_SA_GREEN_GATE] == BG_SA_GATE_DESTROYED)
+ if (IsGateDestroyed(BG_SA_GREEN_GATE))
rewardHonor = false;
break;
case BG_SA_RED_GATE:
- if (GateStatus[BG_SA_PURPLE_GATE] == BG_SA_GATE_DESTROYED)
+ if (IsGateDestroyed(BG_SA_PURPLE_GATE))
rewardHonor = false;
break;
case BG_SA_PURPLE_GATE:
- if (GateStatus[BG_SA_RED_GATE] == BG_SA_GATE_DESTROYED)
+ if (IsGateDestroyed(BG_SA_RED_GATE))
rewardHonor = false;
break;
default:
@@ -639,7 +592,9 @@ void BattlegroundSA::HandleKillUnit(Creature* creature, Player* killer)
if (creature->GetEntry() == NPC_DEMOLISHER_SA)
{
UpdatePlayerScore(killer, SCORE_DESTROYED_DEMOLISHER, 1);
- _allVehiclesAlive[Attackers] = false;
+ int32 worldStateId = Attackers == TEAM_HORDE ? BG_SA_DESTROYED_HORDE_VEHICLES : BG_SA_DESTROYED_ALLIANCE_VEHICLES;
+ int32 currentDestroyedVehicles = sWorldStateMgr->GetValue(worldStateId, GetBgMap());
+ UpdateWorldState(worldStateId, currentDestroyedVehicles + 1);
}
}
@@ -723,29 +678,21 @@ WorldSafeLocsEntry const* BattlegroundSA::GetClosestGraveyard(Player* player)
return closest;
}
-void BattlegroundSA::SendTime()
-{
- uint32 end_of_round = (EndRoundTimer - TotalTime);
- UpdateWorldState(BG_SA_TIMER_MINS, end_of_round/60000);
- UpdateWorldState(BG_SA_TIMER_SEC_TENS, (end_of_round%60000)/10000);
- UpdateWorldState(BG_SA_TIMER_SEC_DECS, ((end_of_round%60000)%10000)/1000);
-}
-
bool BattlegroundSA::CanInteractWithObject(uint32 objectId)
{
switch (objectId)
{
case BG_SA_TITAN_RELIC:
- if (GateStatus[BG_SA_ANCIENT_GATE] != BG_SA_GATE_DESTROYED || GateStatus[BG_SA_YELLOW_GATE] != BG_SA_GATE_DESTROYED)
+ if (!IsGateDestroyed(BG_SA_ANCIENT_GATE) || !IsGateDestroyed(BG_SA_YELLOW_GATE))
return false;
[[fallthrough]];
case BG_SA_CENTRAL_FLAG:
- if (GateStatus[BG_SA_RED_GATE] != BG_SA_GATE_DESTROYED && GateStatus[BG_SA_PURPLE_GATE] != BG_SA_GATE_DESTROYED)
+ if (!IsGateDestroyed(BG_SA_RED_GATE) && !IsGateDestroyed(BG_SA_PURPLE_GATE))
return false;
[[fallthrough]];
case BG_SA_LEFT_FLAG:
case BG_SA_RIGHT_FLAG:
- if (GateStatus[BG_SA_GREEN_GATE] != BG_SA_GATE_DESTROYED && GateStatus[BG_SA_BLUE_GATE] != BG_SA_GATE_DESTROYED)
+ if (!IsGateDestroyed(BG_SA_GREEN_GATE) && !IsGateDestroyed(BG_SA_BLUE_GATE))
return false;
break;
default:
@@ -1039,17 +986,10 @@ void BattlegroundSA::SendTransportsRemove(Player* player)
}
}
-bool BattlegroundSA::CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target, uint32 miscValue)
+bool BattlegroundSA::IsGateDestroyed(BG_SA_Objects gateId) const
{
- switch (criteriaId)
- {
- case BG_CRITERIA_CHECK_NOT_EVEN_A_SCRATCH:
- return _allVehiclesAlive[GetTeamIndexByTeamId(GetPlayerTeam(source->GetGUID()))];
- case BG_CRITERIA_CHECK_DEFENSE_OF_THE_ANCIENTS:
- return GetTeamIndexByTeamId(GetPlayerTeam(source->GetGUID())) != Attackers && !_gateDestroyed;
- }
-
- return Battleground::CheckAchievementCriteriaMeet(criteriaId, source, target, miscValue);
+ ASSERT(gateId < MAX_GATES);
+ return GateStatus[gateId] == BG_SA_ALLIANCE_GATE_DESTROYED || GateStatus[gateId] == BG_SA_HORDE_GATE_DESTROYED;
}
bool BattlegroundSA::IsSpellAllowed(uint32 spellId, Player const* /*player*/) const
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
index 0e73f34b9ed..93f62c31091 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
@@ -37,9 +37,14 @@ enum BG_SA_Status
enum BG_SA_GateState
{
- BG_SA_GATE_OK = 1,
- BG_SA_GATE_DAMAGED = 2,
- BG_SA_GATE_DESTROYED = 3
+ // alliance is defender
+ BG_SA_ALLIANCE_GATE_OK = 1,
+ BG_SA_ALLIANCE_GATE_DAMAGED = 2,
+ BG_SA_ALLIANCE_GATE_DESTROYED = 3,
+ // horde is defender
+ BG_SA_HORDE_GATE_OK = 4,
+ BG_SA_HORDE_GATE_DAMAGED = 5,
+ BG_SA_HORDE_GATE_DESTROYED = 6,
};
enum BG_SA_EventIds
@@ -151,9 +156,7 @@ enum SATexts
enum SAWorldStates
{
- BG_SA_TIMER_MINS = 3559,
- BG_SA_TIMER_SEC_TENS = 3560,
- BG_SA_TIMER_SEC_DECS = 3561,
+ BG_SA_TIMER = 3557,
BG_SA_ALLY_ATTACKS = 4352,
BG_SA_HORDE_ATTACKS = 4353,
BG_SA_PURPLE_GATEWS = 3614,
@@ -175,7 +178,10 @@ enum SAWorldStates
BG_SA_LEFT_GY_HORDE = 3633,
BG_SA_CENTER_GY_HORDE = 3634,
BG_SA_BONUS_TIMER = 3571,
- BG_SA_ENABLE_TIMER = 3564
+ BG_SA_ENABLE_TIMER = 3564,
+ BG_SA_ATTACKER_TEAM = 3690,
+ BG_SA_DESTROYED_ALLIANCE_VEHICLES = 3955,
+ BG_SA_DESTROYED_HORDE_VEHICLES = 3956,
};
enum BG_SA_NPCs
@@ -577,14 +583,9 @@ class BattlegroundSA : public Battleground
/* inherited from BattlegroundClass */
/// Called when a player join battle
void AddPlayer(Player* player) override;
- /// Called when battle start
- void StartingEventCloseDoors() override;
- void StartingEventOpenDoors() override;
/// Called for ini battleground, after that the first player be entered
bool SetupBattleground() override;
void Reset() override;
- /// Called for generate packet contain worldstate data
- void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override;
/// Called when a player kill a unit in bg
void HandleKillUnit(Creature* creature, Player* killer) override;
/// Return the nearest graveyard where player can respawn
@@ -614,9 +615,6 @@ class BattlegroundSA : public Battleground
/* Scorekeeping */
- // Achievement: Not Even a Scratch
- bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target = nullptr, uint32 miscValue = 0) override;
-
// Control Phase Shift
bool IsSpellAllowed(uint32 spellId, Player const* player) const override;
@@ -657,8 +655,6 @@ class BattlegroundSA : public Battleground
* -Delete gameobject in front of door (lighting object, with different colours for each door)
*/
void DestroyGate(Player* player, GameObject* go) override;
- /// Update timer worldstate
- void SendTime();
/**
* \brief Called when a graveyard is capture
* -Update spiritguide
@@ -680,6 +676,8 @@ class BattlegroundSA : public Battleground
/// Send packet to player for destroy boats (client part)
void SendTransportsRemove(Player* player);
+ bool IsGateDestroyed(BG_SA_Objects gateId) const;
+
/// Id of attacker team
TeamId Attackers;
@@ -708,11 +706,5 @@ class BattlegroundSA : public Battleground
/// for know if second round has been init
bool InitSecondRound;
std::map<uint32/*id*/, uint32/*timer*/> DemoliserRespawnList;
-
- // Achievement: Defense of the Ancients
- bool _gateDestroyed;
-
- // Achievement: Not Even a Scratch
- bool _allVehiclesAlive[PVP_TEAMS_COUNT];
};
#endif
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
index e810e408e37..fab658dad53 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
@@ -18,6 +18,7 @@
#include "BattlegroundWS.h"
#include "BattlegroundMgr.h"
#include "GameObject.h"
+#include "GameTime.h"
#include "Log.h"
#include "Map.h"
#include "Object.h"
@@ -25,7 +26,6 @@
#include "ObjectMgr.h"
#include "Player.h"
#include "SpellInfo.h"
-#include "WorldStatePackets.h"
// these variables aren't used outside of this file, so declare them only here
enum BG_WSG_Rewards
@@ -68,7 +68,6 @@ BattlegroundWS::BattlegroundWS(BattlegroundTemplate const* battlegroundTemplate)
m_ReputationCapture = 0;
m_HonorWinKills = 0;
m_HonorEndKills = 0;
- _minutesElapsed = 0;
}
BattlegroundWS::~BattlegroundWS() { }
@@ -77,7 +76,7 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff)
{
if (GetStatus() == STATUS_IN_PROGRESS)
{
- if (GetElapsedTime() >= 27*MINUTE*IN_MILLISECONDS)
+ if (GetElapsedTime() >= 17*MINUTE*IN_MILLISECONDS)
{
if (GetTeamScore(TEAM_ALLIANCE) == 0)
{
@@ -95,12 +94,6 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff)
else
EndBattleground(ALLIANCE);
}
- // first update needed after 1 minute of game already in progress
- else if (GetElapsedTime() > uint32(_minutesElapsed * MINUTE * IN_MILLISECONDS) + 3 * MINUTE * IN_MILLISECONDS)
- {
- ++_minutesElapsed;
- UpdateWorldState(BG_WS_STATE_TIMER, 25 - _minutesElapsed);
- }
if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
{
@@ -202,9 +195,6 @@ void BattlegroundWS::StartingEventCloseDoors()
}
for (uint32 i = BG_WS_OBJECT_A_FLAG; i <= BG_WS_OBJECT_BERSERKBUFF_2; ++i)
SpawnBGObject(i, RESPAWN_ONE_DAY);
-
- UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 1);
- UpdateWorldState(BG_WS_STATE_TIMER, 25);
}
void BattlegroundWS::StartingEventOpenDoors()
@@ -222,6 +212,9 @@ void BattlegroundWS::StartingEventOpenDoors()
SpawnBGObject(BG_WS_OBJECT_DOOR_H_3, RESPAWN_ONE_DAY);
SpawnBGObject(BG_WS_OBJECT_DOOR_H_4, RESPAWN_ONE_DAY);
+ UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 1);
+ UpdateWorldState(BG_WS_STATE_TIMER, GameTime::GetGameTime() + 15 * MINUTE);
+
// players joining later are not eligibles
TriggerGameEvent(WS_EVENT_START_BATTLE);
}
@@ -339,7 +332,7 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player)
else
SendBroadcastText(BG_WS_TEXT_CAPTURED_ALLIANCE_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, player);
- UpdateFlagState(team, 1); // flag state none
+ UpdateFlagState(team, BG_WS_FLAG_STATE_WAIT_RESPAWN); // flag state none
UpdateTeamScore(GetTeamIndexByTeamId(team));
// only flag capture should be updated
UpdatePlayerScore(player, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
@@ -355,8 +348,6 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player)
if (winner)
{
- UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 0);
- UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 0);
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, 1);
UpdateWorldState(BG_WS_FLAG_STATE_HORDE, 1);
UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 0);
@@ -442,18 +433,12 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player)
if (set)
{
player->CastSpell(player, SPELL_RECENTLY_DROPPED_FLAG, true);
- UpdateFlagState(team, 1);
+ UpdateFlagState(team, BG_WS_FLAG_STATE_ON_GROUND);
if (team == ALLIANCE)
- {
SendBroadcastText(BG_WS_TEXT_HORDE_FLAG_DROPPED, CHAT_MSG_BG_SYSTEM_HORDE, player);
- UpdateWorldState(BG_WS_FLAG_UNK_HORDE, uint32(-1));
- }
else
- {
SendBroadcastText(BG_WS_TEXT_ALLIANCE_FLAG_DROPPED, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
- UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, uint32(-1));
- }
_flagsDropTimer[GetTeamIndexByTeamId(team) ? 0 : 1] = BG_WS_FLAG_DROP_TIME;
}
@@ -477,7 +462,6 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target
_flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
//update world state to show correct flag carrier
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
- UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1);
player->CastSpell(player, BG_WS_SPELL_SILVERWING_FLAG, true);
player->StartCriteriaTimer(CriteriaStartEvent::BeSpellTarget, BG_WS_SPELL_SILVERWING_FLAG_PICKED);
if (_flagState[1] == BG_WS_FLAG_STATE_ON_PLAYER)
@@ -495,7 +479,6 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
//update world state to show correct flag carrier
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
- UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1);
player->CastSpell(player, BG_WS_SPELL_WARSONG_FLAG, true);
player->StartCriteriaTimer(CriteriaStartEvent::BeSpellTarget, BG_WS_SPELL_WARSONG_FLAG_PICKED);
if (_flagState[0] == BG_WS_FLAG_STATE_ON_PLAYER)
@@ -529,7 +512,6 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target
player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true);
else if (_flagDebuffState == 2)
player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true);
- UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1);
}
//called in HandleGameObjectUseOpcode:
//target_obj->Delete();
@@ -562,7 +544,6 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target
player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true);
else if (_flagDebuffState == 2)
player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true);
- UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1);
}
//called in HandleGameObjectUseOpcode:
//target_obj->Delete();
@@ -600,10 +581,30 @@ void BattlegroundWS::RemovePlayer(Player* player, ObjectGuid guid, uint32 /*team
void BattlegroundWS::UpdateFlagState(uint32 team, uint32 value)
{
- if (team == ALLIANCE)
+ auto transformValueToOtherTeamControlWorldState = [](uint32 value)
+ {
+ switch (value)
+ {
+ case BG_WS_FLAG_STATE_ON_BASE:
+ case BG_WS_FLAG_STATE_ON_GROUND:
+ case BG_WS_FLAG_STATE_WAIT_RESPAWN:
+ return 1;
+ case BG_WS_FLAG_STATE_ON_PLAYER:
+ return 2;
+ default:
+ return 0;
+ }
+ };
+ if (team == HORDE)
+ {
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, value);
+ UpdateWorldState(BG_WS_FLAG_CONTROL_HORDE, transformValueToOtherTeamControlWorldState(value));
+ }
else
+ {
UpdateWorldState(BG_WS_FLAG_STATE_HORDE, value);
+ UpdateWorldState(BG_WS_FLAG_CONTROL_ALLIANCE, transformValueToOtherTeamControlWorldState(value));
+ }
}
void BattlegroundWS::UpdateTeamScore(uint32 team)
@@ -742,7 +743,6 @@ void BattlegroundWS::Reset()
m_HonorWinKills = 1;
m_HonorEndKills = 2;
}
- _minutesElapsed = 0;
_lastFlagCaptureTeam = 0;
_bothFlagsKept = false;
_flagDebuffState = 0;
@@ -824,46 +824,6 @@ WorldSafeLocsEntry const* BattlegroundWS::GetExploitTeleportLocation(Team team)
return sObjectMgr->GetWorldSafeLoc(team == ALLIANCE ? WS_EXPLOIT_TELEPORT_LOCATION_ALLIANCE : WS_EXPLOIT_TELEPORT_LOCATION_HORDE);
}
-void BattlegroundWS::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet)
-{
- packet.Worldstates.emplace_back(BG_WS_FLAG_CAPTURES_ALLIANCE, GetTeamScore(TEAM_ALLIANCE));
- packet.Worldstates.emplace_back(BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(TEAM_HORDE));
-
- if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
- packet.Worldstates.emplace_back(BG_WS_FLAG_UNK_ALLIANCE, uint32(-1)); // ??
- else if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
- packet.Worldstates.emplace_back(BG_WS_FLAG_UNK_ALLIANCE, 1);
- else
- packet.Worldstates.emplace_back(BG_WS_FLAG_UNK_ALLIANCE, 0);
-
- if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
- packet.Worldstates.emplace_back(BG_WS_FLAG_UNK_HORDE, uint32(-1)); // ??
- else if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
- packet.Worldstates.emplace_back(BG_WS_FLAG_UNK_HORDE, 1);
- else
- packet.Worldstates.emplace_back(BG_WS_FLAG_UNK_HORDE, 0);
-
- packet.Worldstates.emplace_back(BG_WS_FLAG_CAPTURES_MAX, BG_WS_MAX_TEAM_SCORE);
-
- if (GetStatus() == STATUS_IN_PROGRESS)
- {
- packet.Worldstates.emplace_back(BG_WS_STATE_TIMER_ACTIVE, 1);
- packet.Worldstates.emplace_back(BG_WS_STATE_TIMER, 25 - _minutesElapsed);
- }
- else
- packet.Worldstates.emplace_back(BG_WS_STATE_TIMER_ACTIVE, 0);
-
- if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
- packet.Worldstates.emplace_back(BG_WS_FLAG_STATE_HORDE, 2);
- else
- packet.Worldstates.emplace_back(BG_WS_FLAG_STATE_HORDE, 1);
-
- if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
- packet.Worldstates.emplace_back(BG_WS_FLAG_STATE_ALLIANCE, 2);
- else
- packet.Worldstates.emplace_back(BG_WS_FLAG_STATE_ALLIANCE, 1);
-}
-
uint32 BattlegroundWS::GetPrematureWinner()
{
if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE))
@@ -873,17 +833,3 @@ uint32 BattlegroundWS::GetPrematureWinner()
return Battleground::GetPrematureWinner();
}
-
-bool BattlegroundWS::CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* player, Unit const* target, uint32 miscValue)
-{
- switch (criteriaId)
- {
- case BG_CRITERIA_CHECK_SAVE_THE_DAY:
- if (target)
- if (Player const* playerTarget = target->ToPlayer())
- return GetFlagState(GetPlayerTeam(playerTarget->GetGUID())) == BG_WS_FLAG_STATE_ON_BASE;
- return false;
- }
-
- return Battleground::CheckAchievementCriteriaMeet(criteriaId, player, target, miscValue);
-}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
index 851fb7d96be..a3eb9f56503 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
@@ -72,18 +72,25 @@ enum BG_WS_SpellId
enum BG_WS_WorldStates
{
- BG_WS_FLAG_UNK_ALLIANCE = 1545,
- BG_WS_FLAG_UNK_HORDE = 1546,
-// FLAG_UNK = 1547,
- BG_WS_FLAG_CAPTURES_ALLIANCE = 1581,
- BG_WS_FLAG_CAPTURES_HORDE = 1582,
- BG_WS_FLAG_CAPTURES_MAX = 1601,
- BG_WS_FLAG_STATE_HORDE = 2338,
- BG_WS_FLAG_STATE_ALLIANCE = 2339,
- BG_WS_STATE_TIMER = 4248,
- BG_WS_STATE_TIMER_ACTIVE = 4247
+ BG_WS_FLAG_STATE_ALLIANCE = 1545,
+ BG_WS_FLAG_STATE_HORDE = 1546,
+ BG_WS_FLAG_STATE_NEUTRAL = 1547, // unused
+ BG_WS_HORDE_FLAG_COUNT_PICKED_UP = 17712, // brawl
+ BG_WS_ALLIANCE_FLAG_COUNT_PICKED_UP = 17713, // brawl
+ BG_WS_FLAG_CAPTURES_ALLIANCE = 1581,
+ BG_WS_FLAG_CAPTURES_HORDE = 1582,
+ BG_WS_FLAG_CAPTURES_MAX = 1601,
+ BG_WS_FLAG_CAPTURES_MAX_NEW = 17303,
+ BG_WS_FLAG_CONTROL_HORDE = 2338,
+ BG_WS_FLAG_CONTROL_ALLIANCE = 2339,
+ BG_WS_STATE_TIMER = 4248,
+ BG_WS_STATE_TIMER_ACTIVE = 4247
};
+// save the day
+// alliance criteria: BG_WS_FLAG_STATE_HORDE == 1 && BG_WS_FLAG_STATE_NEUTRAL == 0 && WS(1664) > 0
+// horde criteria: BG_WS_FLAG_STATE_ALLIANCE == 1 && BG_WS_FLAG_STATE_NEUTRAL == 0 && WS(1664) > 0
+
enum BG_WS_ObjectTypes
{
BG_WS_OBJECT_DOOR_A_1 = 0,
@@ -127,10 +134,10 @@ enum BG_WS_ObjectEntry
enum BG_WS_FlagState
{
- BG_WS_FLAG_STATE_ON_BASE = 0,
- BG_WS_FLAG_STATE_WAIT_RESPAWN = 1,
+ BG_WS_FLAG_STATE_ON_BASE = 1,
BG_WS_FLAG_STATE_ON_PLAYER = 2,
- BG_WS_FLAG_STATE_ON_GROUND = 3
+ BG_WS_FLAG_STATE_ON_GROUND = 3,
+ BG_WS_FLAG_STATE_WAIT_RESPAWN = 4,
};
enum BG_WS_Graveyards
@@ -259,7 +266,6 @@ class BattlegroundWS : public Battleground
}
ObjectGuid GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)]; }
- void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override;
/* Scorekeeping */
void AddPoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] += Points; }
@@ -268,9 +274,6 @@ class BattlegroundWS : public Battleground
uint32 GetPrematureWinner() override;
- /* Achievements*/
- bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* source, Unit const* target = nullptr, uint32 miscvalue1 = 0) override;
-
protected:
void PostUpdateImpl(uint32 diff) override;
@@ -288,6 +291,5 @@ class BattlegroundWS : public Battleground
int32 _flagSpellForceTimer;
bool _bothFlagsKept;
uint8 _flagDebuffState; // 0 - no debuffs, 1 - focused assault, 2 - brutal assault
- uint8 _minutesElapsed;
};
#endif
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 00750ba6501..f243ae0beda 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -9203,7 +9203,6 @@ void Player::SendUpdateWorldState(uint32 variable, uint32 value, bool hidden /*=
void Player::SendInitWorldStates(uint32 zoneId, uint32 areaId)
{
uint32 mapId = GetMapId();
- Battleground* battleground = GetBattleground();
OutdoorPvP* outdoorPvP = sOutdoorPvPMgr->GetOutdoorPvPToZoneId(zoneId);
TC_LOG_DEBUG("network", "Player::SendInitWorldStates: Sending SMSG_INIT_WORLD_STATES for Map: %u, Zone: %u", mapId, zoneId);
@@ -9268,182 +9267,6 @@ void Player::SendInitWorldStates(uint32 zoneId, uint32 areaId)
packet.Worldstates.emplace_back(2324, 0); // AQ_SANDWORM_SW
packet.Worldstates.emplace_back(2325, 0); // AQ_SANDWORM_E
break;
- case 2597: // Alterac Valley
- if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_AV)
- battleground->FillInitialWorldStates(packet);
- else
- {
- packet.Worldstates.emplace_back(1966, 1); // AV_SNOWFALL_N
- packet.Worldstates.emplace_back(1330, 1); // AV_FROSTWOLFHUT_H_C
- packet.Worldstates.emplace_back(1329, 0); // AV_FROSTWOLFHUT_A_C
- packet.Worldstates.emplace_back(1326, 0); // AV_AID_A_A
- packet.Worldstates.emplace_back(1393, 0); // East Frostwolf Tower Horde Assaulted - UNUSED
- packet.Worldstates.emplace_back(1392, 0); // West Frostwolf Tower Horde Assaulted - UNUSED
- packet.Worldstates.emplace_back(1383, 1); // AV_FROSTWOLFE_CONTROLLED
- packet.Worldstates.emplace_back(1382, 1); // AV_FROSTWOLFW_CONTROLLED
- packet.Worldstates.emplace_back(1360, 1); // AV_N_MINE_N
- packet.Worldstates.emplace_back(1348, 0); // AV_ICEBLOOD_A_A
- packet.Worldstates.emplace_back(1334, 0); // AV_PIKEGRAVE_H_C
- packet.Worldstates.emplace_back(1333, 1); // AV_PIKEGRAVE_A_C
- packet.Worldstates.emplace_back(1304, 0); // AV_STONEHEART_A_A
- packet.Worldstates.emplace_back(1303, 0); // AV_STONEHEART_H_A
- packet.Worldstates.emplace_back(1396, 0); // unk
- packet.Worldstates.emplace_back(1395, 0); // Iceblood Tower Horde Assaulted - UNUSED
- packet.Worldstates.emplace_back(1394, 0); // Towerpoint Horde Assaulted - UNUSED
- packet.Worldstates.emplace_back(1391, 0); // unk
- packet.Worldstates.emplace_back(1390, 0); // AV_ICEBLOOD_ASSAULTED
- packet.Worldstates.emplace_back(1389, 0); // AV_TOWERPOINT_ASSAULTED
- packet.Worldstates.emplace_back(1388, 0); // AV_FROSTWOLFE_ASSAULTED
- packet.Worldstates.emplace_back(1387, 0); // AV_FROSTWOLFW_ASSAULTED
- packet.Worldstates.emplace_back(1386, 1); // unk
- packet.Worldstates.emplace_back(1385, 1); // AV_ICEBLOOD_CONTROLLED
- packet.Worldstates.emplace_back(1384, 1); // AV_TOWERPOINT_CONTROLLED
- packet.Worldstates.emplace_back(1381, 0); // AV_STONEH_ASSAULTED
- packet.Worldstates.emplace_back(1380, 0); // AV_ICEWING_ASSAULTED
- packet.Worldstates.emplace_back(1379, 0); // AV_DUNN_ASSAULTED
- packet.Worldstates.emplace_back(1378, 0); // AV_DUNS_ASSAULTED
- packet.Worldstates.emplace_back(1377, 0); // Stoneheart Bunker Alliance Assaulted - UNUSED
- packet.Worldstates.emplace_back(1376, 0); // Icewing Bunker Alliance Assaulted - UNUSED
- packet.Worldstates.emplace_back(1375, 0); // Dunbaldar South Alliance Assaulted - UNUSED
- packet.Worldstates.emplace_back(1374, 0); // Dunbaldar North Alliance Assaulted - UNUSED
- packet.Worldstates.emplace_back(1373, 0); // AV_STONEH_DESTROYED
- packet.Worldstates.emplace_back(966, 0); // AV_UNK_02
- packet.Worldstates.emplace_back(964, 0); // AV_UNK_01
- packet.Worldstates.emplace_back(962, 0); // AV_STORMPIKE_COMMANDERS
- packet.Worldstates.emplace_back(1302, 1); // AV_STONEHEART_A_C
- packet.Worldstates.emplace_back(1301, 0); // AV_STONEHEART_H_C
- packet.Worldstates.emplace_back(950, 0); // AV_STORMPIKE_LIEUTENANTS
- packet.Worldstates.emplace_back(1372, 0); // AV_ICEWING_DESTROYED
- packet.Worldstates.emplace_back(1371, 0); // AV_DUNN_DESTROYED
- packet.Worldstates.emplace_back(1370, 0); // AV_DUNS_DESTROYED
- packet.Worldstates.emplace_back(1369, 0); // unk
- packet.Worldstates.emplace_back(1368, 0); // AV_ICEBLOOD_DESTROYED
- packet.Worldstates.emplace_back(1367, 0); // AV_TOWERPOINT_DESTROYED
- packet.Worldstates.emplace_back(1366, 0); // AV_FROSTWOLFE_DESTROYED
- packet.Worldstates.emplace_back(1365, 0); // AV_FROSTWOLFW_DESTROYED
- packet.Worldstates.emplace_back(1364, 1); // AV_STONEH_CONTROLLED
- packet.Worldstates.emplace_back(1363, 1); // AV_ICEWING_CONTROLLED
- packet.Worldstates.emplace_back(1362, 1); // AV_DUNN_CONTROLLED
- packet.Worldstates.emplace_back(1361, 1); // AV_DUNS_CONTROLLED
- packet.Worldstates.emplace_back(1359, 0); // AV_N_MINE_H
- packet.Worldstates.emplace_back(1358, 0); // AV_N_MINE_A
- packet.Worldstates.emplace_back(1357, 1); // AV_S_MINE_N
- packet.Worldstates.emplace_back(1356, 0); // AV_S_MINE_H
- packet.Worldstates.emplace_back(1355, 0); // AV_S_MINE_A
- packet.Worldstates.emplace_back(1349, 0); // AV_ICEBLOOD_H_A
- packet.Worldstates.emplace_back(1347, 1); // AV_ICEBLOOD_H_C
- packet.Worldstates.emplace_back(1346, 0); // AV_ICEBLOOD_A_C
- packet.Worldstates.emplace_back(1344, 0); // AV_SNOWFALL_H_A
- packet.Worldstates.emplace_back(1343, 0); // AV_SNOWFALL_A_A
- packet.Worldstates.emplace_back(1342, 0); // AV_SNOWFALL_H_C
- packet.Worldstates.emplace_back(1341, 0); // AV_SNOWFALL_A_C
- packet.Worldstates.emplace_back(1340, 0); // AV_FROSTWOLF_H_A
- packet.Worldstates.emplace_back(1339, 0); // AV_FROSTWOLF_A_A
- packet.Worldstates.emplace_back(1338, 1); // AV_FROSTWOLF_H_C
- packet.Worldstates.emplace_back(1337, 0); // AV_FROSTWOLF_A_C
- packet.Worldstates.emplace_back(1336, 0); // AV_PIKEGRAVE_H_A
- packet.Worldstates.emplace_back(1335, 0); // AV_PIKEGRAVE_A_A
- packet.Worldstates.emplace_back(1332, 0); // AV_FROSTWOLFHUT_H_A
- packet.Worldstates.emplace_back(1331, 0); // AV_FROSTWOLFHUT_A_A
- packet.Worldstates.emplace_back(1328, 0); // AV_AID_H_A
- packet.Worldstates.emplace_back(1327, 0); // AV_AID_H_C
- packet.Worldstates.emplace_back(1325, 1); // AV_AID_A_C
- }
- break;
- case 3277: // Warsong Gulch
- if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_WS)
- battleground->FillInitialWorldStates(packet);
- else
- {
- packet.Worldstates.emplace_back(1581, 0); // alliance flag captures
- packet.Worldstates.emplace_back(1582, 0); // horde flag captures
- packet.Worldstates.emplace_back(1545, 0); // unk, set to 1 on alliance flag pickup...
- packet.Worldstates.emplace_back(1546, 0); // unk, set to 1 on horde flag pickup, after drop it's -1
- packet.Worldstates.emplace_back(1547, 2); // unk
- packet.Worldstates.emplace_back(1601, 3); // unk (max flag captures?)
- packet.Worldstates.emplace_back(2338, 1); // horde (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing)
- packet.Worldstates.emplace_back(2339, 1); // alliance (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing)
- }
- break;
- case 3358: // Arathi Basin
- if (battleground && (battleground->GetTypeID(true) == BATTLEGROUND_AB || battleground->GetTypeID(true) == BATTLEGROUND_DOM_AB))
- battleground->FillInitialWorldStates(packet);
- else
- {
- packet.Worldstates.emplace_back(1767, 0); // stables alliance
- packet.Worldstates.emplace_back(1768, 0); // stables horde
- packet.Worldstates.emplace_back(1769, 0); // stables alliance controlled
- packet.Worldstates.emplace_back(1770, 0); // stables horde controlled
- packet.Worldstates.emplace_back(1772, 0); // farm alliance
- packet.Worldstates.emplace_back(1773, 0); // farm horde
- packet.Worldstates.emplace_back(1774, 0); // farm alliance controlled
- packet.Worldstates.emplace_back(1775, 0); // farm horde controlled
- packet.Worldstates.emplace_back(1776, 0); // alliance resources
- packet.Worldstates.emplace_back(1777, 0); // horde resources
- packet.Worldstates.emplace_back(1778, 0); // horde bases
- packet.Worldstates.emplace_back(1779, 0); // alliance bases
- packet.Worldstates.emplace_back(1780, 2000); // max resources (2000)
- packet.Worldstates.emplace_back(1782, 0); // blacksmith alliance
- packet.Worldstates.emplace_back(1783, 0); // blacksmith horde
- packet.Worldstates.emplace_back(1784, 0); // blacksmith alliance controlled
- packet.Worldstates.emplace_back(1785, 0); // blacksmith horde controlled
- packet.Worldstates.emplace_back(1787, 0); // gold mine alliance
- packet.Worldstates.emplace_back(1788, 0); // gold mine horde
- packet.Worldstates.emplace_back(1789, 0); // gold mine alliance controlled
- packet.Worldstates.emplace_back(1790, 0); // gold mine horde controlled
- packet.Worldstates.emplace_back(1792, 0); // lumber mill alliance
- packet.Worldstates.emplace_back(1793, 0); // lumber mill horde
- packet.Worldstates.emplace_back(1794, 0); // lumber mill alliance controlled
- packet.Worldstates.emplace_back(1795, 0); // lumber mill horde controlled
- packet.Worldstates.emplace_back(1842, 1); // stables (1 - uncontrolled)
- packet.Worldstates.emplace_back(1843, 1); // gold mine (1 - uncontrolled)
- packet.Worldstates.emplace_back(1844, 1); // lumber mill (1 - uncontrolled)
- packet.Worldstates.emplace_back(1845, 1); // farm (1 - uncontrolled)
- packet.Worldstates.emplace_back(1846, 1); // blacksmith (1 - uncontrolled)
- packet.Worldstates.emplace_back(1861, 2); // unk
- packet.Worldstates.emplace_back(1955, 1800); // warning limit (1800)
- }
- break;
- case 3820: // Eye of the Storm
- if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_EY)
- battleground->FillInitialWorldStates(packet);
- else
- {
- packet.Worldstates.emplace_back(2753, 0); // Horde Bases
- packet.Worldstates.emplace_back(2752, 0); // Alliance Bases
- packet.Worldstates.emplace_back(2742, 0); // Mage Tower - Horde conflict
- packet.Worldstates.emplace_back(2741, 0); // Mage Tower - Alliance conflict
- packet.Worldstates.emplace_back(2740, 0); // Fel Reaver - Horde conflict
- packet.Worldstates.emplace_back(2739, 0); // Fel Reaver - Alliance conflict
- packet.Worldstates.emplace_back(2738, 0); // Draenei - Alliance conflict
- packet.Worldstates.emplace_back(2737, 0); // Draenei - Horde conflict
- packet.Worldstates.emplace_back(2736, 0); // unk (0 at start)
- packet.Worldstates.emplace_back(2735, 0); // unk (0 at start)
- packet.Worldstates.emplace_back(2733, 0); // Draenei - Horde control
- packet.Worldstates.emplace_back(2732, 0); // Draenei - Alliance control
- packet.Worldstates.emplace_back(2731, 1); // Draenei uncontrolled (1 - yes, 0 - no)
- packet.Worldstates.emplace_back(2730, 0); // Mage Tower - Alliance control
- packet.Worldstates.emplace_back(2729, 0); // Mage Tower - Horde control
- packet.Worldstates.emplace_back(2728, 1); // Mage Tower uncontrolled (1 - yes, 0 - no)
- packet.Worldstates.emplace_back(2727, 0); // Fel Reaver - Horde control
- packet.Worldstates.emplace_back(2726, 0); // Fel Reaver - Alliance control
- packet.Worldstates.emplace_back(2725, 1); // Fel Reaver uncontrolled (1 - yes, 0 - no)
- packet.Worldstates.emplace_back(2724, 0); // Boold Elf - Horde control
- packet.Worldstates.emplace_back(2723, 0); // Boold Elf - Alliance control
- packet.Worldstates.emplace_back(2722, 1); // Boold Elf uncontrolled (1 - yes, 0 - no)
- packet.Worldstates.emplace_back(2757, 1); // Flag (1 - show, 0 - hide) - doesn't work exactly this way!
- packet.Worldstates.emplace_back(2770, 1); // Horde top-stats (1 - show, 0 - hide) // 02 -> horde picked up the flag
- packet.Worldstates.emplace_back(2769, 1); // Alliance top-stats (1 - show, 0 - hide) // 02 -> alliance picked up the flag
- packet.Worldstates.emplace_back(2750, 0); // Horde resources
- packet.Worldstates.emplace_back(2749, 0); // Alliance resources
- packet.Worldstates.emplace_back(2565, 142); // unk, constant?
- packet.Worldstates.emplace_back(2720, 0); // Capturing progress-bar (100 -> empty (only grey), 0 -> blue|red (no grey), default 0)
- packet.Worldstates.emplace_back(2719, 0); // Capturing progress-bar (0 - left, 100 - right)
- packet.Worldstates.emplace_back(2718, 0); // Capturing progress-bar (1 - show, 0 - hide)
- packet.Worldstates.emplace_back(3085, 379); // unk, constant?
- // missing unknowns
- }
- break;
case 3483: // Hellfire Peninsula
if (outdoorPvP && outdoorPvP->GetTypeId() == OUTDOOR_PVP_HP)
outdoorPvP->FillInitialWorldStates(packet);
@@ -9570,135 +9393,6 @@ void Player::SendInitWorldStates(uint32 zoneId, uint32 areaId)
packet.Worldstates.emplace_back(2655, 0); // ZM_MAP_ALLIANCE_FLAG_READY
}
break;
- case 3698: // Nagrand Arena
- if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_NA)
- battleground->FillInitialWorldStates(packet);
- else
- {
- packet.Worldstates.emplace_back(2575, 0); // BATTLEGROUND_NAGRAND_ARENA_GOLD
- packet.Worldstates.emplace_back(2576, 0); // BATTLEGROUND_NAGRAND_ARENA_GREEN
- packet.Worldstates.emplace_back(2577, 0); // BATTLEGROUND_NAGRAND_ARENA_SHOW
- }
- break;
- case 3702: // Blade's Edge Arena
- if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_BE)
- battleground->FillInitialWorldStates(packet);
- else
- {
- packet.Worldstates.emplace_back(2544, 0); // BATTLEGROUND_BLADES_EDGE_ARENA_GOLD
- packet.Worldstates.emplace_back(2545, 0); // BATTLEGROUND_BLADES_EDGE_ARENA_GREEN
- packet.Worldstates.emplace_back(2547, 0); // BATTLEGROUND_BLADES_EDGE_ARENA_SHOW
- }
- break;
- case 3968: // Ruins of Lordaeron
- if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_RL)
- battleground->FillInitialWorldStates(packet);
- else
- {
- packet.Worldstates.emplace_back(3000, 0); // BATTELGROUND_RUINS_OF_LORDAERNON_GOLD
- packet.Worldstates.emplace_back(3001, 0); // BATTELGROUND_RUINS_OF_LORDAERNON_GREEN
- packet.Worldstates.emplace_back(3002, 0); // BATTELGROUND_RUINS_OF_LORDAERNON_SHOW
- }
- break;
- case 4378: // Dalaran Sewers
- if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_DS)
- battleground->FillInitialWorldStates(packet);
- else
- {
- packet.Worldstates.emplace_back(3601, 0); // ARENA_WORLD_STATE_ALIVE_PLAYERS_GOLD
- packet.Worldstates.emplace_back(3600, 0); // ARENA_WORLD_STATE_ALIVE_PLAYERS_GREEN
- packet.Worldstates.emplace_back(3610, 0); // ARENA_WORLD_STATE_ALIVE_PLAYERS_SHOW
- }
- break;
- case 4384: // Strand of the Ancients
- if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_SA)
- battleground->FillInitialWorldStates(packet);
- else
- {
- packet.Worldstates.emplace_back(3849, 0); // Gate of Temple
- packet.Worldstates.emplace_back(3638, 0); // Gate of Yellow Moon
- packet.Worldstates.emplace_back(3623, 0); // Gate of Green Emerald
- packet.Worldstates.emplace_back(3620, 0); // Gate of Blue Sapphire
- packet.Worldstates.emplace_back(3617, 0); // Gate of Red Sun
- packet.Worldstates.emplace_back(3614, 0); // Gate of Purple Ametyst
- packet.Worldstates.emplace_back(3571, 0); // bonus timer (1 - on, 0 - off)
- packet.Worldstates.emplace_back(3565, 0); // Horde Attacker
- packet.Worldstates.emplace_back(3564, 0); // Alliance Attacker
-
- // End Round timer, example: 19:59 -> A:BC
- packet.Worldstates.emplace_back(3561, 0); // C
- packet.Worldstates.emplace_back(3560, 0); // B
- packet.Worldstates.emplace_back(3559, 0); // A
-
- packet.Worldstates.emplace_back(3637, 0); // BG_SA_CENTER_GY_ALLIANCE
- packet.Worldstates.emplace_back(3636, 0); // BG_SA_RIGHT_GY_ALLIANCE
- packet.Worldstates.emplace_back(3635, 0); // BG_SA_LEFT_GY_ALLIANCE
- packet.Worldstates.emplace_back(3634, 0); // BG_SA_CENTER_GY_HORDE
- packet.Worldstates.emplace_back(3633, 0); // BG_SA_LEFT_GY_HORDE
- packet.Worldstates.emplace_back(3632, 0); // BG_SA_RIGHT_GY_HORDE
- packet.Worldstates.emplace_back(3631, 0); // BG_SA_HORDE_DEFENCE_TOKEN
- packet.Worldstates.emplace_back(3630, 0); // BG_SA_ALLIANCE_DEFENCE_TOKEN
- packet.Worldstates.emplace_back(3629, 0); // BG_SA_LEFT_ATT_TOKEN_HRD
- packet.Worldstates.emplace_back(3628, 0); // BG_SA_RIGHT_ATT_TOKEN_HRD
- packet.Worldstates.emplace_back(3627, 0); // BG_SA_RIGHT_ATT_TOKEN_ALL
- packet.Worldstates.emplace_back(3626, 0); // BG_SA_LEFT_ATT_TOKEN_ALL
- // missing unknowns
- }
- break;
- case 4406: // Ring of Valor
- if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_RV)
- battleground->FillInitialWorldStates(packet);
- else
- {
- packet.Worldstates.emplace_back(3600, 0); // ARENA_WORLD_STATE_ALIVE_PLAYERS_GREEN
- packet.Worldstates.emplace_back(3601, 0); // ARENA_WORLD_STATE_ALIVE_PLAYERS_GOLD
- packet.Worldstates.emplace_back(3610, 0); // ARENA_WORLD_STATE_ALIVE_PLAYERS_SHOW
- }
- break;
- case 4710: // Isle of Conquest
- if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_IC)
- battleground->FillInitialWorldStates(packet);
- else
- {
- packet.Worldstates.emplace_back(4221, 1); // BG_IC_ALLIANCE_RENFORT_SET
- packet.Worldstates.emplace_back(4222, 1); // BG_IC_HORDE_RENFORT_SET
- packet.Worldstates.emplace_back(4226, 300); // BG_IC_ALLIANCE_RENFORT
- packet.Worldstates.emplace_back(4227, 300); // BG_IC_HORDE_RENFORT
- packet.Worldstates.emplace_back(4322, 1); // BG_IC_GATE_FRONT_H_WS_OPEN
- packet.Worldstates.emplace_back(4321, 1); // BG_IC_GATE_WEST_H_WS_OPEN
- packet.Worldstates.emplace_back(4320, 1); // BG_IC_GATE_EAST_H_WS_OPEN
- packet.Worldstates.emplace_back(4323, 1); // BG_IC_GATE_FRONT_A_WS_OPEN
- packet.Worldstates.emplace_back(4324, 1); // BG_IC_GATE_WEST_A_WS_OPEN
- packet.Worldstates.emplace_back(4325, 1); // BG_IC_GATE_EAST_A_WS_OPEN
- packet.Worldstates.emplace_back(4317, 1); // unk
- packet.Worldstates.emplace_back(4301, 1); // BG_IC_DOCKS_UNCONTROLLED
- packet.Worldstates.emplace_back(4296, 1); // BG_IC_HANGAR_UNCONTROLLED
- packet.Worldstates.emplace_back(4306, 1); // BG_IC_QUARRY_UNCONTROLLED
- packet.Worldstates.emplace_back(4311, 1); // BG_IC_REFINERY_UNCONTROLLED
- packet.Worldstates.emplace_back(4294, 1); // BG_IC_WORKSHOP_UNCONTROLLED
- packet.Worldstates.emplace_back(4243, 1); // unk
- packet.Worldstates.emplace_back(4345, 1); // unk
- }
- break;
- case 5031: // Twin Peaks
- if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_TP)
- battleground->FillInitialWorldStates(packet);
- else
- {
- packet.Worldstates.emplace_back(1581, 0x0); // alliance flag captures
- packet.Worldstates.emplace_back(1582, 0x0); // horde flag captures
- packet.Worldstates.emplace_back(1545, 0x0); // unk
- packet.Worldstates.emplace_back(1546, 0x0); // unk
- packet.Worldstates.emplace_back(1547, 0x2); // unk
- packet.Worldstates.emplace_back(1601, 0x3); // unk
- packet.Worldstates.emplace_back(2338, 0x1); // horde (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing)
- packet.Worldstates.emplace_back(2339, 0x1); // alliance (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing)
- }
- break;
- case 5449: // Battle for Gilneas
- if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_BFG)
- battleground->FillInitialWorldStates(packet);
- break;
default:
break;
}
diff --git a/src/server/scripts/World/achievement_scripts.cpp b/src/server/scripts/World/achievement_scripts.cpp
index c17e3826413..5b922a86930 100644
--- a/src/server/scripts/World/achievement_scripts.cpp
+++ b/src/server/scripts/World/achievement_scripts.cpp
@@ -16,120 +16,12 @@
*/
#include "ScriptMgr.h"
-#include "BattlegroundSA.h"
-#include "BattlegroundIC.h"
+#include "Battleground.h"
#include "BattlePetMgr.h"
#include "Creature.h"
#include "Player.h"
#include "WorldSession.h"
-class achievement_resilient_victory : public AchievementCriteriaScript
-{
- public:
- achievement_resilient_victory() : AchievementCriteriaScript("achievement_resilient_victory") { }
-
- bool OnCheck(Player* source, Unit* target) override
- {
- if (Battleground* bg = source->GetBattleground())
- return bg->CheckAchievementCriteriaMeet(BG_CRITERIA_CHECK_RESILIENT_VICTORY, source, target);
-
- return false;
- }
-};
-
-class achievement_bg_control_all_nodes : public AchievementCriteriaScript
-{
- public:
- achievement_bg_control_all_nodes() : AchievementCriteriaScript("achievement_bg_control_all_nodes") { }
-
- bool OnCheck(Player* source, Unit* /*target*/) override
- {
- if (Battleground* bg = source->GetBattleground())
- return bg->IsAllNodesControlledByTeam(bg->GetPlayerTeam(source->GetGUID()));
-
- return false;
- }
-};
-
-class achievement_save_the_day : public AchievementCriteriaScript
-{
- public:
- achievement_save_the_day() : AchievementCriteriaScript("achievement_save_the_day") { }
-
- bool OnCheck(Player* source, Unit* target) override
- {
- if (Battleground* bg = source->GetBattleground())
- return bg->CheckAchievementCriteriaMeet(BG_CRITERIA_CHECK_SAVE_THE_DAY, source, target);
-
- return false;
- }
-};
-
-class achievement_bg_ic_resource_glut : public AchievementCriteriaScript
-{
- public:
- achievement_bg_ic_resource_glut() : AchievementCriteriaScript("achievement_bg_ic_resource_glut") { }
-
- bool OnCheck(Player* source, Unit* /*target*/) override
- {
- if (source->HasAura(SPELL_OIL_REFINERY) && source->HasAura(SPELL_QUARRY))
- return true;
-
- return false;
- }
-};
-
-class achievement_bg_ic_glaive_grave : public AchievementCriteriaScript
-{
- public:
- achievement_bg_ic_glaive_grave() : AchievementCriteriaScript("achievement_bg_ic_glaive_grave") { }
-
- bool OnCheck(Player* source, Unit* /*target*/) override
- {
- if (Creature* vehicle = source->GetVehicleCreatureBase())
- {
- if (vehicle->GetEntry() == NPC_GLAIVE_THROWER_H || vehicle->GetEntry() == NPC_GLAIVE_THROWER_A)
- return true;
- }
-
- return false;
- }
-};
-
-class achievement_bg_ic_mowed_down : public AchievementCriteriaScript
-{
- public:
- achievement_bg_ic_mowed_down() : AchievementCriteriaScript("achievement_bg_ic_mowed_down") { }
-
- bool OnCheck(Player* source, Unit* /*target*/) override
- {
- if (Creature* vehicle = source->GetVehicleCreatureBase())
- {
- if (vehicle->GetEntry() == NPC_KEEP_CANNON)
- return true;
- }
-
- return false;
- }
-};
-
-class achievement_bg_sa_artillery : public AchievementCriteriaScript
-{
- public:
- achievement_bg_sa_artillery() : AchievementCriteriaScript("achievement_bg_sa_artillery") { }
-
- bool OnCheck(Player* source, Unit* /*target*/) override
- {
- if (Creature* vehicle = source->GetVehicleCreatureBase())
- {
- if (vehicle->GetEntry() == NPC_ANTI_PERSONNAL_CANNON)
- return true;
- }
-
- return false;
- }
-};
-
class achievement_arena_kills : public AchievementCriteriaScript
{
public:
@@ -151,66 +43,6 @@ class achievement_arena_kills : public AchievementCriteriaScript
uint8 const _arenaType;
};
-class achievement_sickly_gazelle : public AchievementCriteriaScript
-{
-public:
- achievement_sickly_gazelle() : AchievementCriteriaScript("achievement_sickly_gazelle") { }
-
- bool OnCheck(Player* /*source*/, Unit* target) override
- {
- if (!target)
- return false;
-
- if (Player* victim = target->ToPlayer())
- if (victim->IsMounted())
- return true;
-
- return false;
- }
-};
-
-class achievement_everything_counts : public AchievementCriteriaScript
-{
- public:
- achievement_everything_counts() : AchievementCriteriaScript("achievement_everything_counts") { }
-
- bool OnCheck(Player* source, Unit* target) override
- {
- if (Battleground* bg = source->GetBattleground())
- return bg->CheckAchievementCriteriaMeet(BG_CRITERIA_CHECK_EVERYTHING_COUNTS, source, target);
-
- return false;
- }
-};
-
-class achievement_bg_av_perfection : public AchievementCriteriaScript
-{
- public:
- achievement_bg_av_perfection() : AchievementCriteriaScript("achievement_bg_av_perfection") { }
-
- bool OnCheck(Player* source, Unit* target) override
- {
- if (Battleground* bg = source->GetBattleground())
- return bg->CheckAchievementCriteriaMeet(BG_CRITERIA_CHECK_AV_PERFECTION, source, target);
-
- return false;
- }
-};
-
-class achievement_bg_sa_defense_of_ancients : public AchievementCriteriaScript
-{
- public:
- achievement_bg_sa_defense_of_ancients() : AchievementCriteriaScript("achievement_bg_sa_defense_of_ancients") { }
-
- bool OnCheck(Player* source, Unit* target) override
- {
- if (Battleground* bg = source->GetBattleground())
- return bg->CheckAchievementCriteriaMeet(BG_CRITERIA_CHECK_DEFENSE_OF_THE_ANCIENTS, source, target);
-
- return false;
- }
-};
-
enum ArgentTournamentAreas
{
AREA_ARGENT_TOURNAMENT_FIELDS = 4658,
@@ -242,20 +74,6 @@ class achievement_tilted : public AchievementCriteriaScript
}
};
-class achievement_not_even_a_scratch : public AchievementCriteriaScript
-{
- public:
- achievement_not_even_a_scratch() : AchievementCriteriaScript("achievement_not_even_a_scratch") { }
-
- bool OnCheck(Player* source, Unit* target) override
- {
- if (Battleground* bg = source->GetBattleground())
- return bg->CheckAchievementCriteriaMeet(BG_CRITERIA_CHECK_NOT_EVEN_A_SCRATCH, source, target);
-
- return false;
- }
-};
-
enum FlirtWithDisaster
{
AURA_PERFUME_FOREVER = 70235,
@@ -318,22 +136,10 @@ public:
void AddSC_achievement_scripts()
{
- new achievement_resilient_victory();
- new achievement_bg_control_all_nodes();
- new achievement_save_the_day();
- new achievement_bg_ic_resource_glut();
- new achievement_bg_ic_glaive_grave();
- new achievement_bg_ic_mowed_down();
- new achievement_bg_sa_artillery();
- new achievement_sickly_gazelle();
- new achievement_everything_counts();
- new achievement_bg_av_perfection();
new achievement_arena_kills("achievement_arena_2v2_kills", ARENA_TYPE_2v2);
new achievement_arena_kills("achievement_arena_3v3_kills", ARENA_TYPE_3v3);
new achievement_arena_kills("achievement_arena_5v5_kills", ARENA_TYPE_5v5);
- new achievement_bg_sa_defense_of_ancients();
new achievement_tilted();
- new achievement_not_even_a_scratch();
new achievement_flirt_with_disaster_perf_check();
new achievement_killed_exp_or_honor_target();
new achievement_newbie();