Skip to content

Commit e5be1ba

Browse files
committed
More Early Access Updates and Fixes
1 parent 195f2a5 commit e5be1ba

File tree

5 files changed

+132
-52
lines changed

5 files changed

+132
-52
lines changed

KkthnxUI/Core/CheckVersion.lua

+123-35
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,47 @@ local string_format = string.format
88
local string_gsub = string.gsub
99
local string_split = string.split
1010
local tonumber = tonumber
11-
12-
local Ambiguate = Ambiguate
13-
local C_ChatInfo_RegisterAddonMessagePrefix = C_ChatInfo.RegisterAddonMessagePrefix
14-
local C_ChatInfo_SendAddonMessage = C_ChatInfo.SendAddonMessage
11+
local CreateFrame = CreateFrame
1512
local GetTime = GetTime
13+
local Ambiguate = Ambiguate
1614
local IsInGroup = IsInGroup
1715
local IsInGuild = IsInGuild
16+
local IsInRaid = IsInRaid
17+
local IsPartyLFG = IsPartyLFG
18+
local print = print
19+
20+
local C_ChatInfo_RegisterAddonMessagePrefix = C_ChatInfo.RegisterAddonMessagePrefix
21+
local C_ChatInfo_SendAddonMessage = C_ChatInfo.SendAddonMessage
1822

19-
local lastVCTime, isVCInit = 0
2023
local tn = tonumber
24+
local lastVCTime, isVCInit = 0
25+
local debugTest = false
2126

22-
local function HandleVersonTag(version)
23-
local major, minor = strsplit(".", version)
27+
-- Debugging function to track issues
28+
local function DebugLog(message)
29+
if K.isDeveloper and debugTest then
30+
print("|cffFF0000[DEBUG]:|r " .. message)
31+
end
32+
end
33+
34+
local function HandleVersonTag(version, author)
35+
local major, minor = string_split(".", version)
2436
major, minor = tn(major), tn(minor)
37+
2538
if K.LibBase64:CV(major) then
2639
major, minor = 0, 0
2740
if K.isDeveloper and author then
28-
print("Moron: " .. author)
41+
DebugLog("Invalid version from author: " .. author)
2942
end
3043
end
44+
3145
return major, minor
3246
end
3347

3448
function Module:VersionCheck_Compare(new, old, author)
3549
local new1, new2 = HandleVersonTag(new, author)
3650
local old1, old2 = HandleVersonTag(old)
51+
3752
if new1 > old1 or (new1 == old1 and new2 > old2) then
3853
return "IsNew"
3954
elseif new1 < old1 or (new1 == old1 and new2 < old2) then
@@ -43,32 +58,69 @@ end
4358

4459
function Module:CreateUpdateNoticeFrame()
4560
local frame = CreateFrame("Frame", "KKUI_UpdateNotice", UIParent)
46-
frame:SetSize(420, 150)
61+
frame:SetSize(420, 180)
4762
frame:SetPoint("CENTER", UIParent, "CENTER")
4863
frame:CreateBorder()
4964

65+
-- Set background texture to 'adventureguide-pane-small'
66+
frame.Background = frame:CreateTexture(nil, "BACKGROUND")
67+
frame.Background:SetAtlas("adventureguide-pane-small")
68+
frame.Background:SetAllPoints(frame)
69+
frame.Background:SetBlendMode("ADD")
70+
5071
frame.Texture = frame:CreateTexture(nil, "OVERLAY")
5172
frame.Texture:SetTexture("Interface\\HELPFRAME\\HelpIcon-ReportAbuse")
52-
frame.Texture:SetPoint("TOP", frame, "TOP", 0, 8)
73+
frame.Texture:SetPoint("TOP", frame, "TOP", 0, -4)
5374

5475
frame.Text = frame:CreateFontString(nil, "OVERLAY")
5576
frame.Text:SetWidth(400)
5677
frame.Text:SetFontObject(K.UIFont)
5778
frame.Text:SetFont(select(1, frame.Text:GetFont()), 15, select(3, frame.Text:GetFont()))
58-
frame.Text:SetPoint("CENTER", frame, "CENTER")
79+
frame.Text:SetPoint("TOP", frame, "TOP", 0, -70)
5980

60-
frame.EditBox = CreateFrame("EditBox", nil, frame)
61-
frame.EditBox:SetPoint("BOTTOM", frame, "BOTTOM", 0, 8)
62-
frame.EditBox:SetWidth(330)
63-
frame.EditBox:SetHeight(19)
64-
frame.EditBox:SetMultiLine(false)
65-
frame.EditBox:SetAutoFocus(false)
66-
frame.EditBox:SetFontObject(K.UIFont)
67-
frame.EditBox:CreateBorder()
81+
-- CurseForge link
82+
frame.CurseLink = CreateFrame("EditBox", nil, frame)
83+
frame.CurseLink:SetPoint("CENTER", frame, "CENTER", 0, -40)
84+
frame.CurseLink:SetWidth(330)
85+
frame.CurseLink:SetHeight(19)
86+
frame.CurseLink:SetMultiLine(false)
87+
frame.CurseLink:SetAutoFocus(false)
88+
frame.CurseLink:SetFontObject(K.UIFont)
89+
frame.CurseLink:SetText("https://www.curseforge.com/wow/addons/kkthnxui")
90+
frame.CurseLink:CreateBorder()
6891

69-
frame.EditBox.Text = frame.EditBox:CreateFontString(nil, "OVERLAY")
70-
frame.EditBox.Text:SetFontObject(K.UIFont)
71-
frame.EditBox.Text:SetPoint("BOTTOM", frame.EditBox, "TOP", 0, 2)
92+
-- Tooltip for CurseForge link
93+
frame.CurseLink:SetScript("OnEnter", function()
94+
GameTooltip:SetOwner(frame.CurseLink, "ANCHOR_TOP")
95+
GameTooltip:AddLine("CurseForge Link", 1, 1, 1)
96+
GameTooltip:AddLine("This is the stable release version.", 0.7, 0.7, 0.7)
97+
GameTooltip:Show()
98+
end)
99+
frame.CurseLink:SetScript("OnLeave", function()
100+
GameTooltip:Hide()
101+
end)
102+
103+
-- GitHub link
104+
frame.GitHubLink = CreateFrame("EditBox", nil, frame)
105+
frame.GitHubLink:SetPoint("CENTER", frame, "CENTER", 0, -70)
106+
frame.GitHubLink:SetWidth(330)
107+
frame.GitHubLink:SetHeight(19)
108+
frame.GitHubLink:SetMultiLine(false)
109+
frame.GitHubLink:SetAutoFocus(false)
110+
frame.GitHubLink:SetFontObject(K.UIFont)
111+
frame.GitHubLink:SetText("https://github.com/Kkthnx-Wow/KkthnxUI")
112+
frame.GitHubLink:CreateBorder()
113+
114+
-- Tooltip for GitHub link
115+
frame.GitHubLink:SetScript("OnEnter", function()
116+
GameTooltip:SetOwner(frame.GitHubLink, "ANCHOR_TOP")
117+
GameTooltip:AddLine("GitHub Link", 1, 1, 1)
118+
GameTooltip:AddLine("This is the bleeding edge version and may contain bugs.", 0.7, 0.7, 0.7)
119+
GameTooltip:Show()
120+
end)
121+
frame.GitHubLink:SetScript("OnLeave", function()
122+
GameTooltip:Hide()
123+
end)
72124

73125
frame.OkayButton = CreateFrame("Button", nil, frame)
74126
frame.OkayButton:SetPoint("TOP", frame, "BOTTOM", 0, -6)
@@ -80,29 +132,29 @@ function Module:CreateUpdateNoticeFrame()
80132
end
81133
end)
82134

135+
-- Set background texture to 'GarrMissionLocation-Maw-ButtonBG'
136+
frame.Background = frame:CreateTexture(nil, "BACKGROUND")
137+
frame.Background:SetAtlas("GarrMissionLocation-Maw-ButtonBG")
138+
frame.Background:SetAllPoints(frame.OkayButton)
139+
frame.Background:SetBlendMode("ADD")
140+
83141
frame.OkayButton.Text = frame.OkayButton:CreateFontString(nil, "ARTWORK")
84142
frame.OkayButton.Text:SetFontObject(K.UIFont)
85143
frame.OkayButton.Text:SetFont(select(1, frame.OkayButton.Text:GetFont()), 13, select(3, frame.OkayButton.Text:GetFont()))
86144
frame.OkayButton.Text:SetText("I am going to update right now")
87145
frame.OkayButton.Text:SetTextColor(0, 1, 0)
88146
frame.OkayButton.Text:SetPoint("CENTER", frame.OkayButton, "CENTER", 0, 0)
89-
K.AddTooltip(frame.OkayButton, "ANCHOR_BOTTOM", K.SystemColor .. "Obviously |cff669dffKkthnx|r is trusting you to go update and not complain about a missing feature or a bug because you are out of date |CFFFF0000<3|r")
147+
K.AddTooltip(frame.OkayButton, "ANCHOR_BOTTOM", K.SystemColor .. "Please update to the latest version!")
90148

91149
return frame
92150
end
93151

94152
function Module:VersionCheck_Create(text)
95153
if not C["General"].VersionCheck then
154+
DebugLog("VersionCheck is disabled in settings.")
96155
return
97156
end
98157

99-
-- HelpTip:Show(ChatFrame1, {
100-
-- text = text,
101-
-- buttonStyle = HelpTip.ButtonStyle.Okay,
102-
-- targetPoint = HelpTip.Point.TopEdgeCenter,
103-
-- offsetY = 10,
104-
-- })
105-
106158
local frame = Module:CreateUpdateNoticeFrame()
107159
frame.Text:SetText(text)
108160
frame:Show()
@@ -111,59 +163,95 @@ end
111163
function Module:VersionCheck_Init()
112164
if not isVCInit then
113165
local status = Module:VersionCheck_Compare(KkthnxUIDB.DetectVersion, K.Version)
166+
114167
if status == "IsNew" then
115-
local release = gsub(KkthnxUIDB.DetectVersion, "(%d+)$", "0")
116-
Module:VersionCheck_Create(format("|cff669dffKkthnxUI|r is out of date, the latest release is |cff70C0F5%s|r", release))
168+
local release = string_gsub(KkthnxUIDB.DetectVersion, "(%d+)$", "0")
169+
Module:VersionCheck_Create(string_format("|cff669dffKkthnxUI|r is out of date!|nPlease update to the latest version: |cff70C0F5%s|r.", release))
117170
elseif status == "IsOld" then
118171
KkthnxUIDB.DetectVersion = K.Version
119172
end
120173

121174
isVCInit = true
175+
DebugLog("VersionCheck initialized.")
176+
else
177+
DebugLog("VersionCheck already initialized.")
122178
end
123179
end
124180

125181
function Module:VersionCheck_Send(channel)
126182
if GetTime() - lastVCTime >= 10 then
127183
C_ChatInfo_SendAddonMessage("KKUIVersionCheck", KkthnxUIDB.DetectVersion, channel)
128184
lastVCTime = GetTime()
185+
DebugLog("VersionCheck message sent to channel: " .. channel)
186+
else
187+
DebugLog("VersionCheck message not sent due to cooldown.")
129188
end
130189
end
131190

132-
function Module:VersionCheck_Update(...)
133-
local prefix, msg, distType, author = ...
191+
function Module:VersionCheck_Update(prefix, msg, distType, author)
134192
if prefix ~= "KKUIVersionCheck" then
135193
return
136194
end
195+
137196
if Ambiguate(author, "none") == K.Name then
197+
DebugLog("VersionCheck ignored message from self.")
138198
return
139199
end
140200

141201
local status = Module:VersionCheck_Compare(msg, KkthnxUIDB.DetectVersion, author)
202+
142203
if status == "IsNew" then
143204
KkthnxUIDB.DetectVersion = msg
205+
DebugLog("Detected new version: " .. msg)
144206
elseif status == "IsOld" then
145207
Module:VersionCheck_Send(distType)
208+
DebugLog("Detected outdated version. Sending current version to: " .. distType)
146209
end
147210

148211
Module:VersionCheck_Init()
149212
end
150213

151214
function Module:VersionCheck_UpdateGroup()
152215
if not IsInGroup() then
216+
DebugLog("Not in a group, skipping version check.")
153217
return
154218
end
155-
Module:VersionCheck_Send(IsPartyLFG() and "INSTANCE_CHAT" or IsInRaid() and "RAID" or "PARTY")
219+
220+
local channel = IsPartyLFG() and "INSTANCE_CHAT" or IsInRaid() and "RAID" or "PARTY"
221+
Module:VersionCheck_Send(channel)
156222
end
157223

158224
function Module:OnEnable()
159225
Module:VersionCheck_Init()
226+
160227
C_ChatInfo_RegisterAddonMessagePrefix("KKUIVersionCheck")
161228
K:RegisterEvent("CHAT_MSG_ADDON", Module.VersionCheck_Update)
162229

163230
if IsInGuild() then
164231
C_ChatInfo_SendAddonMessage("KKUIVersionCheck", K.Version, "GUILD")
165232
lastVCTime = GetTime()
233+
DebugLog("VersionCheck message sent to guild.")
166234
end
235+
167236
Module:VersionCheck_UpdateGroup()
168237
K:RegisterEvent("GROUP_ROSTER_UPDATE", Module.VersionCheck_UpdateGroup)
169238
end
239+
240+
-- Add this function to manually trigger a test of the version check frame
241+
function Module:VersionCheck_Test()
242+
-- Fake version for testing purposes
243+
local fakeVersion = "9.9.9"
244+
245+
-- Force the creation of the update notice frame with fake text
246+
local fakeText = string_format("|cff669dffKkthnxUI|r is out of date!|nPlease update to the latest version: |cff70C0F5%s|r.", fakeVersion)
247+
Module:VersionCheck_Create(fakeText)
248+
249+
-- Print debug message for testing
250+
DebugLog("Triggered VersionCheck test with version: " .. fakeVersion)
251+
end
252+
253+
-- Add a slash command to manually trigger the test during runtime
254+
SLASH_KKUI_VERSIONCHECK1 = "/vctest"
255+
SlashCmdList["KKUI_VERSIONCHECK"] = function()
256+
Module:VersionCheck_Test()
257+
end

KkthnxUI/KkthnxUI.toc

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
## Title: |cff669DFFKkthnxUI|r
44
## Notes: Empty toc for Curseforge
55
## Author: Josh "Kkthnx" Russell
6-
## Version: 10.5.1
6+
## Version: 10.5.2
77
## IconTexture: Interface\AddOns\KkthnxUI\Media\KkthnxUI_Spell_Icon
88
## X-Support: TWW

KkthnxUI/KkthnxUI_Mainline.toc

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Title: |cff669DFFKkthnxUI|r
44
## Notes: Enhances the game's user interface (UI) by providing a clean, minimalist design and a range of customizable features.|n|n|cff669DFFDeveloper|cffffffff:|r |nJosh "|CFF7b8489Kkthnx|r" Russell|n|n|cff009cdePayPal|r|cffffffff:|r |n|cffffffffwww.paypal.me/KkthnxTV|r|n|n|cfff96854Patreon|r|cffffffff:|r |n|cffffffffwww.patreon.com/Kkthnx|r
55
## Author: Josh "Kkthnx" Russell
6-
## Version: 10.5.1
6+
## Version: 10.5.2
77
## IconTexture: Interface\AddOns\KkthnxUI\Media\KkthnxUI_Spell_Icon
88
## X-Support: TWW
99
## SavedVariables: KkthnxUIDB

KkthnxUI/Modules/Maps/Elements/CollectButtons.lua

+5
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ function Module:CreateRecycleBin()
8686
local ignoredButtons = {
8787
["GatherMatePin"] = true,
8888
["HandyNotes.-Pin"] = true,
89+
["TTMinimapButton"] = true,
8990
}
9091

9192
local function isButtonIgnored(name)
@@ -167,6 +168,10 @@ function Module:CreateRecycleBin()
167168
child:SetScript("OnMouseUp", nil)
168169
elseif name == "BagSync_MinimapButton" then
169170
child:HookScript("OnMouseUp", clickFunc)
171+
elseif name == "WIM3MinimapButton" then
172+
child.SetParent = K.Noop
173+
child:SetFrameStrata("DIALOG")
174+
child.SetFrameStrata = K.Noop
170175
end
171176

172177
child.styled = true

KkthnxUI/Modules/UnitFrames/Elements/Tags.lua

+2-15
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ oUF.Tags.Methods["pppower"] = function(unit)
278278
end
279279
oUF.Tags.Events["pppower"] = "UNIT_POWER_FREQUENT UNIT_MAXPOWER UNIT_DISPLAYPOWER"
280280

281-
local PatchInfoCheck = select(4, GetBuildInfo()) >= 110000 -- 11.0.0
282281
local NameOnlyGuild = false
283282
local NameOnlyTitle = true
284283
oUF.Tags.Methods["npctitle"] = function(unit)
@@ -292,23 +291,11 @@ oUF.Tags.Methods["npctitle"] = function(unit)
292291
scanTip:SetOwner(UIParent, "ANCHOR_NONE")
293292
scanTip:SetUnit(unit)
294293

295-
local title = _G[format("KKUI_ScanTooltipTextLeft%d", GetCVarBool("colorblindmode") and 3 or 2)]:GetText()
294+
local textLine = _G[format("KKUI_ScanTooltipTextLeft%d", GetCVarBool("colorblindmode") and 3 or 2)]
295+
local title = textLine and textLine:GetText()
296296
if title and not strfind(title, "^" .. LEVEL) then
297297
return title
298298
end
299-
300-
-- local data = not PatchInfoCheck and C_TooltipInfo.GetUnit(unit) -- FIXME: ColorMixin error
301-
-- if not data then
302-
-- return ""
303-
-- end
304-
305-
-- local lineData = data.lines[GetCVarBool("colorblindmode") and 3 or 2]
306-
-- if lineData then
307-
-- local title = lineData.leftText
308-
-- if title and not strfind(title, "^" .. LEVEL) then
309-
-- return title
310-
-- end
311-
-- end
312299
end
313300
end
314301
oUF.Tags.Events["npctitle"] = "UNIT_NAME_UPDATE"

0 commit comments

Comments
 (0)