Files

87 lines
4.6 KiB
Lua

-- OctoTextSize: addon-local factory; Blizzard CreateFrame is unchanged.
local CreateFrame = OctoTextSize and OctoTextSize.WrapFactory(CreateFrame) or CreateFrame
-- #150: Octo 1.12 slash commands missing from the 70334 command list (GlobalStrings SLASH_* diff, 2026-11-27).
-- Only new command keys are registered; no Blizzard SlashCmdList entry or global is replaced.
local function add(key, fn, ...)
for i = 1, select("#", ...) do _G["SLASH_" .. key .. i] = select(i, ...) end
SlashCmdList[key] = fn
end
local function say(msg) DEFAULT_CHAT_FRAME:AddMessage("|cffffd100" .. msg .. "|r") end
-- Octo ChatFrame.lua: /gm opens the help (GM ticket) window.
add("OCTOGM", function() if ToggleHelpFrame then ToggleHelpFrame() end end, "/gm")
-- Octo ChatFrame.lua: /rl is the short form of /reload.
add("OCTORELOAD", function() if C_UI and C_UI.Reload then C_UI.Reload() else ReloadUI() end end, "/rl")
-- Octo ChatFrame.lua: /print <expr> prints a Lua expression.
add("OCTOPRINT", function(msg)
local f, err = loadstring("print(" .. (msg or "") .. ")")
if not f then say(err) return end
local ok, e = pcall(f); if not ok then say(e) end
end, "/print")
-- 1.12 /gkick and /guildkick = native /gremove: the typed name goes to the server through the gateway channel,
-- like the patched native /gremove (#116), with the native roster uninvite as fallback.
add("OCTOGKICK", function(msg)
if not msg or msg == "" then say("Usage: /gkick <name>") return end
local sent = C_ChatInfo.SendAddonMessage("GWTURTLE", "guildremove " .. msg, "WHISPER", UnitName("player"))
if sent ~= true and sent ~= 0 then C_GuildInfo.Uninvite(msg) end
end, "/gkick", "/guildkick")
-- Octo /cal and /octocal open the calendar (/calendar is native).
add("OCTOCAL", function()
if not Calendar_Toggle and C_AddOns then C_AddOns.LoadAddOn("Blizzard_Calendar") end
if Calendar_Toggle then Calendar_Toggle() end
end, "/cal", "/octocal")
-- Octo LFT.lua: /lft opens the dungeon finder.
add("OCTOLFT", function()
local f = OctoDungeonFinderFrame
if f then if f:IsShown() then f:Hide() else f:Show() end else say("Dungeon finder is not loaded.") end
end, "/lft")
-- Octo /bug and /suggest: the Turtle server only logs CMSG_BUG and keeps nothing, so point at the real report path.
local function report(kind)
return function()
say(kind .. ": close the game and run OctoReport.exe in the game folder. It sends your text together with the logs.")
end
end
add("OCTOBUG", report("Bug report"), "/bug")
add("OCTOSUGGEST", report("Suggestion"), "/suggest")
-- Octo /i = invite (1.12 meaning). The native /i instance-chat alias is renamed in GlobalStrings (content step).
add("OCTOINVITE", function(msg)
msg = msg and strtrim(msg) or ""
if msg == "" then if UnitExists("target") then msg = UnitName("target") else say("Usage: /i <name>") return end end
C_PartyInfo.InviteUnit(msg)
end, "/i")
-- #151 Octo /h = Turtle hardcore chat (CHAT_MSG_HARDCORE 0x5E). 70334 has no such chat type: /h goes to the server
-- through the gateway channel and lines arrive as local "OctoHC" add-on messages "<name>\t<tag>\t<text>".
-- Shown like Octo (CHAT_HARDCORE_GET "[Hardcore] %s: ") in every chat frame except the combat log (Octo default).
local HC_PREFIX, HC_COLOR = "OctoHC", "|cffe6804d"
add("OCTOHARDCORE", function(msg)
msg = msg and strtrim(msg) or ""
if msg == "" then say("Usage: /h <message>") return end
C_ChatInfo.SendAddonMessage("GWTURTLE", "hardcore " .. msg, "WHISPER", UnitName("player"))
end, "/h")
local hc = CreateFrame("Frame")
hc:RegisterEvent("ADDON_LOADED")
hc:RegisterEvent("CHAT_MSG_ADDON")
hc:SetScript("OnEvent", function(_, event, a1, a2, channel, sender)
if event == "ADDON_LOADED" then
if a1 == "OctoSlash" then C_ChatInfo.RegisterAddonMessagePrefix(HC_PREFIX) end
return
end
-- The gateway presents Source hardcore chat as a guild addon message from this character.
if a1 ~= HC_PREFIX or channel ~= "GUILD" or not sender or Ambiguate(sender, "none") ~= UnitName("player") then return end
local name, tag, text = a2:match("^([^\t]+)\t(%d)\t(.*)$")
if not name then return end
local badge = ""
if tag == "3" then
badge = ChatFrameUtil.GetOctoStaffBadge and ChatFrameUtil.GetOctoStaffBadge("GM", text)
or "|TInterface\\ChatFrame\\UI-ChatIcon-Blizz:12:20:0:0:32:16:4:28:0:16|t"
end
local who = badge .. "|Hplayer:" .. name .. "|h[" .. name .. "]|h"
local line = HC_COLOR .. "[Hardcore] " .. who .. ": " .. text .. "|r"
for i = 1, NUM_CHAT_WINDOWS do
local f = _G["ChatFrame" .. i]
if f and i ~= 2 and (i == 1 or f.isDocked or f:IsShown()) then f:AddMessage(line) end
end
end)