mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-28 08:54:43 +00:00
load StateDriver libraries & update files as needed (Needs more testing)
This commit is contained in:
@@ -292,9 +292,9 @@ function L_UIDropDownMenu_AddButton(info, level)
|
||||
local index = listFrame and (listFrame.numButtons + 1) or 1;
|
||||
local width;
|
||||
|
||||
--UIDropDownMenuDelegate:SetAttribute("createframes-level", level);
|
||||
--UIDropDownMenuDelegate:SetAttribute("createframes-index", index);
|
||||
--UIDropDownMenuDelegate:SetAttribute("createframes", true);
|
||||
UIDropDownMenuDelegate:SetAttribute("createframes-level", level);
|
||||
UIDropDownMenuDelegate:SetAttribute("createframes-index", index);
|
||||
UIDropDownMenuDelegate:SetAttribute("createframes", true);
|
||||
|
||||
listFrame = listFrame or _G["L_DropDownList"..level];
|
||||
local listFrameName = listFrame:GetName();
|
||||
@@ -789,9 +789,9 @@ function L_ToggleDropDownMenu(level, value, dropDownFrame, anchorName, xOffset,
|
||||
level = 1;
|
||||
end
|
||||
|
||||
--UIDropDownMenuDelegate:SetAttribute("createframes-level", level);
|
||||
--UIDropDownMenuDelegate:SetAttribute("createframes-index", 0);
|
||||
--UIDropDownMenuDelegate:SetAttribute("createframes", true);
|
||||
UIDropDownMenuDelegate:SetAttribute("createframes-level", level);
|
||||
UIDropDownMenuDelegate:SetAttribute("createframes-index", 0);
|
||||
UIDropDownMenuDelegate:SetAttribute("createframes", true);
|
||||
L_UIDROPDOWNMENU_MENU_LEVEL = level;
|
||||
L_UIDROPDOWNMENU_MENU_VALUE = value;
|
||||
local listFrame = _G["L_DropDownList"..level];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/">
|
||||
<Script file="templates.lua"/>
|
||||
<Include file="templates.xml"/>
|
||||
|
||||
|
||||
<Script file="init.lua"/>
|
||||
<Script file="private.lua"/>
|
||||
<Script file="ouf.lua"/>
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<Cooldown name="oUF_CooldownFrameTemplate" inherits="CooldownFrameTemplate" drawEdge="true" virtual="true"/>
|
||||
|
||||
<!--
|
||||
|
||||
Sub-object as a child of the parent unit frame:
|
||||
<Button name="oUF_HeaderTargetTemplate" inherits="SecureUnitButtonTemplate" virtual="true">
|
||||
<Frames>
|
||||
@@ -57,5 +57,5 @@
|
||||
</Button>
|
||||
</Frames>
|
||||
</Button>
|
||||
-->
|
||||
|
||||
</Ui>
|
||||
+22
-22
@@ -59,7 +59,7 @@ local function onAttributeChanged(self, name, value)
|
||||
if(not self.onlyProcessChildren) then
|
||||
updateActiveUnit(self, "OnAttributeChanged")
|
||||
end
|
||||
--[[
|
||||
|
||||
if(self.unit and self.unit == value) then
|
||||
return
|
||||
else
|
||||
@@ -67,7 +67,7 @@ local function onAttributeChanged(self, name, value)
|
||||
iterateChildren(self:GetChildren())
|
||||
end
|
||||
end
|
||||
]]
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -331,7 +331,7 @@ local function initObject(unit, style, styleFunc, header, ...)
|
||||
|
||||
styleFunc(object, objectUnit, not header)
|
||||
|
||||
--object:SetScript("OnAttributeChanged", onAttributeChanged)
|
||||
object:SetScript("OnAttributeChanged", onAttributeChanged)
|
||||
object:SetScript("OnShow", function() onShow(this) end)
|
||||
|
||||
activeElements[object] = {}
|
||||
@@ -359,7 +359,7 @@ local function walkObject(object, unit)
|
||||
-- Check if we should leave the main frame blank.
|
||||
if(object.onlyProcessChildren) then
|
||||
object.hasChildren = true
|
||||
--object:SetScript("OnAttributeChanged", onAttributeChanged)
|
||||
object:SetScript("OnAttributeChanged", onAttributeChanged)
|
||||
return initObject(unit, style, styleFunc, header, object:GetChildren())
|
||||
end
|
||||
|
||||
@@ -542,8 +542,8 @@ do
|
||||
end
|
||||
|
||||
self.menu = togglemenu
|
||||
--self:SetAttribute("type1", "target")
|
||||
--self:SetAttribute("type2", "menu")
|
||||
self:SetAttribute("type1", "target")
|
||||
self:SetAttribute("type2", "menu")
|
||||
self.guessUnit = unit
|
||||
self.unit = "player"
|
||||
-- self.onlyProcessChildren =true
|
||||
@@ -552,18 +552,18 @@ do
|
||||
styleProxy(nil, self:GetName())
|
||||
end
|
||||
|
||||
local setAttribute = function(self, name, value)
|
||||
if self.attributes[name] ~= value then
|
||||
self.attributes[name] = value
|
||||
-- local setAttribute = function(self, name, value)
|
||||
-- if self.attributes[name] ~= value then
|
||||
-- self.attributes[name] = value
|
||||
|
||||
if self:IsVisible() then
|
||||
SecureGroupHeader_Update(self)
|
||||
end
|
||||
end
|
||||
end
|
||||
local getAttribute = function(self, name)
|
||||
return self.attributes[name]
|
||||
end
|
||||
-- if self:IsVisible() then
|
||||
-- SecureGroupHeader_Update(self)
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
-- local getAttribute = function(self, name)
|
||||
-- return self.attributes[name]
|
||||
-- end
|
||||
--[[ oUF:SpawnHeader(overrideName, template, visibility, ...)
|
||||
Used to create a group header and apply the currently active style to it.
|
||||
|
||||
@@ -594,10 +594,10 @@ do
|
||||
header:Hide()
|
||||
|
||||
header.attributes = {}
|
||||
header.SetAttribute = setAttribute
|
||||
header.GetAttribute = getAttribute
|
||||
-- header.SetAttribute = SetAttribute
|
||||
-- header.GetAttribute = GetAttribute
|
||||
|
||||
--header:SetAttribute("template", "SecureUnitButtonTemplate")
|
||||
header:SetAttribute("template", "SecureUnitButtonTemplate")
|
||||
for i = 1, getn(arg), 2 do
|
||||
local att, val = select(i, unpack(arg))
|
||||
if(not att) then break end
|
||||
@@ -620,7 +620,7 @@ do
|
||||
end
|
||||
|
||||
|
||||
--[[if(visibility) then
|
||||
if(visibility) then
|
||||
local type, list = split(" ", visibility, 2)
|
||||
if(list and type == "custom") then
|
||||
RegisterStateDriver(header, "visibility", list)
|
||||
@@ -630,7 +630,7 @@ do
|
||||
RegisterStateDriver(header, "visibility", condition)
|
||||
header.visibility = condition
|
||||
end
|
||||
end]]
|
||||
end
|
||||
|
||||
return header
|
||||
end
|
||||
|
||||
@@ -1,27 +1,29 @@
|
||||
local E, L, V, P, G = unpack(ElvUI)
|
||||
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames");
|
||||
local ns = oUF
|
||||
local ElvUF = ns.oUF
|
||||
local ns = oUF;
|
||||
local ElvUF = ns.oUF;
|
||||
|
||||
local _G = _G;
|
||||
local setmetatable, getfenv, setfenv = setmetatable, getfenv, setfenv;
|
||||
local type, unpack, select, pairs = type, unpack, select, pairs;
|
||||
local min, random = math.min, math.random;
|
||||
local format = string.format;
|
||||
|
||||
local UnitMana = UnitMana;
|
||||
local UnitManaMax = UnitManaMax;
|
||||
local UnitHealth = UnitHealth;
|
||||
local UnitHealthMax = UnitHealthMax;
|
||||
local UnitName = UnitName;
|
||||
local UnitClass = UnitClass;
|
||||
local InCombatLockdown = InCombatLockdown;
|
||||
local UnregisterUnitWatch = UnregisterUnitWatch;
|
||||
local RegisterUnitWatch = RegisterUnitWatch;
|
||||
local RegisterStateDriver = RegisterStateDriver;
|
||||
local LOCALIZED_CLASS_NAMES_MALE = LOCALIZED_CLASS_NAMES_MALE;
|
||||
local CLASS_SORT_ORDER = CLASS_SORT_ORDER;
|
||||
local MAX_RAID_MEMBERS = MAX_RAID_MEMBERS;
|
||||
--Cache global variables
|
||||
--Lua functions
|
||||
local _G = _G
|
||||
local setmetatable, getfenv, setfenv = setmetatable, getfenv, setfenv
|
||||
local type, unpack, select, pairs = type, unpack, select, pairs
|
||||
local min, random = math.min, math.random
|
||||
local format = string.format
|
||||
--WoW API / Variables
|
||||
local UnitMana = UnitMana
|
||||
local UnitManaMax = UnitManaMax
|
||||
local UnitHealth = UnitHealth
|
||||
local UnitHealthMax = UnitHealthMax
|
||||
local UnitName = UnitName
|
||||
local UnitClass = UnitClass
|
||||
local UnitAffectingCombat = UnitAffectingCombat
|
||||
local UnregisterUnitWatch = UnregisterUnitWatch
|
||||
local RegisterUnitWatch = RegisterUnitWatch
|
||||
local RegisterStateDriver = RegisterStateDriver
|
||||
local LOCALIZED_CLASS_NAMES_MALE = LOCALIZED_CLASS_NAMES_MALE
|
||||
local CLASS_SORT_ORDER = CLASS_SORT_ORDER
|
||||
local MAX_RAID_MEMBERS = MAX_RAID_MEMBERS
|
||||
|
||||
local attributeBlacklist = {["showRaid"] = true, ["showParty"] = true, ["showSolo"] = true}
|
||||
local configEnv
|
||||
@@ -29,45 +31,45 @@ local originalEnvs = {}
|
||||
local overrideFuncs = {}
|
||||
|
||||
local function createConfigEnv()
|
||||
if( configEnv ) then return end
|
||||
if configEnv then return end
|
||||
configEnv = setmetatable({
|
||||
UnitMana = function (unit, displayType)
|
||||
if(unit:find("target") or unit:find("focus")) then
|
||||
return UnitMana(unit, displayType);
|
||||
if find(unit, "target") or find(unit, "focus") then
|
||||
return UnitMana(unit, displayType)
|
||||
end
|
||||
|
||||
return random(1, UnitManaMax(unit, displayType) or 1);
|
||||
return random(1, UnitManaMax(unit, displayType) or 1)
|
||||
end,
|
||||
UnitHealth = function(unit)
|
||||
if(unit:find("target") or unit:find("focus")) then
|
||||
return UnitHealth(unit);
|
||||
if find(unit, "target") or find(unit, "focus") then
|
||||
return UnitHealth(unit)
|
||||
end
|
||||
|
||||
return random(1, UnitHealthMax(unit));
|
||||
return random(1, UnitHealthMax(unit))
|
||||
end,
|
||||
UnitName = function(unit)
|
||||
if(unit:find("target") or unit:find("focus")) then
|
||||
return UnitName(unit);
|
||||
if find(unit, "target") or find(unit, "focus") then
|
||||
return UnitName(unit)
|
||||
end
|
||||
if(E.CreditsList) then
|
||||
local max = #E.CreditsList;
|
||||
return E.CreditsList[random(1, max)];
|
||||
if E.CreditsList then
|
||||
local max = getn(E.CreditsList)
|
||||
return E.CreditsList[random(1, max)]
|
||||
end
|
||||
return "Test Name";
|
||||
return "Test Name"
|
||||
end,
|
||||
UnitClass = function(unit)
|
||||
if(unit:find("target") or unit:find("focus")) then
|
||||
return UnitClass(unit);
|
||||
if find(unit, "target") or find(unit, "focus") then
|
||||
return UnitClass(unit)
|
||||
end
|
||||
|
||||
local classToken = CLASS_SORT_ORDER[random(1, #(CLASS_SORT_ORDER))];
|
||||
return LOCALIZED_CLASS_NAMES_MALE[classToken], classToken;
|
||||
local classToken = CLASS_SORT_ORDER[random(1, getn(CLASS_SORT_ORDER))]
|
||||
return LOCALIZED_CLASS_NAMES_MALE[classToken], classToken
|
||||
end,
|
||||
Hex = function(r, g, b)
|
||||
if(type(r) == "table") then
|
||||
if(r.r) then r, g, b = r.r, r.g, r.b; else r, g, b = unpack(r); end
|
||||
if type(r) == "table" then
|
||||
if r.r then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end
|
||||
end
|
||||
return format("|cff%02x%02x%02x", r*255, g*255, b*255);
|
||||
return format("|cff%02x%02x%02x", r*255, g*255, b*255)
|
||||
end,
|
||||
ColorGradient = ElvUF.ColorGradient,
|
||||
}, {
|
||||
@@ -101,11 +103,11 @@ local function createConfigEnv()
|
||||
end
|
||||
|
||||
function UF:ForceShow(frame)
|
||||
if InCombatLockdown() then return; end
|
||||
if UnitAffectingCombat("player") then return end
|
||||
if not frame.isForced then
|
||||
frame.oldUnit = frame.unit
|
||||
frame.unit = "player"
|
||||
frame.isForced = true;
|
||||
frame.isForced = true
|
||||
frame.oldOnUpdate = frame:GetScript("OnUpdate")
|
||||
end
|
||||
|
||||
@@ -119,17 +121,17 @@ function UF:ForceShow(frame)
|
||||
frame:Update()
|
||||
end
|
||||
|
||||
if(_G[frame:GetName().."Target"]) then
|
||||
self:ForceShow(_G[frame:GetName().."Target"]);
|
||||
if _G[frame:GetName().."Target"] then
|
||||
self:ForceShow(_G[frame:GetName().."Target"])
|
||||
end
|
||||
|
||||
if(_G[frame:GetName().."Pet"]) then
|
||||
self:ForceShow(_G[frame:GetName().."Pet"]);
|
||||
if _G[frame:GetName().."Pet"] then
|
||||
self:ForceShow(_G[frame:GetName().."Pet"])
|
||||
end
|
||||
end
|
||||
|
||||
function UF:UnforceShow(frame)
|
||||
if InCombatLockdown() then return; end
|
||||
if UnitAffectingCombat("player") then return end
|
||||
if not frame.isForced then
|
||||
return
|
||||
end
|
||||
@@ -152,11 +154,11 @@ function UF:UnforceShow(frame)
|
||||
frame:Update()
|
||||
end
|
||||
|
||||
if(_G[frame:GetName().."Target"]) then
|
||||
if _G[frame:GetName().."Target"] then
|
||||
self:UnforceShow(_G[frame:GetName().."Target"])
|
||||
end
|
||||
|
||||
if(_G[frame:GetName().."Pet"]) then
|
||||
if _G[frame:GetName().."Pet"] then
|
||||
self:UnforceShow(_G[frame:GetName().."Pet"])
|
||||
end
|
||||
end
|
||||
@@ -164,8 +166,8 @@ end
|
||||
function UF:ShowChildUnits(header, ...)
|
||||
header.isForced = true
|
||||
|
||||
for i=1, select("#", ...) do
|
||||
local frame = select(i, ...)
|
||||
for i = 1, getn(args) do
|
||||
local frame = select(i, unpack(args))
|
||||
frame:RegisterForClicks(nil)
|
||||
frame:SetID(i)
|
||||
frame.TargetGlow:SetAlpha(0)
|
||||
@@ -176,8 +178,8 @@ end
|
||||
function UF:UnshowChildUnits(header, ...)
|
||||
header.isForced = nil
|
||||
|
||||
for i=1, select("#", ...) do
|
||||
local frame = select(i, ...)
|
||||
for i = 1, getn(args) do
|
||||
local frame = select(i, unpack(args))
|
||||
frame:RegisterForClicks(self.db.targetOnMouseDown and "AnyDown" or "AnyUp")
|
||||
frame.TargetGlow:SetAlpha(1)
|
||||
self:UnforceShow(frame)
|
||||
@@ -185,7 +187,7 @@ function UF:UnshowChildUnits(header, ...)
|
||||
end
|
||||
|
||||
local function OnAttributeChanged(self)
|
||||
if not self:GetParent().forceShow and not self.forceShow then return; end
|
||||
if not self:GetParent().forceShow and not self.forceShow then return end
|
||||
if not self:IsShown() then return end
|
||||
|
||||
local db = self.db or self:GetParent().db
|
||||
@@ -199,7 +201,7 @@ local function OnAttributeChanged(self)
|
||||
end
|
||||
|
||||
function UF:HeaderConfig(header, configMode)
|
||||
if InCombatLockdown() then return; end
|
||||
if UnitAffectingCombat("player") then return end
|
||||
|
||||
createConfigEnv()
|
||||
header.forceShow = configMode
|
||||
@@ -225,18 +227,18 @@ function UF:HeaderConfig(header, configMode)
|
||||
|
||||
RegisterStateDriver(header, "visibility", header.db.visibility)
|
||||
|
||||
if(header:GetScript("OnEvent")) then
|
||||
header:GetScript("OnEvent")(header, "PLAYER_ENTERING_WORLD");
|
||||
if header:GetScript("OnEvent") then
|
||||
header:GetScript("OnEvent")(header, "PLAYER_ENTERING_WORLD")
|
||||
end
|
||||
end
|
||||
|
||||
for i=1, #header.groups do
|
||||
for i = 1, getn(header.groups) do
|
||||
local group = header.groups[i]
|
||||
|
||||
if group:IsShown() then
|
||||
group.forceShow = header.forceShow
|
||||
group.forceShowAuras = header.forceShowAuras
|
||||
group:HookScript("OnAttributeChanged", OnAttributeChanged)
|
||||
HookScript(group, "OnAttributeChanged", OnAttributeChanged)
|
||||
if configMode then
|
||||
for key in pairs(attributeBlacklist) do
|
||||
group:SetAttribute(key, nil)
|
||||
@@ -258,7 +260,7 @@ function UF:HeaderConfig(header, configMode)
|
||||
end
|
||||
end
|
||||
|
||||
UF["headerFunctions"][header.groupName]:AdjustVisibility(header);
|
||||
UF["headerFunctions"][header.groupName]:AdjustVisibility(header)
|
||||
end
|
||||
|
||||
function UF:PLAYER_REGEN_DISABLED()
|
||||
@@ -275,19 +277,7 @@ function UF:PLAYER_REGEN_DISABLED()
|
||||
end
|
||||
end
|
||||
|
||||
for i=1, 5 do
|
||||
if self["arena"..i] and self["arena"..i].isForced then
|
||||
self:UnforceShow(self["arena"..i])
|
||||
end
|
||||
end
|
||||
|
||||
for i=1, 4 do
|
||||
if self["boss"..i] and self["boss"..i].isForced then
|
||||
self:UnforceShow(self["boss"..i])
|
||||
end
|
||||
end
|
||||
|
||||
for i=1, 4 do
|
||||
for i = 1, 4 do
|
||||
if self["party"..i] and self["party"..i].isForced then
|
||||
self:UnforceShow(self["party"..i])
|
||||
end
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/">
|
||||
<Script file="UnitFrames.lua"/>
|
||||
<Script file="Config_Enviroment.lua"/>
|
||||
<Script file="Tags.lua"/>
|
||||
<Include file="Elements\Load_Elements.xml"/>
|
||||
<Include file="Units\Load_Units.xml"/>
|
||||
|
||||
@@ -679,7 +679,7 @@ function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdat
|
||||
if headerUpdate or not self[group].mover then
|
||||
UF["headerFunctions"][group]:Configure_Groups(self[group])
|
||||
if not self[group].isForced and not self[group].blockVisibilityChanges then
|
||||
-- RegisterStateDriver(self[group], "visibility", db.visibility)
|
||||
RegisterStateDriver(self[group], "visibility", db.visibility)
|
||||
end
|
||||
else
|
||||
UF["headerFunctions"][group]:Configure_Groups(self[group])
|
||||
@@ -693,7 +693,7 @@ function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdat
|
||||
E:EnableMover(self[group].mover:GetName())
|
||||
end
|
||||
else
|
||||
-- UnregisterStateDriver(self[group], "visibility")
|
||||
UnregisterStateDriver(self[group], "visibility")
|
||||
self[group]:Hide()
|
||||
if self[group].mover then
|
||||
E:DisableMover(self[group].mover:GetName())
|
||||
@@ -708,7 +708,7 @@ function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdat
|
||||
local db = UF.db["units"][group]
|
||||
if db.enable ~= true then
|
||||
UnregisterStateDriver(UF[group], "visibility")
|
||||
--UF[group]:Hide()
|
||||
UF[group]:Hide()
|
||||
if(UF[group].mover) then
|
||||
E:DisableMover(UF[group].mover:GetName())
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user