diff --git a/sql/updates/7552_world_battleground_template.sql b/sql/updates/7552_world_battleground_template.sql new file mode 100644 index 0000000000..4283a7e79b --- /dev/null +++ b/sql/updates/7552_world_battleground_template.sql @@ -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); diff --git a/sql/world.sql b/sql/world.sql index d42dfb2dcc..f6c2c6b397 100644 --- a/sql/world.sql +++ b/sql/world.sql @@ -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; diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h index 02783a582a..43b724fe1c 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 0f82c2404a..a9ba41c682 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 92723ae7ca..93b6d0288f 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 120f05c998..0f5dc3c925 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 m_EnabledArenas; std::vector m_QueueUpdateScheduler; std::set 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 8782ab9d37..db1c348c89 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 b936162b36..f20b3d61dc 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 1441eafbaf..cc4e02f964 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 43efc8e095..32c7a563cb 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