downport aura tracker window (/details auras)
This commit is contained in:
+18
-152
@@ -26,44 +26,24 @@ function Details.AuraTracker.AddAura(auraType, spellid)
|
||||
Details.AuraTracker[auraType][spellid] = true
|
||||
end
|
||||
|
||||
|
||||
|
||||
local function HandleAuraBuff(...)
|
||||
local auraInfo = AuraUtil.PackAuraData(...)
|
||||
Details.AuraTracker.buff[auraInfo.spellId] = auraInfo
|
||||
end
|
||||
|
||||
local function HandleAuraDebuff(...)
|
||||
local auraInfo = AuraUtil.PackAuraData(...)
|
||||
Details.AuraTracker.debuff[auraInfo.spellId] = auraInfo
|
||||
end
|
||||
|
||||
local doFullAuraUpdate = function()
|
||||
Details:Destroy(Details.AuraTracker.buff)
|
||||
Details:Destroy(Details.AuraTracker.debuff)
|
||||
|
||||
local unitId = "player"
|
||||
|
||||
local function HandleAuraBuff(aura)
|
||||
local auraInfo = C_UnitAuras.GetAuraDataByAuraInstanceID(unitId, aura.auraInstanceID)
|
||||
|
||||
local spellId = auraInfo.spellId
|
||||
local isBossAura = auraInfo.isBossAura --"] = false
|
||||
local duration = auraInfo.duration --"] = 0
|
||||
local expirationTime = auraInfo.expirationTime --"] = 0
|
||||
local isFromPlayerOrPlayerPet = auraInfo.isFromPlayerOrPlayerPet --"] = true
|
||||
local points = auraInfo.points --"] = table { ["1"] = 200 ["2"] = 0 ["3"] = 400 }
|
||||
local icon = auraInfo.icon --"] = 135922
|
||||
local nameplateShowPersonal = auraInfo.nameplateShowPersonal --"] = false
|
||||
local nameplateShowAll = auraInfo.nameplateShowAll --"] = false
|
||||
local auraInstanceID = auraInfo.auraInstanceID --"] = 8871
|
||||
local timeMod = auraInfo.timeMod --"] = 1
|
||||
local isRaid = auraInfo.isRaid --"] = false
|
||||
local isHarmful = auraInfo.isHarmful --"] = false
|
||||
local canApplyAura = auraInfo.canApplyAura --"] = false
|
||||
local name = auraInfo.name --"] = 'Rhapsody'
|
||||
local isHelpful = auraInfo.isHelpful --"] = true
|
||||
local applications = auraInfo.applications --"] = 20
|
||||
local isNameplateOnly = auraInfo.isNameplateOnly --"] = false
|
||||
local sourceUnit = auraInfo.sourceUnit --"] = 'player'
|
||||
local isStealable = auraInfo.isStealable --"] = false
|
||||
|
||||
Details.AuraTracker.buff[aura.auraInstanceID] = auraInfo
|
||||
end
|
||||
|
||||
local function HandleAuraDebuff(aura)
|
||||
local auraInfo = C_UnitAuras.GetAuraDataByAuraInstanceID(unitId, aura.auraInstanceID)
|
||||
Details.AuraTracker.debuff[aura.auraInstanceID] = auraInfo
|
||||
end
|
||||
|
||||
local batchCount = nil
|
||||
local usePackedAura = true
|
||||
AuraUtil.ForEachAura(unitId, "HELPFUL", batchCount, HandleAuraBuff, usePackedAura)
|
||||
@@ -76,41 +56,6 @@ local doFullAuraUpdate = function()
|
||||
Details.AuraTracker.RefreshScrollData()
|
||||
end
|
||||
|
||||
local doIncrementalAuraUpdate = function(aurasUpdated)
|
||||
for _, auraInstanceId in ipairs(aurasUpdated) do
|
||||
local auraInfo = C_UnitAuras.GetAuraDataByAuraInstanceID("player", auraInstanceId)
|
||||
if (auraInfo.isHelpful) then
|
||||
Details.AuraTracker.buff[auraInstanceId] = auraInfo
|
||||
else
|
||||
Details.AuraTracker.debuff[auraInstanceId] = auraInfo
|
||||
end
|
||||
end
|
||||
Details.AuraTracker.RefreshScrollData()
|
||||
end
|
||||
|
||||
local doAddedAuraUpdate = function(aurasAdded)
|
||||
for _, auraInfo in ipairs(aurasAdded) do
|
||||
if (auraInfo.isHelpful) then
|
||||
Details.AuraTracker.buff[auraInfo.auraInstanceID] = auraInfo
|
||||
else
|
||||
Details.AuraTracker.debuff[auraInfo.auraInstanceID] = auraInfo
|
||||
end
|
||||
end
|
||||
Details.AuraTracker.RefreshScrollData()
|
||||
end
|
||||
|
||||
local doRemovedAuraUpdate = function(aurasRemoved)
|
||||
for _, auraInstanceId in ipairs(aurasRemoved) do
|
||||
if (Details.AuraTracker.buff[auraInstanceId]) then
|
||||
Details.AuraTracker.buff[auraInstanceId] = nil
|
||||
|
||||
elseif (Details.AuraTracker.debuff[auraInstanceId]) then
|
||||
Details.AuraTracker.debuff[auraInstanceId] = nil
|
||||
end
|
||||
end
|
||||
Details.AuraTracker.RefreshScrollData()
|
||||
end
|
||||
|
||||
function Details.AuraTracker.OnShowAuraTrackerFrame(auraTrackerFrame)
|
||||
doFullAuraUpdate()
|
||||
auraTrackerFrame.EventFrame:RegisterUnitEvent("UNIT_AURA", "player")
|
||||
@@ -163,7 +108,6 @@ function Details.AuraTracker.CreatePanel()
|
||||
{text = "Aura Name", width = 162},
|
||||
{text = "Spell Id", width = 100},
|
||||
{text = "Lua Table", width = 200},
|
||||
{text = "Payload (Points)", width = 296},
|
||||
}
|
||||
local headerOptions = {
|
||||
padding = 2,
|
||||
@@ -189,81 +133,11 @@ function Details.AuraTracker.CreatePanel()
|
||||
Details.AuraTracker.framesCreated = true
|
||||
end
|
||||
|
||||
local cachedPoints = {}
|
||||
local storeAuraPointsOnCache = function(auraInfo)
|
||||
local thisAuraCache = cachedPoints[auraInfo.spellId]
|
||||
if (not thisAuraCache) then
|
||||
thisAuraCache = {}
|
||||
cachedPoints[auraInfo.spellId] = thisAuraCache
|
||||
end
|
||||
|
||||
for i = 1, #auraInfo.points do
|
||||
thisAuraCache[auraInfo.points[i]] = 1
|
||||
end
|
||||
end
|
||||
|
||||
local formatToLuaTable = {
|
||||
--[232698] = 1, --Shadowform
|
||||
doFormat1 = function(auraInfo)
|
||||
return "[" .. auraInfo.spellId .. "] = 1, --" .. auraInfo.name
|
||||
end,
|
||||
|
||||
--[390636] = {[1] = 200, [200] = 1, [2] = 0, [0] = 2, [3] = 400, [400] = 3}, --Rhapsody
|
||||
doFormat2 = function(auraInfo)
|
||||
local pointsTable = {}
|
||||
for i = 1, #auraInfo.points do
|
||||
pointsTable[#pointsTable+1] = "[" .. i .. "] = " .. auraInfo.points[i]
|
||||
pointsTable[#pointsTable+1] = "[" .. auraInfo.points[i] .. "] = " .. i
|
||||
end
|
||||
return "[" .. auraInfo.spellId .. "] = {" .. table.concat(pointsTable, ", ") .. "}, --" .. auraInfo.name
|
||||
end,
|
||||
|
||||
--[371172] = {[236] = 1}, --Phial of Tepid Versatility
|
||||
doFormat2NoIndex = function(auraInfo)
|
||||
local pointsTable = {}
|
||||
for i = 1, #auraInfo.points do
|
||||
pointsTable[#pointsTable+1] = "[" .. auraInfo.points[i] .. "] = " .. i
|
||||
end
|
||||
return "[" .. auraInfo.spellId .. "] = {" .. table.concat(pointsTable, ", ") .. "}, --" .. auraInfo.name
|
||||
end,
|
||||
|
||||
--[572] = 1, [432] = 1, [75] = 1, [497] = 1
|
||||
doFormat2NoIndexFromCache = function(auraInfo)
|
||||
local points = cachedPoints[auraInfo.spellId] or {}
|
||||
local pointsTable = {}
|
||||
|
||||
for point in pairs(points) do
|
||||
pointsTable[#pointsTable+1] = "[" .. point .. "] = 1"
|
||||
end
|
||||
return table.concat(pointsTable, ", ")
|
||||
end,
|
||||
|
||||
--{[1] = 131, [131] = 1, [2] = 0, [0] = 2},
|
||||
doFormat3 = function(auraInfo)
|
||||
local pointsTable = {}
|
||||
for i = 1, #auraInfo.points do
|
||||
pointsTable[#pointsTable+1] = "[" .. i .. "] = " .. auraInfo.points[i]
|
||||
pointsTable[#pointsTable+1] = "[" .. auraInfo.points[i] .. "] = " .. i
|
||||
end
|
||||
return "{" .. table.concat(pointsTable, ", ") .. "},"
|
||||
end,
|
||||
|
||||
--same as 3 but ignore zeros
|
||||
doFormat4 = function(auraInfo)
|
||||
local pointsTable = {}
|
||||
for i = 1, #auraInfo.points do
|
||||
if (auraInfo.points[i] ~= 0) then
|
||||
pointsTable[#pointsTable+1] = "[" .. i .. "] = " .. auraInfo.points[i]
|
||||
pointsTable[#pointsTable+1] = "[" .. auraInfo.points[i] .. "] = " .. i
|
||||
end
|
||||
end
|
||||
return "{" .. table.concat(pointsTable, ", ") .. "},"
|
||||
end,
|
||||
|
||||
--200, 0, 400
|
||||
doFormat5 = function(auraInfo)
|
||||
return table.concat(auraInfo.points, ", ")
|
||||
end,
|
||||
}
|
||||
|
||||
--if you need your own table format, override the function below as: function(auraInfo) return "" end
|
||||
@@ -278,17 +152,14 @@ function Details.AuraTracker.RefreshScroll(self, data, offset, totalLines)
|
||||
|
||||
if (auraInfo) then
|
||||
local line = self:GetLine(i)
|
||||
storeAuraPointsOnCache(auraInfo)
|
||||
line.Icon.texture = auraInfo.icon
|
||||
line.Name.text = auraInfo.name
|
||||
line.SpellId.text = auraInfo.spellId
|
||||
local globalfunc = DETAILS_AURATRACKER_LUATABLE_FUNC
|
||||
line.LuaTableEntry.text = globalfunc and globalfunc(auraInfo) or formatToLuaTable.doFormat2NoIndex(auraInfo) --doFormat2NoIndex
|
||||
line.Points.text = formatToLuaTable.doFormat5(auraInfo)
|
||||
line.LuaTableEntry.text = globalfunc and globalfunc(auraInfo) or formatToLuaTable.doFormat1(auraInfo) --doFormat2NoIndex
|
||||
|
||||
line.Name:SetCursorPosition(0)
|
||||
line.LuaTableEntry:SetCursorPosition(0)
|
||||
line.Points:SetCursorPosition(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -310,8 +181,11 @@ function Details.AuraTracker.RefreshScrollData()
|
||||
Details.AuraTracker.AuraTrackerFrame.DebuffScroll:Refresh()
|
||||
end
|
||||
|
||||
function Details.AuraTracker.OnUnitAuraEvent(self, event, unit, unitAuraUpdateInfo)
|
||||
doFullAuraUpdate()
|
||||
function Details.AuraTracker.OnUnitAuraEvent(self, event, unit)
|
||||
if unit ~= "player" and unit ~= "pet" then
|
||||
return
|
||||
end
|
||||
doFullAuraUpdate(unit)
|
||||
end
|
||||
|
||||
function Details.AuraTracker.CreateScrollLine(self, lineId)
|
||||
@@ -348,17 +222,10 @@ function Details.AuraTracker.CreateScrollLine(self, lineId)
|
||||
luaTableEntryTextField:SetTextInsets(3, 3, 0, 0)
|
||||
luaTableEntryTextField:SetAutoSelectTextOnFocus(true)
|
||||
|
||||
--points
|
||||
local pointsTextField = DetailsFramework:CreateTextEntry(line, function()end, header:GetColumnWidth(5), scrollLineHeight, _, _, _, dropdownTemplate)
|
||||
pointsTextField:SetJustifyH("left")
|
||||
pointsTextField:SetTextInsets(3, 3, 0, 0)
|
||||
pointsTextField:SetAutoSelectTextOnFocus(true)
|
||||
|
||||
line:AddFrameToHeaderAlignment(auraIconTexture)
|
||||
line:AddFrameToHeaderAlignment(auraNameTextField)
|
||||
line:AddFrameToHeaderAlignment(spellIdTextField)
|
||||
line:AddFrameToHeaderAlignment(luaTableEntryTextField)
|
||||
line:AddFrameToHeaderAlignment(pointsTextField)
|
||||
|
||||
line:AlignWithHeader(header, "left")
|
||||
|
||||
@@ -366,7 +233,6 @@ function Details.AuraTracker.CreateScrollLine(self, lineId)
|
||||
line.Name = auraNameTextField
|
||||
line.SpellId = spellIdTextField
|
||||
line.LuaTableEntry = luaTableEntryTextField
|
||||
line.Points = pointsTextField
|
||||
|
||||
return line
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user