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

@@ -44,14 +44,20 @@ EndScriptData */
#include "StringConvert.h"
#include "Tokenize.h"
#if AC_COMPILER == AC_COMPILER_GNU
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
using namespace Acore::ChatCommands;
class reload_commandscript : public CommandScript
{
public:
reload_commandscript() : CommandScript("reload_commandscript") { }
std::vector<ChatCommand> GetCommands() const override
ChatCommandTable GetCommands() const override
{
static std::vector<ChatCommand> reloadAllCommandTable =
static ChatCommandTable reloadAllCommandTable =
{
{ "achievement", SEC_ADMINISTRATOR, true, &HandleReloadAllAchievementCommand, "" },
{ "area", SEC_ADMINISTRATOR, true, &HandleReloadAllAreaCommand, "" },
@@ -65,7 +71,7 @@ public:
{ "spell", SEC_ADMINISTRATOR, true, &HandleReloadAllSpellCommand, "" },
{ "", SEC_ADMINISTRATOR, true, &HandleReloadAllCommand, "" }
};
static std::vector<ChatCommand> reloadCommandTable =
static ChatCommandTable reloadCommandTable =
{
{ "auctions", SEC_ADMINISTRATOR, true, &HandleReloadAuctionsCommand, "" },
{ "dungeon_access_template", SEC_ADMINISTRATOR, true, &HandleReloadDungeonAccessCommand, "" },
@@ -85,7 +91,7 @@ public:
{ "config", SEC_ADMINISTRATOR, true, &HandleReloadConfigCommand, "" },
{ "creature_text", SEC_ADMINISTRATOR, true, &HandleReloadCreatureText, "" },
{ "creature_questender", SEC_ADMINISTRATOR, true, &HandleReloadCreatureQuestEnderCommand, "" },
{ "creature_linked_respawn", SEC_GAMEMASTER, true, &HandleReloadLinkedRespawnCommand, "" },
{ "creature_linked_respawn", SEC_ADMINISTRATOR, true, &HandleReloadLinkedRespawnCommand, "" },
{ "creature_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesCreatureCommand, "" },
{ "creature_onkill_reputation", SEC_ADMINISTRATOR, true, &HandleReloadOnKillReputationCommand, "" },
{ "creature_queststarter", SEC_ADMINISTRATOR, true, &HandleReloadCreatureQuestStarterCommand, "" },
@@ -161,7 +167,7 @@ public:
{ "vehicle_accessory", SEC_ADMINISTRATOR, true, &HandleReloadVehicleAccessoryCommand, "" },
{ "vehicle_template_accessory", SEC_ADMINISTRATOR, true, &HandleReloadVehicleTemplateAccessoryCommand, "" }
};
static std::vector<ChatCommand> commandTable =
static ChatCommandTable commandTable =
{
{ "reload", SEC_ADMINISTRATOR, true, nullptr, "", reloadCommandTable }
};
@@ -405,9 +411,13 @@ public:
static bool HandleReloadCommandCommand(ChatHandler* handler, const char* /*args*/)
{
handler->SetLoadCommandTable(true);
handler->SendGlobalGMSysMessage("DB table `command` will be reloaded at next chat command use.");
return true;
LOG_INFO("server.loading", "Reloading .command information...");
Acore::ChatCommands::LoadCommandMap();
handler->SendGlobalGMSysMessage("DB table `command` reloaded.");
// do not log this invocation, otherwise we might crash (the command table we used to get here is no longer valid!)
handler->SetSentErrorMessage(true);
return false;
}
static bool HandleReloadOnKillReputationCommand(ChatHandler* handler, const char* /*args*/)