feat: add WoW utility functions and SlashCmdList for addon slash commands

Utility functions:
- strsplit(delim, str), strtrim(str), wipe(table)
- date(format), time() — safe replacements for removed os.date/os.time
- format (alias for string.format), tinsert/tremove (table aliases)

SlashCmdList system:
- Addons can register custom slash commands via the standard WoW pattern:
  SLASH_MYADDON1 = "/myaddon"
  SlashCmdList["MYADDON"] = function(args) ... end
- Chat input checks SlashCmdList before built-in commands
- dispatchSlashCommand() iterates SLASH_<NAME>1..9 globals to match

Total WoW API surface: 23 functions + SlashCmdList + 14 events.
This commit is contained in:
Kelsi 2026-03-20 11:40:58 -07:00
parent 52a97e7730
commit c1820fd07d
3 changed files with 163 additions and 1 deletions

View file

@ -6007,6 +6007,20 @@ void GameScreen::sendChatMessage(game::GameHandler& gameHandler) {
return;
}
// Check addon slash commands (SlashCmdList) before built-in commands
{
auto* am = core::Application::getInstance().getAddonManager();
if (am && am->isInitialized()) {
std::string slashCmd = "/" + cmdLower;
std::string slashArgs;
if (spacePos != std::string::npos) slashArgs = command.substr(spacePos + 1);
if (am->getLuaEngine()->dispatchSlashCommand(slashCmd, slashArgs)) {
chatInputBuffer[0] = '\0';
return;
}
}
}
// Special commands
if (cmdLower == "logout") {
core::Application::getInstance().logoutToLogin();