Skip to content

Commit 5bc9d84

Browse files
committed
Refactor tags, actionbars, auras, chat, unitframes
Multiple small refactors and fixes across the UI: - Libraries/cargBags: fix tagDisplay logic (handle BAG_UPDATE_DELAYED), correct bag/bank/account free slot calculations, improve currency tag to accept either watched index or currencyID, consolidate currency list build, and replace atlas coins with formatted colored money strings. - ActionBars: ensure AutoCastOverlay and lossOfControlCooldown are sized/anchored, expose UpdateCastVFX to adjust VFX masks when button size/font changes, set cooldown text font and wire up spell cast animation textures. - Auras: tidy header/mover calls, comment out unused GetSpellStat, tweak timer/cooldown font and settings, minor formatting/whitespace cleanups. - Chat: use K.LibEasyMenu create call, compact tooltip line creation, preserve whisper reply behavior and flash/tab logic on received whispers. - Load_Modules.xml: disable oUF_DebuffHighlight script include. - Tooltip: show full unit name including server for caster in tooltip. - UnitFrames: remove a debug print and comment out DebuffHighlight creation for several unit templates (party, party pet, raid, simple party, focus, pet, player, target) to avoid creating overlay textures by default. Overall these changes improve robustness, visual consistency, and formatting while removing noisy debug and unused highlight layers.
1 parent dfa58c4 commit 5bc9d84

17 files changed

Lines changed: 206 additions & 165 deletions

File tree

KkthnxUI/Libraries/cargBags/mixins-add/plugins/tagDisplay.lua

Lines changed: 55 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ local cargBags = ns.cargBags
4444

4545
local GetContainerNumFreeSlots = C_Container.GetContainerNumFreeSlots
4646

47-
local tagPool, tagEvents, object = {}, {}
47+
local tagPool, tagEvents = {}, {}
48+
local object
4849
local function tagger(tag, ...)
4950
return object.tags[tag] and object.tags[tag](object, ...) or ""
5051
end
@@ -87,6 +88,7 @@ cargBags:RegisterPlugin("TagDisplay", function(self, tagString, parent)
8788
setTagString(plugin, tagString)
8889

8990
self.implementation:RegisterEvent("BAG_UPDATE", plugin, updater)
91+
self.implementation:RegisterEvent("BAG_UPDATE_DELAYED", plugin, updater)
9092
return plugin
9193
end)
9294

@@ -100,17 +102,17 @@ end
100102
-- Tags
101103
local function GetNumFreeSlots(name)
102104
if name == "Bag" then
103-
local totalFree, freeSlots, bagFamily = 0
105+
local totalFree = 0
104106
for i = 0, 4 do -- reagent bank excluded
105-
freeSlots, bagFamily = GetContainerNumFreeSlots(i)
107+
local freeSlots, bagFamily = GetContainerNumFreeSlots(i)
106108
if bagFamily == 0 then
107109
totalFree = totalFree + freeSlots
108110
end
109111
end
110112
return totalFree
111113
elseif name == "Bank" then
112-
local numFreeSlots = 0
113-
for bagID = 6, 11 do
114+
local numFreeSlots = GetContainerNumFreeSlots(-1)
115+
for bagID = 6, 12 do
114116
numFreeSlots = numFreeSlots + GetContainerNumFreeSlots(bagID)
115117
end
116118
return numFreeSlots
@@ -120,7 +122,7 @@ local function GetNumFreeSlots(name)
120122
return GetContainerNumFreeSlots(5)
121123
elseif name == "Account" then
122124
local numFreeSlots = 0
123-
for bagID = 12, 16 do
125+
for bagID = 13, 17 do
124126
numFreeSlots = numFreeSlots + GetContainerNumFreeSlots(bagID)
125127
end
126128
return numFreeSlots
@@ -142,74 +144,77 @@ tagPool["item"] = function(self, item)
142144
end
143145
end
144146

145-
tagPool["currency"] = function(self, id)
146-
local currencyInfo = C_CurrencyInfo.GetBackpackCurrencyInfo(id)
147-
if currencyInfo then
148-
return currencyInfo.quantity .. createIcon(currencyInfo.iconFileID, self.iconValues)
147+
tagPool["currency"] = function(self, indexOrCurrencyID)
148+
-- Support either an index (as used by GetNumWatchedTokens) or a direct currencyID
149+
local info
150+
if type(indexOrCurrencyID) == "number" then
151+
-- First, try backpack watched token by index
152+
if indexOrCurrencyID <= (GetNumWatchedTokens() or 0) then
153+
info = C_CurrencyInfo.GetBackpackCurrencyInfo(indexOrCurrencyID)
154+
end
155+
-- If not found, treat the number as a currencyID
156+
if not info then
157+
info = C_CurrencyInfo.GetCurrencyInfo(indexOrCurrencyID)
158+
end
159+
end
160+
if not info then
161+
return
162+
end
163+
local name, count, icon = info.name, info.quantity or info.quantityEarnedThisWeek or 0, info.iconFileID
164+
if name and count then
165+
local iconTexture = "|T" .. icon .. ":13:15:0:0:50:50:4:46:4:46|t "
166+
return (iconTexture .. BreakUpLargeNumbers(count))
149167
end
150168
end
151169
tagEvents["currency"] = { "CURRENCY_DISPLAY_UPDATE" }
152170

153171
tagPool["currencies"] = function(self)
154-
local str
155-
for i = 1, GetNumWatchedTokens() do
172+
local out
173+
local watched = GetNumWatchedTokens() or 0
174+
for i = 1, watched do
156175
local curr = self.tags["currency"](self, i)
157176
if curr then
158-
str = (str and str .. " " or "") .. curr
177+
out = out and (out .. " " .. curr) or curr
159178
end
160179
end
161-
return str
180+
return out
162181
end
163182
tagEvents["currencies"] = tagEvents["currency"]
164183

165-
local atlasCache = {}
166-
local function createAtlasCoin(coin)
167-
local str = atlasCache[coin]
168-
if not str then
169-
local info = C_Texture.GetAtlasInfo("coin-" .. coin)
170-
local K = _G.KkthnxUI and _G.KkthnxUI[1] or nil
171-
if info then
172-
str = K and K.GetTextureStrByAtlas and K.GetTextureStrByAtlas(info, 16, 16)
173-
atlasCache[coin] = str
174-
end
175-
end
176-
return str
177-
end
178-
179184
tagPool["money"] = function()
180-
local money = GetMoney() or 0
181-
local str = ""
182-
local gold, silver, copper = floor(money / 1e4), floor(money / 100) % 100, money % 100
185+
local coppername = "|cffeda55fc|r"
186+
local goldname = "|cffffd700g|r"
187+
local silvername = "|cffc7c7cfs|r"
188+
189+
local amount = GetMoney() or 0
190+
local value = abs(amount)
191+
local gold = floor(value / 10000)
192+
local silver = floor(mod(value / 100, 100))
193+
local copper = floor(mod(value, 100))
183194

184195
if gold > 0 then
185-
str = str .. BreakUpLargeNumbers(gold) .. createAtlasCoin("gold") .. " "
186-
end
187-
if silver > 0 then
188-
str = str .. silver .. createAtlasCoin("silver") .. " "
196+
return format("%s%s %02d%s %02d%s", BreakUpLargeNumbers(gold), goldname, silver, silvername, copper, coppername)
197+
elseif silver > 0 then
198+
return format("%d%s %02d%s", silver, silvername, copper, coppername)
199+
else
200+
return format("%d%s", copper, coppername)
189201
end
190-
if copper > 0 then
191-
str = str .. copper .. createAtlasCoin("copper") .. " "
192-
end
193-
194-
return str
195202
end
196203
tagEvents["money"] = { "PLAYER_MONEY" }
197204

198205
tagPool["accountmoney"] = function()
199206
local money = C_Bank.FetchDepositedMoney(Enum.BankType.Account) or 0
200-
local str = ""
207+
local coppername = "|cffeda55fc|r"
208+
local goldname = "|cffffd700g|r"
209+
local silvername = "|cffc7c7cfs|r"
201210
local gold, silver, copper = floor(money / 1e4), floor(money / 100) % 100, money % 100
202211

203212
if gold > 0 then
204-
str = str .. BreakUpLargeNumbers(gold) .. createAtlasCoin("gold") .. " "
205-
end
206-
if silver > 0 then
207-
str = str .. silver .. createAtlasCoin("silver") .. " "
208-
end
209-
if copper >= 0 then
210-
str = str .. copper .. createAtlasCoin("copper") .. " "
213+
return format("%s%s %02d%s %02d%s", BreakUpLargeNumbers(gold), goldname, silver, silvername, copper, coppername)
214+
elseif silver > 0 then
215+
return format("%d%s %02d%s", silver, silvername, copper, coppername)
216+
else
217+
return format("%d%s", copper, coppername)
211218
end
212-
213-
return str
214219
end
215220
tagEvents["accountmoney"] = { "PLAYER_MONEY", "ACCOUNT_MONEY" }

KkthnxUI/Modules/ActionBars/ButtonStyle.lua

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ function Module:StyleActionButton(button)
143143
local iconMask = button.IconMask
144144
local petShine = _G[buttonName .. "Shine"]
145145
local autoCastable = button.AutoCastable
146+
local autoCastOverlay = button.AutoCastOverlay
146147

147148
-- NOTE: Hide original Blizzard textures to prevent visual overlaps.
148149
if normal then
@@ -188,6 +189,10 @@ function Module:StyleActionButton(button)
188189
autoCastable:SetAllPoints()
189190
end
190191

192+
if autoCastOverlay then
193+
autoCastOverlay:SetAllPoints()
194+
end
195+
191196
-- REASON: Setup custom icon and background border.
192197
if icon then
193198
icon:SetAllPoints()
@@ -206,6 +211,12 @@ function Module:StyleActionButton(button)
206211
if cooldown then
207212
cooldown:SetPoint("TOPLEFT", button, "TOPLEFT", 1, -1)
208213
cooldown:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -1, 1)
214+
215+
local region = cooldown:GetRegions()
216+
if region and region:IsObjectType("FontString") then
217+
region:SetFontObject(Game16FontOutline)
218+
button.cooldownText = region
219+
end
209220
end
210221

211222
-- NOTE: Apply custom textures for interaction states (Pushed, Checked, Highlight).
@@ -242,6 +253,18 @@ function Module:StyleActionButton(button)
242253
hooksecurefunc(hotkey, "SetText", Module.UpdateHotKey)
243254
end
244255

256+
-- Cast VFX
257+
local spellCastAnim = button.SpellCastAnimFrame
258+
local spellCastFill = spellCastAnim and spellCastAnim.Fill
259+
if spellCastFill then
260+
spellCastFill.InnerGlowTexture:SetAllPoints(icon)
261+
spellCastFill.InnerGlowTexture:SetTexCoord(K.TexCoords[1], K.TexCoords[2], K.TexCoords[3], K.TexCoords[4])
262+
end
263+
264+
if button.lossOfControlCooldown then
265+
button.lossOfControlCooldown:SetAllPoints()
266+
end
267+
245268
button.__styled = true
246269
end
247270

KkthnxUI/Modules/ActionBars/Elements/Bars.lua

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,37 @@ function Module:UpdateAllSize()
5353
Module:UpdateVehicleButton()
5454
end
5555

56+
function Module:UpdateCastVFX(button)
57+
local buttonWidth, buttonHeight = button:GetSize()
58+
local maskWidth, maskHeight = buttonWidth * 1.5, buttonHeight * 1.5
59+
60+
local spellCastAnim = button.SpellCastAnimFrame
61+
if spellCastAnim then
62+
local endBurst = spellCastAnim.EndBurst
63+
if endBurst then
64+
endBurst.EndMask:SetSize(maskWidth, maskHeight)
65+
end
66+
67+
local spellCastFill = spellCastAnim.Fill
68+
if spellCastFill then
69+
spellCastFill.FillMask:SetSize(maskWidth, maskHeight)
70+
end
71+
end
72+
local interruptDisplay = button.InterruptDisplay
73+
local interruptHighlight = interruptDisplay and interruptDisplay.Highlight
74+
if interruptHighlight then
75+
interruptHighlight.Mask:SetSize(maskWidth, maskHeight)
76+
end
77+
end
78+
5679
-- NOTE: Standardizes font settings across all button text elements.
5780
function Module:UpdateFontSize(button, fontSize)
5881
-- Directly apply the path, new size, and style variables
5982
button.Name:SetFont(K.UIFontOutlinePath, fontSize, K.UIFontOutlineStyle)
6083
button.Count:SetFont(K.UIFontOutlinePath, fontSize, K.UIFontOutlineStyle)
6184
button.HotKey:SetFont(K.UIFontOutlinePath, fontSize, K.UIFontOutlineStyle)
85+
86+
Module:UpdateCastVFX(button)
6287
end
6388

6489
-- REASON: Recalculates button positions and frame bounds based on rows and columns.
@@ -222,8 +247,7 @@ end
222247

223248
-- NOTE: Defines the state-switching logic for the main bar (Bar 1) to handle
224249
-- vehicles, stances, and overriding bars.
225-
local fullPage =
226-
"[bar:6]6;[bar:5]5;[bar:4]4;[bar:3]3;[bar:2]2;[possessbar]16;[overridebar]18;[shapeshift]17;[vehicleui]16;[bonusbar:5]11;[bonusbar:4]10;[bonusbar:3]9;[bonusbar:2]8;[bonusbar:1]7;1"
250+
local fullPage = "[bar:6]6;[bar:5]5;[bar:4]4;[bar:3]3;[bar:2]2;[possessbar]16;[overridebar]18;[shapeshift]17;[vehicleui]16;[bonusbar:5]11;[bonusbar:4]10;[bonusbar:3]9;[bonusbar:2]8;[bonusbar:1]7;1"
227251

228252
function Module:UpdateBarVisibility()
229253
for i = 1, 8 do
@@ -366,8 +390,7 @@ function Module:CreateBars()
366390
end
367391

368392
-- REASON: Bars 2-8 are hidden during special bar states (Vehicles, Override) to avoid clutter.
369-
frame.visibility = index == 1 and "[petbattle] hide; show"
370-
or "[petbattle][overridebar][vehicleui][possessbar,@vehicle,exists][shapeshift] hide; show"
393+
frame.visibility = index == 1 and "[petbattle] hide; show" or "[petbattle][overridebar][vehicleui][possessbar,@vehicle,exists][shapeshift] hide; show"
371394

372395
frame:SetAttribute(
373396
"_onstate-page",

KkthnxUI/Modules/Auras/Core.lua

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,12 @@ function Module:BuildBuffFrame()
110110

111111
-- REASON: Initialize movers for custom positioning.
112112
Module.BuffFrame = Module:CreateAuraHeader("HELPFUL")
113-
Module.BuffFrame.mover =
114-
K.Mover(Module.BuffFrame, "Buffs", "BuffAnchor", { "TOPRIGHT", _G.Minimap, "TOPLEFT", -6, 0 })
113+
Module.BuffFrame.mover = K.Mover(Module.BuffFrame, "Buffs", "BuffAnchor", { "TOPRIGHT", _G.Minimap, "TOPLEFT", -6, 0 })
115114
Module.BuffFrame:ClearAllPoints()
116115
Module.BuffFrame:SetPoint("TOPRIGHT", Module.BuffFrame.mover)
117116

118117
Module.DebuffFrame = Module:CreateAuraHeader("HARMFUL")
119-
Module.DebuffFrame.mover = K.Mover(
120-
Module.DebuffFrame,
121-
"Debuffs",
122-
"DebuffAnchor",
123-
{ "TOPRIGHT", Module.BuffFrame.mover, "BOTTOMRIGHT", 0, -12 }
124-
)
118+
Module.DebuffFrame.mover = K.Mover(Module.DebuffFrame, "Debuffs", "DebuffAnchor", { "TOPRIGHT", Module.BuffFrame.mover, "BOTTOMRIGHT", 0, -12 })
125119
Module.DebuffFrame:ClearAllPoints()
126120
Module.DebuffFrame:SetPoint("TOPRIGHT", Module.DebuffFrame.mover)
127121
end
@@ -194,9 +188,9 @@ function Module:StartAuraTimer(button, timeLeft)
194188
Module.UpdateTimer(button, 0)
195189
end
196190

197-
function Module:GetSpellStat(arg16, arg17, arg18)
198-
return (arg16 > 0 and L["Versa"]) or (arg17 > 0 and L["Mastery"]) or (arg18 > 0 and L["Haste"]) or L["Crit"]
199-
end
191+
-- function Module:GetSpellStat(arg16, arg17, arg18)
192+
-- return (arg16 > 0 and L["Versa"]) or (arg17 > 0 and L["Mastery"]) or (arg18 > 0 and L["Haste"]) or L["Crit"]
193+
-- end
200194

201195
function Module:UpdateAuras(button, index)
202196
local unit, filter = button.header:GetAttribute("unit"), button.filter
@@ -231,17 +225,14 @@ function Module:UpdateAuras(button, index)
231225

232226
local count = auraData.applications
233227
if K.IsSecretValue(count) then
234-
button.count:SetText(
235-
C_UnitAuras.GetAuraApplicationDisplayCount(unit, auraData.auraInstanceID, MIN_SPELL_COUNT, MAX_SPELL_COUNT)
236-
)
228+
button.count:SetText(C_UnitAuras.GetAuraApplicationDisplayCount(unit, auraData.auraInstanceID, MIN_SPELL_COUNT, MAX_SPELL_COUNT))
237229
else
238230
local hideCount = not count or (count < MIN_SPELL_COUNT or count > MAX_SPELL_COUNT)
239231
button.count:SetText(hideCount and "" or count)
240232
end
241233

242234
if filter == "HARMFUL" then
243-
local color = C_UnitAuras.GetAuraDispelTypeColor(unit, auraData.auraInstanceID, Module.DispelColorCurve)
244-
or FALLBACK_COLOR
235+
local color = C_UnitAuras.GetAuraDispelTypeColor(unit, auraData.auraInstanceID, Module.DispelColorCurve) or FALLBACK_COLOR
245236
button.KKUI_Border:SetVertexColor(color.r, color.g, color.b)
246237
else
247238
button.KKUI_Border:SetVertexColor(1, 1, 1)
@@ -372,12 +363,7 @@ function Module:CreateAuraHeader(filter)
372363
end
373364

374365
function Module:RemoveSpellFromIgnoreList()
375-
if
376-
IsAltKeyDown()
377-
and IsControlKeyDown()
378-
and self.spellID
379-
and K.GetCharVars().AuraWatchList.IgnoreSpells[self.spellID]
380-
then
366+
if IsAltKeyDown() and IsControlKeyDown() and self.spellID and K.GetCharVars().AuraWatchList.IgnoreSpells[self.spellID] then
381367
K.GetCharVars().AuraWatchList.IgnoreSpells[self.spellID] = nil
382368
K.Print(string_format(L["RemoveFromIgnoreList"], "", self.spellID))
383369
end
@@ -421,19 +407,20 @@ function Module:CreateAuraIcon(button)
421407
button.count:SetFont(select(1, button.count:GetFont()), fontSize, select(3, button.count:GetFont()))
422408

423409
button.timer = button:CreateFontString(nil, "OVERLAY")
424-
button.timer:SetPoint("TOP", button, "BOTTOM", 1, 5)
410+
button.timer:SetPoint("TOP", button, "BOTTOM", 1, 2)
425411
button.timer:SetFontObject(K.UIFontOutline)
426412
button.timer:SetFont(select(1, button.timer:GetFont()), fontSize, select(3, button.timer:GetFont()))
427413

428414
local cd = CreateFrame("Cooldown", "$parentCooldown", button, "CooldownFrameTemplate")
429415
cd:SetReverse(true)
430-
--cd:SetEdgeTexture(DB.bgTex)
431-
--cd:SetDrawSwipe(C.db["Auras"]["CDAnimation"])
416+
cd:SetEdgeTexture("Interface\\Cooldown\\edge")
417+
cd:SetDrawSwipe(true) -- We need to push this for config later. FIX ME!
432418
cd:SetDrawBling(false)
433419
button.Cooldown = cd
434420

435421
local text = cd:GetRegions()
436-
--B.SetFontSize(text, fontSize)
422+
text:SetFontObject(K.UIFontOutline)
423+
text:SetFont(select(1, button.timer:GetFont()), fontSize, select(3, button.timer:GetFont()))
437424
text:ClearAllPoints()
438425
text:SetPoint("TOP", button, "BOTTOM", 1, 2)
439426
button.CooldownText = text

KkthnxUI/Modules/Chat/Elements/Copy.lua

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ function Module:ChatCopy_Create()
384384
configBtn:SetScript("OnClick", function(_, btn)
385385
if btn == "LeftButton" then
386386
PlaySound(111)
387-
_G.K.LibEasyMenu.Create(menuList, K.EasyMenu, configBtn, 24, 290, "MENU", 2)
387+
K.LibEasyMenu.Create(menuList, K.EasyMenu, configBtn, 24, 290, "MENU", 2)
388388
elseif btn == "RightButton" then
389389
K.NewGUI:Toggle()
390390
end
@@ -443,13 +443,7 @@ function Module:ChatCopy_Create()
443443
GameTooltip:ClearLines()
444444
GameTooltip:AddLine(string_format("%s %s", _G.FAST, _G.ROLL))
445445
GameTooltip:AddLine(" ")
446-
GameTooltip:AddDoubleLine(
447-
LEFT_BUTTON_STRING .. L["Left Click"],
448-
"Roll a random number between 1 and 100",
449-
1,
450-
1,
451-
1
452-
)
446+
GameTooltip:AddDoubleLine(LEFT_BUTTON_STRING .. L["Left Click"], "Roll a random number between 1 and 100", 1, 1, 1)
453447
GameTooltip:AddDoubleLine(RIGHT_BUTTON_STRING .. L["Right Click"], "Guaranteed to roll a perfect 100!", 1, 1, 1)
454448
GameTooltip:Show()
455449
end)

0 commit comments

Comments
 (0)