Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ The repository is structured as a multi-addon project separating core logic, con
| frameSpacing | number | 4 |
| frameMinHeight | number | 68 |
| compactTextLayout | boolean | false |
| reverseButtonOrder | boolean | false |
| iconPosition | string | "inside" |
| iconSide | string | "left" |
| iconOffsetX | number | 0 |
Expand All @@ -95,7 +96,7 @@ The repository is structured as a multi-addon project separating core logic, con
| timerBarStyle | string | "normal" |
| timerBarMinimalHeight | number | 3 |

`confirmGreedAndPass` asks for confirmation before Greed or Pass is submitted. `resultLingerDuration` applies only when `keepOpenAfterVote` is enabled. `showRollTally` is available only on Classic (TBC/MoP); Retail removed `C_LootHistory.GetItem` and `GetPlayerInfo` in patch 10.1.0.
`confirmGreedAndPass` asks for confirmation before Greed or Pass is submitted. `reverseButtonOrder` reverses the roll action button order. `resultLingerDuration` applies only when `keepOpenAfterVote` is enabled. `showRollTally` is available only on Classic (TBC/MoP); Retail removed `C_LootHistory.GetItem` and `GetPlayerInfo` in patch 10.1.0.

### History (`db.profile.history`)

Expand Down
3 changes: 2 additions & 1 deletion DragonLoot/Core/Config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ local defaults = {
frameSpacing = 4,
frameMinHeight = 68,
compactTextLayout = false,
reverseButtonOrder = false,
iconPosition = "inside",
iconSide = "left",
iconOffsetX = 0,
Expand Down Expand Up @@ -145,7 +146,7 @@ local defaults = {
-- Profile Migration
-------------------------------------------------------------------------------

local CURRENT_SCHEMA = 5
local CURRENT_SCHEMA = 6

local function DeepCopyValue(value)
if type(value) ~= "table" then
Expand Down
68 changes: 26 additions & 42 deletions DragonLoot/Display/RollFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -294,26 +294,28 @@ local function CalculateFrameHeight(iconSize, frame)
return math_max(GetFrameMinHeight(), effectiveIconSize + ROLL_FRAME_EXTRA_HEIGHT) + tallyHeight
end

local function GetRollActionButtons(frame)
local middleButton = frame.transmogButton:IsShown() and frame.transmogButton or frame.greedButton
local rollFrameDB = GetRollFrameDB()
if rollFrameDB and rollFrameDB.reverseButtonOrder then
return { frame.passButton, frame.disenchantButton, middleButton, frame.needButton }
end
return { frame.needButton, middleButton, frame.disenchantButton, frame.passButton }
end

local function ApplyTextLayoutOffsets(frame, compact, iconSize, padding, borderSize, rowSpacing)
local contentLeftInset = GetRollContentLeftInset(iconSize, padding, borderSize)
local leftmostButton = frame.rollActionButtons[1]
local rightmostButton = frame.rollActionButtons[#frame.rollActionButtons]
-- Item name top-left anchor (shared by both modes)
frame.itemName:ClearAllPoints()
frame.itemName:SetPoint("TOPLEFT", frame, "TOPLEFT", contentLeftInset, -(padding + borderSize))

if compact then
-- Compact: buttons sit on the same row as the item name
frame.passButton:ClearAllPoints()
frame.passButton:SetPoint(
"RIGHT",
frame,
"RIGHT",
-(GetRollContentRightInset(iconSize, padding, borderSize)),
0
)
frame.passButton:SetPoint("TOP", frame, "TOP", 0, -(padding + borderSize))

-- needButton is always the leftmost button (transmog occupies greed's slot to the right).
local leftmostButton = frame.needButton
rightmostButton:ClearAllPoints()
rightmostButton:SetPoint("RIGHT", frame, "RIGHT", -(GetRollContentRightInset(iconSize, padding, borderSize)), 0)
rightmostButton:SetPoint("TOP", frame, "TOP", 0, -(padding + borderSize))

if frame.bindText:IsShown() then
-- bindText sits to the left of the buttons
Expand All @@ -334,8 +336,8 @@ local function ApplyTextLayoutOffsets(frame, compact, iconSize, padding, borderS
frame.bindText:ClearAllPoints()
frame.bindText:SetPoint("TOPLEFT", frame.itemName, "BOTTOMLEFT", 0, -rowSpacing)

frame.passButton:ClearAllPoints()
frame.passButton:SetPoint("TOPRIGHT", frame.itemName, "BOTTOMRIGHT", 0, -rowSpacing)
rightmostButton:ClearAllPoints()
rightmostButton:SetPoint("TOPRIGHT", frame.itemName, "BOTTOMRIGHT", 0, -rowSpacing)
end
end

Expand Down Expand Up @@ -792,6 +794,8 @@ local function CreateRollFrame(index)
end
frame.transmogButton:Hide()

frame.rollActionButtons = GetRollActionButtons(frame)

frame.frameIndex = index
frame.tallyRowHeight = 0
return frame
Expand Down Expand Up @@ -901,37 +905,17 @@ local function BuildTestRollData(testEntry)
}
end

-------------------------------------------------------------------------------
-- Re-anchor the roll button chain based on current greed/transmog visibility.
-- When transmog is shown (greed's slot), the chain is:
-- need <- transmog <- disenchant <- pass
-- When greed is shown (normal), the chain is:
-- need <- greed <- disenchant <- pass
-------------------------------------------------------------------------------

local function RebuildButtonChain(frame)
local btnSpacing = GetButtonSpacing()
-- disenchant always anchors off pass
frame.disenchantButton:ClearAllPoints()
frame.disenchantButton:SetPoint("RIGHT", frame.passButton, "LEFT", -btnSpacing, 0)

-- greed/transmog share the slot between disenchant and need
-- transmogButton is always created in CreateRollFrame; nil guard is unnecessary.
-- IsShown() (not IsVisible()) is intentional: parent frame may be hidden,
-- but we need to know whether transmog was set for this roll's data.
if frame.transmogButton:IsShown() then
-- transmog occupies greed's slot
frame.transmogButton:ClearAllPoints()
frame.transmogButton:SetPoint("RIGHT", frame.disenchantButton, "LEFT", -btnSpacing, 0)
frame.needButton:ClearAllPoints()
frame.needButton:SetPoint("RIGHT", frame.transmogButton, "LEFT", -btnSpacing, 0)
else
-- greed in its normal slot
frame.greedButton:ClearAllPoints()
frame.greedButton:SetPoint("RIGHT", frame.disenchantButton, "LEFT", -btnSpacing, 0)
frame.needButton:ClearAllPoints()
frame.needButton:SetPoint("RIGHT", frame.greedButton, "LEFT", -btnSpacing, 0)
local buttons = GetRollActionButtons(frame)

for _, button in ipairs(buttons) do
button:ClearAllPoints()
end
for index = #buttons - 1, 1, -1 do
buttons[index]:SetPoint("RIGHT", buttons[index + 1], "LEFT", -btnSpacing, 0)
end
frame.rollActionButtons = buttons
end

-------------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions DragonLoot/Locales/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ L["Minimum Quality"] = true
L["Prevent the roll frame from being dragged"] = true
L["Replace the default Blizzard roll frame with DragonLoot's custom version"] = true
L["Result Delay"] = true
L["Reverse Button Order"] = true
L["Reverse the complete roll button order so Pass is on the left and Need is on the right"] = true
L["Roll Frame"] = true
L["Roll Notifications"] = true
L["Roll frame scale"] = true
Expand Down
14 changes: 14 additions & 0 deletions DragonLoot_Options/Tabs/LootRollTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,20 @@ local function CreateButtonsSection(parent, db, yOffset, layoutWidgets)
local content = section.content
local innerY = -LC.SECTION_PADDING_TOP

local reverseOrderToggle = W.CreateToggle(content, {
label = L["Reverse Button Order"],
tooltip = L["Reverse the complete roll button order so Pass is on the left and Need is on the right"],
get = function()
return db.profile.rollFrame.reverseButtonOrder
end,
set = function(value)
db.profile.rollFrame.reverseButtonOrder = value
NotifyRollManager()
end,
})
layoutWidgets[#layoutWidgets + 1] = reverseOrderToggle
innerY = LC.AnchorWidget(reverseOrderToggle, content, innerY) - LC.SPACING_BETWEEN_WIDGETS

innerY = CreateLayoutSlider(
content,
db,
Expand Down
34 changes: 31 additions & 3 deletions spec/Config_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe("Config", function()
local db = initWithSeed(ns, nil)

-- Keep in sync with CURRENT_SCHEMA in DragonLoot/Core/Config.lua
assert.are.equal(5, db.profile.schemaVersion)
assert.are.equal(6, db.profile.schemaVersion)
end)

it("has lootIconSize in a fresh profile", function()
Expand Down Expand Up @@ -80,6 +80,12 @@ describe("Config", function()

assert.is_false(db.profile.rollFrame.showRollTally)
end)

it("defaults rollFrame.reverseButtonOrder to false", function()
local db = initWithSeed(ns, nil)

assert.is_false(db.profile.rollFrame.reverseButtonOrder)
end)
end)

---------------------------------------------------------------------------
Expand Down Expand Up @@ -215,6 +221,28 @@ describe("Config", function()

assert.is_true(db.profile.rollFrame.showRollTally)
end)

it("back-fills missing rollFrame.reverseButtonOrder with false", function()
local db = initWithSeed(ns, {
schemaVersion = 5,
rollFrame = {
enabled = true,
},
})

assert.is_false(db.profile.rollFrame.reverseButtonOrder)
end)

it("preserves an opted-in rollFrame.reverseButtonOrder", function()
local db = initWithSeed(ns, {
schemaVersion = 5,
rollFrame = {
reverseButtonOrder = true,
},
})

assert.is_true(db.profile.rollFrame.reverseButtonOrder)
end)
end)

---------------------------------------------------------------------------
Expand Down Expand Up @@ -276,7 +304,7 @@ describe("Config", function()
-- Seed at current schema so FillMissingDefaults is skipped and the
-- (unconditional) iconSize-split migration can propagate iconSize=48.
-- Keep in sync with CURRENT_SCHEMA in DragonLoot/Core/Config.lua.
schemaVersion = 5,
schemaVersion = 6,
appearance = {
iconSize = 48,
-- lootIconSize intentionally absent to test migration propagation
Expand All @@ -300,7 +328,7 @@ describe("Config", function()
})

-- Keep in sync with CURRENT_SCHEMA in DragonLoot/Core/Config.lua
assert.are.equal(5, db.profile.schemaVersion)
assert.are.equal(6, db.profile.schemaVersion)
end)
end)
end)
Loading
Loading