Rework the way triggers and indicators work

Triggers are now a link between link between a datasource (for now only
AuraList) and an indicator (for now only SquareIndicator).
This commit is contained in:
2023-03-19 06:54:02 +01:00
parent 5d21f1030c
commit 825738a040
4 changed files with 152 additions and 80 deletions

View File

@@ -18,7 +18,8 @@ local omif = select(2, ...)
local types = omif.GetModule("types")
local StatusBar = types.StatusBar
local AuraList = types.AuraList
local Indicator = types.Indicator
local SquareIndicator = types.SquareIndicator
local AuraTrigger = types.AuraTrigger
types.UnitFrame = types.CreateClass("UnitFrame")
local UnitFrame = types.UnitFrame
@@ -59,11 +60,29 @@ function UnitFrame:Init(unit, width, height, hideInRaid)
overlays:Show()
self.overlays = overlays
self:CreateName()
self.indicators = {
Indicator:new(self, self.auras, 14, "TOPLEFT", 2, -2, colors.white, 383648),
Indicator:new(self, self.auras, 14, "TOPLEFT", 2, -2, colors.white, 974),
Indicator:new(self, self.auras, 14, "BOTTOMLEFT", 2, 2, colors.cyan, 61295)
}
self.auras:AddTrigger(
AuraTrigger:new(
SquareIndicator:new(self, 14, "TOPLEFT", 2, -2, colors.white),
383648, -- Second Earthshield on self
true
)
)
self.auras:AddTrigger(
AuraTrigger:new(
SquareIndicator:new(self, 14, "TOPLEFT", 2, -2, colors.white),
974, -- Earthshield
true
)
)
self.auras:AddTrigger(
AuraTrigger:new(
SquareIndicator:new(self, 14, "BOTTOMLEFT", 2, 2, colors.cyan),
61295, -- Riptide
true
)
)
self:RegisterEvents()
self:Enable()
end
@@ -143,7 +162,7 @@ function UnitFrame:PrepareWheelBinds()
self:SetBindingClick(false, "ALT-MOUSEWHEELUP", "BUTTONNAME", "alt-wheel-up")
self:SetBindingClick(false, "ALT-MOUSEWHEELDOWN", "BUTTONNAME", "alt-wheel-down")
]]):gsub("BUTTONNAME", "OmicronSecureFrame" .. self.unit)
local removeBindScript = [[
self:ClearBindings()
]]
@@ -297,7 +316,7 @@ function UnitFrame:UNIT_HEALTH()
self:UpdateAll(true)
return
end
self:UpdateHealth()
self:UpdateHealth()
self:UpdateHealthColor()
end
@@ -306,7 +325,7 @@ function UnitFrame:UNIT_MAXHEALTH()
self:UpdateAll(true)
return
end
self:UpdateHealth()
self:UpdateHealth()
self:UpdateHealthColor()
end