commit from backup
This commit is contained in:
378
Libraries/oUF_Plugins/oUF_AuraBars/oUF_AuraBars.lua
Normal file
378
Libraries/oUF_Plugins/oUF_AuraBars/oUF_AuraBars.lua
Normal file
@@ -0,0 +1,378 @@
|
||||
local _, ns = ...
|
||||
local oUF = oUF or ns.oUF
|
||||
assert(oUF, 'oUF_AuraBars was unable to locate oUF install.')
|
||||
|
||||
local format = string.format
|
||||
local floor, huge, min = math.floor, math.huge, math.min
|
||||
local tsort = table.sort
|
||||
local tremove = table.remove
|
||||
local random = math.random
|
||||
|
||||
local function Round(number, decimalPlaces)
|
||||
if decimalPlaces and decimalPlaces > 0 then
|
||||
local mult = 10^decimalPlaces
|
||||
return floor(number * mult + .5) / mult
|
||||
end
|
||||
return floor(num + .5)
|
||||
end
|
||||
|
||||
local DAY, HOUR, MINUTE = 86400, 3600, 60
|
||||
local function FormatTime(s)
|
||||
if s < MINUTE then
|
||||
return ("%.1fs"):format(s)
|
||||
elseif s < HOUR then
|
||||
return ("%dm %ds"):format(s/60%60, s%60)
|
||||
elseif s < DAY then
|
||||
return ("%dh %dm"):format(s/(60*60), s/60%60)
|
||||
else
|
||||
return ("%dd %dh"):format(s/DAY, (s / HOUR) - (floor(s/DAY) * 24))
|
||||
end
|
||||
end
|
||||
|
||||
local function UpdateTooltip(self)
|
||||
GameTooltip:SetUnitAura(self.__unit, self:GetParent().aura.name, self:GetParent().aura.rank, self:GetParent().aura.filter)
|
||||
end
|
||||
|
||||
local function OnEnter(self)
|
||||
if(not self:IsVisible()) then return end
|
||||
GameTooltip:SetOwner(self, "ANCHOR_BOTTOMRIGHT")
|
||||
self:UpdateTooltip()
|
||||
end
|
||||
|
||||
local function OnLeave(self)
|
||||
GameTooltip:Hide()
|
||||
end
|
||||
|
||||
local function SetAnchors(self)
|
||||
local bars = self.bars
|
||||
|
||||
for index = 1, #bars do
|
||||
local frame = bars[index]
|
||||
local anchor = frame.anchor
|
||||
frame:Height(self.auraBarHeight or 20)
|
||||
frame.statusBar.iconHolder:Size(frame:GetHeight())
|
||||
frame:Width((self.auraBarWidth or self:GetWidth()) - (frame:GetHeight() + (self.gap or 0)))
|
||||
frame:ClearAllPoints()
|
||||
if self.down == true then
|
||||
if self == anchor then -- Root frame so indent for icon
|
||||
frame:SetPoint('TOPLEFT', anchor, 'TOPLEFT', (frame:GetHeight() + (self.gap or 0) ), -1)
|
||||
else
|
||||
frame:SetPoint('TOPLEFT', anchor, 'BOTTOMLEFT', 0, (-self.spacing or 0))
|
||||
end
|
||||
else
|
||||
if self == anchor then -- Root frame so indent for icon
|
||||
frame:SetPoint('BOTTOMLEFT', anchor, 'BOTTOMLEFT', (frame:GetHeight() + (self.gap or 0)), 1)
|
||||
else
|
||||
frame:SetPoint('BOTTOMLEFT', anchor, 'TOPLEFT', 0, (self.spacing or 0))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function CreateAuraBar(oUF, anchor)
|
||||
local auraBarParent = oUF.AuraBars
|
||||
|
||||
local frame = CreateFrame("Frame", nil, auraBarParent)
|
||||
frame:Height(auraBarParent.auraBarHeight or 20)
|
||||
frame:Width((auraBarParent.auraBarWidth or auraBarParent:GetWidth()) - (frame:GetHeight() + (auraBarParent.gap or 0)))
|
||||
frame.anchor = anchor
|
||||
|
||||
-- the main bar
|
||||
local statusBar = CreateFrame("StatusBar", nil, frame)
|
||||
statusBar:SetStatusBarTexture(auraBarParent.auraBarTexture or [[Interface\TargetingFrame\UI-StatusBar]])
|
||||
statusBar:SetAlpha(auraBarParent.fgalpha or 1)
|
||||
statusBar:SetAllPoints(frame)
|
||||
|
||||
frame.statusBar = statusBar
|
||||
|
||||
if auraBarParent.down == true then
|
||||
if auraBarParent == anchor then -- Root frame so indent for icon
|
||||
frame:SetPoint('TOPLEFT', anchor, 'TOPLEFT', (frame:GetHeight() + (auraBarParent.gap or 0) ), -1)
|
||||
else
|
||||
frame:SetPoint('TOPLEFT', anchor, 'BOTTOMLEFT', 0, (-auraBarParent.spacing or 0))
|
||||
end
|
||||
else
|
||||
if auraBarParent == anchor then -- Root frame so indent for icon
|
||||
frame:SetPoint('BOTTOMLEFT', anchor, 'BOTTOMLEFT', (frame:GetHeight() + (auraBarParent.gap or 0)), 1)
|
||||
else
|
||||
frame:SetPoint('BOTTOMLEFT', anchor, 'TOPLEFT', 0, (auraBarParent.spacing or 0))
|
||||
end
|
||||
end
|
||||
|
||||
local spark = statusBar:CreateTexture(nil, "OVERLAY", nil);
|
||||
spark:SetTexture([[Interface\CastingBar\UI-CastingBar-Spark]]);
|
||||
spark:Width(12);
|
||||
spark:SetBlendMode("ADD");
|
||||
spark:SetPoint('CENTER', statusBar:GetStatusBarTexture(), 'RIGHT')
|
||||
statusBar.spark = spark
|
||||
|
||||
statusBar.iconHolder = CreateFrame('Button', nil, statusBar)
|
||||
statusBar.iconHolder:Height(frame:GetHeight())
|
||||
statusBar.iconHolder:Width(frame:GetHeight())
|
||||
statusBar.iconHolder:SetPoint('BOTTOMRIGHT', frame, 'BOTTOMLEFT', -auraBarParent.gap, 0)
|
||||
statusBar.iconHolder.__unit = oUF.unit
|
||||
statusBar.iconHolder:SetScript('OnEnter', OnEnter)
|
||||
statusBar.iconHolder:SetScript('OnLeave', OnLeave)
|
||||
statusBar.iconHolder.UpdateTooltip = UpdateTooltip
|
||||
|
||||
statusBar.icon = statusBar.iconHolder:CreateTexture(nil, 'BACKGROUND')
|
||||
statusBar.icon:SetTexCoord(.07, .93, .07, .93)
|
||||
statusBar.icon:SetAllPoints()
|
||||
|
||||
statusBar.spelltime = statusBar:CreateFontString(nil, 'ARTWORK')
|
||||
if auraBarParent.spellTimeObject then
|
||||
statusBar.spelltime:SetFontObject(auraBarParent.spellTimeObject)
|
||||
else
|
||||
statusBar.spelltime:SetFont(auraBarParent.spellTimeFont or [[Fonts\FRIZQT__.TTF]], auraBarParent.spellTimeSize or 10)
|
||||
end
|
||||
statusBar.spelltime:SetTextColor(1 ,1, 1)
|
||||
statusBar.spelltime:SetJustifyH'RIGHT'
|
||||
statusBar.spelltime:SetJustifyV'CENTER'
|
||||
statusBar.spelltime:SetPoint'RIGHT'
|
||||
|
||||
statusBar.spellname = statusBar:CreateFontString(nil, 'ARTWORK')
|
||||
if auraBarParent.spellNameObject then
|
||||
statusBar.spellname:SetFontObject(auraBarParent.spellNameObject)
|
||||
else
|
||||
statusBar.spellname:SetFont(auraBarParent.spellNameFont or [[Fonts\FRIZQT__.TTF]], auraBarParent.spellNameSize or 10)
|
||||
end
|
||||
statusBar.spellname:SetTextColor(1, 1, 1)
|
||||
statusBar.spellname:SetJustifyH'LEFT'
|
||||
statusBar.spellname:SetJustifyV'CENTER'
|
||||
statusBar.spellname:SetPoint'LEFT'
|
||||
statusBar.spellname:SetPoint('RIGHT', statusBar.spelltime, 'LEFT')
|
||||
|
||||
if auraBarParent.PostCreateBar then
|
||||
auraBarParent.PostCreateBar(frame)
|
||||
end
|
||||
|
||||
return frame
|
||||
end
|
||||
|
||||
local function UpdateBars(auraBars)
|
||||
local bars = auraBars.bars
|
||||
local timenow = GetTime()
|
||||
|
||||
for index = 1, #bars do
|
||||
local frame = bars[index]
|
||||
local bar = frame.statusBar
|
||||
if not frame:IsVisible() then
|
||||
break
|
||||
end
|
||||
if bar.aura.noTime then
|
||||
bar.spelltime:SetText()
|
||||
bar.spark:Hide()
|
||||
else
|
||||
local timeleft = bar.aura.expirationTime - timenow
|
||||
bar:SetValue(timeleft)
|
||||
bar.spelltime:SetText(FormatTime(timeleft))
|
||||
if auraBars.spark == true then
|
||||
if (auraBars.scaleTime and ((auraBars.scaleTime <= 0) or (auraBars.scaleTime > 0 and timeleft < auraBars.scaleTime))) then
|
||||
bar.spark:Show()
|
||||
else
|
||||
bar.spark:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function DefaultFilter(self, unit, name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate)
|
||||
if unitCaster == 'player' and not shouldConsolidate then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local sort = function(a, b)
|
||||
local compa, compb = a.noTime and huge or a.expirationTime, b.noTime and huge or b.expirationTime
|
||||
return compa > compb
|
||||
end
|
||||
|
||||
|
||||
local function Update(self, event, unit)
|
||||
if self.unit ~= unit then return end
|
||||
local auraBars = self.AuraBars
|
||||
local helpOrHarm
|
||||
local isFriend = UnitIsFriend('player', unit)
|
||||
|
||||
if auraBars.friendlyAuraType and auraBars.enemyAuraType then
|
||||
if isFriend then
|
||||
helpOrHarm = auraBars.friendlyAuraType
|
||||
else
|
||||
helpOrHarm = auraBars.enemyAuraType
|
||||
end
|
||||
else
|
||||
helpOrHarm = isFriend and 'HELPFUL' or 'HARMFUL'
|
||||
end
|
||||
|
||||
-- Create a table of auras to display
|
||||
local auras = {}
|
||||
local lastAuraIndex = 0
|
||||
local counter = 0
|
||||
if(auraBars.forceShow) then
|
||||
for index = 1, auraBars.maxBars do
|
||||
local spellID = 47540
|
||||
local name, rank, icon = GetSpellInfo(spellID)
|
||||
local count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, canApplyAura, isBossDebuff = 5, 'Magic', 0, 0, 'player', nil, nil, nil, nil
|
||||
lastAuraIndex = lastAuraIndex + 1
|
||||
auras[lastAuraIndex] = {}
|
||||
auras[lastAuraIndex].spellID = spellID
|
||||
auras[lastAuraIndex].name = name
|
||||
auras[lastAuraIndex].rank = rank
|
||||
auras[lastAuraIndex].icon = icon
|
||||
auras[lastAuraIndex].count = count
|
||||
auras[lastAuraIndex].debuffType = debuffType
|
||||
auras[lastAuraIndex].duration = duration
|
||||
auras[lastAuraIndex].expirationTime = expirationTime
|
||||
auras[lastAuraIndex].unitCaster = unitCaster
|
||||
auras[lastAuraIndex].isStealable = isStealable
|
||||
auras[lastAuraIndex].noTime = (duration == 0 and expirationTime == 0)
|
||||
auras[lastAuraIndex].filter = helpOrHarm
|
||||
auras[lastAuraIndex].shouldConsolidate = shouldConsolidate
|
||||
end
|
||||
else
|
||||
for index = 1, 40 do
|
||||
local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellID = UnitAura(unit, index, helpOrHarm)
|
||||
if not name then break end
|
||||
|
||||
if (auraBars.filter or DefaultFilter)(self, unit, name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellID) then
|
||||
lastAuraIndex = lastAuraIndex + 1
|
||||
auras[lastAuraIndex] = {}
|
||||
auras[lastAuraIndex].spellID = spellID
|
||||
auras[lastAuraIndex].name = name
|
||||
auras[lastAuraIndex].rank = rank
|
||||
auras[lastAuraIndex].icon = icon
|
||||
auras[lastAuraIndex].count = count
|
||||
auras[lastAuraIndex].debuffType = debuffType
|
||||
auras[lastAuraIndex].duration = duration
|
||||
auras[lastAuraIndex].expirationTime = expirationTime
|
||||
auras[lastAuraIndex].unitCaster = unitCaster
|
||||
auras[lastAuraIndex].isStealable = isStealable
|
||||
auras[lastAuraIndex].noTime = (duration == 0 and expirationTime == 0)
|
||||
auras[lastAuraIndex].filter = helpOrHarm
|
||||
auras[lastAuraIndex].shouldConsolidate = shouldConsolidate
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if(auraBars.sort and not auraBars.forceShow) then
|
||||
tsort(auras, type(auraBars.sort) == 'function' and auraBars.sort or sort)
|
||||
end
|
||||
|
||||
for i=1, #auras do
|
||||
if(i > auraBars.maxBars) then
|
||||
tremove(auras, i)
|
||||
else
|
||||
lastAuraIndex = i
|
||||
end
|
||||
end
|
||||
|
||||
-- Show and configure bars for buffs/debuffs.
|
||||
local bars = auraBars.bars
|
||||
if lastAuraIndex == 0 then
|
||||
self.AuraBars:Height(1)
|
||||
end
|
||||
|
||||
for index = 1 , lastAuraIndex do
|
||||
if (auraBars:GetWidth() == 0) then break; end
|
||||
local aura = auras[index]
|
||||
local frame = bars[index]
|
||||
|
||||
if not frame then
|
||||
frame = CreateAuraBar(self, index == 1 and auraBars or bars[index - 1])
|
||||
bars[index] = frame
|
||||
end
|
||||
|
||||
if index == lastAuraIndex then
|
||||
if self.AuraBars.down then
|
||||
self.AuraBars:Height(self.AuraBars:GetTop() - frame:GetBottom())
|
||||
elseif frame:GetTop() and self.AuraBars:GetBottom() then
|
||||
self.AuraBars:Height(frame:GetTop() - self.AuraBars:GetBottom())
|
||||
else
|
||||
self.AuraBars:Height(20)
|
||||
end
|
||||
end
|
||||
|
||||
local bar = frame.statusBar
|
||||
frame.index = index
|
||||
|
||||
-- Backup the details of the aura onto the bar, so the OnUpdate function can use it
|
||||
bar.aura = aura
|
||||
|
||||
-- Configure
|
||||
if bar.aura.noTime then
|
||||
bar:SetMinMaxValues(0, 1)
|
||||
bar:SetValue(1)
|
||||
else
|
||||
if auraBars.scaleTime and auraBars.scaleTime > 0 then
|
||||
local maxvalue = min(auraBars.scaleTime, bar.aura.duration)
|
||||
bar:SetMinMaxValues(0, auraBars.scaleTime)
|
||||
bar:Width(
|
||||
( maxvalue / auraBars.scaleTime ) *
|
||||
( ( auraBars.auraBarWidth or auraBars:GetWidth() ) -
|
||||
( bar:GetHeight() + (auraBars.gap or 0) ) ) ) -- icon size + gap
|
||||
else
|
||||
bar:SetMinMaxValues(0, bar.aura.duration)
|
||||
end
|
||||
bar:SetValue(bar.aura.expirationTime - GetTime())
|
||||
end
|
||||
|
||||
bar.icon:SetTexture(bar.aura.icon)
|
||||
|
||||
bar.spellname:SetText(bar.aura.count > 1 and format("%s [%d]", bar.aura.name, bar.aura.count) or bar.aura.name)
|
||||
bar.spelltime:SetText(not bar.noTime and FormatTime(bar.aura.expirationTime-GetTime()))
|
||||
|
||||
-- Colour bars
|
||||
local r, g, b = .2, .6, 1 -- Colour for buffs
|
||||
if auraBars.buffColor then
|
||||
r, g, b = unpack(auraBars.buffColor)
|
||||
end
|
||||
|
||||
if helpOrHarm == 'HARMFUL' then
|
||||
local debuffType = bar.aura.debuffType and bar.aura.debuffType or 'none'
|
||||
|
||||
r, g, b = DebuffTypeColor[debuffType].r, DebuffTypeColor[debuffType].g, DebuffTypeColor[debuffType].b
|
||||
if auraBars.debuffColor then
|
||||
r, g, b = unpack(auraBars.debuffColor)
|
||||
else
|
||||
if debuffType == 'none' and auraBars.defaultDebuffColor then
|
||||
r, g, b = unpack(auraBars.defaultDebuffColor)
|
||||
end
|
||||
end
|
||||
end
|
||||
bar:SetStatusBarColor(r, g, b)
|
||||
frame:Show()
|
||||
end
|
||||
|
||||
-- Hide unused bars.
|
||||
for index = lastAuraIndex + 1, #bars do
|
||||
bars[index]:Hide()
|
||||
end
|
||||
|
||||
if auraBars.PostUpdate then
|
||||
auraBars:PostUpdate(event, unit)
|
||||
end
|
||||
end
|
||||
|
||||
local function Enable(self)
|
||||
if self.AuraBars then
|
||||
self:RegisterEvent('UNIT_AURA', Update)
|
||||
self.AuraBars:Height(1)
|
||||
self.AuraBars.bars = self.AuraBars.bars or {}
|
||||
self.AuraBars.SetAnchors = SetAnchors
|
||||
self.AuraBars:SetScript('OnUpdate', UpdateBars)
|
||||
self.AuraBars.maxBars = self.AuraBars.maxBars or 40
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local function Disable(self)
|
||||
local auraFrame = self.AuraBars
|
||||
if auraFrame then
|
||||
self:UnregisterEvent('UNIT_AURA', Update)
|
||||
auraFrame:SetScript('OnUpdate', nil)
|
||||
end
|
||||
end
|
||||
|
||||
oUF:AddElement('AuraBars', Update, Enable, Disable)
|
||||
388
Libraries/oUF_Plugins/oUF_AuraWatch/oUF_AuraWatch.lua
Normal file
388
Libraries/oUF_Plugins/oUF_AuraWatch/oUF_AuraWatch.lua
Normal file
@@ -0,0 +1,388 @@
|
||||
--[[------------------------------------------------------------------------------------------------------
|
||||
oUF_AuraWatch by Astromech
|
||||
Please leave comments, suggestions, and bug reports on this addon's WoWInterface page
|
||||
|
||||
To setup, create a table named AuraWatch in your unit frame. There are several options
|
||||
you can specify, as explained below.
|
||||
|
||||
icons
|
||||
Mandatory!
|
||||
A table of frames to be used as icons. oUF_Aurawatch does not position
|
||||
these frames, so you must do so yourself. Each icon needs a spellID entry,
|
||||
which is the spell ID of the aura to watch. Table should be set up
|
||||
such that values are icon frames, but the keys can be anything.
|
||||
|
||||
Note each icon can have several options set as well. See below.
|
||||
strictMatching
|
||||
Default: false
|
||||
If true, AuraWatch will only show an icon if the specific aura
|
||||
with the specified spell id is on the unit. If false, AuraWatch
|
||||
will show the icon if any aura with the same name and icon texture
|
||||
is on the unit. Strict matching can be undesireable because most
|
||||
ranks of an aura have different spell ids.
|
||||
missingAlpha
|
||||
Default 0.75
|
||||
The alpha value for icons of auras which have faded from the unit.
|
||||
presentAlpha
|
||||
Default 1
|
||||
The alpha value for icons or auras present on the unit.
|
||||
onlyShowMissing
|
||||
Default false
|
||||
If this is true, oUF_AW will hide icons if they are present on the unit.
|
||||
onlyShowPresent
|
||||
Default false
|
||||
If this is true, oUF_AW will hide icons if they have expired from the unit.
|
||||
hideCooldown
|
||||
Default false
|
||||
If this is true, oUF_AW will not create a cooldown frame
|
||||
hideCount
|
||||
Default false
|
||||
If this is true, oUF_AW will not create a count fontstring
|
||||
fromUnits
|
||||
Default {["player"] = true, ["pet"] = true, ["vehicle"] = true}
|
||||
A table of units from which auras can originate. Have the units be the keys
|
||||
and "true" be the values.
|
||||
anyUnit
|
||||
Default false
|
||||
Set to true for oUF_AW to to show an aura no matter what unit it
|
||||
originates from. This will override any fromUnits setting.
|
||||
decimalThreshold
|
||||
Default 5
|
||||
The threshold before timers go into decimal form. Set to -1 to disable decimals.
|
||||
PostCreateIcon
|
||||
Default nil
|
||||
A function to call when an icon is created to modify it, such as adding
|
||||
a border or repositioning the count fontstring. Leave as nil to ignore.
|
||||
The arguements are: AuraWatch table, icon, auraSpellID, auraName, unitFrame
|
||||
|
||||
Below are options set on a per icon basis. Set these as fields in the icon frames.
|
||||
|
||||
The following settings can be overridden from the AuraWatch table on a per-aura basis:
|
||||
onlyShowMissing
|
||||
onlyShowPresent
|
||||
hideCooldown
|
||||
hideCount
|
||||
fromUnits
|
||||
anyUnit
|
||||
decimalThreshold
|
||||
|
||||
The following settings are unique to icons:
|
||||
|
||||
spellID
|
||||
Mandatory!
|
||||
The spell id of the aura, as explained above.
|
||||
icon
|
||||
Default aura texture
|
||||
A texture value for this icon.
|
||||
overlay
|
||||
Default Blizzard aura overlay
|
||||
An overlay for the icon. This is not created if a custom icon texture is created.
|
||||
count
|
||||
Default A fontstring
|
||||
An fontstring to show the stack count of an aura.
|
||||
|
||||
Here is an example of how to set oUF_AW up:
|
||||
|
||||
local createAuraWatch = function(self, unit)
|
||||
local auras = {}
|
||||
|
||||
-- A table of spellIDs to create icons for
|
||||
-- To find spellIDs, look up a spell on www.wowhead.com and look at the URL
|
||||
-- http://www.wowhead.com/?spell=SPELL_ID
|
||||
local spellIDs = { ... }
|
||||
|
||||
auras.presentAlpha = 1
|
||||
auras.missingAlpha = .7
|
||||
auras.PostCreateIcon = myCustomIconSkinnerFunction
|
||||
-- Set any other AuraWatch settings
|
||||
auras.icons = {}
|
||||
for i, sid in pairs(spellIDs) do
|
||||
local icon = CreateFrame("Frame", nil, auras)
|
||||
icon.spellID = sid
|
||||
-- set the dimensions and positions
|
||||
icon:Width(24)
|
||||
icon:Height(24)
|
||||
icon:SetPoint("BOTTOM", self, "BOTTOM", 0, 28 * i)
|
||||
auras.icons[sid] = icon
|
||||
-- Set any other AuraWatch icon settings
|
||||
end
|
||||
self.AuraWatch = auras
|
||||
end
|
||||
-----------------------------------------------------------------------------------------------------------]]
|
||||
|
||||
local _, ns = ...
|
||||
local oUF = oUF or ns.oUF
|
||||
assert(oUF, "oUF_AuraWatch cannot find an instance of oUF. If your oUF is embedded into a layout, it may not be embedded properly.")
|
||||
|
||||
local UnitBuff, UnitDebuff, UnitGUID = UnitBuff, UnitDebuff, UnitGUID
|
||||
local GUIDs = {}
|
||||
|
||||
local PLAYER_UNITS = {
|
||||
player = true,
|
||||
vehicle = true,
|
||||
pet = true,
|
||||
}
|
||||
|
||||
local setupGUID
|
||||
do
|
||||
local cache = setmetatable({}, {__type = "k"})
|
||||
|
||||
local frame = CreateFrame"Frame"
|
||||
frame:SetScript("OnEvent", function(self, event)
|
||||
for k,t in pairs(GUIDs) do
|
||||
GUIDs[k] = nil
|
||||
for a in pairs(t) do
|
||||
t[a] = nil
|
||||
end
|
||||
cache[t] = true
|
||||
end
|
||||
end)
|
||||
frame:RegisterEvent"PLAYER_REGEN_ENABLED"
|
||||
frame:RegisterEvent"PLAYER_ENTERING_WORLD"
|
||||
|
||||
function setupGUID(guid)
|
||||
local t = next(cache)
|
||||
if t then
|
||||
cache[t] = nil
|
||||
else
|
||||
t = {}
|
||||
end
|
||||
GUIDs[guid] = t
|
||||
end
|
||||
end
|
||||
|
||||
local day, hour, minute, second = 86400, 3600, 60, 1
|
||||
local function formatTime(s, threshold)
|
||||
if s >= day then
|
||||
return format("%dd", ceil(s / hour))
|
||||
elseif s >= hour then
|
||||
return format("%dh", ceil(s / hour))
|
||||
elseif s >= minute then
|
||||
return format("%dm", ceil(s / minute))
|
||||
elseif s >= threshold then
|
||||
return floor(s)
|
||||
end
|
||||
|
||||
return format("%.1f", s)
|
||||
end
|
||||
|
||||
local function updateText(self, elapsed)
|
||||
if self.timeLeft then
|
||||
self.elapsed = (self.elapsed or 0) + elapsed
|
||||
if self.elapsed >= 0.1 then
|
||||
if not self.first then
|
||||
self.timeLeft = self.timeLeft - self.elapsed
|
||||
else
|
||||
self.timeLeft = self.timeLeft - GetTime()
|
||||
self.first = false
|
||||
end
|
||||
if self.timeLeft > 0 then
|
||||
if ((self.timeLeft <= self.textThreshold) or self.textThreshold == -1) then
|
||||
local time = formatTime(self.timeLeft, self.decimalThreshold or 5)
|
||||
self.text:SetText(time)
|
||||
else
|
||||
self.text:SetText('')
|
||||
end
|
||||
else
|
||||
self.text:SetText('')
|
||||
self:SetScript("OnUpdate", nil)
|
||||
end
|
||||
self.elapsed = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function resetIcon(icon, frame, count, duration, remaining)
|
||||
if icon.onlyShowMissing then
|
||||
icon:Hide()
|
||||
else
|
||||
icon:Show()
|
||||
if icon.cd then
|
||||
if duration and duration > 0 and icon.style ~= 'NONE' then
|
||||
icon.cd:SetCooldown(remaining - duration, duration)
|
||||
icon.cd:Show()
|
||||
else
|
||||
icon.cd:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
if icon.displayText then
|
||||
icon.timeLeft = remaining
|
||||
icon.first = true;
|
||||
icon:SetScript('OnUpdate', updateText)
|
||||
end
|
||||
|
||||
if icon.count then
|
||||
icon.count:SetText((count > 1 and count))
|
||||
end
|
||||
if icon.overlay then
|
||||
icon.overlay:Hide()
|
||||
end
|
||||
icon:SetAlpha(icon.presentAlpha)
|
||||
end
|
||||
end
|
||||
|
||||
local function expireIcon(icon, frame)
|
||||
if icon.onlyShowPresent then
|
||||
icon:Hide()
|
||||
else
|
||||
if (icon.cd) then icon.cd:Hide() end
|
||||
if (icon.count) then icon.count:SetText() end
|
||||
icon:SetAlpha(icon.missingAlpha)
|
||||
if icon.overlay then
|
||||
icon.overlay:Show()
|
||||
end
|
||||
icon:Show()
|
||||
end
|
||||
end
|
||||
|
||||
local found = {}
|
||||
local function Update(frame, event, unit)
|
||||
if frame.unit ~= unit or not unit then return end
|
||||
local watch = frame.AuraWatch
|
||||
local index, icons = 1, watch.watched
|
||||
local _, name, texture, count, duration, remaining, caster, key, icon, spellID
|
||||
local filter = "HELPFUL"
|
||||
local guid = UnitGUID(unit)
|
||||
if not guid then return end
|
||||
if not GUIDs[guid] then setupGUID(guid) end
|
||||
|
||||
for key, icon in pairs(icons) do
|
||||
if not icon.onlyShowMissing then
|
||||
icon:Hide()
|
||||
else
|
||||
icon:Show()
|
||||
end
|
||||
end
|
||||
|
||||
while true do
|
||||
name, _, texture, count, _, duration, remaining, caster, _, _, spellID = UnitAura(unit, index, filter)
|
||||
if not name then
|
||||
if filter == "HELPFUL" then
|
||||
filter = "HARMFUL"
|
||||
index = 1
|
||||
else
|
||||
break
|
||||
end
|
||||
else
|
||||
if watch.strictMatching then
|
||||
key = spellID
|
||||
else
|
||||
key = name..texture
|
||||
end
|
||||
icon = icons[key]
|
||||
|
||||
if icon and (icon.anyUnit or (caster and icon.fromUnits and icon.fromUnits[caster])) then
|
||||
resetIcon(icon, watch, count, duration, remaining)
|
||||
GUIDs[guid][key] = true
|
||||
found[key] = true
|
||||
end
|
||||
index = index + 1
|
||||
end
|
||||
end
|
||||
|
||||
for key in pairs(GUIDs[guid]) do
|
||||
if icons[key] and not found[key] then
|
||||
expireIcon(icons[key], watch)
|
||||
end
|
||||
end
|
||||
|
||||
for k in pairs(found) do
|
||||
found[k] = nil
|
||||
end
|
||||
end
|
||||
|
||||
local function setupIcons(self)
|
||||
|
||||
local watch = self.AuraWatch
|
||||
local icons = watch.icons
|
||||
watch.watched = {}
|
||||
|
||||
for _,icon in pairs(icons) do
|
||||
|
||||
local name, _, image = GetSpellInfo(icon.spellID)
|
||||
|
||||
if name then
|
||||
icon.name = name
|
||||
|
||||
if not icon.cd and not (watch.hideCooldown or icon.hideCooldown) then
|
||||
local cd = CreateFrame("Cooldown", nil, icon, "CooldownFrameTemplate")
|
||||
cd:SetAllPoints(icon)
|
||||
icon.cd = cd
|
||||
end
|
||||
|
||||
if not icon.icon then
|
||||
local tex = icon:CreateTexture(nil, "BACKGROUND")
|
||||
tex:SetAllPoints(icon)
|
||||
tex:SetTexture(image)
|
||||
icon.icon = tex
|
||||
if not icon.overlay then
|
||||
local overlay = icon:CreateTexture(nil, "OVERLAY")
|
||||
overlay:SetTexture"Interface\\Buttons\\UI-Debuff-Overlays"
|
||||
overlay:SetAllPoints(icon)
|
||||
overlay:SetTexCoord(.296875, .5703125, 0, .515625)
|
||||
overlay:SetVertexColor(1, 0, 0)
|
||||
icon.overlay = overlay
|
||||
end
|
||||
end
|
||||
|
||||
if not icon.count and not (watch.hideCount or icon.hideCount) then
|
||||
local count = icon:CreateFontString(nil, "OVERLAY")
|
||||
count:SetFontObject(NumberFontNormal)
|
||||
count:SetPoint("BOTTOMRIGHT", icon, "BOTTOMRIGHT", -1, 0)
|
||||
icon.count = count
|
||||
end
|
||||
|
||||
if icon.onlyShowMissing == nil then
|
||||
icon.onlyShowMissing = watch.onlyShowMissing
|
||||
end
|
||||
if icon.onlyShowPresent == nil then
|
||||
icon.onlyShowPresent = watch.onlyShowPresent
|
||||
end
|
||||
if icon.presentAlpha == nil then
|
||||
icon.presentAlpha = watch.presentAlpha
|
||||
end
|
||||
if icon.missingAlpha == nil then
|
||||
icon.missingAlpha = watch.missingAlpha
|
||||
end
|
||||
if icon.fromUnits == nil then
|
||||
icon.fromUnits = watch.fromUnits or PLAYER_UNITS
|
||||
end
|
||||
if icon.anyUnit == nil then
|
||||
icon.anyUnit = watch.anyUnit
|
||||
end
|
||||
|
||||
if watch.strictMatching then
|
||||
watch.watched[icon.spellID] = icon
|
||||
else
|
||||
watch.watched[name..image] = icon
|
||||
end
|
||||
|
||||
if watch.PostCreateIcon then watch:PostCreateIcon(icon, icon.spellID, name, self) end
|
||||
else
|
||||
print("oUF_AuraWatch error: no spell with "..tostring(icon.spellID).." spell ID exists")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function Enable(self)
|
||||
if self.AuraWatch then
|
||||
self.AuraWatch.Update = setupIcons
|
||||
self:RegisterEvent("UNIT_AURA", Update)
|
||||
setupIcons(self)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
local function Disable(self)
|
||||
if self.AuraWatch then
|
||||
self:UnregisterEvent("UNIT_AURA", Update)
|
||||
for _,icon in pairs(self.AuraWatch.icons) do
|
||||
icon:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
oUF:AddElement("AuraWatch", Update, Enable, Disable)
|
||||
9
Libraries/oUF_Plugins/oUF_AuraWatch/oUF_AuraWatch.toc
Normal file
9
Libraries/oUF_Plugins/oUF_AuraWatch/oUF_AuraWatch.toc
Normal file
@@ -0,0 +1,9 @@
|
||||
## Interface: 30300
|
||||
## Title: oUF AuraWatch
|
||||
## Author: Astromech
|
||||
## Version: 1.3.28-6
|
||||
## Notes: Adds aura timers to oUF
|
||||
## OptionalDeps: oUF
|
||||
## X-oUF: oUF
|
||||
|
||||
oUF_AuraWatch.lua
|
||||
127
Libraries/oUF_Plugins/oUF_CombatFader/oUF_CombatFader.lua
Normal file
127
Libraries/oUF_Plugins/oUF_CombatFader/oUF_CombatFader.lua
Normal file
@@ -0,0 +1,127 @@
|
||||
--By Elv, for E.
|
||||
local parent, ns = ...
|
||||
local oUF = ns.oUF
|
||||
local frames, allFrames = {}, {}
|
||||
local showStatus
|
||||
|
||||
local CheckForReset = function()
|
||||
for frame, unit in pairs(allFrames) do
|
||||
if frame.fadeInfo and frame.fadeInfo.reset then
|
||||
frame:SetAlpha(1)
|
||||
frame.fadeInfo.reset = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local FadeFramesInOut = function(fade, unit)
|
||||
local E = unpack(ElvUI)
|
||||
for frame, unit in pairs(frames) do
|
||||
if not UnitExists(unit) then return end
|
||||
if fade then
|
||||
if frame:GetAlpha() ~= 1 or (frame.fadeInfo and frame.fadeInfo.endAlpha == 0) then
|
||||
E:UIFrameFadeIn(frame, 0.15)
|
||||
end
|
||||
else
|
||||
if frame:GetAlpha() ~= 0 then
|
||||
E:UIFrameFadeOut(frame, 0.15)
|
||||
frame.fadeInfo.finishedFunc = CheckForReset
|
||||
else
|
||||
showStatus = false;
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if unit == 'player' then
|
||||
showStatus = fade
|
||||
end
|
||||
end
|
||||
|
||||
local Update = function(self, arg1, arg2)
|
||||
if arg1 == "UNIT_HEALTH" and self and self.unit ~= arg2 then return end
|
||||
if type(arg1) == 'boolean' and not frames[self] then
|
||||
return
|
||||
end
|
||||
|
||||
local E = unpack(ElvUI)
|
||||
|
||||
if not frames[self] then
|
||||
E:UIFrameFadeIn(self, 0.15)
|
||||
self.fadeInfo.reset = true
|
||||
return
|
||||
end
|
||||
|
||||
local combat = UnitAffectingCombat("player")
|
||||
local cur, max = UnitHealth("player"), UnitHealthMax("player")
|
||||
local cast, channel = UnitCastingInfo("player"), UnitChannelInfo("player")
|
||||
local target, focus = UnitExists("target"), UnitExists("focus")
|
||||
|
||||
if (cast or channel) and showStatus ~= true then
|
||||
FadeFramesInOut(true, frames[self])
|
||||
elseif cur ~= max and showStatus ~= true then
|
||||
FadeFramesInOut(true, frames[self])
|
||||
elseif (target or focus) and showStatus ~= true then
|
||||
FadeFramesInOut(true, frames[self])
|
||||
elseif arg1 == true and showStatus ~= true then
|
||||
FadeFramesInOut(true, frames[self])
|
||||
else
|
||||
if combat and showStatus ~= true then
|
||||
FadeFramesInOut(true, frames[self])
|
||||
elseif not target and not combat and not focus and (cur == max) and not (cast or channel) then
|
||||
FadeFramesInOut(false, frames[self])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local Enable = function(self, unit)
|
||||
if self.CombatFade then
|
||||
frames[self] = self.unit
|
||||
allFrames[self] = self.unit
|
||||
|
||||
if unit == 'player' then
|
||||
showStatus = false;
|
||||
end
|
||||
|
||||
self:RegisterEvent("PLAYER_ENTERING_WORLD", Update)
|
||||
self:RegisterEvent("PLAYER_REGEN_ENABLED", Update)
|
||||
self:RegisterEvent("PLAYER_REGEN_DISABLED", Update)
|
||||
self:RegisterEvent("PLAYER_TARGET_CHANGED", Update)
|
||||
self:RegisterEvent("PLAYER_FOCUS_CHANGED", Update)
|
||||
self:RegisterEvent("UNIT_HEALTH", Update)
|
||||
self:RegisterEvent("UNIT_SPELLCAST_START", Update)
|
||||
self:RegisterEvent("UNIT_SPELLCAST_STOP", Update)
|
||||
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START", Update)
|
||||
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP", Update)
|
||||
self:RegisterEvent("UNIT_PORTRAIT_UPDATE", Update)
|
||||
self:RegisterEvent("UNIT_MODEL_CHANGED", Update)
|
||||
|
||||
if not self.CombatFadeHooked then
|
||||
self:HookScript("OnEnter", function(self) Update(self, true) end)
|
||||
self:HookScript("OnLeave", function(self) Update(self, false) end)
|
||||
self.CombatFadeHooked = true
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local Disable = function(self)
|
||||
if(self.CombatFade) then
|
||||
frames[self] = nil
|
||||
Update(self)
|
||||
|
||||
self:UnregisterEvent("PLAYER_ENTERING_WORLD", Update)
|
||||
self:UnregisterEvent("PLAYER_REGEN_ENABLED", Update)
|
||||
self:UnregisterEvent("PLAYER_REGEN_DISABLED", Update)
|
||||
self:UnregisterEvent("PLAYER_TARGET_CHANGED", Update)
|
||||
self:UnregisterEvent("PLAYER_FOCUS_CHANGED", Update)
|
||||
self:UnregisterEvent("UNIT_HEALTH", Update)
|
||||
self:UnregisterEvent("UNIT_SPELLCAST_START", Update)
|
||||
self:UnregisterEvent("UNIT_SPELLCAST_STOP", Update)
|
||||
self:UnregisterEvent("UNIT_SPELLCAST_CHANNEL_START", Update)
|
||||
self:UnregisterEvent("UNIT_SPELLCAST_CHANNEL_STOP", Update)
|
||||
self:UnregisterEvent("UNIT_PORTRAIT_UPDATE", Update)
|
||||
self:UnregisterEvent("UNIT_MODEL_CHANGED", Update)
|
||||
end
|
||||
end
|
||||
|
||||
oUF:AddElement('CombatFade', Update, Enable, Disable)
|
||||
@@ -0,0 +1,8 @@
|
||||
## Interface: 40200
|
||||
## Title: oUF Combat Fader
|
||||
## Notes: Adds combat fade ability to oUF
|
||||
## Author: Elv
|
||||
## Version: 1.0.0
|
||||
## Dependencies: oUF
|
||||
|
||||
oUF_CombatFader.lua
|
||||
@@ -0,0 +1,178 @@
|
||||
local _, ns = ...
|
||||
local oUF = oUF or ns.oUF
|
||||
if not oUF then return end
|
||||
|
||||
local playerClass = select(2,UnitClass("player"))
|
||||
local CanDispel = {
|
||||
PRIEST = { Magic = true, Disease = true },
|
||||
SHAMAN = { Magic = false, Curse = true },
|
||||
PALADIN = { Magic = false, Poison = true, Disease = true },
|
||||
DRUID = { Magic = false, Curse = true, Poison = true, Disease = false },
|
||||
MONK = { Magic = false, Poison = true, Disease = true }
|
||||
}
|
||||
|
||||
local blackList = {
|
||||
[GetSpellInfo(140546)] = true, --Fully Mutated
|
||||
[GetSpellInfo(136184)] = true, --Thick Bones
|
||||
[GetSpellInfo(136186)] = true, --Clear mind
|
||||
[GetSpellInfo(136182)] = true, --Improved Synapses
|
||||
[GetSpellInfo(136180)] = true, --Keen Eyesight
|
||||
}
|
||||
|
||||
local SymbiosisName = GetSpellInfo(110309)
|
||||
local CleanseName = GetSpellInfo(4987)
|
||||
local dispellist = CanDispel[playerClass] or {}
|
||||
local origColors = {}
|
||||
local origBorderColors = {}
|
||||
local origPostUpdateAura = {}
|
||||
|
||||
local function GetDebuffType(unit, filter, filterTable)
|
||||
if not unit or not UnitCanAssist("player", unit) then return nil end
|
||||
local i = 1
|
||||
while true do
|
||||
local name, _, texture, _, debufftype, _,_,_,_,_, spellID = UnitAura(unit, i, "HARMFUL")
|
||||
if not texture then break end
|
||||
|
||||
local filterSpell = filterTable[spellID] or filterTable[name]
|
||||
|
||||
if(filterTable and filterSpell and filterSpell.enable) then
|
||||
return debufftype, texture, true, filterSpell.style, filterSpell.color
|
||||
elseif debufftype and (not filter or (filter and dispellist[debufftype])) and not blackList[name] then
|
||||
return debufftype, texture
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
|
||||
local function CheckTalentTree(tree)
|
||||
local activeGroup = GetActiveSpecGroup()
|
||||
|
||||
if activeGroup and GetSpecialization(false, false, activeGroup) then
|
||||
return tree == GetSpecialization(false, false, activeGroup)
|
||||
end
|
||||
end
|
||||
|
||||
local function CheckSpec(self, event, levels)
|
||||
if event == "CHARACTER_POINTS_CHANGED" and levels > 0 then return end
|
||||
|
||||
--Check for certain talents to see if we can dispel magic or not
|
||||
if playerClass == "PRIEST" then
|
||||
if CheckTalentTree(3) then
|
||||
dispellist.Disease = false
|
||||
else
|
||||
dispellist.Disease = true
|
||||
end
|
||||
elseif playerClass == "PALADIN" then
|
||||
if CheckTalentTree(1) then
|
||||
dispellist.Magic = true
|
||||
else
|
||||
dispellist.Magic = false
|
||||
end
|
||||
elseif playerClass == "SHAMAN" then
|
||||
if CheckTalentTree(3) then
|
||||
dispellist.Magic = true
|
||||
else
|
||||
dispellist.Magic = false
|
||||
end
|
||||
elseif playerClass == "DRUID" then
|
||||
if CheckTalentTree(4) then
|
||||
dispellist.Magic = true
|
||||
else
|
||||
dispellist.Magic = false
|
||||
end
|
||||
elseif playerClass == "MONK" then
|
||||
if CheckTalentTree(2) then
|
||||
dispellist.Magic = true
|
||||
else
|
||||
dispellist.Magic = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function CheckSymbiosis()
|
||||
if GetSpellInfo(SymbiosisName) == CleanseName then
|
||||
dispellist.Disease = true
|
||||
else
|
||||
dispellist.Disease = false
|
||||
end
|
||||
end
|
||||
|
||||
local function Update(object, event, unit)
|
||||
if unit ~= object.unit then return; end
|
||||
|
||||
local debuffType, texture, wasFiltered, style, color = GetDebuffType(unit, object.DebuffHighlightFilter, object.DebuffHighlightFilterTable)
|
||||
if(wasFiltered) then
|
||||
if style == "GLOW" and object.DBHGlow then
|
||||
object.DBHGlow:Show()
|
||||
object.DBHGlow:SetBackdropBorderColor(color.r, color.g, color.b)
|
||||
elseif object.DBHGlow then
|
||||
object.DBHGlow:Hide()
|
||||
object.DebuffHighlight:SetVertexColor(color.r, color.g, color.b, color.a or object.DebuffHighlightAlpha or .5)
|
||||
end
|
||||
elseif debuffType then
|
||||
color = DebuffTypeColor[debuffType]
|
||||
if object.DebuffHighlightBackdrop and object.DBHGlow then
|
||||
object.DBHGlow:Show()
|
||||
object.DBHGlow:SetBackdropBorderColor(color.r, color.g, color.b)
|
||||
elseif object.DebuffHighlightUseTexture then
|
||||
object.DebuffHighlight:SetTexture(texture)
|
||||
else
|
||||
object.DebuffHighlight:SetVertexColor(color.r, color.g, color.b, object.DebuffHighlightAlpha or .5)
|
||||
end
|
||||
else
|
||||
if object.DBHGlow then
|
||||
object.DBHGlow:Hide()
|
||||
end
|
||||
|
||||
if object.DebuffHighlightUseTexture then
|
||||
object.DebuffHighlight:SetTexture(nil)
|
||||
else
|
||||
object.DebuffHighlight:SetVertexColor(0, 0, 0, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function Enable(object)
|
||||
-- if we're not highlighting this unit return
|
||||
if not object.DebuffHighlightBackdrop and not object.DebuffHighlight and not object.DBHGlow then
|
||||
return
|
||||
end
|
||||
-- if we're filtering highlights and we're not of the dispelling type, return
|
||||
if object.DebuffHighlightFilter and not CanDispel[playerClass] then
|
||||
return
|
||||
end
|
||||
|
||||
object:RegisterEvent("UNIT_AURA", Update)
|
||||
if playerClass == "DRUID" then
|
||||
object:RegisterEvent("SPELLS_CHANGED", CheckSymbiosis)
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
local function Disable(object)
|
||||
object:UnregisterEvent("UNIT_AURA", Update)
|
||||
|
||||
if playerClass == "DRUID" then
|
||||
object:UnregisterEvent("SPELLS_CHANGED", CheckSymbiosis)
|
||||
end
|
||||
|
||||
if object.DBHGlow then
|
||||
object.DBHGlow:Hide()
|
||||
end
|
||||
|
||||
if object.DebuffHighlight then
|
||||
local color = origColors[object]
|
||||
if color then
|
||||
object.DebuffHighlight:SetVertexColor(color.r, color.g, color.b, color.a)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local f = CreateFrame("Frame")
|
||||
f:RegisterEvent("PLAYER_TALENT_UPDATE")
|
||||
f:RegisterEvent("CHARACTER_POINTS_CHANGED")
|
||||
f:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED")
|
||||
f:SetScript("OnEvent", CheckSpec)
|
||||
|
||||
oUF:AddElement('DebuffHighlight', Update, Enable, Disable)
|
||||
@@ -0,0 +1,14 @@
|
||||
## Interface: 30100
|
||||
## Title: oUF Debuff Highlight
|
||||
## Notes: Adds Debuff Highlighting to oUF.
|
||||
## Author: Ammo
|
||||
## Version: 1.0
|
||||
## X-Category: UnitFrame
|
||||
## Dependencies: oUF
|
||||
## X-Curse-Packaged-Version: r44-release
|
||||
## X-Curse-Project-Name: oUF_DebuffHighlight
|
||||
## X-Curse-Project-ID: o-uf_debuff-highlight
|
||||
## X-Curse-Repository-ID: wow/o-uf_debuff-highlight/mainline
|
||||
|
||||
oUF_DebuffHighlight.lua
|
||||
|
||||
65
Libraries/oUF_Plugins/oUF_PVPSpecIcons/oUF_PVPSpecIcons.lua
Normal file
65
Libraries/oUF_Plugins/oUF_PVPSpecIcons/oUF_PVPSpecIcons.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
local _, ns = ...
|
||||
local oUF = ns.oUF or oUF
|
||||
assert(oUF, 'oUF not loaded')
|
||||
|
||||
|
||||
local Update = function(self, event, unit)
|
||||
if event == 'ARENA_OPPONENT_UPDATE' and unit ~= self.unit then return; end
|
||||
local specIcon = self.PVPSpecIcon
|
||||
|
||||
local _, instanceType = IsInInstance();
|
||||
specIcon.instanceType = instanceType
|
||||
|
||||
if(specIcon.PreUpdate) then specIcon:PreUpdate(event) end
|
||||
|
||||
if instanceType == 'arena' then
|
||||
local numOpps = GetNumArenaOpponentSpecs()
|
||||
local ID = self.unit:match('arena(%d)') or self:GetID() or 0
|
||||
local specID = GetArenaOpponentSpec(tonumber(ID))
|
||||
if specID and specID > 0 then
|
||||
local _, _, _, icon = GetSpecializationInfoByID(specID);
|
||||
specIcon.Icon:SetTexture(icon)
|
||||
else
|
||||
specIcon.Icon:SetTexture([[INTERFACE\ICONS\INV_MISC_QUESTIONMARK]])
|
||||
end
|
||||
else
|
||||
local unitFactionGroup = UnitFactionGroup(self.unit)
|
||||
if unitFactionGroup == "Horde" then
|
||||
specIcon.Icon:SetTexture([[Interface\Icons\INV_BannerPVP_01]])
|
||||
elseif unitFactionGroup == 'Alliance' then
|
||||
specIcon.Icon:SetTexture([[Interface\Icons\INV_BannerPVP_02]])
|
||||
else
|
||||
specIcon.Icon:SetTexture([[INTERFACE\ICONS\INV_MISC_QUESTIONMARK]])
|
||||
end
|
||||
end
|
||||
|
||||
if(specIcon.PostUpdate) then specIcon:PostUpdate(event) end
|
||||
end
|
||||
|
||||
local Enable = function(self)
|
||||
local specIcon = self.PVPSpecIcon
|
||||
if specIcon then
|
||||
self:RegisterEvent("ARENA_OPPONENT_UPDATE", Update, true)
|
||||
self:RegisterEvent("PLAYER_ENTERING_WORLD", Update, true)
|
||||
|
||||
if not specIcon.Icon then
|
||||
specIcon.Icon = specIcon:CreateTexture(nil, "OVERLAY")
|
||||
specIcon.Icon:SetAllPoints(specIcon)
|
||||
specIcon.Icon:SetTexCoord(0.07, 0.93, 0.07, 0.93)
|
||||
end
|
||||
specIcon:Show()
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local Disable = function(self)
|
||||
local specIcon = self.PVPSpecIcon
|
||||
if specIcon then
|
||||
self:UnregisterEvent("ARENA_PREP_OPPONENT_SPECIALIZATIONS", Update)
|
||||
self:UnregisterEvent("ARENA_OPPONENT_UPDATE", Update)
|
||||
self:UnregisterEvent("PLAYER_ENTERING_WORLD", Update)
|
||||
specIcon:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
oUF:AddElement('PVPSpecIcon', Update, Enable, Disable)
|
||||
@@ -0,0 +1,9 @@
|
||||
## Interface: 50001
|
||||
## Title: oUF Arena Spec Icons
|
||||
## Notes: Adds spec icons to arena frames.
|
||||
## Author: Elv
|
||||
## Version: 1.00
|
||||
## X-Category: oUF
|
||||
## Dependencies: oUF
|
||||
|
||||
oUF_PVPSpecIcons.lua
|
||||
10
Libraries/oUF_Plugins/oUF_Plugins.xml
Normal file
10
Libraries/oUF_Plugins/oUF_Plugins.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/">
|
||||
<Script file="oUF_AuraWatch\oUF_AuraWatch.lua"/>
|
||||
<Script file="oUF_AuraBars\oUF_AuraBars.lua"/>
|
||||
<Script file="oUF_RaidDebuffs\oUF_RaidDebuffs.lua"/>
|
||||
<Script file="oUF_DebuffHighlight\oUF_DebuffHighlight.lua"/>
|
||||
<Script file="oUF_Smooth\oUF_Smooth.lua"/>
|
||||
<Script file="oUF_Trinkets\oUF_Trinkets.lua"/>
|
||||
<Script file="oUF_CombatFader\oUF_CombatFader.lua"/>
|
||||
<Script file='oUF_PVPSpecIcons\oUF_PVPSpecIcons.lua'/>
|
||||
</Ui>
|
||||
332
Libraries/oUF_Plugins/oUF_RaidDebuffs/oUF_RaidDebuffs.lua
Normal file
332
Libraries/oUF_Plugins/oUF_RaidDebuffs/oUF_RaidDebuffs.lua
Normal file
@@ -0,0 +1,332 @@
|
||||
local E, L, DF = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales
|
||||
|
||||
|
||||
local _, ns = ...
|
||||
local oUF = ns.oUF or oUF
|
||||
|
||||
local SymbiosisName = GetSpellInfo(110309)
|
||||
local CleanseName = GetSpellInfo(4987)
|
||||
|
||||
local addon = {}
|
||||
ns.oUF_RaidDebuffs = addon
|
||||
oUF_RaidDebuffs = ns.oUF_RaidDebuffs
|
||||
if not _G.oUF_RaidDebuffs then
|
||||
_G.oUF_RaidDebuffs = addon
|
||||
end
|
||||
|
||||
local debuff_data = {}
|
||||
addon.DebuffData = debuff_data
|
||||
|
||||
|
||||
addon.ShowDispelableDebuff = true
|
||||
addon.FilterDispellableDebuff = true
|
||||
addon.MatchBySpellName = false
|
||||
|
||||
|
||||
addon.priority = 10
|
||||
|
||||
local function add(spell, priority, stackThreshold)
|
||||
if addon.MatchBySpellName and type(spell) == 'number' then
|
||||
spell = GetSpellInfo(spell)
|
||||
end
|
||||
|
||||
if(spell) then
|
||||
debuff_data[spell] = {
|
||||
priority = (addon.priority + priority),
|
||||
stackThreshold = (stackThreshold or 0),
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function addon:RegisterDebuffs(t)
|
||||
for spell, value in pairs(t) do
|
||||
if type(t[spell]) == 'boolean' then
|
||||
local oldValue = t[spell]
|
||||
t[spell] = {
|
||||
['enable'] = oldValue,
|
||||
['priority'] = 0,
|
||||
['stackThreshold'] = 0
|
||||
}
|
||||
else
|
||||
if t[spell].enable then
|
||||
add(spell, t[spell].priority, t[spell].stackThreshold)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function addon:ResetDebuffData()
|
||||
wipe(debuff_data)
|
||||
end
|
||||
|
||||
local DispellColor = {
|
||||
['Magic'] = {.2, .6, 1},
|
||||
['Curse'] = {.6, 0, 1},
|
||||
['Disease'] = {.6, .4, 0},
|
||||
['Poison'] = {0, .6, 0},
|
||||
['none'] = { .23, .23, .23},
|
||||
}
|
||||
|
||||
local DispellPriority = {
|
||||
['Magic'] = 4,
|
||||
['Curse'] = 3,
|
||||
['Disease'] = 2,
|
||||
['Poison'] = 1,
|
||||
}
|
||||
|
||||
local DispellFilter
|
||||
do
|
||||
local dispellClasses = {
|
||||
['PRIEST'] = {
|
||||
['Magic'] = true,
|
||||
['Disease'] = true,
|
||||
},
|
||||
['SHAMAN'] = {
|
||||
['Magic'] = false,
|
||||
['Curse'] = true,
|
||||
},
|
||||
['PALADIN'] = {
|
||||
['Poison'] = true,
|
||||
['Magic'] = false,
|
||||
['Disease'] = true,
|
||||
},
|
||||
['DRUID'] = {
|
||||
['Magic'] = false,
|
||||
['Curse'] = true,
|
||||
['Poison'] = true,
|
||||
['Disease'] = false,
|
||||
},
|
||||
['MONK'] = {
|
||||
['Magic'] = false,
|
||||
['Disease'] = true,
|
||||
['Poison'] = true,
|
||||
},
|
||||
}
|
||||
|
||||
DispellFilter = dispellClasses[select(2, UnitClass('player'))] or {}
|
||||
end
|
||||
|
||||
local function CheckTalentTree(tree)
|
||||
local activeGroup = GetActiveSpecGroup()
|
||||
if activeGroup and GetSpecialization(false, false, activeGroup) then
|
||||
return tree == GetSpecialization(false, false, activeGroup)
|
||||
end
|
||||
end
|
||||
|
||||
local playerClass = select(2, UnitClass('player'))
|
||||
local function CheckSpec(self, event, levels)
|
||||
-- Not interested in gained points from leveling
|
||||
if event == "CHARACTER_POINTS_CHANGED" and levels > 0 then return end
|
||||
|
||||
--Check for certain talents to see if we can dispel magic or not
|
||||
if playerClass == "PALADIN" then
|
||||
if CheckTalentTree(1) then
|
||||
DispellFilter.Magic = true
|
||||
else
|
||||
DispellFilter.Magic = false
|
||||
end
|
||||
elseif playerClass == "SHAMAN" then
|
||||
if CheckTalentTree(3) then
|
||||
DispellFilter.Magic = true
|
||||
else
|
||||
DispellFilter.Magic = false
|
||||
end
|
||||
elseif playerClass == "DRUID" then
|
||||
if CheckTalentTree(4) then
|
||||
DispellFilter.Magic = true
|
||||
else
|
||||
DispellFilter.Magic = false
|
||||
end
|
||||
elseif playerClass == "MONK" then
|
||||
if CheckTalentTree(2) then
|
||||
DispellFilter.Magic = true
|
||||
else
|
||||
DispellFilter.Magic = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function CheckSymbiosis()
|
||||
if GetSpellInfo(SymbiosisName) == CleanseName then
|
||||
DispellFilter.Disease = true
|
||||
else
|
||||
DispellFilter.Disease = false
|
||||
end
|
||||
end
|
||||
|
||||
local function formatTime(s)
|
||||
if s > 60 then
|
||||
return format('%dm', s/60), s%60
|
||||
elseif s < 1 then
|
||||
return format("%.1f", s), s - floor(s)
|
||||
else
|
||||
return format('%d', s), s - floor(s)
|
||||
end
|
||||
end
|
||||
|
||||
local abs = math.abs
|
||||
local function OnUpdate(self, elapsed)
|
||||
self.elapsed = (self.elapsed or 0) + elapsed
|
||||
if self.elapsed >= 0.1 then
|
||||
local timeLeft = self.endTime - GetTime()
|
||||
if self.reverse then timeLeft = abs((self.endTime - GetTime()) - self.duration) end
|
||||
if timeLeft > 0 then
|
||||
local text = formatTime(timeLeft)
|
||||
self.time:SetText(text)
|
||||
else
|
||||
self:SetScript('OnUpdate', nil)
|
||||
self.time:Hide()
|
||||
end
|
||||
self.elapsed = 0
|
||||
end
|
||||
end
|
||||
|
||||
local function UpdateDebuff(self, name, icon, count, debuffType, duration, endTime, spellId, stackThreshold)
|
||||
local f = self.RaidDebuffs
|
||||
|
||||
if name and (count >= stackThreshold) then
|
||||
f.icon:SetTexture(icon)
|
||||
f.icon:Show()
|
||||
f.duration = duration
|
||||
|
||||
if f.count then
|
||||
if count and (count > 1) then
|
||||
f.count:SetText(count)
|
||||
f.count:Show()
|
||||
else
|
||||
f.count:SetText("")
|
||||
f.count:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
if spellId and select(1, unpack(ElvUI)).ReverseTimer[spellId] then
|
||||
f.reverse = true
|
||||
else
|
||||
f.reverse = nil
|
||||
end
|
||||
|
||||
if f.time then
|
||||
if duration and (duration > 0) then
|
||||
f.endTime = endTime
|
||||
f.nextUpdate = 0
|
||||
f:SetScript('OnUpdate', OnUpdate)
|
||||
f.time:Show()
|
||||
else
|
||||
f:SetScript('OnUpdate', nil)
|
||||
f.time:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
if f.cd then
|
||||
if duration and (duration > 0) then
|
||||
f.cd:SetCooldown(endTime - duration, duration)
|
||||
f.cd:Show()
|
||||
else
|
||||
f.cd:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
local c = DispellColor[debuffType] or DispellColor.none
|
||||
f:SetBackdropBorderColor(c[1], c[2], c[3])
|
||||
|
||||
f:Show()
|
||||
else
|
||||
f:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
local blackList = {
|
||||
[105171] = true, -- Deep Corruption
|
||||
[108220] = true, -- Deep Corruption
|
||||
[116095] = true, -- Disable, Slow
|
||||
[137637] = true, -- Warbringer, Slow
|
||||
}
|
||||
|
||||
local function Update(self, event, unit)
|
||||
if unit ~= self.unit then return end
|
||||
local _name, _icon, _count, _dtype, _duration, _endTime, _spellId
|
||||
local _priority, priority = 0, 0
|
||||
local _stackThreshold = 0
|
||||
|
||||
--store if the unit its charmed, mind controlled units (Imperial Vizier Zor'lok: Convert)
|
||||
local isCharmed = UnitIsCharmed(unit)
|
||||
|
||||
--store if we cand attack that unit, if its so the unit its hostile (Amber-Shaper Un'sok: Reshape Life)
|
||||
local canAttack = UnitCanAttack("player", unit)
|
||||
|
||||
for i = 1, 40 do
|
||||
local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellId, canApplyAura, isBossDebuff = UnitAura(unit, i, 'HARMFUL')
|
||||
if (not name) then break end
|
||||
|
||||
--we coudln't dispell if the unit its charmed, or its not friendly
|
||||
if addon.ShowDispelableDebuff and (self.RaidDebuffs.showDispellableDebuff ~= false) and debuffType and (not isCharmed) and (not canAttack) then
|
||||
|
||||
if addon.FilterDispellableDebuff then
|
||||
DispellPriority[debuffType] = (DispellPriority[debuffType] or 0) + addon.priority --Make Dispell buffs on top of Boss Debuffs
|
||||
priority = DispellFilter[debuffType] and DispellPriority[debuffType] or 0
|
||||
if priority == 0 then
|
||||
debuffType = nil
|
||||
end
|
||||
else
|
||||
priority = DispellPriority[debuffType] or 0
|
||||
end
|
||||
|
||||
if priority > _priority then
|
||||
_priority, _name, _icon, _count, _dtype, _duration, _endTime, _spellId = priority, name, icon, count, debuffType, duration, expirationTime, spellId
|
||||
end
|
||||
end
|
||||
|
||||
priority = debuff_data[addon.MatchBySpellName and name or spellId] and debuff_data[addon.MatchBySpellName and name or spellId].priority
|
||||
if priority and not blackList[spellId] and (priority > _priority) then
|
||||
_priority, _name, _icon, _count, _dtype, _duration, _endTime, _spellId = priority, name, icon, count, debuffType, duration, expirationTime, spellId
|
||||
end
|
||||
end
|
||||
|
||||
if self.RaidDebuffs.forceShow then
|
||||
_spellId = 47540
|
||||
_name, _, _icon = GetSpellInfo(_spellId)
|
||||
_count, _dtype, _duration, _endTime, _stackThreshold = 5, 'Magic', 0, 60, 0
|
||||
end
|
||||
|
||||
if _name then
|
||||
_stackThreshold = debuff_data[addon.MatchBySpellName and _name or _spellId] and debuff_data[addon.MatchBySpellName and _name or _spellId].stackThreshold or _stackThreshold
|
||||
end
|
||||
|
||||
UpdateDebuff(self, _name, _icon, _count, _dtype, _duration, _endTime, _spellId, _stackThreshold)
|
||||
|
||||
--Reset the DispellPriority
|
||||
DispellPriority = {
|
||||
['Magic'] = 4,
|
||||
['Curse'] = 3,
|
||||
['Disease'] = 2,
|
||||
['Poison'] = 1,
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
local function Enable(self)
|
||||
if self.RaidDebuffs then
|
||||
self:RegisterEvent('UNIT_AURA', Update)
|
||||
return true
|
||||
end
|
||||
--Need to run these always
|
||||
self:RegisterEvent("PLAYER_TALENT_UPDATE", CheckSpec)
|
||||
self:RegisterEvent("CHARACTER_POINTS_CHANGED", CheckSpec)
|
||||
if playerClass == "DRUID" then
|
||||
self:RegisterEvent("SPELLS_CHANGED", CheckSymbiosis)
|
||||
end
|
||||
end
|
||||
|
||||
local function Disable(self)
|
||||
if self.RaidDebuffs then
|
||||
self:UnregisterEvent('UNIT_AURA', Update)
|
||||
self.RaidDebuffs:Hide()
|
||||
end
|
||||
self:UnregisterEvent("PLAYER_TALENT_UPDATE", CheckSpec)
|
||||
self:UnregisterEvent("CHARACTER_POINTS_CHANGED", CheckSpec)
|
||||
if playerClass == "DRUID" then
|
||||
self:UnregisterEvent("SPELLS_CHANGED", CheckSymbiosis)
|
||||
end
|
||||
end
|
||||
|
||||
oUF:AddElement('RaidDebuffs', Update, Enable, Disable)
|
||||
@@ -0,0 +1,7 @@
|
||||
## Interface: 30300
|
||||
## Title: oUF RaidDebuffs
|
||||
## Notes: Raid debuff mod for oUF
|
||||
## Version: 1.2
|
||||
## OptionalDeps: oUF
|
||||
|
||||
oUF_RaidDebuffs.lua
|
||||
64
Libraries/oUF_Plugins/oUF_Smooth/oUF_Smooth.lua
Normal file
64
Libraries/oUF_Plugins/oUF_Smooth/oUF_Smooth.lua
Normal file
@@ -0,0 +1,64 @@
|
||||
local _, ns = ...
|
||||
local oUF = ns.oUF or oUF
|
||||
if not oUF then return end
|
||||
|
||||
local smoothing = {}
|
||||
local function Smooth(self, value)
|
||||
if value ~= self:GetValue() or value == 0 then
|
||||
smoothing[self] = value
|
||||
else
|
||||
smoothing[self] = nil
|
||||
end
|
||||
end
|
||||
|
||||
local function SmoothBar(bar)
|
||||
if not bar.SetValue_ then
|
||||
bar.SetValue_ = bar.SetValue;
|
||||
bar.SetValue = Smooth;
|
||||
end
|
||||
end
|
||||
|
||||
local function ResetBar(bar)
|
||||
if bar.SetValue_ then
|
||||
bar.SetValue = bar.SetValue_;
|
||||
bar.SetValue_ = nil;
|
||||
end
|
||||
end
|
||||
|
||||
local function hook(frame)
|
||||
if frame.Health then
|
||||
SmoothBar(frame.Health)
|
||||
end
|
||||
if frame.Power then
|
||||
SmoothBar(frame.Power)
|
||||
end
|
||||
if frame.AltPowerBar then
|
||||
SmoothBar(frame.AltPowerBar)
|
||||
end
|
||||
end
|
||||
|
||||
for i, frame in ipairs(oUF.objects) do hook(frame) end
|
||||
oUF:RegisterInitCallback(hook)
|
||||
|
||||
local f, min, max = CreateFrame('Frame'), math.min, math.max
|
||||
f:SetScript('OnUpdate', function()
|
||||
local rate = GetFramerate()
|
||||
local limit = 30/rate
|
||||
|
||||
for bar, value in pairs(smoothing) do
|
||||
local cur = bar:GetValue()
|
||||
local new = cur + min((value-cur)/3, max(value-cur, limit))
|
||||
if new ~= new then
|
||||
-- Mad hax to prevent QNAN.
|
||||
new = value
|
||||
end
|
||||
bar:SetValue_(new)
|
||||
if (cur == value or abs(new - value) < 2) and bar.Smooth then
|
||||
bar:SetValue_(value)
|
||||
smoothing[bar] = nil
|
||||
elseif not bar.Smooth then
|
||||
bar:SetValue_(value)
|
||||
smoothing[bar] = nil
|
||||
end
|
||||
end
|
||||
end)
|
||||
84
Libraries/oUF_Plugins/oUF_Trinkets/oUF_Trinkets.lua
Normal file
84
Libraries/oUF_Plugins/oUF_Trinkets/oUF_Trinkets.lua
Normal file
@@ -0,0 +1,84 @@
|
||||
local _, ns = ...
|
||||
local oUF = ns.oUF or oUF
|
||||
assert(oUF, 'oUF not loaded')
|
||||
|
||||
local trinketSpells = {
|
||||
[208683] = 120,
|
||||
[195710] = 180,
|
||||
[59752] = 120,
|
||||
[42292] = 120,
|
||||
[7744] = 45,
|
||||
}
|
||||
|
||||
local GetTrinketIcon = function(unit)
|
||||
if UnitFactionGroup(unit) == "Horde" then
|
||||
return "Interface\\Icons\\INV_Jewelry_TrinketPVP_02"
|
||||
else
|
||||
return "Interface\\Icons\\INV_Jewelry_TrinketPVP_01"
|
||||
end
|
||||
end
|
||||
|
||||
local Update = function(self, event, ...)
|
||||
local _, instanceType = IsInInstance();
|
||||
if instanceType ~= 'arena' then
|
||||
self.Trinket:Hide();
|
||||
return;
|
||||
else
|
||||
self.Trinket:Show();
|
||||
end
|
||||
|
||||
if(self.Trinket.PreUpdate) then self.Trinket:PreUpdate(event) end
|
||||
|
||||
if event == "COMBAT_LOG_EVENT_UNFILTERED" then
|
||||
local _, eventType, _, sourceGUID, _, _, _, _, _, _, _, spellID = ...
|
||||
if eventType == "SPELL_CAST_SUCCESS" and sourceGUID == UnitGUID(self.unit) and trinketSpells[spellID] then
|
||||
CooldownFrame_Set(self.Trinket.cooldownFrame, GetTime(), trinketSpells[spellID], 1)
|
||||
end
|
||||
elseif event == "ARENA_OPPONENT_UPDATE" then
|
||||
local unit, type = ...
|
||||
if type == "seen" then
|
||||
if UnitExists(unit) and UnitIsPlayer(unit) then
|
||||
self.Trinket.Icon:SetTexture(GetTrinketIcon(unit))
|
||||
end
|
||||
end
|
||||
elseif event == 'PLAYER_ENTERING_WORLD' then
|
||||
CooldownFrame_Set(self.Trinket.cooldownFrame, 1, 1, 1)
|
||||
end
|
||||
|
||||
if(self.Trinket.PostUpdate) then self.Trinket:PostUpdate(event) end
|
||||
end
|
||||
|
||||
local Enable = function(self)
|
||||
if self.Trinket then
|
||||
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED", Update, true)
|
||||
self:RegisterEvent("ARENA_OPPONENT_UPDATE", Update, true)
|
||||
self:RegisterEvent("PLAYER_ENTERING_WORLD", Update, true)
|
||||
|
||||
if not self.Trinket.cooldownFrame then
|
||||
self.Trinket.cooldownFrame = CreateFrame("Cooldown", nil, self.Trinket, "CooldownFrameTemplate")
|
||||
self.Trinket.cooldownFrame:SetAllPoints(self.Trinket)
|
||||
self.Trinket.cooldownFrame:SetHideCountdownNumbers(true)
|
||||
ElvUI[1]:RegisterCooldown(self.Trinket.cooldownFrame)
|
||||
end
|
||||
|
||||
if not self.Trinket.Icon then
|
||||
self.Trinket.Icon = self.Trinket:CreateTexture(nil, "BORDER")
|
||||
self.Trinket.Icon:SetAllPoints(self.Trinket)
|
||||
self.Trinket.Icon:SetTexCoord(0.07, 0.93, 0.07, 0.93)
|
||||
self.Trinket.Icon:SetTexture(GetTrinketIcon('player'))
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local Disable = function(self)
|
||||
if self.Trinket then
|
||||
self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED", Update)
|
||||
self:UnregisterEvent("ARENA_OPPONENT_UPDATE", Update)
|
||||
self:UnregisterEvent("PLAYER_ENTERING_WORLD", Update)
|
||||
self.Trinket:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
oUF:AddElement('Trinket', Update, Enable, Disable)
|
||||
9
Libraries/oUF_Plugins/oUF_Trinkets/oUF_Trinkets.toc
Normal file
9
Libraries/oUF_Plugins/oUF_Trinkets/oUF_Trinkets.toc
Normal file
@@ -0,0 +1,9 @@
|
||||
## Interface: 50001
|
||||
## Title: oUF Trinkets
|
||||
## Notes: Adds PvP trinket status to oUF frames.
|
||||
## Author: Elv
|
||||
## Version: 1.00
|
||||
## X-Category: oUF
|
||||
## Dependencies: oUF
|
||||
|
||||
oUF_Trinkets.lua
|
||||
Reference in New Issue
Block a user