Skip to content

Commit

Permalink
10.5.1-TWW
Browse files Browse the repository at this point in the history
  • Loading branch information
Kkthnx committed Aug 22, 2024
1 parent 64943c5 commit 954a69e
Show file tree
Hide file tree
Showing 16 changed files with 182 additions and 417 deletions.
28 changes: 28 additions & 0 deletions KkthnxUI/Config/Elements/FilterLists/Changelog.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
local K = KkthnxUI[1]

local KKUI_Changelog = {
{
Version = "[10.5.1] - 2024-08-22 - Patch 11.0",
General = "This update includes various performance optimizations across the codebase to improve maintainability and efficiency. These optimizations enhance overall functionality and responsiveness.",

Sections = {

{
Header = "Optimization",
Entries = {
"Implemented global caching for frequently used functions and API calls to reduce redundant operations and improve performance.",
"Optimized the LossOfControl frame reskinning process to ensure better performance and code clarity.",
"Streamlined the header reskinning function for ObjectiveTracker, reducing code duplication and improving efficiency.",
"Improved tooltip handling for mount sources and auras, optimizing lookup processes and reducing performance impact.",
},
},

{
Header = "Bug Fixes",
Entries = {
"Fixed an issue with an empty icon in the aura watch caused by incorrect calls being used.",
"Fixed the `ExpansionLandingPageMinimapButton` not working on right-click.",
"Fixed the minimap tracking icon always being shown.",
"Fixed the tracking menu not opening with a right-click on the minimap tracking button.",
},
},
},
},

{
Version = "[10.5.0] - 2024-08-22 - Patch 11.0",
General = "The KkthnxUI has been updated to align with The War Within expansion. Stay engaged with the community on Discord for the latest developments, updates, and discussions.",
Expand Down
3 changes: 1 addition & 2 deletions KkthnxUI/Core/API.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ local function CreateBorder(bFrame, ...)
end

local bSubLevel, bLayer, bSize, bTexture, bOffset, bColor, bgTexture, bgSubLevel, bgLayer, bgPoint, bgColor = ...
local General = C.General
local Media = C.Media
local General, Media = C.General, C.Media
local BorderValue = General.BorderStyle.Value or "KkthnxUI"
local BorderSize = bSize or (BorderValue == "KkthnxUI" and 12 or 10)

Expand Down
24 changes: 13 additions & 11 deletions KkthnxUI/Core/Border.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local K, C = KkthnxUI[1], KkthnxUI[2]
local Module = {}

local type, unpack = type, unpack
local type, unpack, setmetatable, pairs, error = type, unpack, setmetatable, pairs, error

local objectToWidgets = setmetatable({}, { __index = objectToWidgets })

Expand All @@ -17,13 +17,12 @@ local borderSections = {
}

local borderStyle = C["General"].BorderStyle.Value

local function getBorderSize()
return borderStyle == "KkthnxUI" and 12 or 10
end
local borderSizeKkthnx = 12
local borderSizeDefault = 10
local getBorderSize = (borderStyle == "KkthnxUI") and borderSizeKkthnx or borderSizeDefault

local function getTile(border, w, h)
return (w + 2 * border.__offset) / getBorderSize()
return (w + 2 * border.__offset) / getBorderSize
end

local function setTextureCoordinates(border, tile)
Expand All @@ -50,12 +49,13 @@ function Module:SetOffset(offset)
end

function Module:SetTexture(texture)
local len = #borderSections
if type(texture) == "table" then
for _, v in pairs(borderSections) do
for i = 1, len do
local v = borderSections[i]
self[v.name]:SetColorTexture(unpack(texture))
end
else
local len = #borderSections
for i = 1, len do
local v = borderSections[i]
if i > 4 then
Expand Down Expand Up @@ -86,7 +86,8 @@ function Module:SetSize(size)
end
end

onSizeChanged(self.__parent, self.__parent:GetWidth(), self.__parent:GetHeight())
local parentWidth, parentHeight = self.__parent:GetWidth(), self.__parent:GetHeight()
onSizeChanged(self.__parent, parentWidth, parentHeight)
end

function Module:Hide()
Expand Down Expand Up @@ -136,7 +137,8 @@ function K:CreateBorder(drawLayer, drawSubLevel)
local border = setmetatable({}, { __index = Module })
border.__parent = self

for _, section in pairs(borderSections) do
for i = 1, #borderSections do
local section = borderSections[i]
border[section.name] = self:CreateTexture(nil, drawLayer or "OVERLAY", nil, drawSubLevel or 1)
border[section.name]:SetTexCoord(unpack(section.coord))
end
Expand All @@ -158,7 +160,7 @@ function K:CreateBorder(drawLayer, drawSubLevel)
objectToWidgets[self] = border

border:SetOffset(-4)
border:SetSize(getBorderSize())
border:SetSize(getBorderSize)

return border
end
2 changes: 1 addition & 1 deletion KkthnxUI/KkthnxUI.toc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
## Title: |cff669DFFKkthnxUI|r
## Notes: Empty toc for Curseforge
## Author: Josh "Kkthnx" Russell
## Version: 10.5.0
## Version: 10.5.1
## IconTexture: Interface\AddOns\KkthnxUI\Media\KkthnxUI_Spell_Icon
## X-Support: TWW
2 changes: 1 addition & 1 deletion KkthnxUI/KkthnxUI_Mainline.toc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Title: |cff669DFFKkthnxUI|r
## 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
## Author: Josh "Kkthnx" Russell
## Version: 10.5.0
## Version: 10.5.1
## IconTexture: Interface\AddOns\KkthnxUI\Media\KkthnxUI_Spell_Icon
## X-Support: TWW
## SavedVariables: KkthnxUIDB
Expand Down
99 changes: 46 additions & 53 deletions KkthnxUI/Modules/Auras/Elements/AuraWatch.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ local table_insert = table.insert
local table_remove = table.remove
local table_wipe = table.wipe

local C_Item_GetItemInfo = C_Item.GetItemInfo
local C_Spell_GetSpellCharges = C_Spell.GetSpellCharges
local C_Spell_GetSpellCooldown = C_Spell.GetSpellCooldown
local C_Spell_GetSpellName = C_Spell.GetSpellName
local C_Spell_GetSpellTexture = C_Spell.GetSpellTexture
local CreateFrame = CreateFrame
local GameTooltip = GameTooltip
local GetInventoryItemCooldown = GetInventoryItemCooldown
local GetInventoryItemLink = GetInventoryItemLink
local GetItemInfo = C_Item.GetItemInfo
local GetPlayerInfoByGUID = GetPlayerInfoByGUID
local GetSpellCharges = C_Spell.GetSpellCharges
local GetTime = GetTime
local GetTotemInfo = GetTotemInfo
local InCombatLockdown = InCombatLockdown
Expand All @@ -27,10 +30,12 @@ local UnitInParty = UnitInParty
local UnitInRaid = UnitInRaid
local UnitName = UnitName

local maxFrames = 12 -- Max Tracked Auras
-- Constants
local maxFrames = 12
local hasCentralize
local auraWatchUpdater = CreateFrame("Frame")

-- Pre-allocate tables
local auraWatchUpdater = CreateFrame("Frame")
local AuraList = {}
local FrameList = {}
local UnitIDTable = {}
Expand All @@ -39,7 +44,7 @@ local IntCD = {}
local myTable = {}
local cooldownTable = {}

-- DataConvert
-- Data conversion
local function DataAnalyze(v)
local newTable = {}
if type(v[1]) == "number" then
Expand All @@ -63,15 +68,13 @@ local function DataAnalyze(v)
newTable.Text = v[9]
newTable.Flash = v[10]
end

return newTable
end

local function InsertData(index, target)
if KkthnxUIDB.Variables[K.Realm][K.Name].AuraWatchList.Switcher[index] then
table_wipe(target)
end

for spellID, v in pairs(myTable[index]) do
local value = target[spellID]
if value and value.AuraID == v.AuraID then
Expand All @@ -84,27 +87,21 @@ end
local function ConvertTable()
for i = 1, 10 do
myTable[i] = {}
if i < 10 then
local value = KkthnxUIDB.Variables[K.Realm][K.Name].AuraWatchList[i]
if value and next(value) then
for spellID, v in pairs(value) do
myTable[i][spellID] = DataAnalyze(v)
end
end
else
if next(KkthnxUIDB.Variables[K.Realm][K.Name].InternalCD) then
for spellID, v in pairs(KkthnxUIDB.Variables[K.Realm][K.Name].InternalCD) do
myTable[i][spellID] = DataAnalyze(v)
end
local value = KkthnxUIDB.Variables[K.Realm][K.Name].AuraWatchList[i]
if value and next(value) then
for spellID, v in pairs(value) do
myTable[i][spellID] = DataAnalyze(v)
end
end
end

for _, v in pairs(C.AuraWatchList[K.Class]) do
-- if v.Name == "Player Aura" then
-- InsertData(1, v.List)
-- elseif v.Name == "Target Aura" then
-- InsertData(3, v.List)
local internalCD = KkthnxUIDB.Variables[K.Realm][K.Name].InternalCD
if next(internalCD) then
for spellID, v in pairs(internalCD) do
myTable[10][spellID] = DataAnalyze(v)
end
end
local auraWatchList = C.AuraWatchList[K.Class]
for _, v in pairs(auraWatchList) do
if v.Name == "Special Aura" then
InsertData(2, v.List)
elseif v.Name == "Focus Aura" then
Expand All @@ -113,8 +110,8 @@ local function ConvertTable()
InsertData(6, v.List)
end
end

for i, v in pairs(C.AuraWatchList["ALL"]) do
local allAuras = C.AuraWatchList["ALL"]
for i, v in pairs(allAuras) do
if v.Name == "Enchant Aura" then
InsertData(7, v.List)
elseif v.Name == "Raid Buff" then
Expand All @@ -126,19 +123,16 @@ local function ConvertTable()
elseif v.Name == "InternalCD" then
InsertData(10, v.List)
IntCD = v
table_remove(C.AuraWatchList["ALL"], i)
table_remove(allAuras, i)
end
end
end

local function BuildAuraList()
AuraList = C.AuraWatchList["ALL"] or {}
for class in pairs(C.AuraWatchList) do
if class == K.Class then
for _, value in pairs(C.AuraWatchList[class]) do
table_insert(AuraList, value)
end
end
local classAuras = C.AuraWatchList[K.Class]
for _, value in pairs(classAuras) do
table_insert(AuraList, value)
end
table_wipe(C.AuraWatchList)
end
Expand All @@ -150,11 +144,10 @@ local function BuildUnitIDTable()
existingUnits[v] = true
end
end

for _, VALUE in pairs(AuraList) do
if VALUE and VALUE.List then
if VALUE.List then
for _, value in pairs(VALUE.List) do
if value and value.UnitID and not existingUnits[value.UnitID] then
if value.UnitID and not existingUnits[value.UnitID] then
existingUnits[value.UnitID] = true
table_insert(UnitIDTable, value.UnitID)
end
Expand All @@ -165,11 +158,10 @@ end

local function BuildCooldownTable()
table_wipe(cooldownTable)

for KEY, VALUE in pairs(AuraList) do
if VALUE and VALUE.List then
if VALUE.List then
for spellID, value in pairs(VALUE.List) do
if value and (value.SpellID and IsPlayerSpell(value.SpellID)) or value.ItemID or value.SlotID or value.TotemID then
if (value.SpellID and IsPlayerSpell(value.SpellID)) or value.ItemID or value.SlotID or value.TotemID then
if not cooldownTable[KEY] then
cooldownTable[KEY] = {}
end
Expand All @@ -196,7 +188,7 @@ local function tooltipOnEnter(self)
if self.type == 1 then
GameTooltip:SetSpellByID(self.spellID)
elseif self.type == 2 then
GameTooltip:SetHyperlink(select(2, GetItemInfo(self.spellID)))
GameTooltip:SetHyperlink(select(2, C_Item_GetItemInfo(self.spellID)))
elseif self.type == 3 then
GameTooltip:SetInventoryItem("player", self.spellID)
elseif self.type == 4 then
Expand Down Expand Up @@ -462,10 +454,10 @@ function Module:AuraWatch_UpdateCD()
local value = group.List[spellID]
if value then
if value.SpellID then
local name, _, icon = C_Spell.GetSpellName(value.SpellID)
local start = C_Spell.GetSpellCooldown(value.SpellID).startTime
local duration = C_Spell.GetSpellCooldown(value.SpellID).duration
local charges, maxCharges, chargeStart, chargeDuration = GetSpellCharges(value.SpellID)
local name, icon = C_Spell_GetSpellName(value.SpellID), C_Spell_GetSpellTexture(value.SpellID)
local start = C_Spell_GetSpellCooldown(value.SpellID).startTime
local duration = C_Spell_GetSpellCooldown(value.SpellID).duration
local charges, maxCharges, chargeStart, chargeDuration = C_Spell_GetSpellCharges(value.SpellID)
if group.Mode == "ICON" then
name = nil
end
Expand All @@ -478,7 +470,7 @@ function Module:AuraWatch_UpdateCD()
elseif value.ItemID then
local start, duration = C_Item.GetItemCooldown(value.ItemID)
if start and duration > 3 then
local name, _, _, _, _, _, _, _, _, icon = GetItemInfo(value.ItemID)
local name, _, _, _, _, _, _, _, _, icon = C_Item_GetItemInfo(value.ItemID)
if group.Mode == "ICON" then
name = nil
end
Expand All @@ -489,7 +481,7 @@ function Module:AuraWatch_UpdateCD()
if link then
local itemID = GetItemInfoFromHyperlink(link)
if not Module.IgnoredItems[itemID] then
local name, _, _, _, _, _, _, _, _, icon = GetItemInfo(link)
local name, _, _, _, _, _, _, _, _, icon = C_Item_GetItemInfo(link)
local start, duration = GetInventoryItemCooldown("player", value.SlotID)
if duration > 1.5 then
if group.Mode == "ICON" then
Expand All @@ -515,11 +507,12 @@ end

-- UpdateAura
local replacedTexture = {
[336892] = 135130, -- 无懈警戒换成瞄准射击图标
[378770] = 236174, -- 夺命打击换成夺命射击图标
[389020] = 132330, -- 子弹风暴换成多重射击
[378747] = 132176, -- 凶暴兽群换成杀戮命令
[336892] = 135130, -- Change (Unyielding Vigil) to the Aimed Shot icon
[378770] = 236174, -- Change (Killing Strike) to the Kill Shot icon
[389020] = 132330, -- Change (Bullet Storm) to the Multi-Shot icon
[378747] = 132176, -- Change (Frenzied Pack) to the Kill Command icon
}

function Module:AuraWatch_SetupAura(KEY, unit, index, filter, name, icon, count, duration, expires, spellID, flash)
if not KEY then
return
Expand Down Expand Up @@ -694,11 +687,11 @@ function Module:AuraWatch_SetupInt(intID, itemID, duration, unitID, guid, source

local name, icon, _, class
if itemID then
name, _, _, _, _, _, _, _, _, icon = GetItemInfo(itemID)
name, _, _, _, _, _, _, _, _, icon = C_Item_GetItemInfo(itemID)
frame.type = 2
frame.spellID = itemID
else
name, _, icon = C_Spell.GetSpellName(intID)
name, icon = C_Spell_GetSpellName(intID), C_Spell_GetSpellTexture(intID)
frame.type = 1
frame.spellID = intID
end
Expand Down
1 change: 0 additions & 1 deletion KkthnxUI/Modules/Load_Modules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@
<Include file="Skins\Blizzard\FrameXML\GhostFrame.lua" />
<Include file="Skins\Blizzard\FrameXML\LossOfControlFrame.lua" />
<Include file="Skins\Blizzard\FrameXML\ObjectiveTracker.lua" />
<Include file="Skins\Blizzard\FrameXML\SpellBookFrame.lua" />
<Include file="Skins\Blizzard\FrameXML\StaticPopup.lua" />
<Include file="Skins\Blizzard\FrameXML\UIDropDownMenu.lua" />
<Include file="Skins\Blizzard\FrameXML\UIWidgets.lua" />
Expand Down
Loading

0 comments on commit 954a69e

Please sign in to comment.