Allow triggers/indicators to be configured.

Also adds priest test config and expands shaman test config.
This commit is contained in:
2023-04-03 08:45:39 +02:00
parent 09e94ca72f
commit d85a1c3579
2 changed files with 163 additions and 22 deletions

View File

@@ -16,6 +16,13 @@
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
local omif = select(2, ...)
local colors = {
cyan = {0.0, 0.8, 0.8},
white = {1.0, 1.0, 1.0},
orange = {1.0, 0.5 , 0},
violet = {1.0, 0, 1.0},
}
local function RangeConfig()
local _, class = UnitClass("player")
if class == "SHAMAN" then
@@ -24,6 +31,12 @@ local function RangeConfig()
enemy = "Lightning Bolt",
fade = 0.2
}
elseif class == "PRIEST" then
return {
friendly = "Flash Heal",
enemy = "Smite",
fade = 0.2
}
else
return {
fade = 0.2
@@ -41,7 +54,7 @@ local function MouseConfig()
{button="mouse3", mods={}, kind="macro", data="/use [@UNIT,dead,help]Ancestral Spirit; [@UNIT,help]Purify Spirit"},
{button="wheel-up", mods={}, kind="macro", data="/use [@UNIT,help]Healing Surge"},
{button="wheel-down", mods={}, kind="macro", data="/use [@UNIT,help]Riptide"},
-- alt
{button="wheel-up", mods={alt=true}, kind="spell", data="Healing Wave"},
{button="wheel-down", mods={alt=true}, kind="spell", data="Earth Shield"},
@@ -49,6 +62,27 @@ local function MouseConfig()
-- Shift
{button="mouse2", mods={shift=true}, kind="togglemenu"},
}
elseif class == "PRIEST" then
return {
-- No modifier
{button="mouse1", mods={}, kind="target"},
{button="mouse2", mods={}, kind="macro", data="/use [@UNIT,dead,help]Mass Resurrection; [@UNIT,help]Power Word: Radiance"},
{button="mouse3", mods={}, kind="macro", data="/use [@UNIT,dead,help]Resurrection; [@UNIT,help]Purify"},
{button="mouse4", mods={}, kind="spell", data="Shadow Covenant"},
{button="wheel-up", mods={}, kind="macro", data="/use [@UNIT,help]Flash Heal"},
{button="wheel-down", mods={}, kind="macro", data="/use [@UNIT,help]Renew"},
-- alt
{button="mouse2", mods={alt=true}, kind="spell", data="Pain Suppression"},
{button="mouse3", mods={alt=true}, kind="spell", data="Power Infusion"},
{button="wheel-up", mods={alt=true}, kind="spell", data="Rapture"},
{button="wheel-down", mods={alt=true}, kind="spell", data="Power Word: Shield"},
-- Shift
{button="mouse2", mods={shift=true}, kind="togglemenu"},
{button="wheel-up", mods={shift=true}, kind="macro", data="/cast [@UNIT,help]Levitate;\n/stopspelltarget"},
{button="wheel-down", mods={shift=true}, kind="macro", data="/cast [@UNIT,help]Leap of Faith;\n/stopspelltarget"},
}
else
return {
-- Super basic defaults
@@ -58,6 +92,99 @@ local function MouseConfig()
end
end
local function TriggerConfig()
local _, class = UnitClass("player")
if class == "SHAMAN" then
return {
{
kind="AuraTrigger", spellId=383648, own=true, -- Second Earth Shield on yourself
indicator={
kind="SquareIndicator",
size=14,
point="TOPLEFT",
x=2, y=-2,
color=colors.white,
}
},
{
kind="AuraTrigger", spellId=974, own=true, -- Second Earth Shield on yourself
indicator={
kind="SquareIndicator",
size=14,
point="TOPLEFT",
x=2, y=-2,
color=colors.white,
}
},
{
kind="AuraTrigger", spellId=61295, own=true, -- Riptide
indicator={
kind="SquareIndicator",
size=14,
point="BOTTOMLEFT",
x=2, y=2,
color=colors.cyan,
}
},
}
elseif class == "PRIEST" then
return {
{
kind="AuraTrigger", spellId=17, own=true, -- Power Word: Shield
indicator={
kind="SquareIndicator",
size=14,
point="TOPLEFT",
x=2, y=-2,
color=colors.white,
}
},
{
kind="AuraTrigger", spellId=33206, own=true, -- Pain Suppression
indicator={
kind="SquareIndicator",
size=14,
point="TOPLEFT",
x=18, y=-2,
color=colors.orange,
}
},
{
kind="AuraTrigger", spellId=139, own=true, -- Renew
indicator={
kind="SquareIndicator",
size=14,
point="BOTTOMLEFT",
x=2, y=2,
color=colors.cyan,
}
},
{
kind="AuraTrigger", spellId=194384, own=true, -- Renew
indicator={
kind="SquareIndicator",
size=14,
point="BOTTOMLEFT",
x=18, y=2,
color=colors.white,
}
},
{
kind="AuraTrigger", spellId=10060, own=true, -- Renew
indicator={
kind="SquareIndicator",
size=14,
point="BOTTOMLEFT",
x=34, y=2,
color=colors.violet,
}
},
}
else
return {}
end
end
local types = omif.GetModule("types")
local UnitFrame = types.UnitFrame
local UnitGroup = types.UnitGroup
@@ -129,6 +256,7 @@ function CreateFrames()
range = RangeConfig(),
mouse = MouseConfig(),
hideInRaid = true,
triggers = TriggerConfig(),
}
CreatePartyFrames(0, -290, config)

View File

@@ -73,32 +73,45 @@ function UnitFrame:Init(unit, config)
self.overlays = overlays
self:CreateName()
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:CreateTriggers(config.triggers)
self:RegisterEvents()
self:Enable()
end
function UnitFrame:CreateTriggers(triggers)
for _, trigger in ipairs(triggers) do
local kind = trigger.kind
if kind == "AuraTrigger" then
self.auras:AddTrigger(
AuraTrigger:new(
self:CreateIndicator(trigger.indicator),
trigger.spellId,
trigger.own,
trigger.requiredCount,
trigger.invert
)
)
end
end
end
function UnitFrame:CreateIndicator(indicator)
local kind = indicator.kind
if kind == "SquareIndicator" then
return SquareIndicator:new(
self,
indicator.size,
indicator.point,
indicator.x,
indicator.y,
indicator.color
)
else
error(string.format("Invalid Indicator kind `%s` requested", indicator.kind))
end
end
function UnitFrame:StartRangeTicker()
if self.rangeTicker then
return