Allow Battlegrounds and arenas to be disabled by DB.

wtlk arenas disabled by default.

- Player will continue to see all bgs using UI, but won't be able to join disabled bg's
- Gossip menu not shown for disabled Bgs/arenas
- Id 6 disabled = all arenas disabled.
- Only id 6 arena enabled = Gossip shown but unable to join any arena

--HG--
branch : trunk
This commit is contained in:
Spp
2010-03-13 00:47:24 +01:00
parent e1a8e1b2c9
commit ff89bad0fe
10 changed files with 52 additions and 40 deletions
+3 -1
View File
@@ -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
+13 -1
View File
@@ -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:
+9 -13
View File
@@ -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());
+2
View File
@@ -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;
+2 -2
View File
@@ -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."
-1
View File
@@ -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);
-1
View File
@@ -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,
-6
View File
@@ -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