mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Scripts/Commands: Implemented .bg start and .bg stop commands.
This commit is contained in:
@@ -995,6 +995,8 @@ INSERT INTO `rbac_linked_permissions` VALUES
|
||||
(197,863),
|
||||
(197,864),
|
||||
(197,865),
|
||||
(197,884),
|
||||
(197,885),
|
||||
(198,218),
|
||||
(198,300),
|
||||
(198,312),
|
||||
@@ -1794,7 +1796,9 @@ INSERT INTO `rbac_permissions` VALUES
|
||||
(878,'Command: debug questreset'),
|
||||
(879,'Command: debug poolstatus'),
|
||||
(880,'Command: pdump copy'),
|
||||
(881,'Command: reload vehicle_template');
|
||||
(881,'Command: reload vehicle_template'),
|
||||
(884,'Command: bg start'),
|
||||
(885,'Command: bg stop');
|
||||
/*!40000 ALTER TABLE `rbac_permissions` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@@ -2016,7 +2020,8 @@ INSERT INTO `updates` VALUES
|
||||
('2023_06_14_00_auth.sql','BB8A7EB214F4F3632C4F54EA596CB7C8FBA305D5','ARCHIVED','2023-06-14 19:34:24',0),
|
||||
('2023_11_21_00_auth.sql','146E5E6EF94C5DB78343372A8FDB32B062B80040','RELEASED','2023-11-21 11:24:11',0),
|
||||
('2024_01_06_00_auth.sql','767D697594D5471B67CC0FDF0D7BB15374116A71','RELEASED','2024-01-06 09:53:51',0),
|
||||
('2024_01_06_01_auth.sql','3D9E0A906A357877DB8E7B72E0797AB38EF884BC','RELEASED','2024-01-06 11:33:07',0);
|
||||
('2024_01_06_01_auth.sql','3D9E0A906A357877DB8E7B72E0797AB38EF884BC','RELEASED','2024-01-06 11:33:07',0),
|
||||
('2024_01_06_02_auth.sql','B14F889C198A4F640A968BAB8A4C262AC61634C7','RELEASED','2024-01-06 12:43:47',0);
|
||||
/*!40000 ALTER TABLE `updates` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
|
||||
10
sql/updates/auth/3.3.5/2024_01_06_02_auth.sql
Normal file
10
sql/updates/auth/3.3.5/2024_01_06_02_auth.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
--
|
||||
DELETE FROM `rbac_permissions` WHERE `id` IN (884, 885);
|
||||
INSERT INTO `rbac_permissions` (`id`, `name`) VALUES
|
||||
(884, "Command: bg start"),
|
||||
(885, "Command: bg stop");
|
||||
|
||||
DELETE FROM `rbac_linked_permissions` WHERE `linkedId` IN (884, 885);
|
||||
INSERT INTO `rbac_linked_permissions` (`id`, `linkedId`) VALUES
|
||||
(197, 884),
|
||||
(197, 885);
|
||||
7
sql/updates/world/3.3.5/2024_01_06_00_world.sql
Normal file
7
sql/updates/world/3.3.5/2024_01_06_00_world.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
--
|
||||
DELETE FROM `trinity_string` WHERE `entry` IN (395, 396);
|
||||
INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES
|
||||
(395, '### USAGE: .bg start
|
||||
Skips battleground preparation time and starts the battle.'),
|
||||
(396, '### USAGE: .bg stop
|
||||
Immediately ends the battleground.');
|
||||
@@ -746,6 +746,8 @@ enum RBACPermissions
|
||||
// 878-879 previously used, do not reuse
|
||||
RBAC_PERM_COMMAND_PDUMP_COPY = 880,
|
||||
RBAC_PERM_COMMAND_RELOAD_VEHICLE_TEMPLATE = 881,
|
||||
RBAC_PERM_COMMAND_BG_START = 884,
|
||||
RBAC_PERM_COMMAND_BG_STOP = 885,
|
||||
//
|
||||
// IF YOU ADD NEW PERMISSIONS, ADD THEM IN MASTER BRANCH AS WELL!
|
||||
//
|
||||
|
||||
@@ -447,7 +447,9 @@ enum TrinityStrings
|
||||
LANG_COMMAND_LEARN_ALL_RECIPES_HELP = 392,
|
||||
LANG_COMMAND_LEARN_ALL_TALENTS_HELP = 393,
|
||||
LANG_COMMAND_LEARN_ALL_PETTALENT_HELP = 394,
|
||||
// Room for more level 2 395-399 not used
|
||||
LANG_COMMAND_BG_START_HELP = 395,
|
||||
LANG_COMMAND_BG_STOP_HELP = 396,
|
||||
// Room for more level 2 397-399 not used
|
||||
|
||||
// level 3 chat
|
||||
LANG_SCRIPTS_RELOADED = 400,
|
||||
|
||||
76
src/server/scripts/Commands/cs_bg.cpp
Normal file
76
src/server/scripts/Commands/cs_bg.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "Chat.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
#include "RBAC.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
using namespace Trinity::ChatCommands;
|
||||
|
||||
class bg_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
bg_commandscript() : CommandScript("bg_commandscript") { }
|
||||
|
||||
ChatCommandTable GetCommands() const override
|
||||
{
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
{ "bg start", HandleBgStartCommand, LANG_COMMAND_BG_START_HELP, rbac::RBAC_PERM_COMMAND_BG_START, Console::No },
|
||||
{ "bg stop", HandleBgStopCommand, LANG_COMMAND_BG_STOP_HELP, rbac::RBAC_PERM_COMMAND_BG_STOP, Console::No }
|
||||
};
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static bool HandleBgStartCommand(ChatHandler* handler)
|
||||
{
|
||||
Battleground* bg = handler->GetPlayer()->GetBattleground();
|
||||
if (!bg)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_NO_BATTLEGROUND_FOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
bg->SetStartDelayTime(0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleBgStopCommand(ChatHandler* handler)
|
||||
{
|
||||
Battleground* bg = handler->GetPlayer()->GetBattleground();
|
||||
if (!bg)
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_NO_BATTLEGROUND_FOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
bg->EndBattleground(0);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_bg_commandscript()
|
||||
{
|
||||
new bg_commandscript();
|
||||
}
|
||||
@@ -22,6 +22,7 @@ void AddSC_ahbot_commandscript();
|
||||
void AddSC_arena_commandscript();
|
||||
void AddSC_ban_commandscript();
|
||||
void AddSC_bf_commandscript();
|
||||
void AddSC_bg_commandscript();
|
||||
void AddSC_cast_commandscript();
|
||||
void AddSC_character_commandscript();
|
||||
void AddSC_cheat_commandscript();
|
||||
@@ -67,6 +68,7 @@ void AddCommandsScripts()
|
||||
AddSC_arena_commandscript();
|
||||
AddSC_ban_commandscript();
|
||||
AddSC_bf_commandscript();
|
||||
AddSC_bg_commandscript();
|
||||
AddSC_cast_commandscript();
|
||||
AddSC_character_commandscript();
|
||||
AddSC_cheat_commandscript();
|
||||
|
||||
Reference in New Issue
Block a user