6.1 KiB
Executable file
6.1 KiB
Executable file
Feature: Major Redesign
This redesign of the Addon's window will start by following the following design
- The window will be a tabbed window
- The 'Use Skills' tab will correspond to the current roll screen
- The 'Build Skills' tab will be a new screen, to be implemented later. For now, leave it empty.
- The 'Log' should record all rolls made by the user, and be displayed in a scrollable list.
- They should be displayed in the same style as the announced rolls, even when the announce option is off
- The log should store a maximum of 100 rolls
Implementation plan
1. Restructure the main window layout (UI.lua)
- Increase
WINDOW_WIDTHto roughly double (≈660) to accommodate the two-column layout (left panel for tabs, right panel for the log) - Replace
BasicFrameTemplateWithInsetor layer a new structure inside it:- Left column (~50% width): contains two tabs ("Use Skills", "Build Skills") and their content panels
- Right column (~50% width): contains the "Log" header and a scrollable log list
- Keep the title bar ("AltSystem") and close button at the top spanning the full width
2. Implement the tab system (UI.lua)
- Create two tab buttons ("Use Skills" and "Build Skills") anchored at the top of the left column
- Use
PanelTemplates_SetNumTabs/PanelTemplates_SetTabor manual highlight toggling to switch active tab styling - "Use Skills" tab content: migrate all existing UI elements (Roll Type radios → Skill dropdown → Armor radios → Modifiers checkboxes → Announce dropdown → Roll button) into this tab's content frame
- Adapt the current layout from
CreateMainFrame— re-parent all widgets to the tab content frame instead offdirectly
- Adapt the current layout from
- "Build Skills" tab content: create an empty placeholder frame (can show a "Coming soon" label)
- Toggling tabs shows/hides the corresponding content frame
3. Redesign the "Use Skills" tab to match the mockup (UI.lua)
- Replace the current separate Attack/Defense buttons with a Roll Type radio-button group ("Attack Roll" / "Defense Roll") that sets
AltSystem.State.rollType - Keep the Skill dropdown as-is (already matches the mockup)
- Replace the current Defense dropdown with an Armor radio-button group ("No Armor" / "Basic Armor (+1)" / "Heavy Armor (+2)")
- Map these to the existing
AltSystem.Data.Defensesentries; show armor options only when Defense Roll is selected, or always visible per mockup
- Map these to the existing
- Group Shield and Pet checkboxes under a "Modifiers (optional)" section header with a "Label" sub-header matching the mockup
- Replace the Announce checkbox + channel dropdown with a single "Announce Roll" dropdown whose options are "Self Roll" (no announce) plus the existing channel list (Emote, Party, Raid, Guild)
- "Self Roll" maps to
announceEnabled = false; any other selection maps toannounceEnabled = truewith the corresponding channel index
- "Self Roll" maps to
- Add a single "Roll $rollType" button at the bottom (text dynamically reflects "Roll Attack" or "Roll Defense")
- Remove the old roll-result text area from this tab (results now go to the Log panel)
4. Build the Log panel (UI.lua)
- Create a right-side panel with a "Log" header label
- Inside, create a
ScrollFrame(usingUIPanelScrollFrameTemplateor a manual scroll child) to hold log entries - Each log entry is a small frame/fontstring displaying the roll result in the same format as the announced message:
"[Name] rolled [d20 result] [modifiers] = [total]"(reuseBuildModifierStringfrom Roll.lua)- Critical rolls show "rolled a Critical Failure!" or "rolled a Critical Success!"
- Entries are listed newest-first (most recent at top) in a vertically stacked layout
5. Implement the roll log data store (Core.lua / Roll.lua)
- Add
AltSystem.State.rollLog = {}— an array of log entry tables, each containing:{ text = "...", timestamp = time() } - In
Roll.lua, after every roll result is calculated (inCalculateAndDisplayResult), build the log message string (same format as announce) and insert it intoAltSystem.State.rollLog - Cap the log at 100 entries: if
#rollLog > 100, remove the oldest entry (table.remove(rollLog, 1)) - After inserting, call a UI refresh function to update the scroll frame content
- The log is always populated, regardless of the announce setting (per the requirement: "displayed in the same style as the announced rolls, even when the announce option is off")
- Log does not need to persist across sessions (not mentioned in requirements); keep it in memory only
6. Wire up the new Roll button (Roll.lua)
- The single "Roll $rollType" button calls
AltSystem:PerformRoll(state.rollType)wherestate.rollTypeis set by the radio-button group ("attack" or "defense") - Existing
PerformRollandCalculateAndDisplayResultlogic remains largely unchanged; only the final display step changes from settingResultTextto appending to the log + refreshing the log UI
7. Update state persistence (Core.lua)
- Save/restore
rollTypeselection (attack/defense) inAltSystemDB - Update announce state handling to work with the new single-dropdown approach (save selected option index)
- Armor selection (radio group) replaces
selectedDefenseIndex— reuse same key or migrate
8. Update the .toc file if needed (AltSystem.toc)
- No new Lua files are expected (all changes fit in existing files), but verify the load order is still correct
9. Testing checklist
- Window opens at new size, tabs switch correctly
- "Use Skills" tab shows all controls matching the mockup layout
- "Build Skills" tab is empty / shows placeholder
- Attack and Defense rolls work correctly via the new single Roll button
- Log panel populates with each roll, formatted like announce messages
- Log scrolls when entries exceed visible area
- Log caps at 100 entries, oldest removed first
- Log populates even when announce is set to "Self Roll" (off)
- Announce still works when a channel is selected
- State (roll type, armor, announce option) persists across sessions
- Window is draggable and clamps to screen