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")
sectionHeader:SetPoint("TOPLEFT", parentFrame, "TOPLEFT", PADDING, yPos)
sectionHeader:SetText("Skill list")
sectionHeader:SetTextColor(1, 1, 1)
--sectionHeader:SetTextColor(1, 1, 1)
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 })
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 = {
{ name = "No item", modifier = 0 },
{ name = "Rare", modifier = 3 },
{ name = "Epic", modifier = 5 },
{ name = "No item", label = "No item", modifier = 0 },
{ name = "Rare", label = "Rare item", modifier = 3 },
{ 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 = {
{ name = "None", modifier = 0 },
{ name = "Partial", modifier = 1 },
{ name = "Full", modifier = 2 },
{ name = "None", label = "No armor", modifier = 0 },
{ name = "Partial", label = "Extra armor", modifier = 1 },
{ name = "Full", label = "Extra armor", modifier = 2 },
}
-- 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 })
end
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
if petMod ~= 0 then
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 })
end
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
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
if shieldMod ~= 0 then
table.insert(modifiers, { name = "Shield", value = shieldMod })

128
UI.lua
View file

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