From: Aleksi Blinnikka Date: Wed, 24 Jan 2018 01:23:45 +0000 (+0200) Subject: Add customizable settings, remove extra code X-Git-Url: https://www.aleksib.fi/git/wowui.git/commitdiff_plain/d180f82975c6b13a3380bd8df5ab47df70112c49?ds=inline;hp=8da63c020fd2f1367dbec400f8daf15fa8375b94 Add customizable settings, remove extra code --- diff --git a/OmaRF/Core.lua b/OmaRF/Core.lua deleted file mode 100644 index e0ecbd1..0000000 --- a/OmaRF/Core.lua +++ /dev/null @@ -1,103 +0,0 @@ -local unpack, wipe, next, pairs, ipairs = unpack, wipe, next, pairs, ipairs; - -OmaRF = CreateFrame("Frame"); - -OmaRF.normalBarColor = CreateColor(0.3, 0.3, 0.3); -OmaRF.dispelBarColor = CreateColor(1, 0.5, 0); -OmaRF.normalBackColor = {0.7, 0.7, 0.7}; -OmaRF.dispelBackColor = {0.5, 0.2, 0}; -OmaRF.positions = { - "TOPLEFT", "TOPRIGHT", "CENTER", "BOTTOMLEFT", "BOTTOMRIGHT" -}; -OmaRF.running = false; -OmaRF.ooc_queue = {}; - -local defaults = { - profile = { - enabled = true, - majorAuras = { - auras = {"Aqua Bomb"}, - max = 3; - iconSize = 24, - textSize = 10, - }, - indicators = { - ['**'] = { - auras = {}, - textSize = 10, - textColor = {1, 1, 1, 1}, - mine = false, - stack = true, - showText = true, - showIcon = true, - useDefaultIcon = true, - iconSize = 10, - iconColor = {1, 1, 1, 1}, - }, - }, - } -}; - -function OmaRF:OnInitialize() - self.db = LibStub("AceDB-3.0"):New("OmaRFDB", defaults); - self.db.RegisterCallback(self, "OnProfileChanged", "RefreshConfig"); - self.db.RegisterCallback(self, "OnProfileCopied", "RefreshConfig"); - self.db.RegisterCallback(self, "OnProfileReset", "RefreshConfig"); -end - -function OmaRF:OnEnable() - self:RefreshConfig(); -end - -function OmaRF:OnDisable() - self.running = false; - self.frameBase:Hide(); -end - -local function onEvent(self, event, ...) - if event == "PLAYER_REGEN_ENABLED" then - for _, t in pairs(self.ooc_queue) do - t.func(unpack(t.args)); - end - if next(self.ooc_queue) ~= nil then - wipe(self.ooc_queue); - end - elseif event == "PLAYER_LOGIN" then - self:OnEnable(); - elseif event == "ADDON_LOADED" then - self:OnInitialize(); - end -end - -SLASH_OMARF1 = "/omarf"; -function SlashCmdList.OMARF(msg, editBox) - local loaded, finished = IsAddOnLoaded("OmaRFConfig"); - if not loaded then - local loaded, reason = LoadAddOn("OmaRFConfig"); - if not loaded then - if reason == "DISABLED" then - print("OmaRFConfig is disabled"); - elseif reason == "MISSING" then - print("OmaRFConfig is missing"); - elseif reason == "CORRUPT" then - print("OmaRFConfig is corrupt"); - elseif reason == "INCOMPATIBLE" then - print("OmaRFConfig is incompatible"); - elseif reason == "INTERFACE_VERSION" then - print("OmaRFConfig has wrong interface version"); - end - return; - end - elseif not finished then - -- slash command sent again when loading process is in progress - return; - end - - InterfaceOptionsFrame_OpenToCategory(OmaRF.optionsFrames.Profile); - InterfaceOptionsFrame_OpenToCategory(OmaRF.optionsFrames.Indicators); -end - -OmaRF:RegisterEvent("ADDON_LOADED"); -OmaRF:RegisterEvent("PLAYER_LOGIN"); -OmaRF:RegisterEvent("PLAYER_REGEN_ENABLED"); -OmaRF:SetScript("OnEvent", onEvent); diff --git a/OmaRF/CFrame.lua b/OmaRF/Events.lua similarity index 84% rename from OmaRF/CFrame.lua rename to OmaRF/Events.lua index 1273367..4316a82 100644 --- a/OmaRF/CFrame.lua +++ b/OmaRF/Events.lua @@ -1,41 +1,54 @@ --- CFrame.lua +-- Events.lua local _; -local unpack, pairs, ipairs = unpack, pairs, ipairs; +local unpack = unpack; local ssub = string.sub; local min = math.min; local UnitName, UnitClass, UnitExists = UnitName, UnitClass, UnitExists; local UnitDebuff, UnitIsCharmed = UnitDebuff, UnitIsCharmed; local UnitPower, UnitPowerMax, UnitPowerType = UnitPower, UnitPowerMax, UnitPowerType; local UnitHealth, UnitHealthMax = UnitHealth, UnitHealthMax; -local UnitInParty, UnitInRaid = UnitInParty, UnitInRaid; local UnitGetIncomingHeals, UnitGetTotalAbsorbs = UnitGetIncomingHeals, UnitGetTotalAbsorbs; local UnitThreatSituation, GetThreatStatusColor = UnitThreatSituation, GetThreatStatusColor; local UnitIsDeadOrGhost, UnitIsConnected = UnitIsDeadOrGhost, UnitIsConnected; local UnitHasIncomingResurrection = UnitHasIncomingResurrection; local UnitGetTotalHealAbsorbs = UnitGetTotalHealAbsorbs; -local IsInGroup, IsInRaid = IsInGroup, IsInRaid; local UnitHasVehicleUI, UnitTargetsVehicleInRaidUI = UnitHasVehicleUI, UnitTargetsVehicleInRaidUI; local UnitGroupRolesAssigned = UnitGroupRolesAssigned; -local CTimerAfter = C_Timer.After; local RAID_CLASS_COLORS = RAID_CLASS_COLORS; -local Frames = OmaFrames; -local registerEvents = OmaFrames.RegisterEvents; -local Indicators = OmaIndicators; -local checkIndicators = Indicators.CheckIndicators; +local checkIndicators = OmaRFIndicators.CheckIndicators; -local CFrame = CreateFrame("Frame", "OmaCFrame", UIParent); -local party = {}; -local raid = {}; -local updaters = {}; +local Settings = OmaRFSettings; +local width = Settings.Character.Width; +local baseColor = Settings.BaseColor; +local overlayColorDispel = Settings.OverlayColorDispel; +local overlayColorCharm = Settings.OverlayColorCharm; +local overlayColorAlert = Settings.OverlayColorAlert; +local powerColors = Settings.PowerColors; -local width, height = Frames.Width, Frames.Height; -local anchorX, anchorY = Frames.AnchorX, Frames.AnchorY; -local baseColor = Frames.BaseColor; -local overlayColorDispel = Frames.OverlayColorDispel; -local overlayColorCharm = Frames.OverlayColorCharm; -local overlayColorAlert = Frames.OverlayColorAlert; -local powerColors = Frames.PowerColors; +local M = {}; +OmaRFEvents = M; +function M.RegisterEvents(frame) + -- events are taken from FrameXML/CompactUnitFrame.lua + -- TODO ready check support, raid marker support, + -- player flags support (/afk, /dnd) + local displayed = frame.unit ~= frame.displayed and frame.displayed or nil; + frame:RegisterUnitEvent("UNIT_HEALTH", frame.unit, displayed); + frame:RegisterUnitEvent("UNIT_HEALTH_FREQUENT", frame.unit, displayed); + frame:RegisterUnitEvent("UNIT_MAXHEALTH", frame.unit, displayed); + frame:RegisterUnitEvent("UNIT_POWER", frame.unit, displayed); + frame:RegisterUnitEvent("UNIT_MAXPOWER", frame.unit, displayed); + frame:RegisterUnitEvent("UNIT_DISPLAYPOWER", frame.unit, displayed); + frame:RegisterUnitEvent("UNIT_NAME_UPDATE", frame.unit, displayed); + frame:RegisterUnitEvent("UNIT_AURA", frame.unit, displayed); + frame:RegisterUnitEvent("UNIT_HEAL_PREDICTION", frame.unit, displayed); + frame:RegisterUnitEvent("UNIT_ABSORB_AMOUNT_CHANGED", frame.unit, displayed); + frame:RegisterUnitEvent("UNIT_HEAL_ABSORB_AMOUNT_CHANGED", frame.unit, displayed); + frame:RegisterUnitEvent("UNIT_THREAT_SITUATION_UPDATE", frame.unit, displayed); + frame:RegisterUnitEvent("UNIT_CONNECTION", frame.unit, displayed); + frame:RegisterUnitEvent("INCOMING_RESURRECT_CHANGED", frame.unit, displayed); +end +local registerEvents = M.RegisterEvents; local function updateHealth(frame, unit) local current, max = UnitHealth(unit), frame.health.max; @@ -309,6 +322,7 @@ local eventFuncs = { updateHealPred(frame, frame.displayed); updateHealAbsorb(frame, frame.displayed); updatePowerColor(frame, frame.displayed); + updateIncomingRes(frame, frame.unit); updateAggro(frame, frame.displayed); updateName(frame, frame.displayed); updateRole(frame, frame.unit); @@ -320,32 +334,6 @@ eventFuncs["UNIT_ENTERED_VEHICLE"] = eventFuncs["UPDATE_ALL_BARS"]; eventFuncs["UNIT_EXITED_VEHICLE"] = eventFuncs["UPDATE_ALL_BARS"]; eventFuncs["UNIT_PET"] = eventFuncs["UPDATE_ALL_BARS"]; eventFuncs["GROUP_ROSTER_UPDATE"] = eventFuncs["UPDATE_ALL_BARS"]; ---local function unitEvent(self, event, ...) -local function unitEvent(self, event) - --local arg1, arg2, arg3, arg4 = ...; +function M.UnitEvent(self, event) eventFuncs[event](self); end - -local function initialize() - CFrame:SetPoint("CENTER", nil, "CENTER", anchorX, anchorY); - CFrame:SetHeight((height+2)*8); - CFrame:SetWidth((width+2)*5+1); -- extra pixel for shield overflow - Frames.InitializeParty(CFrame, party, unitEvent); - Frames.InitializeRaid(CFrame, raid, unitEvent); -end - -CFrame:RegisterEvent("ADDON_LOADED"); -CFrame:RegisterEvent("PLAYER_LOGIN"); -CFrame:RegisterEvent("PLAYER_ENTERING_WORLD"); -CFrame:RegisterEvent("GROUP_ROSTER_UPDATE"); -CFrame:RegisterEvent("PLAYER_REGEN_ENABLED"); -CFrame:SetScript("OnEvent", function(self, event, ...) - if event == "GROUP_ROSTER_UPDATE" or event == "PLAYER_REGEN_ENABLED" or - event == "PLAYER_ENTERING_WORLD" then - --updateGroup(); - elseif event == "PLAYER_LOGIN" then - initialize(); - elseif event == "ADDON_LOADED" then - -- loaded - end -end); diff --git a/OmaRF/Indicators.lua b/OmaRF/Indicators.lua index b3ad0ef..fbf9817 100644 --- a/OmaRF/Indicators.lua +++ b/OmaRF/Indicators.lua @@ -6,36 +6,17 @@ local UnitAura = UnitAura; local UnitIsDeadOrGhost, UnitIsConnected = UnitIsDeadOrGhost, UnitIsConnected; local CTimerAfter = C_Timer.After; -local Frames = OmaFrames; -local positions = Frames.Positions; - -local watchedAuras = { - [53563] = "TOPRIGHT", - [156910] = "TOPRIGHT", - [200025] = "TOPRIGHT", - [200654] = "BOTTOMLEFT", -}; -local majorAuras = { - ["Psychic Assault"] = true, - ["Everburning Flames"] = true, - ["Corrupt"] = true, - ["Sleep Canister"] = true, - ["Misery"] = true, - ["Necrotic Embrace"] = true, - ["Fulminating Pulse"] = true, - ["Chilled Blood"] = true, - ["Soulblight"] = true, - ["Soulburst"] = true, - ["Soulbomb"] = true, - ["Aqua Bomb"] = true, -}; +local Settings = OmaRFSettings; +local positions = Settings.Positions; +local watchedAuras = Settings.Character["WatchedAuras"]; +local majorAuras = Settings.MajorAuras; local updaters = {}; local updating = {}; local auraFilters = {"HELPFUL", "HARMFUL"}; local M = {}; -OmaIndicators = M; +OmaRFIndicators = M; local function remaining(text, expires, current) if expires == 0 then diff --git a/OmaRF/OmaRF.toc b/OmaRF/OmaRF.toc index 2ba266c..c577c0e 100644 --- a/OmaRF/OmaRF.toc +++ b/OmaRF/OmaRF.toc @@ -2,10 +2,10 @@ ## Title: Oma Raid Frame ## Version: 1.0 ## Author: schyrio -## Notes: Customization to the standard raid frames -## SavedVariables: OmaRFDB +## Notes: My raid frames -FrameInit.lua +Settings.lua Indicators.lua -CFrame.lua +Events.lua +RaidFrame.lua PlayerFrameHooks.lua diff --git a/OmaRF/FrameInit.lua b/OmaRF/RaidFrame.lua similarity index 65% rename from OmaRF/FrameInit.lua rename to OmaRF/RaidFrame.lua index 510751e..31ef192 100644 --- a/OmaRF/FrameInit.lua +++ b/OmaRF/RaidFrame.lua @@ -1,55 +1,36 @@ --- FrameInit.lua +-- RaidFrame.lua local _; local unpack, pairs, rawget = unpack, pairs, rawget; local format = string.format; local UnitHealthMax, UnitPowerMax = UnitHealthMax, UnitPowerMax; local UnitInRange = UnitInRange; local CreateFrame, RegisterStateDriver, RegisterUnitWatch = CreateFrame, RegisterStateDriver, RegisterUnitWatch; -local PowerTypeMana = Enum.PowerType.Mana; -local PowerTypeRage = Enum.PowerType.Rage; -local PowerTypeFocus = Enum.PowerType.Focus; -local PowerTypeEnergy = Enum.PowerType.Energy; -local PowerTypeRunic = Enum.PowerType.RunicPower; +local STANDARD_TEXT_FONT = STANDARD_TEXT_FONT; -local unitEvent = nil; +local registerEvents = OmaRFEvents.RegisterEvents; +local unitEvent = OmaRFEvents.UnitEvent; -local M = {}; -OmaFrames = M; +local Settings = OmaRFSettings; +local positions = Settings.Positions; +local width, height = Settings.Character.Width, Settings.Character.Height; +local anchorX, anchorY = Settings.Character.AnchorX, Settings.Character.AnchorY; +local indSize = Settings.IndSize; +local baseColor = Settings.BaseColor; +local bgColor = Settings.BgColor; +local healthColor = Settings.HealthColor; +local shieldColor = Settings.ShieldColor; +local shieldhlColor = Settings.ShieldhlColor; +local healpredColor = Settings.HealpredColor; +local healabsorbColor = Settings.HealabsorbColor; +local attributes = Settings.Character.Clickheal; --- configurable settings -M.Positions = {"TOPRIGHT", "BOTTOMLEFT"}; -M.Width, M.Height = 80, 40; -M.AnchorX, M.AnchorY = 0, -330; -M.IndSize = 14; M.BaseColor = {0, 0, 0}; -M.BgColor = {0.7, 0.7, 0.7}; -M.HealthColor = {0.3, 0.3, 0.3}; -M.ShieldColor = {0, 0.7, 1}; -M.ShieldhlColor = {0.5, 0.8, 1}; -M.HealpredColor = {0.5, 0.6, 0.5}; -M.HealabsorbColor = {0.1, 0.1, 0.1}; -M.OverlayColorDispel = {1, 0.5, 0, 0.5}; -M.OverlayColorCharm = {0.8, 0, 1, 0.5}; -M.OverlayColorAlert = {1, 0, 0, 0.5}; -M.PowerColors = { - [PowerTypeMana] = {0, 0.5, 1}, - [PowerTypeRage] = {1, 0, 0}, - [PowerTypeFocus] = {1, 0.5, 0}, - [PowerTypeEnergy] = {1, 0.8, 0}, - [PowerTypeRunic] = {0.9, 0, 0.1}, -}; --- watch to not remove mana entry -setmetatable(M.PowerColors, {__index = function(t) return rawget(t, PowerTypeMana) end}); +local CFrame = CreateFrame("Frame", "OmaRFFrame", UIParent); +local inheritedFrames = "SecureUnitButtonTemplate,SecureHandlerStateTemplate"; +local party = {}; +local raid = {}; -local positions = M.Positions; -local width, height = M.Width, M.Height; -local indSize = M.IndSize; -local baseColor = M.BaseColor; -local bgColor = M.BgColor; -local healthColor = M.HealthColor; -local shieldColor = M.ShieldColor; -local shieldhlColor = M.ShieldhlColor; -local healpredColor = M.HealpredColor; -local healabsorbColor = M.HealabsorbColor; +local M = {}; +OmaRaidFrame = M; local function setupIndicators(frame) frame.inds = CreateFrame("Frame", nil, frame); @@ -100,28 +81,6 @@ local function unitUpdate(self, elapsed) end end -function M.RegisterEvents(frame) - -- events are taken from FrameXML/CompactUnitFrame.lua - -- TODO ready check support, raid marker support, - -- player flags support (/afk, /dnd) - local displayed = frame.unit ~= frame.displayed and frame.displayed or nil; - frame:RegisterUnitEvent("UNIT_HEALTH", frame.unit, displayed); - frame:RegisterUnitEvent("UNIT_HEALTH_FREQUENT", frame.unit, displayed); - frame:RegisterUnitEvent("UNIT_MAXHEALTH", frame.unit, displayed); - frame:RegisterUnitEvent("UNIT_POWER", frame.unit, displayed); - frame:RegisterUnitEvent("UNIT_MAXPOWER", frame.unit, displayed); - frame:RegisterUnitEvent("UNIT_DISPLAYPOWER", frame.unit, displayed); - frame:RegisterUnitEvent("UNIT_NAME_UPDATE", frame.unit, displayed); - frame:RegisterUnitEvent("UNIT_AURA", frame.unit, displayed); - frame:RegisterUnitEvent("UNIT_HEAL_PREDICTION", frame.unit, displayed); - frame:RegisterUnitEvent("UNIT_ABSORB_AMOUNT_CHANGED", frame.unit, displayed); - frame:RegisterUnitEvent("UNIT_HEAL_ABSORB_AMOUNT_CHANGED", frame.unit, displayed); - frame:RegisterUnitEvent("UNIT_THREAT_SITUATION_UPDATE", frame.unit, displayed); - frame:RegisterUnitEvent("UNIT_CONNECTION", frame.unit, displayed); - frame:RegisterUnitEvent("INCOMING_RESURRECT_CHANGED", frame.unit, displayed); -end -local registerEvents = M.RegisterEvents; - local function frameShow(frame) frame:RegisterEvent("PARTY_MEMBER_ENABLE"); frame:RegisterEvent("PARTY_MEMBER_DISABLE"); @@ -141,9 +100,22 @@ local function frameHide(frame) end local function setupFrame(frame, secure, unit) + secure:SetAttribute("unit", unit); + frame:SetAttribute("unit", unit); + frame.unit = unit; + frame.displayed = unit; + -- hide frame to get initial frameShow call + frame:Hide(); + if unit == "player" then + frame.vehicle = "vehicle"; + else + frame.vehicle = unit.."pet"; + end -- create visuals secure:SetWidth(width+2); + secure:SetHeight(height+2); frame:SetWidth(width+2); + frame:SetHeight(height+2); frame.base = frame:CreateTexture(nil, "BACKGROUND"); frame.base:SetAllPoints(); frame.base:SetColorTexture(1, 1, 1); @@ -207,27 +179,17 @@ local function setupFrame(frame, secure, unit) frame.rez:SetPoint("BOTTOMRIGHT", frame.background, "CENTER", 12, -12); frame.rez:SetTexture("Interface\\RaidFrame\\Raid-Icon-Rez"); frame.rez:Hide(); + -- set up indicators setupIndicators(frame); + -- set scripts frame:SetScript("OnShow", frameShow); frame:SetScript("OnHide", frameHide); + frame:SetScript("OnEvent", unitEvent); -- set attributes secure:RegisterForClicks("AnyDown"); - secure:SetAttribute("type1", "spell"); -- left click - secure:SetAttribute("type2", "spell"); -- right click - secure:SetAttribute("shift-type1", "spell"); -- shift left click - secure:SetAttribute("shift-type2", "spell"); -- shift right click - secure:SetAttribute("ctrl-type1", "spell"); -- ctrl left click - secure:SetAttribute("alt-type2", "spell"); -- alt right click - secure:SetAttribute("alt-shift-type1", "spell"); -- alt+shift left click - secure:SetAttribute("alt-shift-type2", "spell"); -- alt+shift right click - secure:SetAttribute("spell1", "Holy Light"); - secure:SetAttribute("spell2", "Bestow Faith"); - secure:SetAttribute("shift-spell1", "Flash of Light"); - secure:SetAttribute("shift-spell2", "Light of the Martyr"); - secure:SetAttribute("ctrl-spell1", "Cleanse"); - secure:SetAttribute("alt-spell2", "Lay on Hands"); - secure:SetAttribute("alt-shift-spell1", "Beacon of Light"); - secure:SetAttribute("alt-shift-spell2", "Beacon of Faith"); + for attr, val in pairs(attributes) do + secure:SetAttribute(attr, val); + end -- rest give target and menu secure:SetAttribute("*type1", "target"); secure:SetAttribute("*type2", "togglemenu"); @@ -237,30 +199,18 @@ end local vehicletoggle = [=[ local unit = self:GetAttribute("unit"); if unit and newstate == "vehicle" and not UnitTargetsVehicleInRaidUI(unit) then - print(unit, "in vehicle, still target player"); self:SetAttribute("toggleForVehicle", false); else self:SetAttribute("toggleForVehicle", true); end ]=] --- TODO reorganizing needed for eventhandler stuff -function M.InitializeParty(parent, party, eventhandler) - unitEvent = eventhandler; - local secure = CreateFrame("Button", "OmaPartySecure0", parent, "SecureUnitButtonTemplate,SecureHandlerStateTemplate"); +local function initializeParty(parent) + local secure = CreateFrame("Button", "OmaPartySecure0", parent, inheritedFrames); local frame = CreateFrame("Frame", "OmaParty0", parent); local unit = "player"; - secure:SetAttribute("unit", unit); secure:SetPoint("TOPLEFT", parent, "TOPLEFT"); - secure:SetHeight(height+2); - frame.unit = unit; - frame.vehicle = "vehicle"; - frame.displayed = unit; - frame:SetAttribute("unit", unit); frame:SetPoint("TOPLEFT", parent, "TOPLEFT"); - frame:SetHeight(height+2); - frame:SetScript("OnEvent", eventhandler); - frame:Hide(); setupFrame(frame, secure, unit); RegisterStateDriver(frame, "visibility", "[@player,group:raid] hide; show"); RegisterStateDriver(secure, "visibility", "[@player,group:raid] hide; show"); @@ -268,20 +218,11 @@ function M.InitializeParty(parent, party, eventhandler) secure:SetAttribute("_onstate-vehicleui", vehicletoggle); party[0] = {secure=secure, frame=frame}; for i = 1,4 do - local secure = CreateFrame("Button", "OmaPartySecure"..i, parent, "SecureUnitButtonTemplate,SecureHandlerStateTemplate"); + local secure = CreateFrame("Button", "OmaPartySecure"..i, parent, inheritedFrames); local frame = CreateFrame("Frame", "OmaParty"..i, parent); local unit = "party"..i; - secure:SetAttribute("unit", unit); secure:SetPoint("TOPLEFT", party[i-1].secure, "TOPRIGHT"); - secure:SetPoint("BOTTOMLEFT", party[i-1].secure, "BOTTOMRIGHT"); - frame.unit = unit; - frame.vehicle = unit.."pet"; - frame.displayed = unit; - frame:SetAttribute("unit", unit); frame:SetPoint("TOPLEFT", party[i-1].frame, "TOPRIGHT"); - frame:SetPoint("BOTTOMLEFT", party[i-1].frame, "BOTTOMRIGHT"); - frame:SetScript("OnEvent", unitEvent); - frame:Hide(); setupFrame(frame, secure, unit); local visible = format("[@%s,exists,group:raid] hide; [@%s,exists] show; hide", unit, unit); local vehicle = format("[@%s,unithasvehicleui] vehicle; no", unit); @@ -293,21 +234,12 @@ function M.InitializeParty(parent, party, eventhandler) end end -function M.InitializeRaid(parent, raid, eventhandler) - local secure = CreateFrame("Button", "OmaRaidSecure1", parent, "SecureUnitButtonTemplate,SecureHandlerStateTemplate"); +local function initializeRaid(parent) + local secure = CreateFrame("Button", "OmaRaidSecure1", parent, inheritedFrames); local frame = CreateFrame("Frame", "OmaRaid1", parent); local unit = "raid1"; - secure:SetAttribute("unit", unit); secure:SetPoint("TOPLEFT", parent, "TOPLEFT"); - secure:SetHeight(height+2); - frame.unit = unit; - frame.vehicle = unit.."pet"; - frame.displayed = unit; - frame:SetAttribute("unit", unit); frame:SetPoint("TOPLEFT", parent, "TOPLEFT"); - frame:SetHeight(height+2); - frame:SetScript("OnEvent", eventhandler); - frame:Hide(); setupFrame(frame, secure, unit); RegisterUnitWatch(frame); RegisterUnitWatch(secure); @@ -317,20 +249,11 @@ function M.InitializeRaid(parent, raid, eventhandler) raid[1] = {secure=secure, frame=frame}; for y = 1,7 do local i = y*5+1; - local secure = CreateFrame("Button", "OmaRaidSecure"..i, parent, "SecureUnitButtonTemplate,SecureHandlerStateTemplate"); + local secure = CreateFrame("Button", "OmaRaidSecure"..i, parent, inheritedFrames); local frame = CreateFrame("Frame", "OmaRaid"..i, parent); local unit = "raid"..i; - secure:SetAttribute("unit", unit); secure:SetPoint("TOPLEFT", raid[i-5].secure, "BOTTOMLEFT"); - secure:SetHeight(height+2); - frame.unit = unit; - frame.vehicle = unit.."pet"; - frame.displayed = unit; - frame:SetAttribute("unit", unit); frame:SetPoint("TOPLEFT", raid[i-5].frame, "BOTTOMLEFT"); - frame:SetHeight(height+2); - frame:SetScript("OnEvent", unitEvent); - frame:Hide(); setupFrame(frame, secure, unit); RegisterUnitWatch(frame); RegisterUnitWatch(secure); @@ -342,20 +265,11 @@ function M.InitializeRaid(parent, raid, eventhandler) for y = 0,7 do for x = 1,4 do local i = y*5+x+1; - local secure = CreateFrame("Button", "OmaRaidSecure"..i, parent, "SecureUnitButtonTemplate,SecureHandlerStateTemplate"); + local secure = CreateFrame("Button", "OmaRaidSecure"..i, parent, inheritedFrames); local frame = CreateFrame("Frame", "OmaRaid"..i, parent); local unit = "raid"..i; - secure:SetAttribute("unit", unit); secure:SetPoint("TOPLEFT", raid[i-1].secure, "TOPRIGHT"); - secure:SetPoint("BOTTOMLEFT", raid[i-1].secure, "BOTTOMRIGHT"); - frame.unit = unit; - frame.vehicle = unit.."pet"; - frame.displayed = unit; - frame:SetAttribute("unit", unit); frame:SetPoint("TOPLEFT", raid[i-1].frame, "TOPRIGHT"); - frame:SetPoint("BOTTOMLEFT", raid[i-1].frame, "BOTTOMRIGHT"); - frame:SetScript("OnEvent", unitEvent); - frame:Hide(); setupFrame(frame, secure, unit); RegisterUnitWatch(frame); RegisterUnitWatch(secure); @@ -366,3 +280,18 @@ function M.InitializeRaid(parent, raid, eventhandler) end end end + +local function initialize() + CFrame:SetPoint("CENTER", nil, "CENTER", anchorX, anchorY); + CFrame:SetHeight((height+2)*8); + CFrame:SetWidth((width+2)*5+1); + initializeParty(CFrame); + initializeRaid(CFrame); +end + +CFrame:RegisterEvent("PLAYER_LOGIN"); +CFrame:SetScript("OnEvent", function(self, event) + if event == "PLAYER_LOGIN" then + initialize(); + end +end); diff --git a/OmaRF/Settings.lua b/OmaRF/Settings.lua new file mode 100644 index 0000000..997e4c7 --- /dev/null +++ b/OmaRF/Settings.lua @@ -0,0 +1,107 @@ +-- Settings.lua +local PowerTypeMana = Enum.PowerType.Mana; +local PowerTypeRage = Enum.PowerType.Rage; +local PowerTypeFocus = Enum.PowerType.Focus; +local PowerTypeEnergy = Enum.PowerType.Energy; +local PowerTypeRunic = Enum.PowerType.RunicPower; +local rawget = rawget; + +-- configurable settings +-- character specific settings +local charDefaults = { + Width = 80, + Height = 40, + AnchorX = 0, + AnchorY = -330, + WatchedAuras = { + }, + Clickheal = { + }, +}; +local chars = { + ["Stormreaver"] = { + ["Vildan"] = { + Width = 80, + Height = 40, + AnchorX = 0, + AnchorY = -330, + WatchedAuras = { + [53563] = "TOPRIGHT", + [156910] = "TOPRIGHT", + [200025] = "TOPRIGHT", + [200654] = "BOTTOMLEFT", + }, + Clickheal = { + ["type1"] = "spell", + ["type2"] = "spell", + ["shift-type1"] = "spell", + ["shift-type2"] = "spell", + ["ctrl-type1"] = "spell", + ["alt-type2"] = "spell", + ["alt-shift-type1"] = "spell", + ["alt-shift-type2"] = "spell", + ["spell1"] = "Holy Light", + ["spell2"] = "Bestow Faith", + ["shift-spell1"] = "Flash of Light", + ["shift-spell2"] = "Light of the Martyr", + ["ctrl-spell1"] = "Cleanse", + ["alt-spell2"] = "Lay on Hands", + ["alt-shift-spell1"] = "Beacon of Light", + ["alt-shift-spell2"] = "Beacon of Faith", + }, + }, + }, +}; + +-- account-wide settings +local settings = { + Positions = {"TOPRIGHT", "BOTTOMLEFT"}, + IndSize = 14, + BaseColor = {0, 0, 0}, + BgColor = {0.7, 0.7, 0.7}, + HealthColor = {0.3, 0.3, 0.3}, + ShieldColor = {0, 0.7, 1}, + ShieldhlColor = {0.5, 0.8, 1}, + HealpredColor = {0.5, 0.6, 0.5}, + HealabsorbColor = {0.1, 0.1, 0.1}, + OverlayColorDispel = {1, 0.5, 0, 0.5}, + OverlayColorCharm = {0.8, 0, 1, 0.5}, + OverlayColorAlert = {1, 0, 0, 0.5}, + PowerColors = { + [PowerTypeMana] = {0, 0.5, 1}, + [PowerTypeRage] = {1, 0, 0}, + [PowerTypeFocus] = {1, 0.5, 0}, + [PowerTypeEnergy] = {1, 0.8, 0}, + [PowerTypeRunic] = {0.9, 0, 0.1}, + }, + MajorAuras = { + -- Antorus + ["Psychic Assault"] = true, + ["Everburning Flames"] = true, + ["Corrupt"] = true, + ["Sleep Canister"] = true, + ["Misery"] = true, + ["Necrotic Embrace"] = true, + ["Fulminating Pulse"] = true, + ["Chilled Blood"] = true, + ["Soulblight"] = true, + ["Soulburst"] = true, + ["Soulbomb"] = true, + -- Proving Grounds for testing + ["Aqua Bomb"] = true, + -- Mythic+ + [209858] = true, -- Necrotic Rot + [240559] = true, -- Grievous Wound + [240443] = true, -- Burst + }, +}; +OmaRFSettings = settings; +-- watch to not remove mana entry +setmetatable(settings.PowerColors, {__index = function(t) return rawget(t, PowerTypeMana) end}); + +local name, realm = UnitFullName("player"); +if chars[realm] and chars[realm][name] then + settings.Character = chars[realm][name]; +else + settings.Character = charDefaults; +end diff --git a/OmaRF/embeds.xml b/OmaRF/embeds.xml deleted file mode 100644 index 04d6201..0000000 --- a/OmaRF/embeds.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - -