aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/BattleGround.h4
-rw-r--r--src/game/BattleGroundHandler.cpp14
-rw-r--r--src/game/BattleGroundMgr.cpp22
-rw-r--r--src/game/BattleGroundMgr.h2
-rw-r--r--src/game/Language.h4
-rw-r--r--src/game/World.cpp1
-rw-r--r--src/game/World.h1
-rw-r--r--src/trinitycore/trinitycore.conf.dist6
8 files changed, 29 insertions, 25 deletions
diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h
index 02783a582a9..43b724fe1c2 100644
--- a/src/game/BattleGround.h
+++ b/src/game/BattleGround.h
@@ -256,7 +256,9 @@ enum BattleGroundJoinError
BG_JOIN_ERR_GROUP_MEMBER_ALREADY_IN_QUEUE = 6,
BG_JOIN_ERR_GROUP_DESERTER = 7,
BG_JOIN_ERR_ALL_QUEUES_USED = 8,
- BG_JOIN_ERR_GROUP_NOT_ENOUGH = 9
+ BG_JOIN_ERR_GROUP_NOT_ENOUGH = 9,
+ BG_JOIN_ERR_BG_DISABLED = 10,
+ BG_JOIN_ERR_ARENA_DISABLED = 11,
};
class BattleGroundScore
diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp
index 0f82c2404ab..a9ba41c682f 100644
--- a/src/game/BattleGroundHandler.cpp
+++ b/src/game/BattleGroundHandler.cpp
@@ -108,7 +108,7 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
if (!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId)))
{
- sLog.outError("Battleground: no available bg / template found");
+ SendBattleGroundOrArenaJoinError(BG_JOIN_ERR_BG_DISABLED);
return;
}
@@ -615,6 +615,12 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
return;
}
+ //check if any arena enabled
+ if (!sBattleGroundMgr.isAnyArenaEnabled())
+ {
+ SendBattleGroundOrArenaJoinError(BG_JOIN_ERR_ARENA_DISABLED);
+ return;
+ }
//check existance
BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(BATTLEGROUND_AA);
if (!bg)
@@ -778,6 +784,12 @@ void WorldSession::SendBattleGroundOrArenaJoinError(uint8 err)
case BG_JOIN_ERR_ALL_QUEUES_USED:
msg = LANG_BG_GROUP_MEMBER_NO_FREE_QUEUE_SLOTS;
break;
+ case BG_JOIN_ERR_ARENA_DISABLED:
+ msg = LANG_ARENA_DISABLED;
+ break;
+ case BG_JOIN_ERR_BG_DISABLED:
+ msg = LANG_BG_DISABLED;
+ break;
case BG_JOIN_ERR_GROUP_NOT_ENOUGH:
case BG_JOIN_ERR_MIXED_ARENATEAM:
default:
diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp
index 92723ae7ca2..93b6d0288f8 100644
--- a/src/game/BattleGroundMgr.cpp
+++ b/src/game/BattleGroundMgr.cpp
@@ -1532,17 +1532,10 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
//for arenas there is random map used
if (bg_template->isArena())
{
- // for type enter in arenas
- uint32 arenaswitch = urand(1, 3);
-
- if (sWorld.getConfig(CONFIG_ARENA_LK_ARENAS_ENABLE) == 1)
- arenaswitch = urand(0, 4); // Enable Ring of Valor and Dalaran Sewers arenas - in these arenas problem with LoS
- else
- arenaswitch = urand(1, 3); // Disable WoTLK Arenas (Ring of Valor, Dalaran Sewers)
-
- BattleGroundTypeId arenas[] = {BATTLEGROUND_RV, BATTLEGROUND_NA, BATTLEGROUND_BE, BATTLEGROUND_RL, BATTLEGROUND_DS};
- uint32 arena_num = arenaswitch;
- bgTypeId = arenas[arena_num];
+ if (!isAnyArenaEnabled()) // it's checked in handler but just to be sure
+ return NULL;
+ uint8 size = m_EnabledArenas.size() - 1;
+ bgTypeId = m_EnabledArenas[urand(0,size)];
bg_template = GetBattleGroundTemplate(bgTypeId);
if (!bg_template)
{
@@ -1671,8 +1664,8 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
uint32 count = 0;
- // 0 1 2 3 4 5 6 7 8
- QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam,MaxPlayersPerTeam,MinLvl,MaxLvl,AllianceStartLoc,AllianceStartO,HordeStartLoc,HordeStartO FROM battleground_template");
+ // 0 1 2 3 4 5 6 7 8
+ QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam,MaxPlayersPerTeam,MinLvl,MaxLvl,AllianceStartLoc,AllianceStartO,HordeStartLoc,HordeStartO FROM battleground_template WHERE disable = 0");
if (!result)
{
@@ -1772,6 +1765,9 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
if (!CreateBattleGround(bgTypeID, IsArena, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]))
continue;
+ if (IsArena && bgTypeID != BATTLEGROUND_AA)
+ m_EnabledArenas.push_back(bgTypeID);
+
++count;
} while (result->NextRow());
diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h
index 120f05c9982..0f5dc3c9255 100644
--- a/src/game/BattleGroundMgr.h
+++ b/src/game/BattleGroundMgr.h
@@ -251,11 +251,13 @@ class BattleGroundMgr
static bool IsBGWeekend(BattleGroundTypeId bgTypeId);
void DoCompleteAchievement(uint32 achievement, Player * player = NULL);
+ bool isAnyArenaEnabled() const { return m_EnabledArenas.size() != 0; }
private:
BattleMastersMap mBattleMastersMap;
/* Battlegrounds */
BattleGroundSet m_BattleGrounds[MAX_BATTLEGROUND_TYPE_ID];
+ std::vector<BattleGroundTypeId> m_EnabledArenas;
std::vector<uint64> m_QueueUpdateScheduler;
std::set<uint32> m_ClientBattleGroundIds[MAX_BATTLEGROUND_TYPE_ID][MAX_BATTLEGROUND_BRACKETS]; //the instanceids just visible for the client
uint32 m_NextRatingDiscardUpdate;
diff --git a/src/game/Language.h b/src/game/Language.h
index 8782ab9d37d..db1c348c899 100644
--- a/src/game/Language.h
+++ b/src/game/Language.h
@@ -692,8 +692,8 @@ enum TrinityStrings
LANG_DIST_ARENA_POINTS_TEAM_START = 744,
LANG_DIST_ARENA_POINTS_TEAM_END = 745,
LANG_DIST_ARENA_POINTS_END = 746,
-// = 747, not used
-// = 748, not used
+ LANG_BG_DISABLED = 747,
+ LANG_ARENA_DISABLED = 748,
// = 749, not used
LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING = 750, // "Not enough players. This game will close in %u mins."
LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS = 751, // "Not enough players. This game will close in %u seconds."
diff --git a/src/game/World.cpp b/src/game/World.cpp
index b936162b367..f20b3d61dc3 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -1051,7 +1051,6 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_ARENA_START_RATING] = sConfig.GetIntDefault ("Arena.ArenaStartRating", 0);
m_configs[CONFIG_ARENA_START_PERSONAL_RATING] = sConfig.GetIntDefault ("Arena.ArenaStartPersonalRating", 0);
m_configs[CONFIG_ARENA_SEASON_IN_PROGRESS] = sConfig.GetBoolDefault("Arena.ArenaSeason.InProgress", true);
- m_configs[CONFIG_ARENA_LK_ARENAS_ENABLE] = sConfig.GetIntDefault ("Arena.LK.ArenasEnable", 0);
m_configs[CONFIG_OFFHAND_CHECK_AT_SPELL_UNLEARN] = sConfig.GetBoolDefault("OffhandCheckAtSpellUnlearn", false);
diff --git a/src/game/World.h b/src/game/World.h
index 1441eafbafe..cc4e02f9642 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -247,7 +247,6 @@ enum WorldConfigs
CONFIG_ARENA_SEASON_IN_PROGRESS,
CONFIG_ARENA_START_RATING,
CONFIG_ARENA_START_PERSONAL_RATING,
- CONFIG_ARENA_LK_ARENAS_ENABLE,
CONFIG_MAX_WHO,
CONFIG_BG_START_MUSIC,
CONFIG_START_ALL_SPELLS,
diff --git a/src/trinitycore/trinitycore.conf.dist b/src/trinitycore/trinitycore.conf.dist
index 43efc8e095d..32c7a563cb1 100644
--- a/src/trinitycore/trinitycore.conf.dist
+++ b/src/trinitycore/trinitycore.conf.dist
@@ -1714,11 +1714,6 @@ BattleGround.PremadeGroupWaitForMatch = 1800000
# Start personal rating on entry in team
# Default: 1500
#
-# Arena.LK.ArenasEnable
-# Enable or Disable new WoTLK Arenas: Ring of Valor and Dalaran Sewers. These arenas have a problem of Line of The Side.
-# Default: 0 (Disable)
-# 1 (Enable)
-#
###############################################################################
Arena.MaxRatingDifference = 150
@@ -1731,7 +1726,6 @@ Arena.ArenaSeason.ID = 1
Arena.ArenaSeason.InProgress = 1
Arena.ArenaStartRating = 0
Arena.ArenaStartPersonalRating = 0
-Arena.LK.ArenasEnable = 0
###############################################################################
# NETWORK CONFIG