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
@@ -0,0 +1,5 @@
-- Add disable column to allow battlegrounds to be disabled.
ALTER TABLE `battleground_template` ADD COLUMN disable TINYINT(1) NOT NULL DEFAULT '0';
-- Disable wtlk arenas by default
UPDATE `battleground_template` SET `disable`=1 WHERE `id` in (10,11);
+18 -15
View File
@@ -244,6 +244,7 @@ CREATE TABLE `battleground_template` (
`AllianceStartO` float NOT NULL,
`HordeStartLoc` mediumint(8) unsigned NOT NULL,
`HordeStartO` float NOT NULL,
`Disable` tynyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -254,20 +255,20 @@ CREATE TABLE `battleground_template` (
LOCK TABLES `battleground_template` WRITE;
/*!40000 ALTER TABLE `battleground_template` DISABLE KEYS */;
INSERT INTO `battleground_template` (`id`,`MinPlayersPerTeam`,`MaxPlayersPerTeam`,`MinLvl`,`MaxLvl`,`AllianceStartLoc`,`AllianceStartO`,`HordeStartLoc`,`HordeStartO`) VALUES
(1,20,40,51,80,611,2.72532,610,2.27452),
(2,5,10,10,80,769,3.14159,770,3.14159),
(3,8,15,20,80,890,3.40156,889,0.263892),
(4,0,2,10,80,929,0,936,3.14159),
(5,0,2,10,80,939,0,940,3.14159),
(6,0,2,10,80,0,0,0,0),
(7,8,15,61,80,1103,3.40156,1104,0.263892),
(8,0,2,10,80,1258,0,1259,3.14159),
(9,7,15,71,80,1367,0,1368,0),
(10,5,5,10,80,1362,0,1363,0),
(11,5,5,10,80,1364,0,1365,0),
(30,20,40,71,80,1485,0,1486,0),
(32,0,40,0,80,0,0,0,0);
INSERT INTO `battleground_template` (`id`,`MinPlayersPerTeam`,`MaxPlayersPerTeam`,`MinLvl`,`MaxLvl`,`AllianceStartLoc`,`AllianceStartO`,`HordeStartLoc`,`HordeStartO`, `Disable`) VALUES
(1,20,40,51,80,611,2.72532,610,2.27452,0),
(2,5,10,10,80,769,3.14159,770,3.14159,0),
(3,8,15,20,80,890,3.40156,889,0.263892,0),
(4,0,2,10,80,929,0,936,3.14159,0),
(5,0,2,10,80,939,0,940,3.14159,0),
(6,0,2,10,80,0,0,0,0,0),
(7,8,15,61,80,1103,3.40156,1104,0.263892,0),
(8,0,2,10,80,1258,0,1259,3.14159,0),
(9,7,15,71,80,1367,0,1368,0,0),
(10,5,5,10,80,1362,0,1363,0,1),
(11,5,5,10,80,1364,0,1365,0,1),
(30,20,40,71,80,1485,0,1486,0,0),
(32,0,40,0,80,0,0,0,0,0);
/*!40000 ALTER TABLE `battleground_template` ENABLE KEYS */;
UNLOCK TABLES;
@@ -14645,6 +14646,8 @@ INSERT INTO `trinity_string` (`entry`,`content_default`,`content_loc1`,`content_
(744, 'Modifying played count, arena points etc. for loaded arena teams, sending updated stats to online players...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(745, 'Modification done.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(746, 'Done flushing Arena points.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(747, 'This Battleground have been disabled. You can''t join the queue.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(748, 'Arenas have been disabled. You can''t join the queue.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(750, 'Not enough players. This game will close in %u mins.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(751, 'Not enough players. This game will close in %u seconds.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(753, 'The battle for Warsong Gulch begins in 2 minutes.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
@@ -14902,7 +14905,7 @@ CREATE TABLE `vehicle_accessory` (
COLLATE=utf8_general_ci
ENGINE=MyISAM
ROW_FORMAT=FIXED
AVG_ROW_LENGTH=0
AVG_ROW_LENGTH=0;
LOCK TABLES `vehicle_accessory` WRITE;
+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