Skip to content
Open
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
103 changes: 98 additions & 5 deletions EllesmereUICooldownManager/EUI_CooldownManager_Options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7814,7 +7814,7 @@ initFrame:SetScript("OnEvent", function(self)
-- Lists the class's CDM-trackable buffs plus a Custom Spell ID entry. No
-- durations (aura-driven, never cast-timed) and no item/preset rows (those are
-- cast-timer / CD-utility concepts that do not belong on an aura tracker).
local function ShowBuffToCDPicker(anchorFrame, targetBarKey, onChanged)
local function ShowBuffToCDPicker(anchorFrame, targetBarKey, onChanged, onPicked)
if _spellPickerMenu and _spellPickerMenu:IsShown() then
_spellPickerMenu:Hide()
if _spellPickerMenu._anchorFrame == anchorFrame then return end
Expand Down Expand Up @@ -7853,8 +7853,9 @@ initFrame:SetScript("OnEvent", function(self)
local alreadyCd = sdCur and ns.CollectCdClaimSet(sdCur)
local knownSpells = {}
for _, sp in ipairs(allSpells) do
if sp.cdmCatGroup == "buff" and sp.spellID and not already[sp.spellID]
and not (sp.cdID and alreadyCd and alreadyCd[sp.cdID]) then
if sp.cdmCatGroup == "buff" and sp.spellID
and (onPicked or (not already[sp.spellID]
and not (sp.cdID and alreadyCd and alreadyCd[sp.cdID]))) then
knownSpells[#knownSpells + 1] = sp
end
end
Expand All @@ -7875,6 +7876,32 @@ initFrame:SetScript("OnEvent", function(self)

local mH = 4

if onPicked then
local clearItem = CreateFrame("Button", nil, inner)
clearItem:SetHeight(ITEM_H)
clearItem:SetPoint("TOPLEFT", inner, "TOPLEFT", 1, -mH)
clearItem:SetPoint("TOPRIGHT", inner, "TOPRIGHT", -1, -mH)
clearItem:SetFrameLevel(menu:GetFrameLevel() + 2)
local clearLbl = clearItem:CreateFontString(nil, "OVERLAY")
clearLbl:SetFont(FONT_PATH, 11, GetCDMOptOutline())
clearLbl:SetPoint("LEFT", 10, 0)
clearLbl:SetText(EllesmereUI.L("None (use cooldown icon)"))
clearLbl:SetTextColor(tDimR, tDimG, tDimB, tDimA)
local clearHl = clearItem:CreateTexture(nil, "ARTWORK")
clearHl:SetAllPoints(); clearHl:SetColorTexture(1, 1, 1, hlA); clearHl:SetAlpha(0)
clearItem:SetScript("OnEnter", function()
clearLbl:SetTextColor(1, 1, 1, 1); clearHl:SetAlpha(hlA)
end)
clearItem:SetScript("OnLeave", function()
clearLbl:SetTextColor(tDimR, tDimG, tDimB, tDimA); clearHl:SetAlpha(0)
end)
clearItem:SetScript("OnClick", function()
menu:Hide()
onPicked(nil, nil)
end)
mH = mH + ITEM_H
end

-- Post-add refresh; picker stays open so several buffs add in a row.
-- onChanged reanchors the live bars and refreshes the preview in place
-- (same flow as the CD/utility "+" add). No RefreshCDPreview here: its
Expand Down Expand Up @@ -7906,8 +7933,26 @@ initFrame:SetScript("OnEvent", function(self)
csItem:SetScript("OnClick", function()
menu:Hide()
ShowCustomSpellIDPopup(targetBarKey, false, function(sid)
ns.AddBuffToCDUtilBar(targetBarKey, sid)
AfterAdd()
if onPicked then
local match
for _, candidate in ipairs(allSpells) do
if candidate.cdmCatGroup == "buff" and candidate.spellID == sid then
match = candidate
break
end
end
if not match then
EllesmereUI.Print("|cff0cd29fEllesmereUI CDM:|r "
.. EllesmereUI.L("That Spell ID is not in Blizzard's tracked-buff catalog."))
return
end
local collisionID = match.cdID and ns.IsCollidedBuffSid
and ns.IsCollidedBuffSid(match.spellID) and match.cdID or nil
onPicked(match.spellID, collisionID)
else
ns.AddBuffToCDUtilBar(targetBarKey, sid)
AfterAdd()
end
end)
end)
mH = mH + ITEM_H
Expand Down Expand Up @@ -7955,6 +8000,13 @@ initFrame:SetScript("OnEvent", function(self)
end)
item:SetScript("OnClick", function()
if notLearned then EllesmereUI.HideWidgetTooltip() end
if onPicked then
local collisionID = sp.cdID and ns.IsCollidedBuffSid
and ns.IsCollidedBuffSid(sp.spellID) and sp.cdID or nil
menu:Hide()
onPicked(sp.spellID, collisionID)
return
end
-- Collided pair (two viewer slots, one shared spellID): claim
-- by cooldownID so each slot is hostable on its own. Non-
-- collided buffs keep the sid path (identity survives talent
Expand Down Expand Up @@ -12308,6 +12360,47 @@ initFrame:SetScript("OnEvent", function(self)
-- synced bars were promoted to bar-level settings by the
-- cdm_spell_settings_tiers_v1 migration.)

-- Cooldown-to-buff replacement. The mapping belongs to the
-- cooldown's per-spec settings entry; the live renderer swaps
-- in Blizzard's real buff frame only while that aura is active.
if not isBuffBar and not isHostedBuff
and type(spellID) == "number" and spellID > 0 then
local replacementSID = rawget(ss, "replacementBuffSpellID")
local replacementName = replacementSID and C_Spell.GetSpellName(replacementSID)
local replaceRow = CreateFrame("Button", nil, inner)
replaceRow:SetHeight(ITEM_H)
replaceRow:SetPoint("TOPLEFT", inner, "TOPLEFT", 1, -mH)
replaceRow:SetPoint("TOPRIGHT", inner, "TOPRIGHT", -1, -mH)
replaceRow:SetFrameLevel(menu:GetFrameLevel() + 2)
local replaceLbl = replaceRow:CreateFontString(nil, "OVERLAY")
replaceLbl:SetFont(FONT_PATH, 11, GetCDMOptOutline())
replaceLbl:SetPoint("LEFT", 10, 0)
replaceLbl:SetPoint("RIGHT", -10, 0)
replaceLbl:SetJustifyH("LEFT")
replaceLbl:SetText(EllesmereUI.L("Replace with Buff") .. ": "
.. (replacementName or EllesmereUI.L("None")))
replaceLbl:SetTextColor(tDimR, tDimG, tDimB, tDimA)
local replaceHl = replaceRow:CreateTexture(nil, "ARTWORK")
replaceHl:SetAllPoints(); replaceHl:SetColorTexture(1, 1, 1, hlA)
replaceHl:SetAlpha(0)
replaceRow:SetScript("OnEnter", function()
replaceLbl:SetTextColor(1, 1, 1, 1); replaceHl:SetAlpha(1)
end)
replaceRow:SetScript("OnLeave", function()
replaceLbl:SetTextColor(tDimR, tDimG, tDimB, tDimA); replaceHl:SetAlpha(0)
end)
replaceRow:SetScript("OnClick", function()
menu:Hide()
ShowBuffToCDPicker(replaceRow, barKey, nil, function(buffSID, buffCdID)
if ns.SetCooldownBuffReplacement then
ns.SetCooldownBuffReplacement(barKey, spellID, buffSID, buffCdID)
end
RefreshCDPreview()
end)
end)
mH = mH + ITEM_H
end

-- Custom Icon (per-spell ONLY -- deliberately outside the
-- Apply-to-Bar tier system: an icon replacement is a per-slot
-- identity choice, so no bar tiers, no apply strip, and no
Expand Down
Loading