Skip to content
Rainrider edited this page Jan 14, 2018 · 7 revisions

Element: Dispelable

Highlights debuffs that are dispelable by the player

Widget

  • .Dispelable - A table to hold the sub-widgets.

Sub-Widgets

  • .dispelIcon - A Button to represent the icon of a dispelable debuff.
  • .dispelTexture - A Texture to be colored according to the debuff type.

Notes

At least one of the sub-widgets should be present for the element to work.
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 adds debuffTypes to oUF's colors table, which can be customized by the layout.

.dispelIcon Sub-Widgets

  • .cd - used to display the cooldown spiral for the remaining debuff duration (Cooldown)
  • .count - used to display the stack count of the dispelable 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)

.dispelIcon Options

  • .tooltipAnchor - anchor for the widget's tooltip if it is mouse-enabled. Defaults to 'ANCHOR_BOTTOMRIGHT' (string)

.dispelIcon Attributes

  • .id - the aura index of the dispelable debuff displayed by the widget (number)
  • .unit - the unit on which the dispelable dubuff displayed by the widget has been found (string)

.dispelTexture Options

  • .dispelAlpha - alpha value for the widget when a dispelable debuff is found. Defaults to 1 (number)[0-1]
  • .noDispelAlpha - alpha value for the widget when no dispelable debuffs are found. Defaults to 0 (number)[0-1]

Callbacks and Overrides

:PreUpdate() - Called before the element has been updated.

  • self - the Dispelable element

:PostUpdate(dispelType, texture, count, duration, expiration) - Called after the element has been updated.

  • self - the Dispelable element
  • dispelType - the type of the dispelable debuff (string?)['Curse', 'Disease', 'Magic', 'Poison']
  • texture - the texture representing the debuff icon (number?)
  • count - the stack count of the dispelable debuff (number?)
  • duration - the duration of the dispelable debuff in seconds (number?)
  • expiration - the point in time when the debuff will expire. Can be compared to GetTime() (number?)

:Override(event, unit) - Used to override the internal update function.

  • self - the Dispelable 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 dispelable 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]

Examples

All supported widgets:

-- Position and size
local Dispelable = {}
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()

-- Register with oUF
button.cd = cd
button.icon = icon
button.overlay = overlay
button.count = count

Dispelable.dispelIcon = button
Dispelable.dispelTexture = texture
self.Dispelable = Dispelable

Using the unit frame's backdrop:

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
local dispelable = {}
dispelable.dispelTexture = texture
self.Dispelable = dispelable
Clone this wiki locally