Allow size and range check features to be configured.
This also improves the range check to fall back to UnitInRange if no friendly spell is available
This commit is contained in:
@@ -16,6 +16,20 @@
|
||||
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
|
||||
local omif = select(2, ...)
|
||||
|
||||
local function RangeConfig()
|
||||
local _, class = UnitClass("player")
|
||||
if class == "SHAMAN" then
|
||||
return {
|
||||
friendly = "Healing Surge",
|
||||
enemy = "Lightning Bolt",
|
||||
fade = 0.2
|
||||
}
|
||||
else
|
||||
return {
|
||||
fade = 0.2
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
local types = omif.GetModule("types")
|
||||
local UnitFrame = types.UnitFrame
|
||||
@@ -40,43 +54,59 @@ function HideBlizzardFrames()
|
||||
toggleFrame:Hide()
|
||||
end
|
||||
|
||||
function CreateRaidFrames(left, top, width, height)
|
||||
function CreateRaidFrames(left, top, config)
|
||||
local width = config.size.width
|
||||
local height = config.size.height
|
||||
local group = UnitGroup:new(left, top, width, height)
|
||||
for i=0,5 do
|
||||
for j=0,4 do
|
||||
local num = i*5 + j + 1
|
||||
local frame = UnitFrame:new("raid" .. num, width, height)
|
||||
local frame = UnitFrame:new("raid" .. num, config)
|
||||
group:AddUnitFrame(frame)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function CreatePartyFrames(left, top, width, height)
|
||||
function CreatePartyFrames(left, top, config)
|
||||
local width = config.size.width
|
||||
local height = config.size.height
|
||||
local group = UnitGroup:new(left, top, width, height)
|
||||
local player = UnitFrame:new("player", width, height, true)
|
||||
local player = UnitFrame:new("player", config)
|
||||
group:AddUnitFrame(player)
|
||||
for i=1,4 do
|
||||
local frame = UnitFrame:new("party" .. i, width, height, true)
|
||||
local frame = UnitFrame:new("party" .. i, config)
|
||||
group:AddUnitFrame(frame)
|
||||
end
|
||||
group:Sort()
|
||||
end
|
||||
|
||||
function CreateTargetFrames(left, top, width, height)
|
||||
local focus = UnitFrame:new("focus", width, height)
|
||||
function CreateTargetFrames(left, top, config)
|
||||
local width = config.size.width
|
||||
local height = config.size.height
|
||||
local focus = UnitFrame:new("focus", config)
|
||||
focus:SetPosition(left, top)
|
||||
local target = UnitFrame:new("target", width, height)
|
||||
local target = UnitFrame:new("target", config)
|
||||
target:SetPosition(left, top - height)
|
||||
for i=1,4 do
|
||||
local boss = UnitFrame:new("boss" .. i, width, height)
|
||||
local boss = UnitFrame:new("boss" .. i, config)
|
||||
boss:SetPosition(left, top-(i+1)*height)
|
||||
end
|
||||
end
|
||||
|
||||
function CreateFrames()
|
||||
CreatePartyFrames(0, -290, 110, 45)
|
||||
CreateRaidFrames(0, -290, 110, 45)
|
||||
CreateTargetFrames(110*3+50, -245, 110, 45)
|
||||
config = {
|
||||
size = {
|
||||
width = 110,
|
||||
height = 45,
|
||||
},
|
||||
range = RangeConfig(),
|
||||
hideInRaid = true,
|
||||
}
|
||||
|
||||
CreatePartyFrames(0, -290, config)
|
||||
config.hideInRaid = false
|
||||
CreateRaidFrames(0, -290, config)
|
||||
CreateTargetFrames(110*3+50, -245, config)
|
||||
HideBlizzardFrames()
|
||||
end
|
||||
omif.SetEventHandler("OMICRON_LOADING", CreateFrames)
|
||||
|
Reference in New Issue
Block a user