feat(Core/Chat): new argument parsing and unify chat hyperlink parsing (#6243)

This commit is contained in:
Kargatum
2021-10-23 15:15:42 +07:00
committed by GitHub
parent 1101f9dd2a
commit bc9473482e
90 changed files with 4280 additions and 2508 deletions

View File

@@ -41,38 +41,44 @@ EndScriptData */
#include <openssl/opensslv.h>
#include <numeric>
#if AC_COMPILER == AC_COMPILER_GNU
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
using namespace Acore::ChatCommands;
class server_commandscript : public CommandScript
{
public:
server_commandscript() : CommandScript("server_commandscript") { }
std::vector<ChatCommand> GetCommands() const override
ChatCommandTable GetCommands() const override
{
static std::vector<ChatCommand> serverIdleRestartCommandTable =
static ChatCommandTable serverIdleRestartCommandTable =
{
{ "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "" },
{ "", SEC_ADMINISTRATOR, true, &HandleServerIdleRestartCommand, "" }
{ "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "" },
{ "", SEC_CONSOLE, true, &HandleServerIdleRestartCommand, "" }
};
static std::vector<ChatCommand> serverIdleShutdownCommandTable =
static ChatCommandTable serverIdleShutdownCommandTable =
{
{ "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "" },
{ "", SEC_ADMINISTRATOR, true, &HandleServerIdleShutDownCommand, "" }
{ "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "" },
{ "", SEC_CONSOLE, true, &HandleServerIdleShutDownCommand, "" }
};
static std::vector<ChatCommand> serverRestartCommandTable =
static ChatCommandTable serverRestartCommandTable =
{
{ "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "" },
{ "", SEC_ADMINISTRATOR, true, &HandleServerRestartCommand, "" }
{ "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "" },
{ "", SEC_ADMINISTRATOR, true, &HandleServerRestartCommand, "" }
};
static std::vector<ChatCommand> serverShutdownCommandTable =
static ChatCommandTable serverShutdownCommandTable =
{
{ "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "" },
{ "", SEC_ADMINISTRATOR, true, &HandleServerShutDownCommand, "" }
{ "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "" },
{ "", SEC_ADMINISTRATOR, true, &HandleServerShutDownCommand, "" }
};
static std::vector<ChatCommand> serverSetCommandTable =
static ChatCommandTable serverSetCommandTable =
{
{ "difftime", SEC_CONSOLE, true, &HandleServerSetDiffTimeCommand, "" },
{ "loglevel", SEC_CONSOLE, true, &HandleServerSetLogLevelCommand, "" },
@@ -80,7 +86,7 @@ public:
{ "closed", SEC_CONSOLE, true, &HandleServerSetClosedCommand, "" }
};
static std::vector<ChatCommand> serverCommandTable =
static ChatCommandTable serverCommandTable =
{
{ "corpses", SEC_GAMEMASTER, true, &HandleServerCorpsesCommand, "" },
{ "debug", SEC_ADMINISTRATOR, true, &HandleServerDebugCommand, "" },
@@ -94,7 +100,7 @@ public:
{ "set", SEC_ADMINISTRATOR, true, nullptr, "", serverSetCommandTable }
};
static std::vector<ChatCommand> commandTable =
static ChatCommandTable commandTable =
{
{ "server", SEC_PLAYER, true, nullptr, "", serverCommandTable }
};