From 0b4af00ab7fb92b23cbbe8d8b2b26a6af37a8796 Mon Sep 17 00:00:00 2001 From: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Date: Sun, 21 Jun 2020 13:17:07 +0200 Subject: [PATCH] feat(Core/Config): Enable/Disable Debug BG/Arena (#3001) --- .../rev_1588709577858892600.sql | 6 +++++ .../game/Battlegrounds/BattlegroundMgr.cpp | 24 +++++++++++++++--- src/server/game/Miscellaneous/Language.h | 5 +++- src/server/game/World/World.cpp | 4 +++ src/server/game/World/World.h | 2 ++ src/server/worldserver/worldserver.conf.dist | 25 +++++++++++++++++-- 6 files changed, 59 insertions(+), 7 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1588709577858892600.sql diff --git a/data/sql/updates/pending_db_world/rev_1588709577858892600.sql b/data/sql/updates/pending_db_world/rev_1588709577858892600.sql new file mode 100644 index 000000000..8103e8e13 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1588709577858892600.sql @@ -0,0 +1,6 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1588709577858892600'); + +DELETE FROM `acore_string` WHERE `entry` IN (30085,30086); +INSERT INTO `acore_string` (`entry`, `content_default`) VALUES +(30085, 'Battleground Debugging is already enabled in the config, thus you are unable to enable/disable it with command.'), +(30086, 'Arena Debugging is already enabled in the config, thus you are unable to enable/disable it with command.'); diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index a12237bc1..6a08bbe46 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -793,14 +793,30 @@ uint8 BattlegroundMgr::BGArenaType(BattlegroundQueueTypeId bgQueueTypeId) void BattlegroundMgr::ToggleTesting() { - m_Testing = !m_Testing; - sWorld->SendWorldText(m_Testing ? LANG_DEBUG_BG_ON : LANG_DEBUG_BG_OFF); + if (sWorld->getBoolConfig(CONFIG_DEBUG_BATTLEGROUND)) + { + m_Testing = true; + sWorld->SendWorldText(LANG_DEBUG_BG_CONF); + } + else + { + m_Testing = !m_Testing; + sWorld->SendWorldText(m_Testing ? LANG_DEBUG_BG_ON : LANG_DEBUG_BG_OFF); + } } void BattlegroundMgr::ToggleArenaTesting() { - m_ArenaTesting = !m_ArenaTesting; - sWorld->SendWorldText(m_ArenaTesting ? LANG_DEBUG_ARENA_ON : LANG_DEBUG_ARENA_OFF); + if (sWorld->getBoolConfig(CONFIG_DEBUG_ARENA)) + { + m_ArenaTesting = true; + sWorld->SendWorldText(LANG_DEBUG_ARENA_CONF); + } + else + { + m_ArenaTesting = !m_ArenaTesting; + sWorld->SendWorldText(m_ArenaTesting ? LANG_DEBUG_ARENA_ON : LANG_DEBUG_ARENA_OFF); + } } void BattlegroundMgr::SetHolidayWeekends(uint32 mask) diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index 95a6ef0cc..807a12731 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -1320,6 +1320,9 @@ enum AcoreStrings LANG_REMOVEITEM_ERROR = 30082, LANG_BG_SHARE_QUEST_ERROR = 30083, - LANG_BG_READY_CHECK_ERROR = 30084 + LANG_BG_READY_CHECK_ERROR = 30084, + + LANG_DEBUG_BG_CONF = 30085, + LANG_DEBUG_ARENA_CONF = 30086 }; #endif diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 5c9662923..4fb565eed 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1404,6 +1404,10 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_WAYPOINT_MOVEMENT_STOP_TIME_FOR_PLAYER] = sConfigMgr->GetIntDefault("WaypointMovementStopTimeForPlayer", 120); + //Debug + m_bool_configs[CONFIG_DEBUG_BATTLEGROUND] = sConfigMgr->GetBoolDefault("Debug.Battleground", false); + m_bool_configs[CONFIG_DEBUG_ARENA] = sConfigMgr->GetBoolDefault("Debug.Arena", false); + // call ScriptMgr if we're reloading the configuration sScriptMgr->OnAfterConfigLoad(reload); } diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index fff15b2e4..5e47df78a 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -176,6 +176,8 @@ enum WorldBoolConfigs CONFIG_ITEMDELETE_METHOD, CONFIG_ITEMDELETE_VENDOR, CONFIG_SET_ALL_CREATURES_WITH_WAYPOINT_MOVEMENT_ACTIVE, + CONFIG_DEBUG_BATTLEGROUND, + CONFIG_DEBUG_ARENA, BOOL_CONFIG_VALUE_COUNT }; diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index bb780ed08..fc552d521 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -27,6 +27,7 @@ # CHARACTER DELETE OPTIONS # ITEM DELETE OPTIONS # CUSTOM SERVER OPTIONS +# DEBUG # ################################################################################################### @@ -3515,7 +3516,6 @@ ICC.Buff.Alliance = 73828 ################################################################################################### ################################################################################################### -# # Packet Spoof Protection Settings # # These settings determine which action to take when harmful packet spoofing is detected. @@ -3548,4 +3548,25 @@ PacketSpoof.BanMode = 0 PacketSpoof.BanDuration = 86400 # -################################################################################################### +################################################################################################### + +################################################################################################### +# DEBUG +# +# Debug.Battleground +# Description: Enable or disable Battleground 1v0 mode. (If enabled, the in-game command is disabled.) +# Default: 0 - (Disabled) +# 1 - (Enabled) + +Debug.Battleground = 0 + +# +# Debug.Arena +# Description: Enable or disable Arena 1v1 mode. (If enabled, the in-game command is disabled.) +# Default: 0 - (Disabled) +# 1 - (Enabled) + +Debug.Arena = 0 + +# +###################################################################################################