Skip to content

Commit

Permalink
Merge branch 'main' into ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
kodewdle committed Dec 4, 2024
2 parents a1a1c90 + b1cdb61 commit 4fc30db
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 50 deletions.
26 changes: 25 additions & 1 deletion ElvUI/Core/Defaults/Global.lua
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ G.unitframe = {
},
rangeCheck = {
FRIENDLY = {
DEATHKNIGHT = {},
DEATHKNIGHT = {
['47541'] = 'Death Coil'
},
DEMONHUNTER = {},
DRUID = {
['8936'] = 'Regrowth'
Expand Down Expand Up @@ -191,6 +193,7 @@ G.unitframe = {
['362969'] = 'Azure Strike'
},
HUNTER = {
['2974'] = not E.Retail and 'Wing Clip' or nil,
['75'] = 'Auto Shot'
},
MAGE = {
Expand Down Expand Up @@ -252,6 +255,27 @@ G.unitframe = {
['20707'] = not E.Classic and 'Soulstone' or nil
},
WARRIOR = {}
},
PET = {
DEATHKNIGHT = {
['47541'] = 'Death Coil'
},
DEMONHUNTER = {},
DRUID = {},
EVOKER = {},
HUNTER = {
['136'] = 'Mend Pet'
},
MAGE = {},
MONK = {},
PALADIN = {},
PRIEST = {},
ROGUE = {},
SHAMAN = {},
WARLOCK = {
['755'] = 'Health Funnel'
},
WARRIOR = {}
}
}
}
Expand Down
36 changes: 18 additions & 18 deletions ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,20 @@ function UF:AuraUnchanged(a, name, icon, count, debuffType, duration, expiration
end
end

function UF:AuraStacks(db, auras, button, name, icon, count, spellID, source, castByPlayer)
function UF:AuraDispellable(debuffType, spellID)
if debuffType then
return DispelTypes[debuffType]
else
return DispelTypes.Bleed and BleedList[spellID]
end
end

function UF:AuraDuration(db, duration)
local dno, dmax, dmin = not duration or duration == 0, db.maxDuration, db.minDuration
return dno, dno or (duration and duration > 0 and (not dmax or dmax == 0 or duration <= dmax) and (not dmin or dmin == 0 or duration >= dmin))
end

function UF:AuraStacks(auras, db, button, name, icon, count, spellID, source, castByPlayer)
if db.stackAuras and not UF.ExcludeStacks[spellID] then
local matching = source and castByPlayer and format('%s:%s', UF.SourceStacks[spellID] or source, name) or name
local amount = (count and count > 0 and count) or 1
Expand All @@ -602,20 +615,7 @@ function UF:AuraStacks(db, auras, button, name, icon, count, spellID, source, ca
end
end

function UF:AuraDispellable(debuffType, spellID)
if debuffType then
return DispelTypes[debuffType]
else
return DispelTypes.Bleed and BleedList[spellID]
end
end

function UF:AuraDuration(db, duration)
local dno, dmax, dmin = not duration or duration == 0, db.maxDuration, db.minDuration
return dno, dno or (duration and duration > 0 and (not dmax or dmax == 0 or duration <= dmax) and (not dmin or dmin == 0 or duration >= dmin))
end

function UF:AuraPopulate(db, unit, button, name, icon, count, debuffType, duration, expiration, source, isStealable, spellID)
function UF:AuraPopulate(auras, db, unit, button, name, icon, count, debuffType, duration, expiration, source, isStealable, spellID)
-- already set by oUF:
--- button.caster = source
--- button.filter = filter
Expand All @@ -624,7 +624,7 @@ function UF:AuraPopulate(db, unit, button, name, icon, count, debuffType, durati

local myPet = source == 'pet'
local otherPet = source and source ~= 'pet' and strfind(source, 'pet', nil, true)
local canDispel = (self.type == 'buffs' and isStealable) or (self.type == 'debuffs' and UF:AuraDispellable(debuffType, spellID))
local canDispel = (auras.type == 'buffs' and isStealable) or (auras.type == 'debuffs' and UF:AuraDispellable(debuffType, spellID))
local isFriend = unit == 'player' or (UnitIsFriend('player', unit) and not UnitCanAttack('player', unit))
local unitIsCaster = source and ((unit == source) or UnitIsUnit(unit, source))

Expand Down Expand Up @@ -658,14 +658,14 @@ function UF:AuraFilter(unit, button, name, icon, count, debuffType, duration, ex
local db = self.db
if not db then
return true -- no database huh
elseif UF:AuraStacks(db, self, button, name, icon, count, spellID, source, castByPlayer) then
elseif UF:AuraStacks(self, db, button, name, icon, count, spellID, source, castByPlayer) then
return false -- stacking so dont allow it
elseif UF:AuraUnchanged(button.auraInfo, name, icon, count, debuffType, duration, expiration, source, isStealable, nameplateShowPersonal, spellID, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll) then
return button.filterPass
end

local noDuration, allowDuration = UF:AuraDuration(db, duration)
local myPet, otherPet, canDispel, isFriend, unitIsCaster = UF:AuraPopulate(db, unit, button, name, icon, count, debuffType, duration, expiration, source, isStealable, spellID)
local myPet, otherPet, canDispel, isFriend, unitIsCaster = UF:AuraPopulate(self, db, unit, button, name, icon, count, debuffType, duration, expiration, source, isStealable, spellID)
if not allowDuration or not self.filterList then
button.filterPass = allowDuration
button.priority = 0
Expand Down
22 changes: 14 additions & 8 deletions ElvUI/Core/Modules/UnitFrames/Elements/Range.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local UF = E:GetModule('UnitFrames')
local next = next
local tonumber = tonumber

local UnitIsUnit = UnitIsUnit
local UnitInPhase = UnitInPhase
local UnitInRange = UnitInRange
local UnitIsPlayer = UnitIsPlayer
Expand Down Expand Up @@ -42,9 +43,10 @@ end
function UF:UpdateRangeSpells()
local db = E.global.unitframe.rangeCheck
if db then
list[1] = UF:UpdateRangeList(db.RESURRECT[E.myclass])
list[2] = UF:UpdateRangeList(db.ENEMY[E.myclass])
list[3] = UF:UpdateRangeList(db.FRIENDLY[E.myclass])
list[1] = UF:UpdateRangeList(db.ENEMY[E.myclass])
list[2] = UF:UpdateRangeList(db.FRIENDLY[E.myclass])
list[3] = UF:UpdateRangeList(db.RESURRECT[E.myclass])
list[4] = UF:UpdateRangeList(db.PET[E.myclass])
end
end

Expand All @@ -71,7 +73,7 @@ function UF:UnitInSpellsRange(unit, which)
return range
end

return true -- no spells assume range is maxed
return 1 -- no spells checked
end

function UF:FriendlyInRange(realUnit)
Expand All @@ -89,10 +91,10 @@ function UF:FriendlyInRange(realUnit)

local range, checked = UnitInRange(unit)
if checked and not range then
return false -- blizz checked and said the unit is out of range
return false -- blizz checked and unit is out of range
end

return UF:UnitInSpellsRange(unit, 3)
return UF:UnitInSpellsRange(unit, 2)
end

function UF:UpdateRange(unit)
Expand All @@ -109,11 +111,15 @@ function UF:UpdateRange(unit)
element.RangeAlpha = element.MinAlpha
elseif unit then
if UnitIsDeadOrGhost(unit) then
element.RangeAlpha = UF:UnitInSpellsRange(unit, 1) and element.MaxAlpha or element.MinAlpha
element.RangeAlpha = UF:UnitInSpellsRange(unit, 3) == true and element.MaxAlpha or element.MinAlpha
elseif UnitCanAttack('player', unit) then
element.RangeAlpha = UF:UnitInSpellsRange(unit, 2) and element.MaxAlpha or element.MinAlpha
element.RangeAlpha = UF:UnitInSpellsRange(unit, 1) and element.MaxAlpha or element.MinAlpha
elseif UnitIsUnit('pet', unit) then
element.RangeAlpha = UF:UnitInSpellsRange(unit, 4) and element.MaxAlpha or element.MinAlpha
elseif UnitIsConnected(unit) then
element.RangeAlpha = UF:FriendlyInRange(unit) and element.MaxAlpha or element.MinAlpha
else
element.RangeAlpha = element.MinAlpha
end
else
element.RangeAlpha = element.MaxAlpha
Expand Down
Loading

0 comments on commit 4fc30db

Please sign in to comment.