+++ /dev/null
--- Auras.lua
-local _;
-local CreateFrame = CreateFrame;
-local UnitAura = UnitAura;
-local GameTooltip = GameTooltip;
-local GetTime = GetTime;
-local CTimerAfter = C_Timer.After;
-
-local auraFilters = {"HELPFUL", "HARMFUL"};
-local updateAuras;
-
-local M = {};
-OmaUFAuras = M;
-
-local function updateTooltip(frame)
- if GameTooltip:IsOwned(frame) then
- GameTooltip:SetUnitAura(frame.unit, frame.index, frame.filter);
- else
- frame:SetScript("OnUpdate", nil);
- end
-end
-
-local function showTooltip(frame)
- -- tooltip handling from FrameXML/TargetFrame.xml
- GameTooltip:SetOwner(frame, "ANCHOR_BOTTOMRIGHT", 15, -25);
- GameTooltip:SetUnitAura(frame.unit, frame.index, frame.filter);
- frame:SetScript("OnUpdate", updateTooltip);
-end
-
-local function hideTooltip(frame)
- GameTooltip:Hide();
- frame:SetScript("OnUpdate", nil);
-end
-
-local function createAura(parent, prev, anchor, name, unit)
- local aura = CreateFrame("Frame", name, parent);
- aura:SetPoint("TOPLEFT", prev, anchor);
- aura:SetWidth(20);
- aura:SetHeight(20);
- aura.icon = aura:CreateTexture(nil, "ARTWORK");
- aura.icon:SetAllPoints();
- aura.stack = aura:CreateFontString(nil, "OVERLAY", "NumberFontNormalSmall");
- aura.stack:SetPoint("BOTTOMRIGHT");
- aura.cd = CreateFrame("Cooldown", name.."CD", aura, "CooldownFrameTemplate");
- aura.cd:SetReverse(true);
- aura.cd:SetHideCountdownNumbers(true);
- aura.cd:SetAllPoints();
- aura.unit = unit;
- aura:SetScript("OnEnter", showTooltip);
- aura:SetScript("OnLeave", hideTooltip);
- aura:Hide();
- return aura;
-end
-
-function M.CreateAuraFrame(parent, unit)
- local name = parent:GetName().."Auras";
- parent.auras = CreateFrame("Frame", name, parent);
- parent.auras:SetPoint("TOPLEFT", parent, "BOTTOMLEFT", 0, -8);
- parent.auras:SetWidth(10);
- parent.auras:SetHeight(10);
- local i = 1;
- -- max auras per row
- for x=1,10 do
- local auraName = name..i;
- if i == 1 then
- parent.auras[i] = createAura(parent.auras, parent.auras, "TOPLEFT", auraName, unit);
- else
- parent.auras[i] = createAura(parent.auras, parent.auras[i-1], "TOPRIGHT", auraName, unit);
- end
- i = i + 1;
- end
- -- max rows
- for y=0,0 do
- for x=1,10 do
- local auraName = name..i;
- parent.auras[i] = createAura(parent.auras, parent.auras[y*10+x], "BOTTOMLEFT", auraName, unit);
- i = i + 1;
- end
- end
-
- parent.throttle = function()
- parent.throttled = nil;
- if UnitExists(unit) then
- return updateAuras(parent, unit);
- end
- end;
-end
-
-function M.UpdateAuras(frame, unit)
- local current = GetTime();
- if frame.throttled then
- return;
- elseif frame.prevUpdate and current - frame.prevUpdate < 0.2 then
- frame.throttled = true;
- return CTimerAfter(0.1, frame.throttle); -- faster timer here to reduce the delay, gets called twice
- end
-
- frame.prevUpdate = current;
- local auras = frame.auras;
- local icon, count, duration, expires, caster, id;
- local pos = 1;
- for _, filter in ipairs(auraFilters) do
- local i = 1;
- while true do
- _, icon, count, _, duration, expires, caster, _, _, id = UnitAura(unit, i, filter);
- if not id or not auras[pos] then break end
- local aura = auras[pos];
- aura.icon:SetTexture(icon);
- aura.index = i;
- aura.filter = filter;
- if count > 1 then
- aura.stack:SetText(count);
- aura.stack:Show();
- else
- aura.stack:Hide();
- end
- if expires > 0 then
- aura.cd:SetCooldown(expires - duration, duration);
- else
- aura.cd:Hide();
- end
- aura:Show();
- pos = pos + 1;
- i = i + 1;
- end
- end
-
- while auras[pos] do
- if not auras[pos]:IsShown() then return end
- auras[pos]:Hide();
- pos = pos + 1;
- end
-end
-updateAuras = M.UpdateAuras;
+++ /dev/null
--- BossFrames.lua
-local _;
-local unpack, pairs = unpack, pairs;
-local format = string.format;
-local UnitExists, ShowBossFrameWhenUninteractable = UnitExists, ShowBossFrameWhenUninteractable;
-local GameTooltip = GameTooltip;
-local GameTooltip_SetDefaultAnchor = GameTooltip_SetDefaultAnchor;
-
-local registerUnitEvents = OmaUFEvents.RegisterUnitEvents;
-local registerCastEvents = OmaUFCastBar.RegisterCastEvents;
-local unregisterCastEvents = OmaUFCastBar.UnregisterCastEvents;
-local unitEvent = OmaUFEvents.UnitEvent;
-
-local Settings = OmaUFSettings;
-local baseColor = Settings.BaseColor;
-local bgColor = Settings.BgColor;
-local healthColor = Settings.HealthColor;
-local shieldColor = Settings.ShieldColor;
-local shieldhlColor = Settings.ShieldhlColor;
-local width, height = Settings.Boss.Width, Settings.Boss.Height;
-local anchorX, anchorY = Settings.Boss.AnchorX, Settings.Boss.AnchorY;
--- placeholders with visible values when error happens
-local attributes = {};
-
-local inheritedFrames = "SecureUnitButtonTemplate,SecureHandlerStateTemplate";
-local barTexture = "Interface\\AddOns\\OmaRF\\images\\minimalist";
-
-local function frameShow(frame)
- frame:RegisterEvent("PLAYER_ENTERING_WORLD");
- frame:RegisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT");
- frame:RegisterEvent("UNIT_TARGETABLE_CHANGED");
- frame:RegisterUnitEvent("UNIT_LEVEL", frame.unit);
- registerUnitEvents(frame);
- registerCastEvents(frame.castbar);
- unitEvent(frame, "UPDATE_ALL_BARS");
-end
-
-local function frameHide(frame)
- frame:UnregisterAllEvents();
- unregisterCastEvents(frame.castbar);
-end
-
-local function showTooltip(secure)
- GameTooltip_SetDefaultAnchor(GameTooltip, secure);
- GameTooltip:SetUnit(secure:GetAttribute("unit"));
-end
-
-local function hideTooltip(secure)
- GameTooltip:FadeOut();
-end
-
-local function bossEvent(self)
- -- INSTANCE_ENCOUNTER_ENGAGE_UNIT only
- for unit, frame in pairs(self.frames) do
- if UnitExists(unit) or ShowBossFrameWhenUninteractable(unit) then
- frame:Show();
- else
- frame:Hide();
- end
- end
-end
-
-local function createFrame(framename, securename, parent, unit, anchorX, anchorY)
- local secure = CreateFrame("Button", securename, parent, inheritedFrames);
- local frame = CreateFrame("Frame", framename, parent);
- secure:SetPoint("CENTER", parent, "CENTER", anchorX, anchorY);
- secure:SetAttribute("unit", unit);
- frame:SetPoint("CENTER", parent, "CENTER", anchorX, anchorY);
- frame:SetAttribute("unit", unit);
- frame.unit = unit;
- frame.displayed = unit;
- -- hide frame to get initial frameShow call
- frame:Hide();
- -- create visuals
- secure:SetWidth(width+2);
- secure:SetHeight(height+2);
- frame:SetWidth(width+2);
- frame:SetHeight(height+2);
- frame.width = width;
- frame.base = frame:CreateTexture(nil, "BACKGROUND");
- frame.base:SetAllPoints();
- frame.base:SetColorTexture(1, 1, 1);
- frame.base:SetVertexColor(unpack(baseColor));
- frame.healthback = frame:CreateTexture(nil, "BACKGROUND", nil, 1);
- frame.healthback:SetPoint("TOPLEFT", frame, "TOPLEFT", 1, -1);
- frame.healthback:SetPoint("BOTTOMRIGHT", frame, "RIGHT", -1, -5);
- frame.healthback:SetTexture(barTexture);
- frame.healthback:SetVertexColor(unpack(bgColor));
- frame.health = frame:CreateTexture(nil, "BORDER");
- frame.health:SetPoint("TOPLEFT", frame.healthback, "TOPLEFT");
- frame.health:SetPoint("BOTTOMLEFT", frame.healthback, "BOTTOMLEFT");
- frame.health:SetTexture(barTexture);
- frame.health:SetVertexColor(unpack(healthColor));
- frame.healthText = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlight");
- frame.healthText:SetPoint("RIGHT", frame.healthback, "RIGHT", -2, 1);
- frame.healthText.percent = true;
- frame.manaback = frame:CreateTexture(nil, "BACKGROUND", nil, 1);
- frame.manaback:SetPoint("TOPLEFT", frame, "LEFT", 1, -5);
- frame.manaback:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -1, 1);
- frame.manaback:SetTexture(barTexture);
- frame.manaback:SetVertexColor(unpack(bgColor));
- frame.mana = frame:CreateTexture(nil, "BORDER");
- frame.mana:SetPoint("TOPLEFT", frame.manaback, "TOPLEFT");
- frame.mana:SetPoint("BOTTOMLEFT", frame.manaback, "BOTTOMLEFT");
- frame.mana:SetTexture(barTexture);
- frame.manaText = frame:CreateFontString(nil, "ARTWORK", "GameFontWhiteTiny");
- frame.manaText:SetPoint("RIGHT", frame.manaback, "RIGHT", -2, 0);
- frame.manaText:Hide();
- frame.shield = frame:CreateTexture(nil, "BORDER");
- frame.shield:SetPoint("TOPLEFT", frame.health, "TOPRIGHT");
- frame.shield:SetPoint("BOTTOMLEFT", frame.health, "BOTTOMRIGHT");
- frame.shield:SetTexture(barTexture);
- frame.shield:SetVertexColor(unpack(shieldColor));
- frame.shield:Hide();
- frame.shieldhl = frame:CreateTexture(nil, "ARTWORK");
- frame.shieldhl:SetPoint("TOPLEFT", frame.healthback, "TOPRIGHT", -1, 0);
- frame.shieldhl:SetPoint("BOTTOMRIGHT", frame.healthback, "BOTTOMRIGHT", 1, 0);
- frame.shieldhl:SetColorTexture(unpack(shieldhlColor));
- frame.shieldhl:Hide();
- frame.name = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
- frame.name:SetPoint("LEFT", frame.healthback, "LEFT", 2, 1);
- frame.name.count = 10;
- frame.level = frame:CreateFontString(nil, "OVERLAY", "GameFontWhiteTiny");
- frame.level:SetPoint("LEFT", frame.manaback, "LEFT", 2, 0);
- frame.targeticon = frame:CreateTexture(nil, "OVERLAY");
- frame.targeticon:SetPoint("CENTER", frame.healthback, "TOP");
- frame.targeticon:SetWidth(16);
- frame.targeticon:SetHeight(16);
- frame.targeticon:SetTexture("Interface\\TARGETINGFRAME\\UI-RaidTargetingIcons");
- frame.targeticon:Hide();
- frame.castbar = OmaUFCastBar.CreateCastBar(frame, unit, -height-24);
- -- set scripts
- frame:SetScript("OnShow", frameShow);
- frame:SetScript("OnHide", frameHide);
- frame:SetScript("OnEvent", unitEvent);
- secure:SetScript("OnEnter", showTooltip);
- secure:SetScript("OnLeave", hideTooltip);
- -- set PowerBarAlt
- local powerbar = _G[string.format("Boss%iTargetFramePowerBarAlt", string.sub(unit, 5, 5))];
- powerbar:SetParent(secure);
- powerbar:ClearAllPoints();
- powerbar:SetPoint("RIGHT", secure, "LEFT");
- -- set attributes
- -- TODO other set of click cast on boss frames possibly
- -- rest give target and menu
- secure:SetAttribute("*type1", "target");
- secure:SetAttribute("*type2", "togglemenu");
- -- TODO dunno how to update frame securely without hiding frame too often
- -- ShowBossFrameWhenUninteractable not in restricted environment
- -- this way all frames are clickable, but there's some invisible clickframes
- RegisterStateDriver(secure, "visibility", "[@boss1,exists][@boss2,exists][@boss3,exists][@boss4,exists][@boss5,exists] show; hide");
- return frame;
-end
-
-function OmaUnitFrames.InitializeBoss(parent)
- attributes = Settings.Character.Clickheal;
-
- -- hidden frame to handle hiding insecure boss frames
- local bossHeader = CreateFrame("Frame");
- bossHeader.frames = {};
- bossHeader:SetScript("OnEvent", bossEvent);
- bossHeader:RegisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT");
- bossHeader.frames["boss1"] = createFrame("OmaBoss1", "OmaBossSecure1", parent, "boss1", anchorX, anchorY);
- for i = 2,MAX_BOSS_FRAMES do
- bossHeader.frames["boss"..i] = createFrame("OmaBoss"..i, "OmaBossSecure"..i, _G["OmaBossSecure"..(i-1)], "boss"..i, 0, -height-26);
- end
- bossEvent(bossHeader);
-
- -- Arena frames are in the same spot
- --[[createFrame("OmaArena1", "OmaArenaSecure1", parent, "arena1", anchorX, anchorY);
- -- MAX_ARENA_ENEMIES from AddOns/Blizzard_ArenaUI/Blizzard_ArenaUI.lua not available
- -- as the addon is not loaded yet, update manually if it changes
- for i = 2,5 do
- createFrame("OmaArena"..i, "OmaArenaSecure"..i, _G["OmaArena"..(i-1)], "arena"..i, 0, -height-26);
- end--]]
-end
+++ /dev/null
--- CastBar.lua
-local _;
-local unpack = unpack;
-local ssub = string.sub;
-local min = math.min;
-local ceil = math.ceil;
-local UnitCastingInfo, UnitChannelInfo = UnitCastingInfo, UnitChannelInfo;
-local GetTime = GetTime;
-local CTimerAfter = C_Timer.After;
-
-local barTexture = "Interface\\AddOns\\OmaRF\\images\\minimalist";
-local castingColor = {1, 0.49, 0}; -- from Quartz defaults
-local nointerruptColor = {0.6, 0.6, 0.6};
-local channelingColor = {0.32, 0.3, 1};
-local updaters = {};
-
-local M = {};
-OmaUFCastBar = M;
-
-local function onUpdate(bar)
- if not bar.updating then return end
- --local width = bar.icon:IsShown() and bar.cast.width or bar.cast.width; -- TODO fullwidth
- local startTime, endTime = bar.startTime, bar.endTime;
- local currentClamped = min(GetTime(), endTime);
- local remaining = endTime - currentClamped;
- local percent;
- if bar.channeling then
- percent = remaining / (endTime - startTime);
- else
- percent = (currentClamped - startTime) / (endTime - startTime);
- end
-
- local width = percent*bar.cast.width;
- if width <= 0 then
- bar.cast:SetWidth(0.1);
- else
- bar.cast:SetWidth(width);
- end
- bar.time:SetFormattedText("%.1f", remaining);
- CTimerAfter(0.03, updaters[bar]);
-end
-M.OnUpdate = onUpdate;
-
-local function showBar(bar)
- bar:Show();
- bar.updating = true;
- onUpdate(bar);
-end
-
-local function hideBar(bar)
- bar:Hide();
- bar.updating = nil;
-end
-
-local function toggleInterruptible(bar, nointr)
- if bar.unit == "player" then return end
- if nointr then
- bar.cast:SetVertexColor(unpack(nointerruptColor));
- bar.shield:Show();
- else
- bar.cast:SetVertexColor(unpack(bar.cast.color));
- bar.shield:Hide();
- end
-end
-
-local function startCast(bar, unit, channeling)
- local name, icon, startTime, endTime, noInterrupt, id;
- if channeling then
- name, _, icon, startTime, endTime, _, noInterrupt = UnitChannelInfo(unit);
- if not startTime or not endTime then return nil end
- bar.channeling = true;
- bar.cast.color = channelingColor;
- else
- _, name, icon, startTime, endTime, _, _, noInterrupt, id = UnitCastingInfo(unit);
- if not startTime or not endTime then return nil end
- bar.channeling = nil;
- bar.cast.color = castingColor;
- end
- bar.startTime = startTime / 1000;
- bar.endTime = endTime / 1000;
- -- don't show samwise for non-existent icons
- if icon ~= "Interface\\Icons\\Temp" then
- bar.icon:SetTexture(icon);
- bar.icon:Show();
- bar.cast:SetWidth(channeling and bar.cast.width or 0.1);
- else
- bar.icon:Hide();
- bar.cast:SetWidth(channeling and bar.cast.width or 0.1); -- TODO use fullwidth
- end
- bar.spell:SetText(ssub(name, 1, bar.spell.count));
- bar.time:SetFormattedText("%.1f", (endTime - startTime)/1000);
- bar.cast:SetVertexColor(unpack(bar.cast.color));
- showBar(bar);
- toggleInterruptible(bar, noInterrupt);
- return true;
-end
-M.StartCast = startCast;
-
-local function applyDelay(bar, unit, channeling)
- local startTime, endTime;
- if channeling then
- _, _, _, startTime, endTime = UnitChannelInfo(unit);
- else
- _, _, _, startTime, endTime = UnitCastingInfo(unit);
- end
- if not startTime or not endTime then return hideBar(bar) end
- bar.startTime = startTime / 1000;
- bar.endTime = endTime / 1000;
-end
-M.ApplyDelay = applyDelay;
-
-local events = {
- ["UNIT_SPELLCAST_START"] = function(bar, unit)
- startCast(bar, unit);
- end,
- ["PLAYER_TARGET_CHANGED"] = function(bar)
- hideBar(bar);
- if not startCast(bar, bar.unit) then
- startCast(bar, bar.unit, true);
- end
- end,
- ["UNIT_SPELLCAST_CHANNEL_START"] = function(bar, unit)
- startCast(bar, unit, true);
- end,
- ["UNIT_SPELLCAST_STOP"] = function(bar)
- hideBar(bar);
- end,
- ["UNIT_SPELLCAST_DELAYED"] = function(bar, unit)
- applyDelay(bar, unit);
- end,
- ["UNIT_SPELLCAST_CHANNEL_UPDATE"] = function(bar, unit)
- applyDelay(bar, unit, true);
- end,
- ["UNIT_SPELLCAST_INTERRUPTIBLE"] = function(bar)
- toggleInterruptible(bar, false);
- end,
- ["UNIT_SPELLCAST_NOT_INTERRUPTIBLE"] = function(bar)
- toggleInterruptible(bar, true);
- end,
-};
-events["UNIT_SPELLCAST_CHANNEL_STOP"] = events["UNIT_SPELLCAST_STOP"];
-
-local function onEvent(bar, event, unit)
- if unit == bar.unit or (bar.unit == "player" and unit == "vehicle") then
- events[event](bar, unit);
- elseif event == "PLAYER_TARGET_CHANGED" then
- events[event](bar);
- end
-end
-
-function M.RegisterCastEvents(bar)
- --bar:RegisterEvent("UNIT_SPELLCAST_SENT");
- bar:RegisterEvent("UNIT_SPELLCAST_START");
- bar:RegisterEvent("UNIT_SPELLCAST_STOP");
- --bar:RegisterEvent("UNIT_SPELLCAST_FAILED");
- --bar:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED");
- bar:RegisterEvent("UNIT_SPELLCAST_DELAYED");
- bar:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START");
- bar:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP");
- bar:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE");
- bar:RegisterEvent("UNIT_SPELLCAST_INTERRUPTIBLE");
- bar:RegisterEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE");
- if bar.unit == "target" then bar:RegisterEvent("PLAYER_TARGET_CHANGED") end
- -- trigger initial check
- if not startCast(bar, bar.unit) then
- startCast(bar, bar.unit, true);
- end
-end
-
-function M.UnregisterCastEvents(bar)
- bar:UnregisterAllEvents();
- hideBar(bar);
-end
-
-function M.CreateCastBar(parent, unit, yoffset)
- local bar = CreateFrame("Frame", parent:GetName().."CastBar", parent);
- bar.unit = unit;
- bar:SetPoint("BOTTOMLEFT", parent, "TOPLEFT", 0, yoffset);
- bar:SetPoint("BOTTOMRIGHT", parent, "TOPRIGHT", 0, yoffset);
- bar:SetHeight(22);
- bar:Hide();
- bar.back = bar:CreateTexture(nil, "BACKGROUND");
- bar.back:SetAllPoints();
- bar.back:SetColorTexture(0, 0, 0, 0.7);
- bar.icon = bar:CreateTexture(nil, "ARTWORK", 1);
- bar.icon:SetPoint("TOPLEFT", bar, "TOPLEFT", 1, -1);
- bar.icon:SetPoint("BOTTOMRIGHT", bar, "BOTTOMLEFT", 21, 1);
- bar.icon:SetTexCoord(0.07, 0.93, 0.07, 0.93); -- remove borders (from Quartz)
- bar.shield = bar:CreateTexture(nil, "ARTWORK");
- bar.shield:SetPoint("CENTER", bar.icon, "CENTER", -2, -1);
- bar.shield:SetWidth(28);
- bar.shield:SetHeight(50);
- bar.shield:SetTexture("Interface\\CastingBar\\UI-CastingBar-Small-Shield");
- bar.shield:SetTexCoord(0, 36/256, 0, 1);
- bar.shield:Hide();
- bar.cast = bar:CreateTexture(nil, "ARTWORK");
- bar.cast:SetPoint("TOPLEFT", bar.icon, "TOPRIGHT", 1, 0);
- bar.cast:SetPoint("BOTTOMLEFT", bar.icon, "BOTTOMRIGHT", 1, 0);
- bar.cast.width = bar:GetWidth() - bar.icon:GetWidth() - 3;
- bar.cast.fullwidth = bar:GetWidth() - 2; -- for casts without icon
- bar.cast:SetWidth(bar.cast.width);
- bar.cast:SetTexture(barTexture);
- bar.cast.color = castingColor;
- bar.spell = bar:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
- bar.spell:SetPoint("LEFT", bar.icon, "RIGHT", 2, 0);
- bar.spell.count = ceil(bar.cast:GetWidth()/10);
- bar.time = bar:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
- bar.time:SetPoint("RIGHT", bar, "RIGHT", -2, 0);
- bar:SetScript("OnEvent", onEvent);
- updaters[bar] = function() onUpdate(bar) end
- return bar;
-end
+++ /dev/null
--- Events.lua
-local _;
-local unpack = unpack;
-local ssub = string.sub;
-local min = math.min;
-local ceil = math.ceil;
-local UnitName, UnitClass, UnitExists = UnitName, UnitClass, UnitExists;
-local UnitPower, UnitPowerMax, UnitPowerType = UnitPower, UnitPowerMax, UnitPowerType;
-local UnitHealth, UnitHealthMax = UnitHealth, UnitHealthMax;
-local UnitGetIncomingHeals, UnitGetTotalAbsorbs = UnitGetIncomingHeals, UnitGetTotalAbsorbs;
-local UnitThreatSituation, GetThreatStatusColor = UnitThreatSituation, GetThreatStatusColor;
-local UnitIsDeadOrGhost, UnitIsConnected = UnitIsDeadOrGhost, UnitIsConnected;
-local UnitHasVehicleUI, UnitTargetsVehicleInRaidUI = UnitHasVehicleUI, UnitTargetsVehicleInRaidUI;
-local UnitLevel, UnitClassification = UnitLevel, UnitClassification;
-local UnitAffectingCombat, IsResting = UnitAffectingCombat, IsResting;
-local UnitIsPVPFreeForAll, UnitIsPVP = UnitIsPVPFreeForAll, UnitIsPVP;
-local UnitFactionGroup, UnitIsMercenary = UnitFactionGroup, UnitIsMercenary;
-local UnitIsGroupLeader, UnitIsGroupAssistant = UnitIsGroupLeader, UnitIsGroupAssistant;
-local HasLFGRestrictions = HasLFGRestrictions;
-local UnitPlayerControlled, UnitIsPlayer = UnitPlayerControlled, UnitIsPlayer;
-local UnitIsTapDenied, UnitSelectionColor = UnitIsTapDenied, UnitSelectionColor;
-local GetRaidTargetIndex, SetRaidTargetIconTexture = GetRaidTargetIndex, SetRaidTargetIconTexture;
-local RAID_CLASS_COLORS = RAID_CLASS_COLORS;
-
-local updateAuras = OmaUFAuras.UpdateAuras;
-
-local Settings = OmaUFSettings;
-local baseColor = Settings.BaseColor;
-local healthColor = Settings.HealthColor;
-local powerColors = Settings.PowerColors;
-
-local M = {};
-OmaUFEvents = M;
-function M.RegisterUnitEvents(frame)
- -- events are taken from FrameXML/CompactUnitFrame.lua and FrameXML/TargetFrame.lua
- -- TODO player flags support (/afk, /dnd)
- frame:RegisterEvent("RAID_TARGET_UPDATE"); -- have to register all and just check
- 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);
- if frame.mana then
- frame:RegisterUnitEvent("UNIT_POWER_UPDATE", frame.unit, displayed);
- frame:RegisterUnitEvent("UNIT_MAXPOWER", frame.unit, displayed);
- frame:RegisterUnitEvent("UNIT_DISPLAYPOWER", frame.unit, displayed);
- frame:RegisterUnitEvent("UNIT_POWER_BAR_SHOW", frame.unit, displayed);
- frame:RegisterUnitEvent("UNIT_POWER_BAR_HIDE", frame.unit, displayed);
- end
- if frame.shield then
- frame:RegisterUnitEvent("UNIT_ABSORB_AMOUNT_CHANGED", frame.unit, displayed);
- end
- if frame.auras then
- frame:RegisterUnitEvent("UNIT_AURA", frame.unit, displayed);
- end
- frame:RegisterUnitEvent("UNIT_NAME_UPDATE", frame.unit, displayed);
- frame:RegisterUnitEvent("UNIT_THREAT_SITUATION_UPDATE", frame.unit, displayed);
- frame:RegisterUnitEvent("UNIT_CONNECTION", frame.unit, displayed);
- frame:RegisterUnitEvent("UNIT_FACTION", frame.unit, displayed);
-end
-local registerUnitEvents = M.RegisterUnitEvents;
-
-local function updateMaxHealth(frame, unit)
- frame.health.max = UnitHealthMax(unit);
-end
-M.UpdateMaxHealth = updateMaxHealth;
-
-local function updateHealth(frame, unit)
- local current, max = UnitHealth(unit), frame.health.max;
- if current > max or max <= 0 then
- -- somehow current health has gone over the maximum (missed maxhealth event)
- frame.health:SetWidth(frame.width);
- updateMaxHealth(frame, unit);
- frame.health:Show();
- elseif current <= 0 or UnitIsDeadOrGhost(unit) then
- frame.health:Hide();
- else
- frame.health:SetWidth(current/max*frame.width);
- frame.health:Show();
- end
-end
-M.UpdateHealth = updateHealth;
-
-local function updateHealthText(frame, unit)
- if UnitIsDeadOrGhost(unit) then
- frame.healthText:SetText("Dead");
- elseif not UnitIsConnected(unit) then
- frame.healthText:SetText("DC");
- elseif frame.healthText.percent then
- frame.healthText:SetFormattedText("%.1f", UnitHealth(unit)/frame.health.max*100);
- else
- local current = UnitHealth(unit);
- if current > 1000000000 then -- 1.0B
- frame.healthText:SetFormattedText("%.2fB", current / 1000000000);
- elseif current > 1000000 then -- 1.0M
- frame.healthText:SetFormattedText("%.2fM", current / 1000000);
- elseif current > 1000 then -- 1K
- frame.healthText:SetFormattedText("%.1fK", current / 1000);
- else
- frame.healthText:SetFormattedText("%d", current)
- end
- end
-end
-M.UpdateHealthText = updateHealthText;
-
-local function updateMaxPower(frame, unit)
- frame.mana.max = UnitPowerMax(unit);
-end
-M.UpdateMaxPower = updateMaxPower;
-
-local function updatePower(frame, unit)
- local current, max = UnitPower(unit), frame.mana.max;
- if current <= 0 then
- frame.mana:Hide();
- elseif current > max or max <= 0 then
- frame.mana:SetWidth(frame.width);
- updateMaxPower(frame, unit);
- frame.mana:Show();
- else
- frame.mana:SetWidth(current/max*frame.width);
- frame.mana:Show();
- end
-end
-M.UpdatePower = updatePower;
-
-local function updatePowerText(frame, unit)
- local current, max = UnitPower(unit), frame.mana.max;
- if UnitIsDeadOrGhost(unit) or not UnitIsConnected(unit) then
- frame.manaText:Hide();
- elseif max > 0 and current > 0 and current < max then
- frame.manaText:SetText(ceil(current/max*100));
- frame.manaText:Show();
- else
- frame.manaText:Hide();
- end
-end
-M.UpdatePowerText = updatePowerText;
-
-local function updatePowerColor(frame, unit)
- frame.mana:SetVertexColor(unpack(powerColors[UnitPowerType(unit)]));
-end
-M.UpdatePowerColor = updatePowerColor;
-
-local function updateName(frame, unit)
- local name = UnitName(unit);
- if not name then return end
- frame.name:SetText(ssub(name, 1, frame.name.count));
-end
-M.UpdateName = updateName;
-
-local function updateShield(frame, unit)
- local shield = UnitGetTotalAbsorbs(unit) or 0;
- if shield > 0 then
- local space = frame.width - frame.health:GetWidth();
- shield = (shield / frame.health.max) * frame.width;
- if space == 0 then
- frame.shield:Hide();
- frame.shieldhl:Show();
- elseif space < shield then
- frame.shield:SetWidth(space);
- frame.shield:Show();
- frame.shieldhl:Show();
- else
- frame.shield:SetWidth(shield);
- frame.shield:Show();
- frame.shieldhl:Hide();
- end
- else
- frame.shield:Hide();
- frame.shieldhl:Hide();
- end
-end
-M.UpdateShield = updateShield;
-
-local function updateAggro(frame, unit)
- local status = UnitThreatSituation(unit);
- if status and status > 0 then
- frame.base:SetVertexColor(GetThreatStatusColor(status));
- else
- frame.base:SetVertexColor(unpack(baseColor));
- end
-end
-M.UpdateAggro = updateAggro;
-
--- only works for player frame
-local function updateVehicle(frame)
- local shouldTargetVehicle = UnitHasVehicleUI("player") and
- UnitTargetsVehicleInRaidUI("player") and UnitExists("vehicle");
- if shouldTargetVehicle then
- if not frame.inVehicle then
- frame.inVehicle = true;
- frame.displayed = frame.vehicle;
- registerUnitEvents(frame);
- end
- elseif frame.inVehicle then
- frame.inVehicle = false;
- frame.displayed = frame.unit;
- registerUnitEvents(frame);
- end
-end
-M.UpdateVehicle = updateVehicle;
-
-local function updateLevelText(frame, unit, levelup)
- if levelup then
- -- PLAYER_LEVEL_UP
- frame.level:SetText(levelup);
- else
- local level = UnitLevel(unit);
- local class = UnitClassification(unit);
- local leveltext, classtext;
- if level < 0 then
- if class == "worldboss" then
- leveltext = "Boss";
- else
- leveltext = "??";
- end
- else
- leveltext = level;
- end
- if class == "rareelite" then
- classtext = " Rare Elite";
- elseif class == "elite" then
- classtext = " Elite";
- elseif class == "rare" then
- classtext = " Rare";
- else
- classtext = "";
- end
- frame.level:SetFormattedText("%s%s", leveltext, classtext);
- end
-end
-M.UpdateLevelText = updateLevelText;
-
-local function updateStatus(frame, unit)
- -- coords from FrameXML/PlayerFrame.lua
- if frame.inCombat or UnitAffectingCombat(unit) then
- frame.status:SetTexCoord(0.5, 1, 0, 0.484375);
- frame.status:Show();
- elseif unit == "player" and IsResting() then
- frame.status:SetTexCoord(0, 0.5, 0, 0.421875);
- frame.status:Show();
- else
- frame.status:Hide();
- end
-end
-M.UpdateStatus = updateStatus;
-
-local pvpIcons = {
- Alliance = "Interface\\TARGETINGFRAME\\UI-PVP-Alliance",
- Horde = "Interface\\TARGETINGFRAME\\UI-PVP-Horde"
-};
-local function updatePVP(frame, unit)
- if UnitIsPVPFreeForAll(unit) then
- frame.pvp:SetTexture("Interface\\TARGETINGFRAME\\UI-PVP-FFA");
- frame.pvp:Show();
- elseif UnitIsPVP(unit) then
- local faction = UnitFactionGroup(unit);
- if faction and faction ~= "Neutral" then
- -- from FrameXML/PlayerFrame.lua, mercenary checks
- if UnitIsMercenary(unit) then
- if faction == "Horde" then
- faction = "Alliance";
- elseif faction == "Alliance" then
- faction = "Horde";
- end
- end
- frame.pvp:SetTexture(pvpIcons[faction]);
- frame.pvp:Show();
- else
- frame.pvp:Hide();
- end
- else
- frame.pvp:Hide();
- end
-end
-M.UpdatePVP = updatePVP;
-
-local function updateLeaderIcon(frame, unit)
- if UnitIsGroupLeader(frame.unit) then
- if HasLFGRestrictions() then
- frame.leader:SetTexture("Interface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES");
- frame.leader:SetTexCoord(0, 0.296875, 0.015625, 0.3125);
- else
- frame.leader:SetTexture("Interface\\GROUPFRAME\\UI-Group-LeaderIcon");
- frame.leader:SetTexCoord(0, 1, 0, 1);
- end
- frame.leader:Show();
- elseif UnitIsGroupAssistant(frame.unit) then
- frame.leader:SetTexture("Interface\\GROUPFRAME\\UI-Group-AssistantIcon");
- frame.leader:SetTexCoord(0, 1, 0, 1);
- frame.leader:Show();
- else
- frame.leader:Hide();
- end
-end
-M.UpdateLeaderIcon = updateLeaderIcon;
-
-local function updateHealthColor(frame, unit)
- if not UnitPlayerControlled(unit) and UnitIsTapDenied(unit) then
- frame.health:SetVertexColor(0.5, 0.5, 0.5);
- elseif UnitIsPlayer(unit) then
- local _, class = UnitClass(unit);
- local color = RAID_CLASS_COLORS[class];
- if color then
- frame.health:SetVertexColor(color.r, color.g, color.b)
- else
- frame.health:SetVertexColor(unpack(healthColor))
- end
- elseif UnitPlayerControlled(unit) then
- frame.health:SetVertexColor(0, 1, 0);
- else
- frame.health:SetVertexColor(UnitSelectionColor(unit));
- end
-end
-M.UpdateHealthColor = updateHealthColor;
-
-local function updateRaidMarker(frame, unit)
- local index = GetRaidTargetIndex(unit);
- if index then
- SetRaidTargetIconTexture(frame.targeticon, index);
- frame.targeticon:Show();
- else
- frame.targeticon:Hide();
- end
-end
-M.UpdateRaidMarker = updateRaidMarker;
-
-local eventFuncs = {
- ["UNIT_HEALTH"] = function(frame)
- updateHealth(frame, frame.displayed);
- updateHealthText(frame, frame.displayed);
- if frame.shield then updateShield(frame, frame.displayed) end
- end,
- ["UNIT_POWER_UPDATE"] = function(frame)
- updatePower(frame, frame.displayed);
- updatePowerText(frame, frame.displayed);
- end,
- ["UNIT_AURA"] = function(frame)
- updateAuras(frame, frame.displayed);
- end,
- ["UNIT_ABSORB_AMOUNT_CHANGED"] = function(frame)
- updateShield(frame, frame.displayed);
- end,
- ["UNIT_THREAT_SITUATION_UPDATE"] = function(frame)
- updateAggro(frame, frame.displayed);
- end,
- ["UNIT_MAXHEALTH"] = function(frame)
- updateMaxHealth(frame, frame.displayed);
- updateHealth(frame, frame.displayed);
- updateHealthText(frame, frame.displayed);
- if frame.shield then updateShield(frame, frame.displayed) end
- end,
- ["UNIT_MAXPOWER"] = function(frame)
- updateMaxPower(frame, frame.displayed);
- updatePower(frame, frame.displayed);
- updatePowerText(frame, frame.displayed);
- end,
- ["UNIT_DISPLAYPOWER"] = function(frame)
- updatePowerColor(frame, frame.displayed);
- updateMaxPower(frame, frame.displayed);
- updatePower(frame, frame.displayed);
- updatePowerText(frame, frame.displayed);
- end,
- ["UNIT_NAME_UPDATE"] = function(frame)
- if frame.name then updateName(frame, frame.displayed) end
- updateHealthColor(frame, frame.displayed);
- end,
- ["UNIT_CONNECTION"] = function(frame)
- updateHealthText(frame, frame.displayed);
- updatePowerText(frame, frame.displayed);
- end,
- ["UNIT_LEVEL"] = function(frame)
- -- if this is registered, frame has frame.level
- updateLevelText(frame, frame.unit);
- end,
- ["PLAYER_LEVEL_UP"] = function(frame, arg1)
- updateLevelText(frame, frame.unit, arg1);
- end,
- ["PLAYER_UPDATE_RESTING"] = function(frame)
- -- player frame has frame.status
- updateStatus(frame, frame.unit);
- end,
- ["PLAYER_REGEN_DISABLED"] = function(frame)
- frame.inCombat = true;
- if frame.status then updateStatus(frame, frame.unit) end
- end,
- ["PLAYER_REGEN_ENABLED"] = function(frame)
- frame.inCombat = false;
- if frame.status then updateStatus(frame, frame.unit) end
- end,
- ["UNIT_FACTION"] = function(frame)
- if frame.pvp then updatePVP(frame, frame.unit) end
- updateHealthColor(frame, frame.displayed);
- end,
- ["PARTY_LEADER_CHANGED"] = function(frame)
- updateLeaderIcon(frame, frame.unit);
- end,
- ["RAID_TARGET_UPDATE"] = function(frame)
- updateRaidMarker(frame, frame.displayed);
- end,
- ["UPDATE_ALL_BARS"] = function(frame)
- if frame.vehicle then updateVehicle(frame) end
- updateMaxHealth(frame, frame.displayed);
- updateHealth(frame, frame.displayed);
- updateHealthText(frame, frame.displayed);
- updateHealthColor(frame, frame.displayed);
- updateAggro(frame, frame.displayed);
- updateRaidMarker(frame, frame.displayed);
- if frame.mana then
- updateMaxPower(frame, frame.displayed);
- updatePower(frame, frame.displayed);
- updatePowerText(frame, frame.displayed);
- updatePowerColor(frame, frame.displayed);
- end
- if frame.auras then updateAuras(frame, frame.displayed) end
- if frame.shield then updateShield(frame, frame.displayed) end
- if frame.name then updateName(frame, frame.displayed) end
- if frame.level then updateLevelText(frame, frame.unit) end
- if frame.status then updateStatus(frame, frame.unit) end
- if frame.pvp then updatePVP(frame, frame.unit) end
- if frame.leader then updateLeaderIcon(frame, frame.unit) end
- end,
-};
-eventFuncs["UNIT_HEALTH_FREQUENT"] = eventFuncs["UNIT_HEALTH"];
-eventFuncs["UNIT_POWER_BAR_SHOW"] = eventFuncs["UNIT_DISPLAYPOWER"];
-eventFuncs["UNIT_POWER_BAR_HIDE"] = eventFuncs["UNIT_DISPLAYPOWER"];
-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"];
-eventFuncs["PLAYER_ENTERING_WORLD"] = eventFuncs["UPDATE_ALL_BARS"];
-eventFuncs["PLAYER_TARGET_CHANGED"] = eventFuncs["UPDATE_ALL_BARS"];
-eventFuncs["INSTANCE_ENCOUNTER_ENGAGE_UNIT"] = eventFuncs["UPDATE_ALL_BARS"];
-eventFuncs["UNIT_TARGETABLE_CHANGED"] = eventFuncs["UPDATE_ALL_BARS"];
-
-function M.UnitEvent(self, event, arg1)
- return eventFuncs[event](self, arg1);
-end
+++ /dev/null
-## Interface: 80100
-## Title: Oma Unit Frame
-## Version: 1.0
-## Author: schyrio
-## Notes: My unit frames
-
-Settings.lua
-Auras.lua
-CastBar.lua
-Events.lua
-UnitFrames.lua
-PlayerFrame.lua
-PetFrame.lua
-TargetFrame.lua
-BossFrames.lua
+++ /dev/null
--- PetFrame.lua
-local _;
-local unpack, pairs = unpack, pairs;
-local format = string.format;
-local GameTooltip = GameTooltip;
-local GameTooltip_SetDefaultAnchor = GameTooltip_SetDefaultAnchor;
-
-local registerUnitEvents = OmaUFEvents.RegisterUnitEvents;
-local unitEvent = OmaUFEvents.UnitEvent;
-
-local Settings = OmaUFSettings;
-local baseColor = Settings.BaseColor;
-local bgColor = Settings.BgColor;
-local healthColor = Settings.HealthColor;
-local shieldColor = Settings.ShieldColor;
-local shieldhlColor = Settings.ShieldhlColor;
-local width, height = Settings.Pet.Width, Settings.Pet.Height;
-local anchorX, anchorY = Settings.Pet.AnchorX, Settings.Pet.AnchorY;
--- placeholders with visible values when error happens
-local attributes = {};
-
-local inheritedFrames = "SecureUnitButtonTemplate,SecureHandlerStateTemplate";
-local barTexture = "Interface\\AddOns\\OmaRF\\images\\minimalist";
-
-local function frameShow(frame)
- frame:RegisterEvent("UNIT_ENTERED_VEHICLE");
- frame:RegisterEvent("UNIT_EXITED_VEHICLE");
- frame:RegisterEvent("UNIT_PET");
- frame:RegisterEvent("PLAYER_ENTERING_WORLD");
- registerUnitEvents(frame);
- unitEvent(frame, "UPDATE_ALL_BARS");
-end
-
-local function frameHide(frame)
- frame:UnregisterAllEvents();
-end
-
-local function showTooltip(secure)
- GameTooltip_SetDefaultAnchor(GameTooltip, secure);
- GameTooltip:SetUnit(secure:GetAttribute("displayed"));
-end
-
-local function hideTooltip(secure)
- GameTooltip:FadeOut();
-end
-
-local vehicletoggle = [=[
- if newstate == "vehicle" then
- self:SetAttribute("displayed", self:GetAttribute("vehicle"));
- else
- self:SetAttribute("displayed", self:GetAttribute("unit"));
- end
-]=]
-
-function OmaUnitFrames.InitializePet(parent)
- attributes = Settings.Character.Clickheal; -- TODO pet clickheal separate with Mend Pet etc.
-
- local secure = CreateFrame("Button", "OmaPetSecure", parent, inheritedFrames);
- local frame = CreateFrame("Frame", "OmaPet", parent);
- local unit = "pet";
- secure:SetPoint("TOPRIGHT", parent, "TOPLEFT", anchorX, anchorY);
- secure:SetAttribute("unit", unit);
- secure:SetAttribute("displayed", unit);
- secure:SetAttribute("vehicle", "player");
- frame:SetPoint("TOPRIGHT", parent, "TOPLEFT", anchorX, anchorY);
- frame:SetAttribute("unit", unit);
- frame.unit = unit;
- frame.displayed = unit;
- frame.vehicle = "player";
- -- hide frame to get initial frameShow call
- frame:Hide();
- -- create visuals
- secure:SetWidth(width+2);
- secure:SetHeight(height+2);
- frame:SetWidth(width+2);
- frame:SetHeight(height+2);
- frame.width = width;
- frame.base = frame:CreateTexture(nil, "BACKGROUND");
- frame.base:SetAllPoints();
- frame.base:SetColorTexture(1, 1, 1);
- frame.base:SetVertexColor(unpack(baseColor));
- frame.healthback = frame:CreateTexture(nil, "BACKGROUND", nil, 1);
- frame.healthback:SetPoint("TOPLEFT", frame, "TOPLEFT", 1, -1);
- frame.healthback:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -1, 1);
- frame.healthback:SetTexture(barTexture);
- frame.healthback:SetVertexColor(unpack(bgColor));
- frame.health = frame:CreateTexture(nil, "BORDER");
- frame.health:SetPoint("TOPLEFT", frame.healthback, "TOPLEFT");
- frame.health:SetPoint("BOTTOMLEFT", frame.healthback, "BOTTOMLEFT");
- frame.health:SetTexture(barTexture);
- frame.health:SetVertexColor(unpack(healthColor));
- frame.healthText = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlight");
- frame.healthText:SetPoint("RIGHT", frame.healthback, "RIGHT", -2, 0);
- frame.targeticon = frame:CreateTexture(nil, "OVERLAY");
- frame.targeticon:SetPoint("CENTER", frame.healthback, "TOP");
- frame.targeticon:SetWidth(18);
- frame.targeticon:SetHeight(18);
- frame.targeticon:SetTexture("Interface\\TARGETINGFRAME\\UI-RaidTargetingIcons");
- frame.targeticon:Hide();
- -- set scripts
- frame:SetScript("OnShow", frameShow);
- frame:SetScript("OnHide", frameHide);
- frame:SetScript("OnEvent", unitEvent);
- secure:SetScript("OnEnter", showTooltip);
- secure:SetScript("OnLeave", hideTooltip);
- -- set attributes
- secure:RegisterForClicks("AnyDown");
- 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");
- secure:SetAttribute("toggleForVehicle", true);
- RegisterUnitWatch(frame);
- RegisterUnitWatch(secure);
- RegisterStateDriver(secure, "vehicleui", "[vehicleui] vehicle; no");
- secure:SetAttribute("_onstate-vehicleui", vehicletoggle);
- return frame;
-end
+++ /dev/null
--- PlayerFrame.lua
-local _;
-local unpack, pairs = unpack, pairs;
-local format = string.format;
-local GameTooltip = GameTooltip;
-local GameTooltip_SetDefaultAnchor = GameTooltip_SetDefaultAnchor;
-
-local registerUnitEvents = OmaUFEvents.RegisterUnitEvents;
-local registerCastEvents = OmaUFCastBar.RegisterCastEvents;
-local unregisterCastEvents = OmaUFCastBar.UnregisterCastEvents;
-local unitEvent = OmaUFEvents.UnitEvent;
-
-local Settings = OmaUFSettings;
-local baseColor = Settings.BaseColor;
-local bgColor = Settings.BgColor;
-local healthColor = Settings.HealthColor;
-local shieldColor = Settings.ShieldColor;
-local shieldhlColor = Settings.ShieldhlColor;
-local width, height = Settings.Player.Width, Settings.Player.Height;
-local anchorX, anchorY = Settings.Player.AnchorX, Settings.Player.AnchorY;
--- placeholders with visible values when error happens
-local attributes = {};
-
-local inheritedFrames = "SecureUnitButtonTemplate,SecureHandlerStateTemplate";
-local barTexture = "Interface\\AddOns\\OmaRF\\images\\minimalist";
-
-local function frameShow(frame)
- frame:RegisterEvent("UNIT_ENTERED_VEHICLE");
- frame:RegisterEvent("UNIT_EXITED_VEHICLE");
- frame:RegisterEvent("GROUP_ROSTER_UPDATE");
- frame:RegisterEvent("PLAYER_ENTERING_WORLD");
- frame:RegisterEvent("PLAYER_LEVEL_UP");
- frame:RegisterEvent("PLAYER_REGEN_DISABLED");
- frame:RegisterEvent("PLAYER_REGEN_ENABLED");
- frame:RegisterEvent("PLAYER_UPDATE_RESTING");
- frame:RegisterEvent("PARTY_LEADER_CHANGED");
- registerUnitEvents(frame);
- registerCastEvents(frame.castbar);
- unitEvent(frame, "UPDATE_ALL_BARS");
-end
-
-local function frameHide(frame)
- frame:UnregisterAllEvents();
- unregisterCastEvents(frame.castbar);
-end
-
-local function showTooltip(secure)
- GameTooltip_SetDefaultAnchor(GameTooltip, secure);
- GameTooltip:SetUnit(secure:GetAttribute("displayed"));
-end
-
-local function hideTooltip(secure)
- GameTooltip:FadeOut();
-end
-
-local vehicletoggle = [=[
- if newstate == "vehicle" then
- self:SetAttribute("displayed", self:GetAttribute("vehicle"));
- else
- self:SetAttribute("displayed", self:GetAttribute("unit"));
- end
-]=]
-
-function OmaUnitFrames.InitializePlayer(parent)
- attributes = Settings.Character.Clickheal;
-
- local secure = CreateFrame("Button", "OmaPlayerSecure", parent, inheritedFrames);
- local frame = CreateFrame("Frame", "OmaPlayer", parent);
- local unit = "player";
- secure:SetPoint("CENTER", parent, "CENTER", anchorX, anchorY);
- secure:SetAttribute("unit", unit);
- secure:SetAttribute("displayed", unit);
- secure:SetAttribute("vehicle", "vehicle");
- frame:SetPoint("CENTER", parent, "CENTER", anchorX, anchorY);
- frame:SetAttribute("unit", unit);
- frame.unit = unit;
- frame.displayed = unit;
- frame.vehicle = "vehicle";
- -- hide frame to get initial frameShow call
- frame:Hide();
- -- create visuals
- secure:SetWidth(width+2);
- secure:SetHeight(height+2);
- frame:SetWidth(width+2);
- frame:SetHeight(height+2);
- frame.width = width;
- frame.base = frame:CreateTexture(nil, "BACKGROUND");
- frame.base:SetAllPoints();
- frame.base:SetColorTexture(1, 1, 1);
- frame.base:SetVertexColor(unpack(baseColor));
- frame.healthback = frame:CreateTexture(nil, "BACKGROUND", nil, 1);
- frame.healthback:SetPoint("TOPLEFT", frame, "TOPLEFT", 1, -1);
- frame.healthback:SetPoint("BOTTOMRIGHT", frame, "RIGHT", -1, -5);
- frame.healthback:SetTexture(barTexture);
- frame.healthback:SetVertexColor(unpack(bgColor));
- frame.health = frame:CreateTexture(nil, "BORDER");
- frame.health:SetPoint("TOPLEFT", frame.healthback, "TOPLEFT");
- frame.health:SetPoint("BOTTOMLEFT", frame.healthback, "BOTTOMLEFT");
- frame.health:SetTexture(barTexture);
- frame.health:SetVertexColor(unpack(healthColor));
- frame.healthText = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlightLarge");
- frame.healthText:SetPoint("RIGHT", frame.healthback, "RIGHT", -2, 1);
- frame.manaback = frame:CreateTexture(nil, "BACKGROUND", nil, 1);
- frame.manaback:SetPoint("TOPLEFT", frame, "LEFT", 1, -5);
- frame.manaback:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -1, 1);
- frame.manaback:SetTexture(barTexture);
- frame.manaback:SetVertexColor(unpack(bgColor));
- frame.mana = frame:CreateTexture(nil, "BORDER");
- frame.mana:SetPoint("TOPLEFT", frame.manaback, "TOPLEFT");
- frame.mana:SetPoint("BOTTOMLEFT", frame.manaback, "BOTTOMLEFT");
- frame.mana:SetTexture(barTexture);
- frame.manaText = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlight");
- frame.manaText:SetPoint("RIGHT", frame.manaback, "RIGHT", -2, 1);
- frame.manaText:Hide();
- frame.shield = frame:CreateTexture(nil, "BORDER");
- frame.shield:SetPoint("TOPLEFT", frame.health, "TOPRIGHT");
- frame.shield:SetPoint("BOTTOMLEFT", frame.health, "BOTTOMRIGHT");
- frame.shield:SetTexture(barTexture);
- frame.shield:SetVertexColor(unpack(shieldColor));
- frame.shield:Hide();
- frame.shieldhl = frame:CreateTexture(nil, "ARTWORK");
- frame.shieldhl:SetPoint("TOPLEFT", frame.healthback, "TOPRIGHT", -1, 0);
- frame.shieldhl:SetPoint("BOTTOMRIGHT", frame.healthback, "BOTTOMRIGHT", 1, 0);
- frame.shieldhl:SetColorTexture(unpack(shieldhlColor));
- frame.shieldhl:Hide();
- frame.status = frame:CreateTexture(nil, "OVERLAY");
- frame.status:SetPoint("TOPLEFT", frame.manaback, "BOTTOMLEFT", -8, 8);
- frame.status:SetPoint("BOTTOMRIGHT", frame.manaback, "BOTTOMLEFT", 8, -8);
- frame.status:SetTexture("Interface\\CHARACTERFRAME\\UI-StateIcon");
- frame.status:Hide();
- frame.pvp = frame:CreateTexture(nil, "OVERLAY");
- frame.pvp:SetPoint("TOPLEFT", frame.manaback, "BOTTOMLEFT", 8, 6);
- frame.pvp:SetPoint("BOTTOMRIGHT", frame.manaback, "BOTTOMLEFT", 32, -18);
- frame.pvp:SetTexture("Interface\\TARGETINGFRAME\\UI-PVP-Horde");
- frame.pvp:Hide();
- frame.leader = frame:CreateTexture(nil, "OVERLAY");
- frame.leader:SetPoint("TOPLEFT", frame.healthback, "TOPLEFT", -6, 6);
- frame.leader:SetPoint("BOTTOMRIGHT", frame.healthback, "TOPLEFT", 6, -6);
- frame.leader:Hide();
- frame.level = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
- frame.level:SetPoint("LEFT", frame.manaback, "LEFT", 2, 1);
- frame.targeticon = frame:CreateTexture(nil, "OVERLAY");
- frame.targeticon:SetPoint("CENTER", frame.healthback, "TOP");
- frame.targeticon:SetWidth(18);
- frame.targeticon:SetHeight(18);
- frame.targeticon:SetTexture("Interface\\TARGETINGFRAME\\UI-RaidTargetingIcons");
- frame.targeticon:Hide();
- frame.castbar = OmaUFCastBar.CreateCastBar(frame, unit, 8);
- -- set scripts
- frame:SetScript("OnShow", frameShow);
- frame:SetScript("OnHide", frameHide);
- frame:SetScript("OnEvent", unitEvent);
- secure:SetScript("OnEnter", showTooltip);
- secure:SetScript("OnLeave", hideTooltip);
- -- set attributes
- secure:RegisterForClicks("AnyDown");
- 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");
- secure:SetAttribute("toggleForVehicle", true);
- RegisterUnitWatch(frame);
- RegisterUnitWatch(secure);
- RegisterStateDriver(secure, "vehicleui", "[vehicleui] vehicle; no");
- secure:SetAttribute("_onstate-vehicleui", vehicletoggle);
- return frame;
-end
+++ /dev/null
--- 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 = {
- Clickheal = {},
-};
-local chars = {
- ["Sylvanas"] = {
- ["Vildana"] = {
- 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",
- },
- },
- },
- ["Stormreaver"] = {
- ["Vildan"] = {
- Clickheal = {
- ["type1"] = "spell",
- ["type2"] = "spell",
- ["shift-type1"] = "spell",
- ["shift-type2"] = "spell",
- ["ctrl-type1"] = "macro",
- ["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-macro1"] = "Cleansing",
- ["alt-spell2"] = "Lay on Hands",
- ["alt-shift-spell1"] = "Beacon of Light",
- ["alt-shift-spell2"] = "Beacon of Faith",
- },
- },
- ["Gedren"] = {
- Clickheal = {
- ["type1"] = "spell",
- ["type2"] = "spell",
- ["shift-type1"] = "spell",
- ["shift-type2"] = "spell",
- ["ctrl-type1"] = "spell",
- ["alt-type2"] = "spell",
- ["spell1"] = "Healing Touch",
- ["spell2"] = "Lifebloom",
- ["shift-spell1"] = "Regrowth",
- ["shift-spell2"] = "Swiftmend",
- ["ctrl-spell1"] = "Nature's Cure",
- ["alt-spell2"] = "Rebirth",
- },
- },
- ["Gilden"] = {
- AnchorX = 0,
- AnchorY = -330,
- Clickheal = {
- ["type1"] = "spell",
- ["type2"] = "spell",
- ["shift-type1"] = "spell",
- ["shift-type2"] = "spell",
- ["ctrl-type1"] = "spell",
- ["spell1"] = "Power Word: Shield",
- ["spell2"] = "Penance",
- ["shift-spell1"] = "Shadow Mend",
- ["shift-spell2"] = "Shadow Covenant",
- ["ctrl-spell1"] = "Purify",
- },
- },
- },
-};
-
--- account-wide settings
-local settings = {
- Player = {
- Width = 160,
- Height = 50,
- AnchorX = -300,
- AnchorY = -175,
- },
- Pet = {
- Width = 80,
- Height = 25,
- AnchorX = -10,
- AnchorY = 0,
- },
- Target = {
- Width = 160,
- Height = 50,
- AnchorX = 300,
- AnchorY = -175,
- },
- Boss = {
- Width = 140,
- Height = 30,
- AnchorX = 550,
- AnchorY = 300,
- },
- BaseColor = {0, 0, 0, 0.5},
- BgColor = {0.1, 0.1, 0.1, 0.4},
- HealthColor = {0.5, 0.5, 0.5},
- ShieldColor = {0.1, 0.8, 1},
- ShieldhlColor = {0.5, 0.8, 1},
- HealpredColor = {0.5, 0.6, 0.5},
- PowerColors = {
- [PowerTypeMana] = {0, 0.5, 1},
- [PowerTypeRage] = {1, 0, 0},
- [PowerTypeFocus] = {1, 0.5, 0},
- [PowerTypeEnergy] = {1, 0.8, 0},
- [PowerTypeRunic] = {0.8, 0, 0.2},
- },
-};
-OmaUFSettings = settings;
--- watch to not remove mana entry
-setmetatable(settings.PowerColors, {__index = function(t) return rawget(t, PowerTypeMana) end});
-
-function OmaUFLoadChar()
- local name, realm = UnitFullName("player");
- if chars[realm] and chars[realm][name] then
- settings.Character = chars[realm][name];
- else
- settings.Character = charDefaults;
- end
-end
+++ /dev/null
--- TargetFrame.lua
-local _;
-local unpack, pairs = unpack, pairs;
-local format = string.format;
-local GameTooltip = GameTooltip;
-local GameTooltip_SetDefaultAnchor = GameTooltip_SetDefaultAnchor;
-
-local registerUnitEvents = OmaUFEvents.RegisterUnitEvents;
-local registerCastEvents = OmaUFCastBar.RegisterCastEvents;
-local unregisterCastEvents = OmaUFCastBar.UnregisterCastEvents;
-local unitEvent = OmaUFEvents.UnitEvent;
-local createAuraFrame = OmaUFAuras.CreateAuraFrame;
-
-local Settings = OmaUFSettings;
-local baseColor = Settings.BaseColor;
-local bgColor = Settings.BgColor;
-local healthColor = Settings.HealthColor;
-local shieldColor = Settings.ShieldColor;
-local shieldhlColor = Settings.ShieldhlColor;
-local width, height = Settings.Target.Width, Settings.Target.Height;
-local anchorX, anchorY = Settings.Target.AnchorX, Settings.Target.AnchorY;
--- placeholders with visible values when error happens
-local attributes = {};
-
-local inheritedFrames = "SecureUnitButtonTemplate,SecureHandlerStateTemplate";
-local barTexture = "Interface\\AddOns\\OmaRF\\images\\minimalist";
-
-local function frameShow(frame)
- frame:RegisterEvent("GROUP_ROSTER_UPDATE");
- frame:RegisterEvent("PLAYER_ENTERING_WORLD");
- frame:RegisterEvent("PLAYER_TARGET_CHANGED");
- frame:RegisterEvent("PARTY_LEADER_CHANGED");
- frame:RegisterUnitEvent("UNIT_LEVEL", frame.unit);
- registerUnitEvents(frame);
- registerCastEvents(frame.castbar);
- unitEvent(frame, "UPDATE_ALL_BARS");
-end
-
-local function frameHide(frame)
- frame:UnregisterAllEvents();
- unregisterCastEvents(frame.castbar);
-end
-
-local function showTooltip(secure)
- GameTooltip_SetDefaultAnchor(GameTooltip, secure);
- GameTooltip:SetUnit(secure:GetAttribute("unit"));
-end
-
-local function hideTooltip(secure)
- GameTooltip:FadeOut();
-end
-
-function OmaUnitFrames.InitializeTarget(parent)
- attributes = Settings.Character.Clickheal;
-
- local secure = CreateFrame("Button", "OmaTargetSecure", parent, inheritedFrames);
- local frame = CreateFrame("Frame", "OmaTarget", parent);
- local unit = "target";
- secure:SetPoint("CENTER", parent, "CENTER", anchorX, anchorY);
- secure:SetAttribute("unit", unit);
- frame:SetPoint("CENTER", parent, "CENTER", anchorX, anchorY);
- frame:SetAttribute("unit", unit);
- frame.unit = unit;
- frame.displayed = unit;
- -- hide frame to get initial frameShow call
- frame:Hide();
- -- create visuals
- secure:SetWidth(width+2);
- secure:SetHeight(height+2);
- frame:SetWidth(width+2);
- frame:SetHeight(height+2);
- frame.width = width;
- frame.base = frame:CreateTexture(nil, "BACKGROUND");
- frame.base:SetAllPoints();
- frame.base:SetColorTexture(1, 1, 1);
- frame.base:SetVertexColor(unpack(baseColor));
- frame.healthback = frame:CreateTexture(nil, "BACKGROUND", nil, 1);
- frame.healthback:SetPoint("TOPLEFT", frame, "TOPLEFT", 1, -1);
- frame.healthback:SetPoint("BOTTOMRIGHT", frame, "RIGHT", -1, -5);
- frame.healthback:SetTexture(barTexture);
- frame.healthback:SetVertexColor(unpack(bgColor));
- frame.health = frame:CreateTexture(nil, "BORDER");
- frame.health:SetPoint("TOPLEFT", frame.healthback, "TOPLEFT");
- frame.health:SetPoint("BOTTOMLEFT", frame.healthback, "BOTTOMLEFT");
- frame.health:SetTexture(barTexture);
- frame.health:SetVertexColor(unpack(healthColor));
- frame.healthText = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlightLarge");
- frame.healthText:SetPoint("RIGHT", frame.healthback, "RIGHT", -2, 1);
- frame.manaback = frame:CreateTexture(nil, "BACKGROUND", nil, 1);
- frame.manaback:SetPoint("TOPLEFT", frame, "LEFT", 1, -5);
- frame.manaback:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -1, 1);
- frame.manaback:SetTexture(barTexture);
- frame.manaback:SetVertexColor(unpack(bgColor));
- frame.mana = frame:CreateTexture(nil, "BORDER");
- frame.mana:SetPoint("TOPLEFT", frame.manaback, "TOPLEFT");
- frame.mana:SetPoint("BOTTOMLEFT", frame.manaback, "BOTTOMLEFT");
- frame.mana:SetTexture(barTexture);
- frame.manaText = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlight");
- frame.manaText:SetPoint("RIGHT", frame.manaback, "RIGHT", -2, 1);
- frame.manaText:Hide();
- frame.shield = frame:CreateTexture(nil, "BORDER");
- frame.shield:SetPoint("TOPLEFT", frame.health, "TOPRIGHT");
- frame.shield:SetPoint("BOTTOMLEFT", frame.health, "BOTTOMRIGHT");
- frame.shield:SetTexture(barTexture);
- frame.shield:SetVertexColor(unpack(shieldColor));
- frame.shield:Hide();
- frame.shieldhl = frame:CreateTexture(nil, "ARTWORK");
- frame.shieldhl:SetPoint("TOPLEFT", frame.healthback, "TOPRIGHT", -1, 0);
- frame.shieldhl:SetPoint("BOTTOMRIGHT", frame.healthback, "BOTTOMRIGHT", 1, 0);
- frame.shieldhl:SetColorTexture(unpack(shieldhlColor));
- frame.shieldhl:Hide();
- frame.status = frame:CreateTexture(nil, "OVERLAY");
- frame.status:SetPoint("TOPLEFT", frame.manaback, "BOTTOMLEFT", -8, 8);
- frame.status:SetPoint("BOTTOMRIGHT", frame.manaback, "BOTTOMLEFT", 8, -8);
- frame.status:SetTexture("Interface\\CHARACTERFRAME\\UI-StateIcon");
- frame.status:Hide();
- frame.pvp = frame:CreateTexture(nil, "OVERLAY");
- frame.pvp:SetPoint("TOPLEFT", frame.manaback, "BOTTOMLEFT", 8, 6);
- frame.pvp:SetPoint("BOTTOMRIGHT", frame.manaback, "BOTTOMLEFT", 32, -18);
- frame.pvp:SetTexture("Interface\\TARGETINGFRAME\\UI-PVP-Horde");
- frame.pvp:Hide();
- frame.leader = frame:CreateTexture(nil, "OVERLAY");
- frame.leader:SetPoint("TOPLEFT", frame.healthback, "TOPLEFT", -6, 6);
- frame.leader:SetPoint("BOTTOMRIGHT", frame.healthback, "TOPLEFT", 6, -6);
- frame.leader:Hide();
- frame.name = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge");
- frame.name:SetPoint("LEFT", frame.healthback, "LEFT", 2, 1);
- frame.name.count = 8;
- frame.level = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
- frame.level:SetPoint("LEFT", frame.manaback, "LEFT", 2, 1);
- frame.targeticon = frame:CreateTexture(nil, "OVERLAY");
- frame.targeticon:SetPoint("CENTER", frame.healthback, "TOP");
- frame.targeticon:SetWidth(18);
- frame.targeticon:SetHeight(18);
- frame.targeticon:SetTexture("Interface\\TARGETINGFRAME\\UI-RaidTargetingIcons");
- frame.targeticon:Hide();
- frame.castbar = OmaUFCastBar.CreateCastBar(frame, unit, 8);
- createAuraFrame(frame, unit);
- -- set scripts
- frame:SetScript("OnShow", frameShow);
- frame:SetScript("OnHide", frameHide);
- frame:SetScript("OnEvent", unitEvent);
- secure:SetScript("OnEnter", showTooltip);
- secure:SetScript("OnLeave", hideTooltip);
- -- set attributes
- secure:RegisterForClicks("AnyDown");
- 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");
- secure:SetAttribute("toggleForVehicle", false);
- RegisterUnitWatch(frame);
- RegisterUnitWatch(secure);
- return frame;
-end
+++ /dev/null
--- UnitFrames.lua
-local _;
-local pairs = pairs;
-local InCombatLockdown = InCombatLockdown;
-
-local UnitFrames = CreateFrame("Frame", "OmaUnitFrame", UIParent);
-
-local M = {};
-OmaUnitFrames = M;
-
-local function initialize()
- UnitFrames:SetFrameStrata("LOW");
- UnitFrames:SetPoint("CENTER");
- UnitFrames:SetWidth(1);
- UnitFrames:SetHeight(1);
- local player = M.InitializePlayer(UnitFrames);
- M.InitializePet(player);
- local target = M.InitializeTarget(UnitFrames);
- --M.InitializeToT(target); -- might not do this
- M.InitializeBoss(UnitFrames);
-end
-
-local hidden = false;
-local function hideBlizzardFrames()
- if hidden then return end
- hidden = true;
-
- local frames = {PlayerFrame, TargetFrame, TargetFrameToT, PetFrame,
- PlayerFrameAlternateManaBar, ComboFrame, PriestBarFrame, RuneFrame,
- WarlockPowerFrame, MonkHarmonyBarFrame, PaladinPowerBarFrame,
- MageArcaneChargesFrame, CastingBarFrame, PetCastingBarFrame};
- for i = 1,MAX_BOSS_FRAMES do
- table.insert(frames, _G["Boss"..i.."TargetFrame"]);
- table.insert(frames, _G["Boss"..i.."TargetFrameHealthBar"]);
- table.insert(frames, _G["Boss"..i.."TargetFrameManaBar"]);
- -- keep boss frame powerBarAlt
- end
- for _, frame in pairs(frames) do
- frame:UnregisterAllEvents();
- if frame.healthbar then frame.healthbar:UnregisterAllEvents() end
- if frame.manabar then frame.manabar:UnregisterAllEvents() end
- if frame.spellbar then frame.spellbar:UnregisterAllEvents() end
- --if frame.powerBarAlt then frame.powerBarAlt:UnregisterAllEvents() end
- frame:Hide();
- end
-
- -- from ShadowedUF, re-register vehicle events for default auras
- PlayerFrame:RegisterEvent("PLAYER_ENTERING_WORLD");
- PlayerFrame:RegisterEvent("UNIT_ENTERING_VEHICLE");
- PlayerFrame:RegisterEvent("UNIT_ENTERED_VEHICLE");
- PlayerFrame:RegisterEvent("UNIT_EXITING_VEHICLE");
- PlayerFrame:RegisterEvent("UNIT_EXITED_VEHICLE");
- PlayerFrame:SetMovable(true);
- PlayerFrame:SetUserPlaced(true);
- PlayerFrame:SetDontSavePosition(true);
-end
-
--- untested, not playing arena, from ShadowedUF
-local hiddenFrame = CreateFrame("Frame");
-hiddenFrame:Hide();
-local arenaHidden = false;
-local function hideArenaFrames()
- if not arenaHidden and not InCombatLockdown() then
- arenaHidden = true;
- ArenaEnemyFrames:UnregisterAllEvents();
- ArenaEnemyFrames:SetParent(hiddenFrame);
- ArenaPrepFrames:UnregisterAllEvents();
- ArenaPrepFrames:SetParent(hiddenFrame);
- SetCVar("showArenaEnemyFrames", 0, "SHOW_ARENA_ENEMY_FRAMES_TEXT");
- end
-end
-
-UnitFrames:RegisterEvent("PLAYER_LOGIN");
-UnitFrames:RegisterEvent("ADDON_LOADED");
-UnitFrames:SetScript("OnEvent", function(self, event, addon)
- if event == "ADDON_LOADED" and addon == "Blizzard_ArenaUI" then
- hideArenaFrames();
- elseif event == "PLAYER_LOGIN" then
- OmaUFLoadChar();
- hideBlizzardFrames();
- initialize();
- end
-end);