-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Highlights debuffs that are dispellable by the player
-
.Dispellable
- Atable
to hold the sub-widgets.
-
.dispelIcon
- AButton
to represent the icon of a dispellable debuff. -
.dispelTexture
- ATexture
to be colored according to the debuff type.
At least one of the sub-widgets should be present for the element to work.
The .dispelTexture
sub-widget is updated by setting its color and alpha. It is always shown to allow the use on non-texture widgets without the need to override the internal update function.
If mouse interactivity is enabled for the .dispelIcon
sub-widget, 'OnEnter' and/or 'OnLeave' handlers will be set to
display a tooltip.
If .dispelIcon
and .dispelIcon.cd
are defined without a global name, one will be set accordingly by the element to
prevent /fstack errors.
The element uses oUF's debuff
colors table to apply colors to the sub-widgets.
-
.cd
- used to display the cooldown spiral for the remaining debuff duration (Cooldown) -
.count
- used to display the stack count of the dispellable debuff (FontString) -
.icon
- used to show the icon's texture (Texture) -
.overlay
- used to represent the icon's border. Will be colored according to the debuff type color (Texture)
-
.tooltipAnchor
- anchor for the widget's tooltip if it is mouse-enabled. Defaults to 'ANCHOR_BOTTOMRIGHT' (string)
-
.id
- the aura index of the dispellable debuff displayed by the widget (number) -
.unit
- the unit on which the dispellable dubuff has been found (string)
-
.dispelAlpha
- alpha value for the widget when a dispellable debuff is found. Defaults to 1 (number)[0-1] -
.noDispelAlpha
- alpha value for the widget when no dispellable debuffs are found. Defaults to 0 (number)[0-1]
:PreUpdate()
- Called before the element has been updated.
-
self
- the Dispellable element
:PostUpdate(dispelType, texture, count, duration, expiration)
- Called after the element has been updated.
-
self
- the Dispellable element -
dispelType
- the type of the dispellable debuff (string?)['Curse', 'Disease', 'Magic', 'Poison'] -
texture
- the texture representing the debuff icon (number?) -
count
- the stack count of the dispellable debuff (number?) -
duration
- the duration of the dispellable debuff in seconds (number?) -
expiration
- the point in time when the debuff will expire. Can be compared toGetTime()
(number?)
:Override(event, unit)
- Used to override the internal update function.
-
self
- the Dispellable element -
event
- the event triggering the update (string) -
unit
- the unit accompaning the event (string)
.dispelIcon:UpdateTooltip()
- Called to update the widget's tooltip.
-
self
- the dispelIcon sub-widget
.dispelTexture:UpdateColor(dispelType, r, g, b, a)
- Called to update the widget's color.
-
self
- the dispelTexture sub-widget -
dispelType
- the type of the dispellable debuff (string?)['Curse', 'Disease', 'Magic', 'Poison'] -
r
- the red color component (number)[0-1] -
g
- the green color component (number)[0-1] -
b
- the blue color component (number)[0-1] -
a
- the alpha color component (number)[0-1]
-- Position and size
local button = CreateFrame('Button', 'LayoutName_Dispel', self.Health)
button:SetPoint('CENTER')
button:SetSize(22, 22)
button:SetToplevel(true)
local cd = CreateFrame('Cooldown', '$parentCooldown', button, 'CooldownFrameTemplate')
cd:SetHideCountdownNumbers(false) -- set to true to disable cooldown numbers on the cooldown spiral
cd:SetAllPoints()
local icon = button:CreateTexture(nil, 'ARTWORK')
icon:SetAllPoints()
local overlay = button:CreateTexture(nil, 'OVERLAY')
overlay:SetTexture('Interface\\Buttons\\UI-Debuff-Overlays')
overlay:SetTexCoord(0.296875, 0.5703125, 0, 0.515625)
overlay:SetAllPoints()
local count = button:CreateFontString(nil, 'OVERLAY', 'NumberFontNormal', 1)
count:SetPoint('BOTTOMRIGHT', -1, 1)
local texture = self.Health:CreateTexture(nil, 'OVERLAY')
texture:SetTexture('Interface\\ChatFrame\\ChatFrameBackground')
texture:SetAllPoints()
texture:SetVertexColor(1, 1, 1, 0) -- hide in case the class can't dispel at all
button.cd = cd
button.icon = icon
button.overlay = overlay
button.count = count
button:Hide() -- hide in case the class can't dispel at all
-- Register with oUF
self.Dispellable = {
dispelIcon = button,
dispelTexture = texture,
}
local texture = {} -- create a dummy "texture"
texture.frame = self -- attach the unit frame to the "texture"
texture.UpdateColor = function(dispelTexture, dispelType, r, g, b)
if (dispelType) then
dispelTexture.frame:SetBackdropBorderColor(r, g, b)
else
-- set original colors
dispelTexture.frame:SetBackdropBorderColor(0, 0, 0)
end
end
-- Register with oUF
self.Dispellable = {
dispelTexture = texture,
}