DopingControl v0.6.4
This commit is contained in:
+68
-10
@@ -149,10 +149,12 @@ O.GRID_LABEL_W = 74 -- role/class label column (expectation grid)
|
||||
O.BOOK_NAME_W = 96 -- player-name column (skill book grid)
|
||||
O.ROW_H = 22 -- one grid row's height, both grids
|
||||
|
||||
-- equipment has the most configurable slots (11 armor enchants + neck +
|
||||
-- 2 rings; trinkets are item tiles and never configurable, see
|
||||
-- slotsForTab) -- the widest grid the pools have to serve.
|
||||
O.MAX_SLOT_COLS = 14
|
||||
-- consumables (v6 slot model) has the most configurable slots (22 incl.
|
||||
-- the five school protection columns);
|
||||
-- equipment follows with 14 (11 armor enchants + neck + 2 rings --
|
||||
-- trinkets are item tiles and never configurable, see slotsForTab).
|
||||
-- The widest grid the pools have to serve.
|
||||
O.MAX_SLOT_COLS = 22
|
||||
|
||||
-- x-offset of the 20 px check button inside its O.CELL_W-wide column
|
||||
O.CELL_INSET = math.floor((O.CELL_W - 20) / 2)
|
||||
@@ -489,6 +491,17 @@ function O.ClassTitle(class)
|
||||
.. string.lower(string.sub(class, 2))
|
||||
end
|
||||
|
||||
-- Label of the demo-mode button. Demo mode is TRANSIENT (core/demo.lua:
|
||||
-- never SavedVariables), so it gets a self-relabeling button rather than a
|
||||
-- checkbox -- the checkbox row above is bound to db fields, and a checkbox
|
||||
-- whose state dies on reload would read like a broken setting.
|
||||
function O.DemoButtonLabel()
|
||||
if DC.demoMode then
|
||||
return "Demo mode: ON (click to stop)"
|
||||
end
|
||||
return "Demo mode: OFF (click to start)"
|
||||
end
|
||||
|
||||
-- ==================================================================
|
||||
-- WOW SECTION -- frame, widgets, wiring
|
||||
-- ==================================================================
|
||||
@@ -504,7 +517,7 @@ if CreateFrame then
|
||||
-- O.GRID_LABEL_W label column O.COL_PITCH column pitch
|
||||
-- O.BOOK_NAME_W player-name column O.ROW_H row pitch
|
||||
-- O.CELL_INSET check button inset O.MAX_SLOT_COLS widest grid
|
||||
-- The two grids differ in column count (14 equipment slots vs. 15
|
||||
-- The two grids differ in column count (22 consumable slots vs. 15
|
||||
-- weapon skills); the frame is BUILT at the wider of the two and
|
||||
-- narrowed per tab by ApplyEditorWidth, so no widget is ever created
|
||||
-- against a width it later has to grow past.
|
||||
@@ -558,9 +571,9 @@ if CreateFrame then
|
||||
elseif tab == "CLASSBUFFS" then
|
||||
return DC.SLOTS_CLASSBUFFS or {}
|
||||
elseif tab == "EQUIPMENT" then
|
||||
-- only kind=="ench" slots are configurable here (14: the 11
|
||||
-- armor slots + neck/rings, which are enchantable on this
|
||||
-- server -- data/enchants.lua). T1/T2 (trinket item tiles)
|
||||
-- only kind=="ench" slots are configurable here (15: the 11
|
||||
-- armor slots + neck/rings/waist, which are enchantable on
|
||||
-- this server -- data/enchants.lua). T1/T2 (trinket item tiles)
|
||||
-- have no enchant question to ask and never appear: the
|
||||
-- matrix always shows them (item present/absent decides,
|
||||
-- expectations are never consulted for tiles).
|
||||
@@ -1536,6 +1549,42 @@ if CreateFrame then
|
||||
place(cbTest, -28)
|
||||
AddTooltip(cbTest, "Replace the scan with a fixed simulated raid.\nChat outputs are disabled while active.")
|
||||
|
||||
-- Demo mode sits right below the test-mode row: same idea (the
|
||||
-- simulated raid), plus a transient expectation layer that shows
|
||||
-- all six school protection columns at once. A BUTTON, not a
|
||||
-- checkbox -- the state is never saved, so it relabels itself
|
||||
-- instead of pretending to be a stored setting.
|
||||
local btnDemo = CreateButton(f, "DopingControlOptDemoBtn",
|
||||
O.DemoButtonLabel(), 200,
|
||||
function()
|
||||
-- Capture the widget BEFORE SetDemoMode runs. `this` is a
|
||||
-- plain global the 1.12 dispatcher sets per script call and
|
||||
-- never restores: SetDemoMode synchronously drives
|
||||
-- DC_Matrix.Refresh -> M.Render, whose leftover-hide loop
|
||||
-- Hide()s pooled rows and group heads that carry their own
|
||||
-- OnHide handlers (ui/matrix.lua M.RowOnHide /
|
||||
-- M.GroupHeadOnHide -- they read `this` themselves). After
|
||||
-- that nested dispatch `this` is the last-hidden widget, and
|
||||
-- a row frame is a plain Frame with no SetText. Same order
|
||||
-- the other handlers in this file already keep
|
||||
-- (GridCellOnClick, ResetOnClick): finish the `this` reads
|
||||
-- and writes before refreshing anything.
|
||||
local btn = this
|
||||
if DC.SetDemoMode then
|
||||
DC.SetDemoMode(not DC.demoMode)
|
||||
end
|
||||
btn:SetText(O.DemoButtonLabel())
|
||||
end)
|
||||
place(btnDemo, -28)
|
||||
AddTooltip(btnDemo, "Simulated raid with ALL SIX protection columns"
|
||||
.. " (fire, frost, nature, shadow, holy, arcane) shown at once."
|
||||
.. "\nYour saved expectations are left untouched, and demo mode"
|
||||
.. " is never saved - it ends with the next reload."
|
||||
-- the demo layer is snapshotted on entry (core/demo.lua), so
|
||||
-- grid edits made while it is armed do not reach the matrix
|
||||
.. "\nThe view is a snapshot: restart demo mode to pick up"
|
||||
.. " expectation changes made while it is running.")
|
||||
|
||||
local cbMinimap = CreateCheckbox(f, "Show minimap button",
|
||||
function() return db().showMinimapButton end,
|
||||
function(v)
|
||||
@@ -1788,6 +1837,11 @@ if CreateFrame then
|
||||
end
|
||||
RefreshEditor() -- grid/books pools + tab visibility + buttons
|
||||
ResetDisarm(getglobal("DopingControlOptResetBtn"))
|
||||
-- demo mode can have been toggled by /dc demo meanwhile
|
||||
local bd = getglobal("DopingControlOptDemoBtn")
|
||||
if bd then
|
||||
bd:SetText(O.DemoButtonLabel())
|
||||
end
|
||||
end)
|
||||
|
||||
-- ESC closes
|
||||
@@ -1827,14 +1881,18 @@ if CreateFrame then
|
||||
f:Show()
|
||||
end
|
||||
|
||||
-- external state changes (/dc test, minimap toggle) can resync an
|
||||
-- open options window
|
||||
-- external state changes (/dc test, /dc demo, minimap toggle) can
|
||||
-- resync an open options window
|
||||
function O.Refresh()
|
||||
if frame and frame:IsShown() then
|
||||
for i = 1, table.getn(checkboxes) do
|
||||
local cb = checkboxes[i]
|
||||
cb:SetChecked(cb.dcGet() and 1 or nil)
|
||||
end
|
||||
local bd = getglobal("DopingControlOptDemoBtn")
|
||||
if bd then
|
||||
bd:SetText(O.DemoButtonLabel())
|
||||
end
|
||||
RefreshEditor() -- a fresh scan can add or drop book rows
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user