Files
WeakestAuras/SubBorder.lua
T
github-actions[bot] ed5f9a9da7 WeakestAuras 0.15.0
Model region, Empty region and improved WeakAuras imports

Model displays

- Ported missing "Model" display type: a 3D model with rotation, zoom, scale
  and alpha, and a model browser with a live preview.
- Creature models can only render textured for creatures your client has seen.

Empty Region

- Ported missing "Empty" display type: displays nothing by itself; attach
  sub-regions (text, border, glow) to give it content.

"multi" unit token

- An aura trigger on unit "multi" tracks your debuff on every mob it lands
  on. One timer per mob, including mobs you never targeted.

Improved WA2 imports

- Retail icon numbers now resolve to this client's own icons instead of the
  missing-texture block where possible.
- A lot of custom Lua written for retail now runs thanks to ClassicAPI 5.1
  Lua transpilation efforts.
- Some WA_ group helpers and retail aura getters have been added to a
  compatibility layer.
- Retail event names such as UNIT_POWER_UPDATE now work as written: a trigger
  listing one is fed by the matching classic events, and custom code checking
  the retail name sees it.
- Far more conditions carry over: variables a custom trigger declares, an
  aura trigger's group-wide match count and total stacks, a cast's spell
  name, and unit death.
- Class-and-spec load rules become class rules; Instance Size matches by
  raid head-count (estimated).
- Added fonts used frequently in aura packs: Accidental Presidency,
  Expressway, Bazooka, FORCED SQUARE and Cabin.
- Improved the import report to only list what is lost or substituted, at a
  fraction of its former length.

Imported code using Lua 5.1 syntax and string methods needs ClassicAPI
1.11.0 or newer.

A pack imported before this release whose custom code checks retail event
names should be re-imported to benefit from these changes.

Triggers

- Weapon Enchant can show while an enchant is missing, or always.
- Power reads the power type you picked: a druid's mana display stays up in
  cat or bear form.
- Cooldown Progress (Equipment Slot) gains "Is Usable"; Power gains "Only if
  Primary".
- A cooldown trigger for a spell your character has not learned no longer
  reads as permanently ready.

Dynamic groups

- Ported missing custom grow: your own Lua function positions the children.
- Children slide to their new slots as clones come and go, instead of
  snapping.
- A per-unit-anchored group's offset controls nudge each clone off its
  nameplate or unit frame.

Fixes

- Auras anchored to nameplates that only had the GUID and no valid unit token
  now land on their own mob's plate instead of the target's.
- Equipment-slot trigger icons survive /reload instead of showing a bag
  placeholder until the next import.
2026-08-22 13:09:51 +00:00

108 lines
4.1 KiB
Lua

-- WeakestAuras -- the "subborder" sub-region: a solid edge drawn around the
-- whole region. Mirrors WA2's Border (§8), including its field names.
-- Upstream section refs (§N) point at design/architecture/weakauras2-reference.md
--
-- A backdrop Frame area-anchored over the parent and tinted via
-- SetBackdropBorderColor; SetBackdrop{edgeFile,edgeSize} is native on 1.12
-- (tooltips use it). Opt-in: addDefaultsForNewAura does not seed one, so an
-- aura carries a border only once the user adds it.
if WeakestAuras.disabled then return end
local WA = WeakestAuras
local proto = WA.regionPrototype
-- Stock solid-white texture on 1.12; tinted to any colour by the backdrop
-- border colour. A solid edge, sized by border_size.
local EDGE = "Interface\\Buttons\\WHITE8X8"
WA.RegisterSubRegionType("subborder", {
displayName = "Border",
supports = function(regionType)
return regionType == "icon" or regionType == "progressbar" or regionType == "text"
or regionType == "texture" or regionType == "progresstexture"
or regionType == "empty"
end,
default = {
type = "subborder",
border_visible = true,
border_color = { 0, 0, 0, 1 },
border_size = 1,
border_offset = 0,
anchor_mode = "area",
anchor_area = "region",
},
-- Condition-overridable (§8): visibility + colour. Size/offset are
-- config-only (a condition animating border thickness is niche).
properties = {
border_visible = { display = "Visible", setter = "SetVisible", type = "bool" },
border_color = { display = "Color", setter = "SetBorderColor", type = "color" },
},
create = function(parent)
local region = { parent = parent }
local frame = CreateFrame("Frame", nil, parent)
region.frame = frame
function region:SetVisible(b)
self.visible = b
if b then self.frame:Show() else self.frame:Hide() end
end
function region:SetBorderColor(r, g, b, a)
self.frame:SetBackdropBorderColor(r, g, b, a or 1)
end
function region:SetFrameLevel(level) self.frame:SetFrameLevel(level) end
function region:Show() if self.visible ~= false then self.frame:Show() end end
function region:Hide() self.frame:Hide() end
return region
end,
modify = function(parent, region, parentData, subData)
region.visible = subData.border_visible ~= false
local frame = region.frame
proto.AnchorSubRegion(frame, parent, subData, {
areaOnly = true, areaTarget = "region", x = subData.border_offset or 0,
y = subData.border_offset or 0,
})
local size = subData.border_size or 1
if size < 1 then size = 1 end
frame:SetBackdrop({ edgeFile = EDGE, edgeSize = size })
local c = subData.border_color or { 0, 0, 0, 1 }
frame:SetBackdropBorderColor(c[1] or 0, c[2] or 0, c[3] or 0, c[4] or 1)
if region.visible then frame:Show() else frame:Hide() end
-- Reassert a condition-cleared visibility when the region reappears
-- (same shape subtext uses for text_visible). No per-frame work, so no
-- Update/FrameTick subscription.
parent.subRegionEvents:AddSubscriber("PreShow", function()
if region.visible then frame:Show() end
end)
end,
-- BuildOptions field array for OptionsFrame's Display Effects list.
options = function(parentData, subData, index)
local fields = {
{
type = "toggle", name = "Show border", key = "border_visible",
get = function() return subData.border_visible ~= false end,
set = function(v) subData.border_visible = v and true or false; WA.Add(parentData, true) end,
},
{
type = "color", name = "Color", key = "border_color",
get = function() return subData.border_color end,
set = function(v) subData.border_color = v; WA.Add(parentData, true) end,
},
{
type = "range", name = "Size", key = "border_size", min = 1, max = 16, step = 1, half = true,
get = function() return subData.border_size end,
set = function(v) subData.border_size = v; WA.Add(parentData, true) end,
},
}
local anchorFields = proto.SubRegionAnchorFields(parentData, subData, {
areaOnly = true, areaTarget = "region", x = subData.border_offset or 0,
y = subData.border_offset or 0,
})
for i = 1, table.getn(anchorFields) do table.insert(fields, anchorFields[i]) end
return fields
end,
})