Tidy up for 0.9.3: Shagu overlap warning, readme rewrite
- Warn once in chat when ShaguTweaks Debuff Timer draws on target debuffs. - Use STANDARD_TEXT_FONT for timers and stack counts. - Clean up comments and dead code; add .gitattributes and .gitignore. - Rewrite README (ClassicAPI version table, ShaguTweaks compatibility); move history to CHANGELOG.md. - Tests: 19 scenarios, no machine-specific paths. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019W3rwutyoLNHxXPycYWSMc
This commit is contained in:
+25
-17
@@ -1,14 +1,14 @@
|
||||
|
||||
-- Title: TargetFrameBuff v0.9.2
|
||||
-- Notes: Shows up to 32 Buffs & 16 Debuffs on a Target (Buffs above, Debuffs below),
|
||||
-- with remaining-time countdowns when ClassicAPI is installed
|
||||
-- Author: lua@lumpn.de (modified)
|
||||
|
||||
-- TargetFrameBuff: up to 32 buffs above and 16 debuffs below the default target
|
||||
-- frame. With ClassicAPI it also adds countdowns, stack counts, removable-buff
|
||||
-- highlights and optional cooldown sweeps. Version and author live in the .toc.
|
||||
|
||||
local lOriginal_TargetDebuffButton_Update = nil;
|
||||
local TARGETFRAMEBUFF_MAX_TARGET_DEBUFFS = 16;
|
||||
local TARGETFRAMEBUFF_MAX_TARGET_BUFFS = 32;
|
||||
|
||||
-- Follow the client font so localized clients keep readable glyphs.
|
||||
local TARGETFRAMEBUFF_FONT = STANDARD_TEXT_FONT or "Fonts\\FRIZQT__.TTF";
|
||||
|
||||
-- How often the countdowns refresh, in seconds.
|
||||
local TARGETFRAMEBUFF_TIMER_INTERVAL = 0.2;
|
||||
|
||||
@@ -62,13 +62,13 @@ local function TargetFrameBuff_AddTimer(button)
|
||||
holder:SetFrameLevel(button:GetFrameLevel() + 2);
|
||||
|
||||
local timer = holder:CreateFontString(nil, "OVERLAY");
|
||||
timer:SetFont("Fonts\\FRIZQT__.TTF", 9, "OUTLINE");
|
||||
timer:SetFont(TARGETFRAMEBUFF_FONT, 9, "OUTLINE");
|
||||
timer:SetPoint("CENTER", button, "CENTER", 0, 0);
|
||||
timer:Hide();
|
||||
|
||||
if (not button.auraCount) then
|
||||
button.auraCount = holder:CreateFontString(nil, "OVERLAY");
|
||||
button.auraCount:SetFont("Fonts\\FRIZQT__.TTF", 9, "OUTLINE");
|
||||
button.auraCount:SetFont(TARGETFRAMEBUFF_FONT, 9, "OUTLINE");
|
||||
button.auraCount:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 1, -1);
|
||||
button.auraCount:Hide();
|
||||
local stockCount = getglobal(button:GetName().."Count");
|
||||
@@ -90,7 +90,7 @@ function TargetFrameBuff_OnLoad()
|
||||
overlay:SetAllPoints(button);
|
||||
overlay:SetFrameLevel(button:GetFrameLevel() + 2);
|
||||
button.auraCount = overlay:CreateFontString(nil, "OVERLAY");
|
||||
button.auraCount:SetFont("Fonts\\FRIZQT__.TTF", 9, "OUTLINE");
|
||||
button.auraCount:SetFont(TARGETFRAMEBUFF_FONT, 9, "OUTLINE");
|
||||
button.auraCount:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 1, -1);
|
||||
button.auraCount:Hide();
|
||||
button.auraBorder = overlay:CreateTexture(nil, "OVERLAY");
|
||||
@@ -148,6 +148,18 @@ function TargetFrameBuff_OnLoad()
|
||||
end
|
||||
|
||||
|
||||
-- ShaguTweaks "Debuff Timer" wraps TargetDebuffButton_Update and adds its own
|
||||
-- cooldown (button.cd), timer text and stack count to every debuff button. On
|
||||
-- top of ours that doubles the timers, sweeps and stack numbers. Its field is
|
||||
-- named cd (ours is cooldown), so seeing it is a locale-proof way to notice.
|
||||
local lWarnedShagu = false;
|
||||
local function TargetFrameBuff_CheckShagu()
|
||||
if (lDebuffButtons[1] and lDebuffButtons[1].cd and lDebuffButtons[1].timer) then
|
||||
lWarnedShagu = true;
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cffffd100TargetFrameBuff:|r ShaguTweaks Debuff Timer is also drawing timers, sweeps and stack counts on target debuffs, so they overlap. Disable it under ShaguTweaks > Unit Frames, or use /tfb timers off and /tfb sweeps off.");
|
||||
end
|
||||
end
|
||||
|
||||
-- use extended update-function (original code from FrameXML/TargetFrame.lua)
|
||||
function TargetFrameBuff_Update()
|
||||
if (TargetFrameBuff_HasClassicAPI() and lBuffButtons[1] and lBuffButtons[1].timer) then
|
||||
@@ -156,6 +168,7 @@ function TargetFrameBuff_Update()
|
||||
TargetFrameBuff_UpdateNative();
|
||||
end
|
||||
TargetFrameBuff_Layout();
|
||||
if (not lWarnedShagu) then TargetFrameBuff_CheckShagu(); end
|
||||
-- Draw countdowns right away instead of waiting for the next tick.
|
||||
lTimerElapsed = TARGETFRAMEBUFF_TIMER_INTERVAL;
|
||||
end
|
||||
@@ -372,13 +385,8 @@ function TargetFrameBuff_Layout()
|
||||
TargetFrameBuff1:ClearAllPoints();
|
||||
TargetFrameBuff1:SetPoint("BOTTOMLEFT", "TargetFrame", "TOPLEFT", 5, -10);
|
||||
|
||||
-- Position debuffs below target frame using default positioning (no gap)
|
||||
-- Layout: 4-4-8 (three rows: 4 debuffs, 4 debuffs, 8 debuffs)
|
||||
-- Debuff 1 uses default WoW positioning to avoid gap with target frame
|
||||
-- TargetFrameDebuff1:ClearAllPoints();
|
||||
-- TargetFrameDebuff1:SetPoint("TOPLEFT", "TargetFrame", "BOTTOMLEFT", 5, 0);
|
||||
|
||||
-- Position remaining buttons in 4-4-8 layout
|
||||
-- Debuff 1 keeps the stock anchor so it sits flush under the target frame.
|
||||
-- Remaining debuffs use a 4-4-8 layout (three rows).
|
||||
for i=2, TARGETFRAMEBUFF_MAX_TARGET_DEBUFFS do
|
||||
button = lDebuffButtons[i];
|
||||
if button then
|
||||
@@ -417,7 +425,7 @@ TargetFrameBuff_UpdateTimer = function(button, now)
|
||||
|
||||
local size = TargetFrameBuff_Setting("timerSize");
|
||||
if (button.timerSize ~= size) then
|
||||
button.timer:SetFont("Fonts\\FRIZQT__.TTF", size, "OUTLINE");
|
||||
button.timer:SetFont(TARGETFRAMEBUFF_FONT, size, "OUTLINE");
|
||||
button.timerSize = size;
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user