Chat announce rolls

This commit is contained in:
Gonçalo Correia 2026-04-12 20:48:49 +01:00
parent e17370a89f
commit 907e0464ed
5 changed files with 154 additions and 2 deletions

48
UI.lua
View file

@ -5,7 +5,7 @@
AltSystem = AltSystem or {}
local WINDOW_WIDTH = 300
local WINDOW_HEIGHT = 380
local WINDOW_HEIGHT = 440
local PADDING = 12
local ROW_HEIGHT = 30
local LABEL_WIDTH = 80
@ -154,6 +154,52 @@ function AltSystem:CreateMainFrame()
AltSystem.State.shieldEnabled = self:GetChecked()
end)
yPos = yPos - ROW_HEIGHT - 8
-------------------------
-- Announce checkbox + channel dropdown
-------------------------
local announceLabel = f:CreateFontString(nil, "OVERLAY", "GameFontNormal")
announceLabel:SetPoint("TOPLEFT", f, "TOPLEFT", PADDING, yPos)
announceLabel:SetText("Announce:")
announceLabel:SetWidth(LABEL_WIDTH)
announceLabel:SetJustifyH("LEFT")
local announceCheck = CreateFrame("CheckButton", "AltSystemAnnounceCheck", f, "UICheckButtonTemplate")
announceCheck:SetPoint("LEFT", announceLabel, "RIGHT", -6, 0)
announceCheck:SetChecked(AltSystem.State.announceEnabled)
-- Channel dropdown (shown only when announce is enabled)
local channelOptions = {}
for _, ch in ipairs(AltSystem.AnnounceChannels) do
table.insert(channelOptions, { text = ch.name })
end
local channelDropdown, getChannelIndex, setChannelIndex = CreateDropdown(
f, "AltSystemChannelDropdown", yPos, "", channelOptions,
AltSystem.State.announceChannelIndex,
function(index)
AltSystem.State.announceChannelIndex = index
end)
channelDropdown:SetPoint("LEFT", announceCheck, "RIGHT", 2, 0)
channelDropdown:SetWidth(130)
-- Show/hide channel dropdown based on checkbox state
local function UpdateChannelDropdownVisibility()
if AltSystem.State.announceEnabled then
channelDropdown:Show()
else
channelDropdown:Hide()
end
end
announceCheck:SetScript("OnClick", function(self)
AltSystem.State.announceEnabled = self:GetChecked()
UpdateChannelDropdownVisibility()
end)
UpdateChannelDropdownVisibility()
yPos = yPos - ROW_HEIGHT - 12
-------------------------