From 78a6d084bc71d72214cf4414f8d1ce007b15f495 Mon Sep 17 00:00:00 2001 From: balrok Date: Sat, 24 Jan 2009 18:38:05 +0100 Subject: [PATCH] add .debug bg to allow starting a battleground with just one player it's implemented like .debug arena - so you toggle debug bg on or off --- src/game/BattleGroundMgr.cpp | 12 +++++++++++- src/game/BattleGroundMgr.h | 3 +++ src/game/Chat.cpp | 1 + src/game/Chat.h | 1 + src/game/debugcmds.cpp | 6 ++++++ 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 785031a9b..15935232a 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -721,7 +721,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, uint32 queue_id, uin sLog.outDebug("Battleground: horde pool wasn't created"); // if selection pools are ready, create the new bg - if (bAllyOK && bHordeOK) + if ((bAllyOK && bHordeOK) || ( sBattleGroundMgr.isTesting() && (bAllyOK || bHordeOK))) { BattleGround * bg2 = 0; // special handling for arenas @@ -1077,6 +1077,7 @@ BattleGroundMgr::BattleGroundMgr() : m_AutoDistributionTimeChecker(0), m_ArenaTe { m_BattleGrounds.clear(); m_NextRatingDiscardUpdate = sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER); + m_Testing=false; } BattleGroundMgr::~BattleGroundMgr() @@ -1894,6 +1895,15 @@ uint8 BattleGroundMgr::BGArenaType(uint32 bgQueueTypeId) } } +void BattleGroundMgr::ToggleTesting() +{ + m_Testing = !m_Testing; + if(m_Testing) + sWorld.SendGlobalText("Battlegrounds are set to 1v0 for debugging.", NULL); + else + sWorld.SendGlobalText("Battlegrounds are set to normal playercount.", NULL); +} + void BattleGroundMgr::ToggleArenaTesting() { m_ArenaTesting = !m_ArenaTesting; diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h index 1d71e7867..2cf268689 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -223,6 +223,7 @@ class BattleGroundMgr void InitAutomaticArenaPointDistribution(); void DistributeArenaPoints(); void ToggleArenaTesting(); + void ToggleTesting(); void LoadBattleMastersEntry(); BattleGroundTypeId GetBattleMasterBG(uint32 entry) const @@ -234,6 +235,7 @@ class BattleGroundMgr } bool isArenaTesting() const { return m_ArenaTesting; } + bool isTesting() const { return m_Testing; } static bool IsArenaType(BattleGroundTypeId bgTypeId); static bool IsBattleGroundType(BattleGroundTypeId bgTypeId) { return !BattleGroundMgr::IsArenaType(bgTypeId); } @@ -249,6 +251,7 @@ class BattleGroundMgr uint64 m_NextAutoDistributionTime; uint32 m_AutoDistributionTimeChecker; bool m_ArenaTesting; + bool m_Testing; }; #define sBattleGroundMgr MaNGOS::Singleton::Instance() diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 3c8fb9c0a..84e33eb8f 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -219,6 +219,7 @@ ChatCommand * ChatHandler::getCommandTable() { "anim", SEC_GAMEMASTER, false, &ChatHandler::HandleAnimCommand, "", NULL }, { "lootrecipient", SEC_GAMEMASTER, false, &ChatHandler::HandleGetLootRecipient, "", NULL }, { "arena", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugArenaCommand, "", NULL }, + { "bg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugBattlegroundCommand, "", NULL }, { "sendlargepacket",SEC_ADMINISTRATOR, false, &ChatHandler::HandleSendLargePacketCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; diff --git a/src/game/Chat.h b/src/game/Chat.h index bb0ba8094..02e47f4e2 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -439,6 +439,7 @@ class ChatHandler bool HandleGetItemState(const char * args); bool HandleGetLootRecipient(const char * args); bool HandleDebugArenaCommand(const char * args); + bool HandleDebugBattlegroundCommand(const char * args); bool HandleSpawnVehicle(const char * args); bool HandleSendLargePacketCommand(const char * args); diff --git a/src/game/debugcmds.cpp b/src/game/debugcmds.cpp index 67412301d..189a077d7 100644 --- a/src/game/debugcmds.cpp +++ b/src/game/debugcmds.cpp @@ -521,6 +521,12 @@ bool ChatHandler::HandleGetItemState(const char* args) return true; } +bool ChatHandler::HandleDebugBattlegroundCommand(const char * /*args*/) +{ + sBattleGroundMgr.ToggleTesting(); + return true; +} + bool ChatHandler::HandleDebugArenaCommand(const char * /*args*/) { sBattleGroundMgr.ToggleArenaTesting();