Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions ElvUI/Game/Shared/Modules/ActionBars/PetBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ local bar = CreateFrame('Frame', 'ElvUI_BarPet', E.UIParent, 'SecureHandlerState
bar:SetFrameStrata('LOW')
bar.buttons = {}

local function ClearPetButtonSpellData(button)
if button.spellDataLoadedCancelFunc then
button.spellDataLoadedCancelFunc()
button.spellDataLoadedCancelFunc = nil
end

button.spellDataLoadedSpellID = nil
button.tooltipSubtext = nil
end

function AB:UpdatePet(event, unit)
if (event == 'UNIT_FLAGS' and unit ~= 'pet') or (event == 'UNIT_PET' and unit ~= 'player') then return end

Expand All @@ -54,11 +64,23 @@ function AB:UpdatePet(event, unit)
button.tooltipName = _G[name]
end

if spellID then
if spellID and button.spellDataLoadedSpellID ~= spellID then
ClearPetButtonSpellData(button)
button.spellDataLoadedSpellID = spellID

local spell = _G.Spell:CreateFromSpellID(spellID)
button.spellDataLoadedCancelFunc = spell:ContinueWithCancelOnSpellLoad(function()
button.tooltipSubtext = spell:GetSpellSubtext()
local spellDataLoaded
local cancelFunc = spell:ContinueWithCancelOnSpellLoad(function()
if button.spellDataLoadedSpellID == spellID then
button.tooltipSubtext = spell:GetSpellSubtext()
button.spellDataLoadedCancelFunc = nil
end

spellDataLoaded = true
end)
button.spellDataLoadedCancelFunc = not spellDataLoaded and cancelFunc or nil
elseif not spellID and button.spellDataLoadedSpellID then
ClearPetButtonSpellData(button)
end

if isActive and name ~= 'PET_ACTION_FOLLOW' then
Expand Down Expand Up @@ -227,10 +249,7 @@ end

function AB:PetBar_OnHide()
for _, button in ipairs(bar.buttons) do
if button.spellDataLoadedCancelFunc then
button.spellDataLoadedCancelFunc()
button.spellDataLoadedCancelFunc = nil
end
ClearPetButtonSpellData(button)
end
end

Expand Down
4 changes: 4 additions & 0 deletions ElvUI/Game/Shared/Modules/UnitFrames/Elements/Range.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ local list = {}
UF.RangeSpells = list

function UF:UpdateRangeList(db)
if not db then return {} end

local spells = {}
for spell, value in next, db do
if value then
Expand Down Expand Up @@ -78,6 +80,8 @@ end

function UF:UnitInSpellsRange(unit, which)
local spells = list[which]
if not spells then return nil end

local range = (not next(spells) and 1) or UF:UnitSpellRange(unit, spells)

if (not range or range == 1) and not InCombatLockdown() then
Expand Down
24 changes: 19 additions & 5 deletions ElvUI_Libraries/Game/Shared/oUF_Plugins/oUF_AuraBars.lua
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,28 @@ end

local function FilterBars(frame, element, unit, filter, limit, isDebuff, offset, dontHide)
if(not offset) then offset = 0 end

local unitAuraFiltered = AuraFiltered[filter][unit]
if not unitAuraFiltered then return 0, 0 end

local temp = {}
local count = 0
for auraInstanceID, aura in next, unitAuraFiltered do
count = count + 1
temp[count] = auraInstanceID
count = count + 1
temp[count] = aura
end

local visible = 0
local hidden = 0

local index = 1
local unitAuraFiltered = AuraFiltered[filter][unit]
local auraInstanceID, aura = next(unitAuraFiltered)
while aura and (visible < limit) do
for i = 1, count, 2 do
if visible >= limit then break end

local auraInstanceID = temp[i]
local aura = temp[i+1]

local result = AuraUpdate(frame, element, unit, aura, index, offset, filter, isDebuff, visible)
if result == VISIBLE then
visible = visible + 1
Expand All @@ -262,7 +277,6 @@ local function FilterBars(frame, element, unit, filter, limit, isDebuff, offset,
end

index = index + 1
auraInstanceID, aura = next(unitAuraFiltered, auraInstanceID)
end

if(not dontHide) then
Expand Down
2 changes: 2 additions & 0 deletions ElvUI_Libraries/Game/Shared/oUF_Plugins/oUF_AuraHighlight.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ end

local function Looper(unit, filter, check, list, func)
local unitAuraFiltered = AuraFiltered[filter][unit]
if not unitAuraFiltered then return end -- next(nil) would error

local auraInstanceID, aura = next(unitAuraFiltered)
while aura do
local name, icon, count, auraType, duration, expiration, source, isStealable, nameplateShowPersonal, spellID = oUF:UnpackAuraData(aura)
Expand Down
22 changes: 18 additions & 4 deletions ElvUI_Libraries/Game/Shared/oUF_Plugins/oUF_AuraWatch.lua
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,25 @@ end
local function FilterIcons(element, unit, filter, limit, isDebuff, offset, dontHide)
if not offset then offset = 0 end

local index, visible, hidden = 1, 0, 0
local unitAuraFiltered = AuraFiltered[filter][unit]
local auraInstanceID, aura = next(unitAuraFiltered)
while aura and (visible < limit) do
if not unitAuraFiltered then return 0, 0 end

local temp = {}
local count = 0
for auraInstanceID, aura in next, unitAuraFiltered do
count = count + 1
temp[count] = auraInstanceID
count = count + 1
temp[count] = aura
end

local index, visible, hidden = 1, 0, 0
for i = 1, count, 2 do
if visible >= limit then break end

local auraInstanceID = temp[i]
local aura = temp[i+1]

local result = UpdateIcon(element, unit, aura, index, offset, filter, isDebuff, visible)
if result == VISIBLE then
visible = visible + 1
Expand All @@ -236,7 +251,6 @@ local function FilterIcons(element, unit, filter, limit, isDebuff, offset, dontH
end

index = index + 1
auraInstanceID, aura = next(unitAuraFiltered, auraInstanceID)
end

if not dontHide then
Expand Down