TRP integration
This commit is contained in:
parent
150e52842e
commit
ce1c6768e1
1 changed files with 28 additions and 42 deletions
70
Core.lua
70
Core.lua
|
|
@ -12,14 +12,11 @@ AltSystem.State = {
|
||||||
-- Initialization on ADDON_LOADED
|
-- Initialization on ADDON_LOADED
|
||||||
local frame = CreateFrame("Frame")
|
local frame = CreateFrame("Frame")
|
||||||
frame:RegisterEvent("ADDON_LOADED")
|
frame:RegisterEvent("ADDON_LOADED")
|
||||||
frame:RegisterEvent("PLAYER_LOGIN")
|
|
||||||
|
|
||||||
frame:SetScript("OnEvent", function(self, event, arg1)
|
frame:SetScript("OnEvent", function(self, event, arg1)
|
||||||
if event == "ADDON_LOADED" and arg1 == "AltSystem" then
|
if event == "ADDON_LOADED" and arg1 == "AltSystem" then
|
||||||
AltSystem:Init()
|
AltSystem:Init()
|
||||||
elseif event == "PLAYER_LOGIN" then
|
AltSystem:RegisterTRP3Module()
|
||||||
AltSystem:RegisterTRP3Button()
|
|
||||||
AltSystem:RegisterMinimapButton()
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
@ -43,55 +40,44 @@ function AltSystem:ToggleWindow()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TRP3 toolbar button registration
|
-- Register as a TRP3 module so our onStart runs in the correct lifecycle phase
|
||||||
|
-- (after the toolbar module is initialized, but before WORKFLOW_ON_FINISH locks it)
|
||||||
|
function AltSystem:RegisterTRP3Module()
|
||||||
|
if not TRP3_API or not TRP3_API.module then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local MODULE_STRUCTURE = {
|
||||||
|
["name"] = "AltSystem",
|
||||||
|
["description"] = "AltSystem rolling window toolbar button",
|
||||||
|
["version"] = 1.000,
|
||||||
|
["id"] = "altsystem_module",
|
||||||
|
["onStart"] = function()
|
||||||
|
AltSystem:RegisterTRP3Button()
|
||||||
|
end,
|
||||||
|
["minVersion"] = 3,
|
||||||
|
["requiredDeps"] = {
|
||||||
|
{"trp3_tool_bar", 1},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
TRP3_API.module.registerModule(MODULE_STRUCTURE)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- TRP3 toolbar button registration (called from the TRP3 module onStart)
|
||||||
function AltSystem:RegisterTRP3Button()
|
function AltSystem:RegisterTRP3Button()
|
||||||
if TRP3_API and TRP3_API.toolbar then
|
if TRP3_API and TRP3_API.toolbar then
|
||||||
local toolbarButton = {
|
local toolbarButton = {
|
||||||
id = "altsystem_toolbar_btn",
|
id = "altsystem_toolbar_btn",
|
||||||
icon = "Interface\\Icons\\INV_Misc_Dice_02",
|
icon = "Interface\\Icons\\INV_Misc_Dice_01",
|
||||||
tooltip = "AltSystem",
|
tooltip = "AltSystem",
|
||||||
tooltipSub = "Open the AltSystem rolling window",
|
tooltipSub = "Open the AltSystem rolling window",
|
||||||
onClick = function()
|
onClick = function()
|
||||||
AltSystem:ToggleWindow()
|
AltSystem:ToggleWindow()
|
||||||
end,
|
end,
|
||||||
|
visible = 1,
|
||||||
}
|
}
|
||||||
TRP3_API.toolbar.toolbarAddButton(toolbarButton)
|
TRP3_API.toolbar.toolbarAddButton(toolbarButton)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Minimap button using LibDBIcon (lightweight fallback if not available)
|
|
||||||
function AltSystem:RegisterMinimapButton()
|
|
||||||
-- Simple minimap button without external libraries
|
|
||||||
local minimapButton = CreateFrame("Button", "AltSystemMinimapButton", Minimap)
|
|
||||||
minimapButton:SetSize(32, 32)
|
|
||||||
minimapButton:SetFrameStrata("MEDIUM")
|
|
||||||
minimapButton:SetFrameLevel(8)
|
|
||||||
minimapButton:SetPoint("TOPLEFT", Minimap, "TOPLEFT", 2, -2)
|
|
||||||
|
|
||||||
local icon = minimapButton:CreateTexture(nil, "ARTWORK")
|
|
||||||
icon:SetTexture("Interface\\Icons\\INV_Misc_Dice_02")
|
|
||||||
icon:SetSize(20, 20)
|
|
||||||
icon:SetPoint("CENTER")
|
|
||||||
|
|
||||||
local border = minimapButton:CreateTexture(nil, "OVERLAY")
|
|
||||||
border:SetTexture("Interface\\Minimap\\MiniMap-TrackingBorder")
|
|
||||||
border:SetSize(54, 54)
|
|
||||||
border:SetPoint("TOPLEFT", -2, 2)
|
|
||||||
|
|
||||||
minimapButton:SetHighlightTexture("Interface\\Minimap\\UI-Minimap-ZoomButton-Highlight")
|
|
||||||
|
|
||||||
minimapButton:SetScript("OnClick", function()
|
|
||||||
AltSystem:ToggleWindow()
|
|
||||||
end)
|
|
||||||
|
|
||||||
minimapButton:SetScript("OnEnter", function(self)
|
|
||||||
GameTooltip:SetOwner(self, "ANCHOR_LEFT")
|
|
||||||
GameTooltip:AddLine("AltSystem")
|
|
||||||
GameTooltip:AddLine("Click to toggle the rolling window", 1, 1, 1)
|
|
||||||
GameTooltip:Show()
|
|
||||||
end)
|
|
||||||
|
|
||||||
minimapButton:SetScript("OnLeave", function()
|
|
||||||
GameTooltip:Hide()
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue