Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function (self, unitId, unitFrame, envTable)
- local auraContainers = {unitFrame.BuffFrame.PlaterBuffList}
- if (Plater.db.profile.buffs_on_aura2) then
- auraContainers [2] = unitFrame.BuffFrame2.PlaterBuffList
- end
- for containerID = 1, #auraContainers do
- local auraContainer = auraContainers [containerID]
- local aurasShown = {}
- local aurasDuplicated = {}
- --build the list of auras shown in the buff frame and check for each aura priority
- --also check if the consolidate (stack) auras with the same name is enabled
- for index, auraIcon in ipairs (auraContainer) do
- if (auraIcon:IsShown()) then
- if (envTable.consolidadeRepeatedAuras) then
- --is this aura already shown?
- local iconShownIndex = aurasDuplicated [auraIcon.SpellName]
- if (iconShownIndex) then
- --get the table with information about the shown icon
- local auraShownTable = aurasShown [iconShownIndex]
- --get the icon already in the table
- local icon = auraShownTable[1]
- --increase the amount of stacks
- auraShownTable[3] = auraShownTable[3] + 1
- --check if the remaining time of the icon already added in the table is lower than the current
- if (auraIcon.RemainingTime > icon.RemainingTime) then
- --replace the icon for the icon with bigger duration
- auraShownTable[1] = auraIcon
- icon:Hide()
- else
- auraIcon:Hide()
- end
- else
- local priority = envTable.priority[auraIcon.SpellName] or envTable.priority[auraIcon.spellId] or 1
- tinsert (aurasShown, {auraIcon, priority, 1}) --icon frame, priority, stack amount
- aurasDuplicated [auraIcon.SpellName] = #aurasShown
- end
- else
- --not stacking similar auras
- local priority = envTable.priority[auraIcon.SpellName] or envTable.priority[auraIcon.spellId] or 1
- tinsert (aurasShown, {auraIcon, priority})
- end
- end
- end
- --sort auras by priority
- table.sort (aurasShown, DetailsFramework.SortOrder2)
- local growDirection
- if (containerID == 1) then --debuff container
- growDirection = Plater.db.profile.aura_grow_direction
- --force to grow to right if it is anchored to center
- if (growDirection == 2) then
- growDirection = 3
- end
- -- "Left", "Center", "Right" - 1 2 3
- elseif (containerID == 2) then --buff container
- growDirection = Plater.db.profile.aura2_grow_direction
- --force to grow to left if it is anchored to center
- if (growDirection == 2) then
- growDirection = 1
- end
- end
- local padding = envTable.padding
- local framersPerRow = envTable.maxAurasPerRow + 1
- --first icon is where the row starts
- local firstIcon = aurasShown[1] and aurasShown[1][1]
- if (firstIcon) then
- local anchorPoint = firstIcon:GetParent() --anchor point is the BuffFrame
- anchorPoint:SetSize (1, 1)
- firstIcon:ClearAllPoints()
- firstIcon:SetPoint ("center", anchorPoint, "center", 0, 5)
- --check the consolidaded stacks, this is not the regular buff stacks
- local firstIconStacks = aurasShown[1][3]
- if (firstIconStacks and firstIconStacks > 1) then
- firstIcon.StackText:SetText (firstIconStacks)
- firstIcon.StackText:Show()
- end
- --> left to right
- if (growDirection == 3) then
- --> iterate among all aura icons
- for i = 2, #aurasShown do
- local auraIcon = aurasShown [i][1]
- auraIcon:ClearAllPoints()
- if (i == framersPerRow) then
- auraIcon:SetPoint ("bottomleft", firstIcon, "topleft", 0, envTable.rowPadding)
- framersPerRow = framersPerRow + framersPerRow
- else
- auraIcon:SetPoint ("topleft", aurasShown [i-1][1], "topright", padding, 0)
- end
- local stacks = aurasShown[i][3]
- if (stacks and stacks > 1) then
- auraIcon.StackText:SetText (stacks)
- auraIcon.StackText:Show()
- end
- end
- --right to left
- elseif (growDirection == 1) then
- --> iterate among all aura icons
- for i = 2, #aurasShown do
- local auraIcon = aurasShown [i][1]
- auraIcon:ClearAllPoints()
- if (i == framersPerRow) then
- auraIcon:SetPoint ("bottomright", firstIcon, "topright", 0, envTable.rowPadding)
- framersPerRow = framersPerRow + framersPerRow
- else
- auraIcon:SetPoint ("topright", aurasShown [i-1][1], "topleft", -padding, 0)
- end
- local stacks = aurasShown[i][3]
- if (stacks and stacks > 1) then
- auraIcon.StackText:SetText (stacks)
- auraIcon.StackText:Show()
- end
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement