Allow triggers/indicators to be configured.
Also adds priest test config and expands shaman test config.
This commit is contained in:
128
src/frames.lua
128
src/frames.lua
@@ -16,6 +16,13 @@
|
|||||||
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
|
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
|
||||||
local omif = select(2, ...)
|
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 function RangeConfig()
|
||||||
local _, class = UnitClass("player")
|
local _, class = UnitClass("player")
|
||||||
if class == "SHAMAN" then
|
if class == "SHAMAN" then
|
||||||
@@ -24,6 +31,12 @@ local function RangeConfig()
|
|||||||
enemy = "Lightning Bolt",
|
enemy = "Lightning Bolt",
|
||||||
fade = 0.2
|
fade = 0.2
|
||||||
}
|
}
|
||||||
|
elseif class == "PRIEST" then
|
||||||
|
return {
|
||||||
|
friendly = "Flash Heal",
|
||||||
|
enemy = "Smite",
|
||||||
|
fade = 0.2
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return {
|
return {
|
||||||
fade = 0.2
|
fade = 0.2
|
||||||
@@ -49,6 +62,27 @@ local function MouseConfig()
|
|||||||
-- Shift
|
-- Shift
|
||||||
{button="mouse2", mods={shift=true}, kind="togglemenu"},
|
{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
|
else
|
||||||
return {
|
return {
|
||||||
-- Super basic defaults
|
-- Super basic defaults
|
||||||
@@ -58,6 +92,99 @@ local function MouseConfig()
|
|||||||
end
|
end
|
||||||
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 types = omif.GetModule("types")
|
||||||
local UnitFrame = types.UnitFrame
|
local UnitFrame = types.UnitFrame
|
||||||
local UnitGroup = types.UnitGroup
|
local UnitGroup = types.UnitGroup
|
||||||
@@ -129,6 +256,7 @@ function CreateFrames()
|
|||||||
range = RangeConfig(),
|
range = RangeConfig(),
|
||||||
mouse = MouseConfig(),
|
mouse = MouseConfig(),
|
||||||
hideInRaid = true,
|
hideInRaid = true,
|
||||||
|
triggers = TriggerConfig(),
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatePartyFrames(0, -290, config)
|
CreatePartyFrames(0, -290, config)
|
||||||
|
@@ -73,32 +73,45 @@ function UnitFrame:Init(unit, config)
|
|||||||
self.overlays = overlays
|
self.overlays = overlays
|
||||||
self:CreateName()
|
self:CreateName()
|
||||||
|
|
||||||
self.auras:AddTrigger(
|
self:CreateTriggers(config.triggers)
|
||||||
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:RegisterEvents()
|
||||||
self:Enable()
|
self:Enable()
|
||||||
end
|
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()
|
function UnitFrame:StartRangeTicker()
|
||||||
if self.rangeTicker then
|
if self.rangeTicker then
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user