This commit is contained in:
Meow
2026-03-30 17:25:19 +02:00
7 changed files with 225 additions and 44 deletions
+25 -4
View File
@@ -1276,6 +1276,26 @@ pfUI:RegisterModule("actionbar", "vanilla", function ()
local spacing = C.bars["bar"..i].spacing
local background = C.bars["bar"..i].background
local formfactor = C.bars["bar"..i].formfactor
local uneven = C.bars["bar"..i].uneven
local _, _, cols, rows = string.find(tostring(formfactor or ""), "(%d+)%s*x%s*(%d+)")
cols, rows = tonumber(cols), tonumber(rows)
local is_square = cols == 3 and rows == 3
local is_vertical = cols and cols <= 3 and not is_square
local is_horizontal = rows and rows <= 3 and not is_square
if is_vertical then
if uneven ~= "Up" and uneven ~= "Down" then
uneven = "Up"
end
elseif is_horizontal then
if uneven ~= "Left" and uneven ~= "Right" then
uneven = "Left"
end
elseif not uneven then
uneven = "Up"
end
C.bars["bar"..i].uneven = uneven
local autohide = C.bars["bar"..i].autohide
local hide_time = C.bars["bar"..i].hide_time
local hide_combat = C.bars["bar"..i].hide_combat == "1" and true or nil
@@ -1298,7 +1318,8 @@ pfUI:RegisterModule("actionbar", "vanilla", function ()
end
-- the stored layout is invalid, temporary fallback
if not pfGridmath[buttons][BarLayoutFormfactor(formfactor)] then
local _, _, fcols, frows = string.find(tostring(formfactor or ""), "(%d+)%s*x%s*(%d+)")
if not ((fcols and frows) or pfGridmath[buttons][BarLayoutFormfactor(formfactor)]) then
formfactor = BarLayoutOptions(buttons)[1]
end
@@ -1407,7 +1428,7 @@ pfUI:RegisterModule("actionbar", "vanilla", function ()
bars[i][j] = CreateActionButton(bars[i], i, j)
bars[i][j].bar = i
BarButtonAnchor(bars[i][j], buttonbasename, j, buttons, formfactor, size, border, spacing)
BarButtonAnchor(bars[i][j], buttonbasename, j, buttons, formfactor, size, border, spacing, uneven)
bars[i][j]:ClearAllPoints()
bars[i][j]:SetPoint(unpack(bars[i][j]._anchor))
bars[i][j]:Show()
@@ -1438,7 +1459,7 @@ pfUI:RegisterModule("actionbar", "vanilla", function ()
end
-- adjust actionbar size
BarLayoutSize(bars[i], buttons, formfactor, size, border, spacing)
BarLayoutSize(bars[i], buttons, formfactor, size, border, spacing, uneven)
bars[i]:SetWidth(bars[i]._size[1])
bars[i]:SetHeight(bars[i]._size[2])
bars[i]:ClearAllPoints()
@@ -1752,4 +1773,4 @@ pfUI:RegisterModule("actionbar", "vanilla", function ()
return reagent_counts[reagent_slots[slot]]
end
end
end)
end)
+18 -2
View File
@@ -2090,7 +2090,7 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
CreateConfig(nil, T["Offhand Bar Color"], C.unitframes, "swingtimerohcolor", "color")
CreateConfig(nil, T["Ranged Bar Color"], C.unitframes, "swingtimerrangedcolor", "color")
CreateConfig(nil, T["Ranged Warn Color (Hunter)"], C.unitframes, "swingtimerrangedwarncolor", "color")
CreateConfig(nil, T["Show HS/Cleave Queue Color (Warrior)"], C.unitframes, "swingtimerhsqueue", "checkbox")
CreateConfig(nil, T["Show On Next Attack Queue Color"], C.unitframes, "swingtimerhsqueue", "checkbox")
CreateConfig(nil, T["Show Attack Speed"], C.unitframes, "swingtimerattackspeed", "checkbox")
CreateConfig(nil, "Mark Tracking", nil, nil, "header")
@@ -2609,6 +2609,21 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
local formfactors = function()
return BarLayoutOptions(tonumber(C.bars["bar"..id].buttons) or id < 11 and NUM_ACTIONBAR_BUTTONS or id > 11 and NUM_SHAPESHIFT_SLOTS or NUM_PET_ACTION_SLOTS)
end
local uneven_options = function()
local formfactor = tostring(C.bars["bar"..id].formfactor or "")
local _, _, cols, rows = string.find(formfactor, "(%d+)%s*x%s*(%d+)")
cols, rows = tonumber(cols), tonumber(rows)
if cols == 3 and rows == 3 then
return { "Up", "Down", "Left", "Right" }
elseif cols and cols <= 3 then
return { "Up", "Down" }
elseif rows and rows <= 3 then
return { "Left", "Right" }
end
return { "Up", "Down", "Left", "Right" }
end
CreateGUIEntry(T["Actionbar"], caption, function()
CreateConfig(U["bars"], T["Enable"], C.bars["bar"..id], "enable", "checkbox")
@@ -2627,6 +2642,7 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
CreateConfig(U["bars"], T["Icon Size"], C.bars["bar"..id], "icon_size")
CreateConfig(U["bars"], T["Spacing"], C.bars["bar"..id], "spacing", "dropdown", pfUI.gui.dropdowns.actionbarbuttons)
CreateConfig(U["bars"], T["Layout"], C.bars["bar"..id], "formfactor", "dropdown", formfactors)
CreateConfig(U["bars"], T["Layout Uneven Orientation"], C.bars["bar"..id], "uneven", "dropdown", uneven_options)
CreateConfig(U["bars"], T["Bar Background"], C.bars["bar"..id], "background", "checkbox")
CreateConfig(U["bars"], T["Show Hotkey Text"], C.bars["bar"..id], "showkeybind", "checkbox")
@@ -2978,4 +2994,4 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
end
end)
end
end)
end)
+37 -16
View File
@@ -22,8 +22,9 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
inCombat = false,
pendingCastSpellId = nil,
mhFrozenAt = nil,
hsQueued = false, cleaveQueued = false,
hsQueued = false, cleaveQueued = false, maulQueued = false,
isWarrior = false,
isDruid = false,
cachedHSSlots = {}, cachedCleaveSlots = {},
useSpellQueueEvent = false,
playerGUID = nil,
@@ -64,7 +65,16 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
local cleaveSpellIDs = {
[845] = true, [7369] = true, [11608] = true, [11609] = true,
[20569] = true,
}
}
-- Maul spell IDs (all ranks 1 to 7)
local maulSpellIDs = {
[6807] = true,
[6808] = true,
[6809] = true,
[8972] = true,
[9745] = true, [9880] = true, [9881] = true,
}
-- Read config
local sw_width = tonumber(C.unitframes.swingtimerwidth) or 200
@@ -506,12 +516,16 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
-- HS/Cleave color
local curR, curG, curB = mhDefaultR, mhDefaultG, mhDefaultB
if sw_hsqueue and S.isWarrior then
local hs, cl = IsHSOrCleaveQueued()
if cl then
curR, curG, curB = 0.2, 0.9, 0.2
elseif hs then
curR, curG, curB = 0.9, 0.9, 0.2
if sw_hsqueue then
if S.maulQueued and S.isDruid then
curR, curG, curB = 1.0, 0.55, 0.0 -- orange for druid maul queue
elseif S.isWarrior then
local hs, cl = IsHSOrCleaveQueued()
if cl then
curR, curG, curB = 0.2, 0.9, 0.2
elseif hs then
curR, curG, curB = 0.9, 0.9, 0.2
end
end
end
@@ -692,8 +706,9 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
-- Slam delays auto-attack but does NOT reset the swing timer. Ignore.
S.pendingCastSpellId = nil
return
elseif hsSpellIDs[spellId] or IsOnSwingSpell(spellId) then
elseif hsSpellIDs[spellId] or cleaveSpellIDs[spellId] or maulSpellIDs[spellId] or IsOnSwingSpell(spellId) then
S.hsQueued = false; S.cleaveQueued = false
S.maulQueued = false
ResetMH()
elseif cleaveSpellIDs[spellId] then
S.hsQueued = false; S.cleaveQueued = false
@@ -716,11 +731,12 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
-- SPELL_CAST_EVENT hook: HS/Cleave queue tracking
pfUI.libdebuff_spell_cast_hooks = pfUI.libdebuff_spell_cast_hooks or {}
pfUI.libdebuff_spell_cast_hooks["swingtimer"] = function(success, spellId)
if success ~= 1 then return end
if hsSpellIDs[spellId] then
S.hsQueued = true; S.cleaveQueued = false
S.hsQueued = true; S.cleaveQueued = false; S.maulQueued = false
elseif cleaveSpellIDs[spellId] then
S.cleaveQueued = true; S.hsQueued = false
S.cleaveQueued = true; S.hsQueued = false; S.maulQueued = false
elseif maulSpellIDs[spellId] then
S.maulQueued = true; S.hsQueued = false; S.cleaveQueued = false
end
end
@@ -806,12 +822,14 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
if eventCode == ON_SWING_QUEUED then
S.useSpellQueueEvent = true
if hsSpellIDs[spellId] then
S.hsQueued = true; S.cleaveQueued = false
S.hsQueued = true; S.cleaveQueued = false; S.maulQueued = false
elseif cleaveSpellIDs[spellId] then
S.cleaveQueued = true; S.hsQueued = false
S.cleaveQueued = true; S.hsQueued = false; S.maulQueued = false
elseif maulSpellIDs[spellId] then
S.maulQueued = true; S.hsQueued = false; S.cleaveQueued = false
end
elseif eventCode == ON_SWING_QUEUE_POPPED then
S.hsQueued = false; S.cleaveQueued = false
S.hsQueued = false; S.cleaveQueued = false; S.maulQueued = false
end
elseif event == "START_AUTOATTACK" then
@@ -823,6 +841,7 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
elseif event == "PLAYER_ENTERING_WORLD" then
local _, class = UnitClass("player")
S.isWarrior = (class == "WARRIOR")
S.isDruid = (class == "DRUID")
S.playerGUID = GetUnitGUID("player")
UpdateWeaponSpeeds()
RebuildQueueSlotCache()
@@ -850,6 +869,7 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
S.inCombat = false
S.hsQueued = false
S.cleaveQueued = false
S.maulQueued = false
elseif event == "UNIT_DIED" then
if arg1 and arg1 == S.playerGUID then
@@ -897,7 +917,8 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
-- Warrior HS/Cleave queue state
IsHSQueued = function() return S.hsQueued end,
IsCleaveQueued = function() return S.cleaveQueued end,
IsMaulQueued = function() return S.maulQueued end,
}
UpdateWeaponSpeeds()
end)
end)