First working version
This commit is contained in:
commit
150e52842e
12 changed files with 515 additions and 0 deletions
97
Core.lua
Normal file
97
Core.lua
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
-- AltSystem Core
|
||||
-- Addon initialization, slash command registration, and TRP3 integration.
|
||||
|
||||
AltSystem = AltSystem or {}
|
||||
AltSystem.State = {
|
||||
selectedSkillIndex = 1,
|
||||
selectedItemIndex = 1, -- 1 = No item
|
||||
selectedDefenseIndex = 1, -- 1 = Base armor
|
||||
shieldEnabled = false,
|
||||
}
|
||||
|
||||
-- Initialization on ADDON_LOADED
|
||||
local frame = CreateFrame("Frame")
|
||||
frame:RegisterEvent("ADDON_LOADED")
|
||||
frame:RegisterEvent("PLAYER_LOGIN")
|
||||
|
||||
frame:SetScript("OnEvent", function(self, event, arg1)
|
||||
if event == "ADDON_LOADED" and arg1 == "AltSystem" then
|
||||
AltSystem:Init()
|
||||
elseif event == "PLAYER_LOGIN" then
|
||||
AltSystem:RegisterTRP3Button()
|
||||
AltSystem:RegisterMinimapButton()
|
||||
end
|
||||
end)
|
||||
|
||||
function AltSystem:Init()
|
||||
-- Register slash command /altsystem
|
||||
SLASH_ALTSYSTEM1 = "/altsystem"
|
||||
SlashCmdList["ALTSYSTEM"] = function()
|
||||
AltSystem:ToggleWindow()
|
||||
end
|
||||
|
||||
print("|cff00ccffAltSystem|r loaded. Type /altsystem to open.")
|
||||
end
|
||||
|
||||
function AltSystem:ToggleWindow()
|
||||
if AltSystem.MainFrame then
|
||||
if AltSystem.MainFrame:IsShown() then
|
||||
AltSystem.MainFrame:Hide()
|
||||
else
|
||||
AltSystem.MainFrame:Show()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- TRP3 toolbar button registration
|
||||
function AltSystem:RegisterTRP3Button()
|
||||
if TRP3_API and TRP3_API.toolbar then
|
||||
local toolbarButton = {
|
||||
id = "altsystem_toolbar_btn",
|
||||
icon = "Interface\\Icons\\INV_Misc_Dice_02",
|
||||
tooltip = "AltSystem",
|
||||
tooltipSub = "Open the AltSystem rolling window",
|
||||
onClick = function()
|
||||
AltSystem:ToggleWindow()
|
||||
end,
|
||||
}
|
||||
TRP3_API.toolbar.toolbarAddButton(toolbarButton)
|
||||
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