mirror of
https://github.com/brues-code/TwitchEmotes.git
synced 2026-10-08 23:20:01 +00:00
Warn instead of loading when ClassicAPI is missing
The addon needs the ClassicAPI DLL - without it the inline |T markup the emotes are built from renders as literal text, title included. Move the real load order into TwitchEmotes_ClassicAPI.toc, which the DLL picks up in preference, and leave the base TOC loading nothing but CAPI_Warning.lua: a popup and a chat line pointing at the latest release, with the download URL in a preselected edit box. Its title drops the inline-texture markup for the same reason. Also list CreateFrame among the globals in .luarc.json.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
local CLASSIC_API_WEBSITE = "https://github.com/brues-code/ClassicAPI"
|
||||
local CLASSIC_API_LATEST_URL = CLASSIC_API_WEBSITE .. "/releases/latest"
|
||||
|
||||
local headline = "TwitchEmotes has been disabled."
|
||||
local detail = "The ClassicAPI DLL isn't loaded. Download the latest release from: "
|
||||
|
||||
local function ShowRequiredPopup()
|
||||
StaticPopupDialogs["TWITCH_CLASSICAPI_REQUIRED"] = {
|
||||
text = headline .. "\n\n" .. detail,
|
||||
button1 = OKAY,
|
||||
hasEditBox = 1,
|
||||
editBoxWidth = 280,
|
||||
timeout = 0,
|
||||
whileDead = 1,
|
||||
hideOnEscape = 1,
|
||||
preferredIndex = 3,
|
||||
OnShow = function()
|
||||
local editBox = getglobal(this:GetName().."EditBox")
|
||||
if editBox then
|
||||
editBox:SetText(CLASSIC_API_LATEST_URL)
|
||||
editBox:HighlightText()
|
||||
editBox:SetFocus()
|
||||
end
|
||||
end,
|
||||
}
|
||||
StaticPopup_Show("TWITCH_CLASSICAPI_REQUIRED")
|
||||
DEFAULT_CHAT_FRAME:AddMessage(
|
||||
headline .. " " .. detail .. CLASSIC_API_LATEST_URL,
|
||||
1, 0.3, 0.3
|
||||
)
|
||||
end
|
||||
|
||||
local loginFrame = CreateFrame("Frame")
|
||||
loginFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
loginFrame:SetScript("OnEvent", function()
|
||||
loginFrame:UnregisterEvent("PLAYER_ENTERING_WORLD")
|
||||
ShowRequiredPopup()
|
||||
end)
|
||||
Reference in New Issue
Block a user