Skip to content

Commit

Permalink
TWW Update
Browse files Browse the repository at this point in the history
  • Loading branch information
d87 committed Aug 28, 2024
1 parent 925872d commit b26a516
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,8 @@ globals = {
"tAppendAll",
"GetInstanceInfo",
"C_PvP",
"C_UnitAuras",
"AuraUtil",
"C_Spell",
"Settings",
}
85 changes: 85 additions & 0 deletions Frame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,91 @@ local function FloatingIconHeader_Reconfigure(hdr, unit)
hdr:SetSize(dbh.auraSize, dbh.auraSize)
end


local CreateFramePool = nil
do
local ObjectPool = {
-- creationFunc = function(self)
-- return self.parent:CreateMaskTexture()
-- end,
-- resetterFunc = function(self, mask)
-- mask:Hide()
-- mask:ClearAllPoints()
-- end,
AddObject = function(self, object)
local dummy = true
self.activeObjects[object] = dummy
self.activeObjectCount = self.activeObjectCount + 1
end,
ReclaimObject = function(self, object)
tinsert(self.inactiveObjects, object)
self.activeObjects[object] = nil
self.activeObjectCount = self.activeObjectCount - 1
end,
Release = function(self, object)
local active = self.activeObjects[object] ~= nil
if active then
self:resetterFunc(object)
self:ReclaimObject(object)
end
return active
end,
Acquire = function(self)
local object = tremove(self.inactiveObjects)
local new = object == nil
if new then
object = self:creationFunc()
self:resetterFunc(object, new)
end
self:AddObject(object)
return object, new
end,
ReleaseAll = function(self)
for obj in pairs(self.activeObjects) do
self:Release(obj);
end
end,
Init = function(self, parent)
self.activeObjects = {}
self.inactiveObjects = {}
self.activeObjectCount = 0
self.parent = parent
end
}

local function Pool_HideAndClearAnchors(framePool, frame)
frame:Hide();
frame:ClearAllPoints();
end
local TextureDefaultReset = Pool_HideAndClearAnchors
local TextureDefaultCreate = function(texturePool)
return texturePool.parent:CreateTexture(nil, texturePool.layer, texturePool.textureTemplate, texturePool.subLayer);
end
-- local FrameDefaultResetter = Pool_HideAndClearAnchors

-- local function CreateTexturePool(parent, layer, subLayer, textureTemplate, resetterFunc)
-- local texturePool = setmetatable({}, { __index = ObjectPool })
-- texturePool:Init(parent)

-- texturePool.layer = layer;
-- texturePool.subLayer = subLayer;
-- texturePool.textureTemplate = textureTemplate;
-- texturePool.creationFunc = TextureDefaultCreate
-- texturePool.resetterFunc = TextureDefaultReset

-- return texturePool;
-- end

CreateFramePool = function(frameType, parent, frameTemplate, resetterFunc)
local framePool = setmetatable({}, { __index = ObjectPool })
framePool:Init(parent)
framePool.frameType = frameType;
framePool.frameTemplate = frameTemplate;
framePool.resetterFunc = resetterFunc or Pool_HideAndClearAnchors
return framePool
end
end

function NugPlateAuras:CreateFloatingIconPool(parent)
local hdr = CreateFrame("Frame", "$parentNPAHeaderBuffGains", parent)

Expand Down
24 changes: 24 additions & 0 deletions NugPlateAuras-Cata.toc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## Interface: 40400

## Title: NugPlateAuras
## SavedVariables: NugPlateAurasDB
## Author: d87
## OptionalDeps: Masque

## X-WoWI-ID: 25439
## X-Curse-Project-ID: 351554
## X-Wago-ID: RXKqnDGy

Libs\LibStub\LibStub.lua
Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua
Libs\AceGUI-3.0\AceGUI-3.0.xml
Libs\AceConfig-3.0\AceConfig-3.0.xml
Libs\AceDB-3.0\AceDB-3.0.xml
Libs\LibAuraTypes\LibAuraTypes.lua
Libs\LibSpellLocks\LibSpellLocks.lua
Libs\LibCustomGlow\LibCustomGlow-1.0.xml

NugPlateAuras.lua
Frame.lua
Options.lua
Migrations.lua
2 changes: 1 addition & 1 deletion NugPlateAuras-Mainline.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Interface: 100105
## Interface: 110000

## Title: NugPlateAuras
## SavedVariables: NugPlateAurasDB
Expand Down
35 changes: 34 additions & 1 deletion NugPlateAuras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,18 @@ local Masque = LibStub("Masque", true)
local MasqueGroup
NugPlateAuras:RegisterEvent("ADDON_LOADED")

local GetAuraDataByIndex = C_UnitAuras.GetAuraDataByIndex
local UnpackAuraData = AuraUtil.UnpackAuraData
local DeprecatedUnitAura = function(unitToken, index, filter)
local auraData = GetAuraDataByIndex(unitToken, index, filter);
if not auraData then
return nil;
end

return UnpackAuraData(auraData);
end

local UnitAura = _G.UnitAura
local UnitAura = DeprecatedUnitAura
local activePlateUnits = {}
local PlateGUIDtoUnit = {}

Expand Down Expand Up @@ -257,6 +267,20 @@ function NugPlateAuras:CreateHeader(parent, headerType)
end


if C_Spell.GetSpellInfo then
local C_Spell_GetSpellInfo = C_Spell.GetSpellInfo
ns.GetSpellInfo = function(spellId)
local info = C_Spell_GetSpellInfo(spellId)
if info then
return info.name, nil, info.iconID
end
end
ns.GetSpellTexture = C_Spell.GetSpellTexture
else
ns.GetSpellInfo = _G.GetSpellInfo
ns.GetSpellTexture = _G.GetSpellTexture
end
local GetSpellInfo = ns.GetSpellInfo
local function MakeFakeAuraFromID(spellID, filter)
local now = GetTime()
local name, rank, icon, castTime, minRange, maxRange, spellId = GetSpellInfo(spellID)
Expand Down Expand Up @@ -607,6 +631,15 @@ local helpMessage = {
}



local function InterfaceOptionsFrame_OpenToCategory(categoryIDOrFrame)
if type(categoryIDOrFrame) == "table" then
local categoryID = categoryIDOrFrame.name;
return Settings.OpenToCategory(categoryID);
else
return Settings.OpenToCategory(categoryIDOrFrame);
end
end
NugPlateAuras.Commands = {
["gui"] = function(v)
if not NugPlateAuras.optionsPanel then
Expand Down

0 comments on commit b26a516

Please sign in to comment.