Compare commits

..

5 commits

Author SHA1 Message Date
810fa10009 Fixing roll labels for items/armor 2026-05-15 14:51:23 +01:00
825128084d Tab styling 2026-05-15 14:46:30 +01:00
57e69568aa Label styling 2026-05-15 14:32:55 +01:00
15da0fedf2 Label styling 2026-05-15 14:30:50 +01:00
78ce755f71 Button styling 2026-05-15 13:51:22 +01:00
5 changed files with 91 additions and 61 deletions

View file

@ -340,7 +340,7 @@ function AltSystem:CreateBuildSkillsContent(parentFrame)
local sectionHeader = parentFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge") local sectionHeader = parentFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
sectionHeader:SetPoint("TOPLEFT", parentFrame, "TOPLEFT", PADDING, yPos) sectionHeader:SetPoint("TOPLEFT", parentFrame, "TOPLEFT", PADDING, yPos)
sectionHeader:SetText("Skill list") sectionHeader:SetText("Skill list")
sectionHeader:SetTextColor(1, 1, 1) --sectionHeader:SetTextColor(1, 1, 1)
yPos = yPos - 24 yPos = yPos - 24

View file

@ -249,18 +249,18 @@ for _, skill in ipairs(DEFAULT_SKILLS) do
table.insert(AltSystem.Data.Skills, { name = skill.name, level = skill.level, modifier = skill.modifier }) table.insert(AltSystem.Data.Skills, { name = skill.name, level = skill.level, modifier = skill.modifier })
end end
-- Item options: name and modifier (first entry = no item) -- Item options: name, label (used in roll messages), and modifier (first entry = no item)
AltSystem.Data.Items = { AltSystem.Data.Items = {
{ name = "No item", modifier = 0 }, { name = "No item", label = "No item", modifier = 0 },
{ name = "Rare", modifier = 3 }, { name = "Rare", label = "Rare item", modifier = 3 },
{ name = "Epic", modifier = 5 }, { name = "Epic", label = "Epic item", modifier = 5 },
} }
-- Defense / Armor options: name and modifier -- Defense / Armor options: name, label (used in roll messages), and modifier
AltSystem.Data.Defenses = { AltSystem.Data.Defenses = {
{ name = "None", modifier = 0 }, { name = "None", label = "No armor", modifier = 0 },
{ name = "Partial", modifier = 1 }, { name = "Partial", label = "Extra armor", modifier = 1 },
{ name = "Full", modifier = 2 }, { name = "Full", label = "Extra armor", modifier = 2 },
} }
-- Shield modifier -- Shield modifier

View file

@ -198,7 +198,7 @@ function AltSystem:CalculateAndDisplayResult(rollType, rollValue, petRollValue)
table.insert(modifiers, { name = skill and skill.name or "Skill", value = skillMod }) table.insert(modifiers, { name = skill and skill.name or "Skill", value = skillMod })
end end
if itemMod ~= 0 then if itemMod ~= 0 then
table.insert(modifiers, { name = item and item.name or "Item", value = itemMod }) table.insert(modifiers, { name = item and (item.label or item.name) or "Item", value = itemMod })
end end
if petMod ~= 0 then if petMod ~= 0 then
table.insert(modifiers, { name = "Pet", value = petMod }) table.insert(modifiers, { name = "Pet", value = petMod })
@ -216,10 +216,10 @@ function AltSystem:CalculateAndDisplayResult(rollType, rollValue, petRollValue)
table.insert(modifiers, { name = skill and skill.name or "Skill", value = skillMod }) table.insert(modifiers, { name = skill and skill.name or "Skill", value = skillMod })
end end
if itemMod ~= 0 then if itemMod ~= 0 then
table.insert(modifiers, { name = item and item.name or "Item", value = itemMod }) table.insert(modifiers, { name = item and (item.label or item.name) or "Item", value = itemMod })
end end
if defenseMod ~= 0 then if defenseMod ~= 0 then
table.insert(modifiers, { name = defense and defense.name or "Armor", value = defenseMod }) table.insert(modifiers, { name = defense and (defense.label or defense.name) or "Armor", value = defenseMod })
end end
if shieldMod ~= 0 then if shieldMod ~= 0 then
table.insert(modifiers, { name = "Shield", value = shieldMod }) table.insert(modifiers, { name = "Shield", value = shieldMod })

128
UI.lua
View file

@ -5,13 +5,17 @@
AltSystem = AltSystem or {} AltSystem = AltSystem or {}
local WINDOW_WIDTH = 700 local WINDOW_WIDTH = 720
local WINDOW_HEIGHT = 500 local WINDOW_HEIGHT = 520
local CONTROLS_WIDTH = 350 local CONTROLS_WIDTH = 360
local LOG_WIDTH = 350 local LOG_WIDTH = 360
local PADDING = 12 local PADDING = 12
local PADDING_HEADER = 6
local ROW_HEIGHT = 26 local ROW_HEIGHT = 26
local SECTION_GAP = 10 local LABEL_HEIGHT = 14 -- approximate height of GameFontNormal text
local LABEL_GAP = 4 -- gap between a sub-label and its input
local ITEM_GAP = 10 -- gap between inputs within the same section
local SECTION_GAP = 22 -- gap between major sections
-- Helper: Build the skill option list from current AltSystem.Data.Skills -- Helper: Build the skill option list from current AltSystem.Data.Skills
local function BuildSkillOptions() local function BuildSkillOptions()
@ -29,26 +33,32 @@ local function BuildSkillOptions()
return options return options
end end
-- Helper: Create a flat dark dropdown with optional label (reuses shared CreateFlatDropdown) -- Helper: Create a flat dark dropdown with label on top (reuses shared CreateFlatDropdown)
local function CreateDropdown(parent, name, labelText, options, defaultIndex, onSelect, labelFont) local function CreateDropdown(parent, name, labelText, options, defaultIndex, onSelect, labelFont)
local hasLabel = labelText and labelText ~= ""
local containerHeight = hasLabel and (LABEL_HEIGHT + LABEL_GAP + 28) or ROW_HEIGHT
local container = CreateFrame("Frame", nil, parent) local container = CreateFrame("Frame", nil, parent)
container:SetHeight(ROW_HEIGHT) container:SetHeight(containerHeight)
local label local label
if labelText and labelText ~= "" then if hasLabel then
label = container:CreateFontString(nil, "OVERLAY", labelFont or "GameFontNormal") label = container:CreateFontString(nil, "OVERLAY", labelFont or "GameFontNormal")
label:SetPoint("LEFT", container, "LEFT", 0, 0) label:SetPoint("TOPLEFT", container, "TOPLEFT", 0, 0)
label:SetText(labelText) label:SetText(labelText)
label:SetJustifyH("LEFT") label:SetJustifyH("LEFT")
label:SetTextColor(0.9, 0.75, 0.2)
end end
local selectedIndex = defaultIndex or 1 local selectedIndex = defaultIndex or 1
local dropdown = AltSystem.CreateFlatDropdown(name, container, 190) local dropdown = AltSystem.CreateFlatDropdown(name, container, 190)
if label then if hasLabel then
dropdown:SetPoint("RIGHT", container, "RIGHT", 0, 0) dropdown:SetPoint("TOPLEFT", container, "TOPLEFT", 0, -(LABEL_HEIGHT + LABEL_GAP))
dropdown:SetPoint("TOPRIGHT", container, "TOPRIGHT", 0, -(LABEL_HEIGHT + LABEL_GAP))
else else
dropdown:SetPoint("LEFT", container, "LEFT", 0, 0) dropdown:SetPoint("LEFT", container, "LEFT", 0, 0)
dropdown:SetPoint("RIGHT", container, "RIGHT", 0, 0)
end end
-- Set initial label text -- Set initial label text
@ -91,22 +101,35 @@ local function CreateRadioButton(parent, name, text, x, y, isChecked, onClick)
btn:SetSize(size, size) btn:SetSize(size, size)
btn:SetPoint("TOPLEFT", parent, "TOPLEFT", x, y) btn:SetPoint("TOPLEFT", parent, "TOPLEFT", x, y)
-- Background (grey when unselected, yellow when selected) — circular via mask -- Outer grey circle (always visible, acts as border)
local bg = btn:CreateTexture(nil, "BACKGROUND") local border = btn:CreateTexture(nil, "BACKGROUND")
bg:SetAllPoints() border:SetAllPoints()
bg:SetColorTexture(0.3, 0.3, 0.3, 1) border:SetColorTexture(0.3, 0.3, 0.3, 1)
local mask = btn:CreateMaskTexture() local borderMask = btn:CreateMaskTexture()
mask:SetAllPoints() borderMask:SetAllPoints()
mask:SetTexture("Interface\\CharacterFrame\\TempPortraitAlphaMask", "CLAMPTOBLACKADDITIVE", "CLAMPTOBLACKADDITIVE") borderMask:SetTexture("Interface\\CharacterFrame\\TempPortraitAlphaMask", "CLAMPTOBLACKADDITIVE", "CLAMPTOBLACKADDITIVE")
bg:AddMaskTexture(mask) border:AddMaskTexture(borderMask)
-- Inner yellow circle (shown when selected, slightly smaller to reveal grey border)
local inner = btn:CreateTexture(nil, "BORDER")
local inset = 3
inner:SetPoint("TOPLEFT", btn, "TOPLEFT", inset, -inset)
inner:SetPoint("BOTTOMRIGHT", btn, "BOTTOMRIGHT", -inset, inset)
inner:SetColorTexture(0.9, 0.75, 0.2, 1)
local innerMask = btn:CreateMaskTexture()
innerMask:SetPoint("TOPLEFT", btn, "TOPLEFT", inset, -inset)
innerMask:SetPoint("BOTTOMRIGHT", btn, "BOTTOMRIGHT", -inset, inset)
innerMask:SetTexture("Interface\\CharacterFrame\\TempPortraitAlphaMask", "CLAMPTOBLACKADDITIVE", "CLAMPTOBLACKADDITIVE")
inner:AddMaskTexture(innerMask)
inner:Hide()
btn.checkTex = nil -- unused, kept for compatibility btn.checkTex = nil -- unused, kept for compatibility
local function UpdateVisual() local function UpdateVisual()
if btn:GetChecked() then if btn:GetChecked() then
bg:SetColorTexture(0.9, 0.75, 0.2, 1) inner:Show()
else else
bg:SetColorTexture(0.3, 0.3, 0.3, 1) inner:Hide()
end end
end end
@ -169,32 +192,38 @@ function AltSystem:CreateMainFrame()
-- TAB BUTTONS (span full window width) -- TAB BUTTONS (span full window width)
--------------------- ---------------------
local contentTop = -24 local contentTop = -24
local tabHeight = 28 local tabHeight = 36
local contentWidth = WINDOW_WIDTH - 8 -- 4px inset on each side local contentWidth = WINDOW_WIDTH - 8 -- 4px inset on each side
local tabWidth = contentWidth / 2 local tabWidth = contentWidth / 2
local tabUseSkills = CreateFrame("Button", "AltSystemTabUseSkills", f) local tabUseSkills = CreateFrame("Button", "AltSystemTabUseSkills", f)
tabUseSkills:SetSize(tabWidth, tabHeight) tabUseSkills:SetSize(tabWidth, tabHeight)
tabUseSkills:SetPoint("TOPLEFT", f, "TOPLEFT", 4, contentTop) tabUseSkills:SetPoint("TOPLEFT", f, "TOPLEFT", 4, contentTop)
tabUseSkills:SetNormalFontObject("GameFontHighlight") tabUseSkills:SetNormalFontObject("GameFontNormalLarge")
tabUseSkills:SetHighlightFontObject("GameFontHighlight") tabUseSkills:SetHighlightFontObject("GameFontNormalLarge")
tabUseSkills:SetText("Use Skills") tabUseSkills:SetText("Use Skills")
local tabUseSkillsBg = tabUseSkills:CreateTexture(nil, "BACKGROUND") local tabUseSkillsBg = tabUseSkills:CreateTexture(nil, "BACKGROUND")
tabUseSkillsBg:SetAllPoints() tabUseSkillsBg:SetAllPoints()
tabUseSkillsBg:SetColorTexture(0.15, 0.15, 0.15, 1) tabUseSkillsBg:SetColorTexture(0, 0, 0, 0)
local tabUseSkillsText = tabUseSkills:GetFontString()
tabUseSkillsText:SetTextColor(0.9, 0.75, 0.2, 1)
local tabBuildSkills = CreateFrame("Button", "AltSystemTabBuildSkills", f) local tabBuildSkills = CreateFrame("Button", "AltSystemTabBuildSkills", f)
tabBuildSkills:SetSize(tabWidth, tabHeight) tabBuildSkills:SetSize(tabWidth, tabHeight)
tabBuildSkills:SetPoint("TOPLEFT", tabUseSkills, "TOPRIGHT", 0, 0) tabBuildSkills:SetPoint("TOPLEFT", tabUseSkills, "TOPRIGHT", 0, 0)
tabBuildSkills:SetNormalFontObject("GameFontHighlight") tabBuildSkills:SetNormalFontObject("GameFontNormalLarge")
tabBuildSkills:SetHighlightFontObject("GameFontHighlight") tabBuildSkills:SetHighlightFontObject("GameFontNormalLarge")
tabBuildSkills:SetText("Build Skills") tabBuildSkills:SetText("Build Skills")
local tabBuildSkillsBg = tabBuildSkills:CreateTexture(nil, "BACKGROUND") local tabBuildSkillsBg = tabBuildSkills:CreateTexture(nil, "BACKGROUND")
tabBuildSkillsBg:SetAllPoints() tabBuildSkillsBg:SetAllPoints()
tabBuildSkillsBg:SetColorTexture(0.3, 0.3, 0.3, 1) tabBuildSkillsBg:SetColorTexture(0.3, 0.3, 0.3, 1)
local tabBuildSkillsText = tabBuildSkills:GetFontString()
tabBuildSkillsText:SetTextColor(1, 1, 1, 1)
--------------------- ---------------------
-- TAB CONTENT FRAMES -- TAB CONTENT FRAMES
--------------------- ---------------------
@ -218,13 +247,17 @@ function AltSystem:CreateMainFrame()
if tabIndex == 1 then if tabIndex == 1 then
useSkillsContent:Show() useSkillsContent:Show()
buildSkillsContent:Hide() buildSkillsContent:Hide()
tabUseSkillsBg:SetColorTexture(0.15, 0.15, 0.15, 1) tabUseSkillsBg:SetColorTexture(0, 0, 0, 0)
tabBuildSkillsBg:SetColorTexture(0.3, 0.3, 0.3, 1) tabBuildSkillsBg:SetColorTexture(0.3, 0.3, 0.3, 1)
tabUseSkillsText:SetTextColor(0.9, 0.75, 0.2, 1)
tabBuildSkillsText:SetTextColor(1, 1, 1, 1)
else else
useSkillsContent:Hide() useSkillsContent:Hide()
buildSkillsContent:Show() buildSkillsContent:Show()
tabUseSkillsBg:SetColorTexture(0.3, 0.3, 0.3, 1) tabUseSkillsBg:SetColorTexture(0.3, 0.3, 0.3, 1)
tabBuildSkillsBg:SetColorTexture(0.15, 0.15, 0.15, 1) tabBuildSkillsBg:SetColorTexture(0, 0, 0, 0)
tabUseSkillsText:SetTextColor(1, 1, 1, 1)
tabBuildSkillsText:SetTextColor(0.9, 0.75, 0.2, 1)
AltSystem:RefreshBuildSkillsList() AltSystem:RefreshBuildSkillsList()
end end
end end
@ -247,12 +280,12 @@ function AltSystem:CreateMainFrame()
local yPos = -PADDING local yPos = -PADDING
-- Section: Define Your Base Roll -- Section: Define Your Base Roll
CreateSectionHeader(content, "Define Your Base Roll", PADDING, yPos) CreateSectionHeader(content, "Base Roll", PADDING_HEADER, yPos)
yPos = yPos - 20 yPos = yPos - 26
-- Roll Type label -- Roll Type label
CreateSubLabel(content, "Roll Type", PADDING, yPos) CreateSubLabel(content, "Roll Type", PADDING, yPos)
yPos = yPos - 20 yPos = yPos - (LABEL_HEIGHT + LABEL_GAP)
-- Roll Type radio buttons -- Roll Type radio buttons
local attackRadio, defenseRadio local attackRadio, defenseRadio
@ -282,7 +315,7 @@ function AltSystem:CreateMainFrame()
UpdateRollTypeSelection("defense") UpdateRollTypeSelection("defense")
end) end)
yPos = yPos - ROW_HEIGHT - SECTION_GAP yPos = yPos - ROW_HEIGHT - ITEM_GAP
-- Skill dropdown -- Skill dropdown
local skillOptions = BuildSkillOptions() local skillOptions = BuildSkillOptions()
@ -338,11 +371,11 @@ function AltSystem:CreateMainFrame()
AltSystem.SetSkillIndex = setSkillIndex AltSystem.SetSkillIndex = setSkillIndex
AltSystem.UpdateSkillWarning = UpdateSkillWarning AltSystem.UpdateSkillWarning = UpdateSkillWarning
yPos = yPos - ROW_HEIGHT - SECTION_GAP yPos = yPos - (LABEL_HEIGHT + LABEL_GAP + 28) - ITEM_GAP
-- Armor label -- Armor label
CreateSubLabel(content, "Extra Armor", PADDING, yPos) CreateSubLabel(content, "Extra Armor", PADDING, yPos)
yPos = yPos - 20 yPos = yPos - (LABEL_HEIGHT + LABEL_GAP)
-- Armor radio buttons -- Armor radio buttons
local armorRadios = {} local armorRadios = {}
@ -373,8 +406,8 @@ function AltSystem:CreateMainFrame()
yPos = yPos - ROW_HEIGHT - SECTION_GAP yPos = yPos - ROW_HEIGHT - SECTION_GAP
-- Section: Modifiers (optional) -- Section: Modifiers (optional)
CreateSectionHeader(content, "Modifiers (optional)", PADDING, yPos) CreateSectionHeader(content, "Modifiers (optional)", PADDING_HEADER, yPos)
yPos = yPos - 28 yPos = yPos - 26
--CreateSubLabel(content, "Label", PADDING, yPos) --CreateSubLabel(content, "Label", PADDING, yPos)
--yPos = yPos - 22 --yPos = yPos - 22
@ -450,11 +483,11 @@ function AltSystem:CreateMainFrame()
UpdatePetVisual() UpdatePetVisual()
end) end)
yPos = yPos - ROW_HEIGHT - SECTION_GAP yPos = yPos - ROW_HEIGHT - ITEM_GAP
-- Item label -- Item label
CreateSubLabel(content, "Item", PADDING, yPos) CreateSubLabel(content, "Item", PADDING, yPos)
yPos = yPos - 20 yPos = yPos - (LABEL_HEIGHT + LABEL_GAP)
-- Item radio buttons -- Item radio buttons
local itemRadios = {} local itemRadios = {}
@ -485,8 +518,8 @@ function AltSystem:CreateMainFrame()
yPos = yPos - ROW_HEIGHT - SECTION_GAP yPos = yPos - ROW_HEIGHT - SECTION_GAP
-- Section: Roll Dice -- Section: Roll Dice
CreateSectionHeader(content, "Roll Dice", PADDING, yPos) CreateSectionHeader(content, "Roll Mode", PADDING_HEADER, yPos)
yPos = yPos - 22 yPos = yPos - 26
-- Announce Roll dropdown (Self Roll + channels) -- Announce Roll dropdown (Self Roll + channels)
local announceOptions = { { text = "Self Roll" } } local announceOptions = { { text = "Self Roll" } }
@ -495,7 +528,7 @@ function AltSystem:CreateMainFrame()
end end
local announceContainer, announceDropdown = CreateDropdown( local announceContainer, announceDropdown = CreateDropdown(
content, "AltSystemAnnounceDropdown", "Announce Roll", announceOptions, content, "AltSystemAnnounceDropdown", "", announceOptions,
AltSystem.State.announceOptionIndex, AltSystem.State.announceOptionIndex,
function(index) function(index)
AltSystem.State.announceOptionIndex = index AltSystem.State.announceOptionIndex = index
@ -511,7 +544,7 @@ function AltSystem:CreateMainFrame()
announceContainer:SetPoint("TOPLEFT", content, "TOPLEFT", PADDING, yPos) announceContainer:SetPoint("TOPLEFT", content, "TOPLEFT", PADDING, yPos)
announceContainer:SetWidth(CONTROLS_WIDTH - PADDING * 2) announceContainer:SetWidth(CONTROLS_WIDTH - PADDING * 2)
yPos = yPos - ROW_HEIGHT - SECTION_GAP yPos = yPos - ROW_HEIGHT - ITEM_GAP
-- Roll button -- Roll button
local rollLabel = AltSystem.State.rollType == "attack" and "Roll Attack" or "Roll Defense" local rollLabel = AltSystem.State.rollType == "attack" and "Roll Attack" or "Roll Defense"
@ -532,15 +565,12 @@ function AltSystem:CreateMainFrame()
logPanel:SetSize(LOG_WIDTH, tabContentHeight) logPanel:SetSize(LOG_WIDTH, tabContentHeight)
-- Log header -- Log header
local logHeader = logPanel:CreateFontString(nil, "OVERLAY", "GameFontNormal") local logHeader = CreateSectionHeader(logPanel, "Log", 0, -PADDING)
logHeader:SetPoint("TOPLEFT", logPanel, "TOPLEFT", PADDING, -4)
logHeader:SetText("Log")
logHeader:SetTextColor(0.9, 0.75, 0.2)
-- Log scroll area background -- Log scroll area background
local logBg = CreateFrame("Frame", nil, logPanel, "InsetFrameTemplate") local logBg = CreateFrame("Frame", nil, logPanel, "InsetFrameTemplate")
logBg:SetPoint("TOPLEFT", logPanel, "TOPLEFT", 4, -22) logBg:SetPoint("TOPLEFT", logPanel, "TOPLEFT", 4, -38)
logBg:SetPoint("BOTTOMRIGHT", logPanel, "BOTTOMRIGHT", -4, 4) logBg:SetPoint("BOTTOMRIGHT", logPanel, "BOTTOMRIGHT", -PADDING, 4)
-- Scroll frame for log entries -- Scroll frame for log entries
local scrollFrame = CreateFrame("ScrollFrame", "AltSystemLogScrollFrame", logBg, "UIPanelScrollFrameTemplate") local scrollFrame = CreateFrame("ScrollFrame", "AltSystemLogScrollFrame", logBg, "UIPanelScrollFrameTemplate")

BIN
docs/roll_tab_design.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Before After
Before After