from retail

This commit is contained in:
NoM0Re
2025-01-17 15:35:11 +01:00
parent db45573d1c
commit efa2dae58a
16 changed files with 122 additions and 63 deletions
-1
View File
@@ -435,7 +435,6 @@ local FakeWeakAurasMixin = {
},
blockedTables = {
ModelPaths = true,
regionPrototype = true,
RealTimeProfilingWindow = true,
-- Note these shouldn't exist in the WeakAuras namespace, but moving them takes a bit of effort,
-- so for now just block them and clean them up later
+40
View File
@@ -1383,6 +1383,9 @@ Private.event_prototypes = {
AddUnitEventForEvents(result, unit, "UNIT_NAME_UPDATE")
AddUnitEventForEvents(result, unit, "UNIT_FLAGS")
AddUnitEventForEvents(result, unit, "PLAYER_FLAGS_CHANGED")
if trigger.use_inRange then
AddUnitEventForEvents(result, unit, "UNIT_IN_RANGE_UPDATE")
end
return result;
end,
internal_events = function(trigger)
@@ -1548,6 +1551,16 @@ Private.event_prototypes = {
end,
init = "UnitIsConnected(unit)"
},
{
name = "inRange",
display = L["In Range"],
type = "toggle",
width = WeakAuras.doubleWidth,
enable = function(trigger)
return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"
end,
init = "UnitInRange(unit)"
},
{
name = "hostility",
display = L["Hostility"],
@@ -1790,6 +1803,9 @@ Private.event_prototypes = {
if trigger.use_ignoreDead or trigger.use_ignoreDisconnected then
AddUnitEventForEvents(result, unit, "UNIT_FLAGS")
end
if trigger.use_inRange then
AddUnitEventForEvents(result, unit, "UNIT_IN_RANGE_UPDATE")
end
return result
end,
internal_events = function(trigger)
@@ -2049,6 +2065,16 @@ Private.event_prototypes = {
end,
init = "UnitIsConnected(unit)"
},
{
name = "inRange",
display = L["In Range"],
type = "toggle",
width = WeakAuras.doubleWidth,
enable = function(trigger)
return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"
end,
init = "UnitInRange(unit)"
},
{
name = "nameplateType",
display = L["Nameplate Type"],
@@ -2099,6 +2125,9 @@ Private.event_prototypes = {
end
tinsert(result.events, "FRAME_UPDATE")
end
if trigger.use_inRange then
AddUnitEventForEvents(result, unit, "UNIT_IN_RANGE_UPDATE")
end
return result;
end,
internal_events = function(trigger)
@@ -2389,6 +2418,16 @@ Private.event_prototypes = {
end,
init = "UnitIsConnected(unit)"
},
{
name = "inRange",
display = L["In Range"],
type = "toggle",
width = WeakAuras.doubleWidth,
enable = function(trigger)
return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"
end,
init = "UnitInRange(unit)"
},
{
name = "nameplateType",
display = L["Nameplate Type"],
@@ -6558,6 +6597,7 @@ Private.event_prototypes = {
if trigger.use_instance_difficulty ~= nil
or trigger.use_instance_size ~= nil
or trigger.use_pvpflagged ~= nil
then
tinsert(events, "WA_DELAYED_PLAYER_ENTERING_WORLD")
end
+6 -6
View File
@@ -38,8 +38,8 @@ local default = {
zoom = 0
};
WeakAuras.regionPrototype.AddAdjustedDurationToDefault(default);
WeakAuras.regionPrototype.AddAlphaToDefault(default);
Private.regionPrototype.AddAdjustedDurationToDefault(default);
Private.regionPrototype.AddAlphaToDefault(default);
local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20;
@@ -132,7 +132,7 @@ local properties = {
},
};
WeakAuras.regionPrototype.AddProperties(properties, default);
Private.regionPrototype.AddProperties(properties, default);
local function GetProperties(data)
local overlayInfo = Private.GetOverlayInfo(data);
@@ -1051,7 +1051,7 @@ local function create(parent)
end
end
WeakAuras.regionPrototype.create(region);
Private.regionPrototype.create(region);
for k, f in pairs(funcs) do
region[k] = f
@@ -1075,7 +1075,7 @@ local function modify(parent, region, data)
region.text = nil
region.stacks = nil
WeakAuras.regionPrototype.modify(parent, region, data);
Private.regionPrototype.modify(parent, region, data);
-- Localize
local bar, iconFrame, icon = region.bar, region.iconFrame, region.icon;
@@ -1355,7 +1355,7 @@ local function modify(parent, region, data)
--- Update internal bar alignment
region.bar:Update();
WeakAuras.regionPrototype.modifyFinish(parent, region, data);
Private.regionPrototype.modifyFinish(parent, region, data);
end
local function validate(data)
+3 -3
View File
@@ -119,7 +119,7 @@ local function create(parent)
region.selfPoint = "TOPLEFT"
region.controlPoints = CreateObjectPool(createControlPoint, releaseControlPoint)
region.controlPoints.parent = region
WeakAuras.regionPrototype.create(region)
Private.regionPrototype.create(region)
region.suspended = 0
local oldSetFrameLevel = region.SetFrameLevel
@@ -1041,7 +1041,7 @@ end
local function modify(parent, region, data)
Private.FixGroupChildrenOrderForGroup(data)
region:SetScale(data.scale and data.scale > 0 and data.scale <= 10 and data.scale or 1)
WeakAuras.regionPrototype.modify(parent, region, data)
Private.regionPrototype.modify(parent, region, data)
if data.border and not data.useAnchorPerUnit then
local background = region.background
@@ -1560,7 +1560,7 @@ local function modify(parent, region, data)
region:ReloadControlledChildren()
WeakAuras.regionPrototype.modifyFinish(parent, region, data)
Private.regionPrototype.modifyFinish(parent, region, data)
end
WeakAuras.RegisterRegionType("dynamicgroup", create, modify, default)
+3 -3
View File
@@ -35,7 +35,7 @@ local function create(parent)
local border = CreateFrame("Frame", nil, region);
region.border = border;
WeakAuras.regionPrototype.create(region);
Private.regionPrototype.create(region);
local oldSetFrameLevel = region.SetFrameLevel
region.SetFrameLevel = function(self, level)
@@ -90,7 +90,7 @@ local function modify(parent, region, data)
else
data.selfPoint = "CENTER";
end
WeakAuras.regionPrototype.modify(parent, region, data);
Private.regionPrototype.modify(parent, region, data);
-- Localize
local border = region.border;
@@ -179,7 +179,7 @@ local function modify(parent, region, data)
region.border:Hide()
end
WeakAuras.regionPrototype.modifyFinish(parent, region, data);
Private.regionPrototype.modifyFinish(parent, region, data);
end
-- Register new region type with WeakAuras
+6 -6
View File
@@ -35,7 +35,7 @@ local default = {
cooldownEdge = false
};
WeakAuras.regionPrototype.AddAlphaToDefault(default);
Private.regionPrototype.AddAlphaToDefault(default);
local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20;
@@ -101,7 +101,7 @@ local properties = {
}
};
WeakAuras.regionPrototype.AddProperties(properties, default);
Private.regionPrototype.AddProperties(properties, default);
local function GetProperties(data)
local result = CopyTable(properties)
@@ -140,7 +140,7 @@ end
local function AnchorSubRegion(self, subRegion, anchorType, selfPoint, anchorPoint, anchorXOffset, anchorYOffset)
if anchorType == "area" then
WeakAuras.regionPrototype.AnchorSubRegion(selfPoint == "region" and self or self.icon, subRegion, anchorType, selfPoint, anchorPoint, anchorXOffset, anchorYOffset)
Private.regionPrototype.AnchorSubRegion(selfPoint == "region" and self or self.icon, subRegion, anchorType, selfPoint, anchorPoint, anchorXOffset, anchorYOffset)
else
subRegion:ClearAllPoints()
anchorPoint = anchorPoint or "CENTER"
@@ -335,7 +335,7 @@ local function create(parent, data)
end
end
WeakAuras.regionPrototype.create(region);
Private.regionPrototype.create(region);
region.AnchorSubRegion = AnchorSubRegion
@@ -347,7 +347,7 @@ local function modify(parent, region, data)
region.stacks = nil
region.text2 = nil
WeakAuras.regionPrototype.modify(parent, region, data);
Private.regionPrototype.modify(parent, region, data);
local button, icon, cooldown = region.button, region.icon, region.cooldown;
@@ -674,7 +674,7 @@ local function modify(parent, region, data)
end
end
WeakAuras.regionPrototype.modifyFinish(parent, region, data);
Private.regionPrototype.modifyFinish(parent, region, data);
--- WORKAROUND
-- This fixes a issue with barmodels not appearing on icons if the
+5 -5
View File
@@ -56,7 +56,7 @@ local properties = {
},
}
WeakAuras.regionPrototype.AddProperties(properties, default);
Private.regionPrototype.AddProperties(properties, default);
local function GetProperties(data)
return properties;
@@ -79,13 +79,13 @@ local function create(parent)
local border = CreateFrame("Frame", nil, region);
region.border = border;
WeakAuras.regionPrototype.create(region);
Private.regionPrototype.create(region);
for k, v in pairs (regionFunctions) do
region[k] = v
end
region.AnchorSubRegion = WeakAuras.regionPrototype.AnchorSubRegion
region.AnchorSubRegion = Private.regionPrototype.AnchorSubRegion
-- Return complete region
return region;
@@ -175,7 +175,7 @@ end
-- Modify a given region/display
local function modify(parent, region, data)
WeakAuras.regionPrototype.modify(parent, region, data);
Private.regionPrototype.modify(parent, region, data);
-- Localize
local border = region.border;
@@ -273,7 +273,7 @@ local function modify(parent, region, data)
end
end
WeakAuras.regionPrototype.modifyFinish(parent, region, data);
Private.regionPrototype.modifyFinish(parent, region, data);
end
-- Work around for movies and world map hiding all models
+6 -6
View File
@@ -113,9 +113,9 @@ local default = {
slantMode = "INSIDE"
};
WeakAuras.regionPrototype.AddAlphaToDefault(default);
Private.regionPrototype.AddAlphaToDefault(default);
WeakAuras.regionPrototype.AddAdjustedDurationToDefault(default);
Private.regionPrototype.AddAdjustedDurationToDefault(default);
local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20;
@@ -176,7 +176,7 @@ local properties = {
}
}
WeakAuras.regionPrototype.AddProperties(properties, default);
Private.regionPrototype.AddProperties(properties, default);
local function GetProperties(data)
local overlayInfo = Private.GetOverlayInfo(data);
@@ -462,7 +462,7 @@ local function create(parent)
region.duration = 0;
region.expirationTime = math.huge;
WeakAuras.regionPrototype.create(region);
Private.regionPrototype.create(region);
return region;
end
@@ -474,7 +474,7 @@ local function TimerTick(self)
end
local function modify(parent, region, data)
WeakAuras.regionPrototype.modify(parent, region, data);
Private.regionPrototype.modify(parent, region, data);
local background, foreground = region.background, region.foreground;
local foregroundSpinner, backgroundSpinner = region.foregroundSpinner, region.backgroundSpinner;
@@ -1029,7 +1029,7 @@ local function modify(parent, region, data)
end
end
WeakAuras.regionPrototype.modifyFinish(parent, region, data);
Private.regionPrototype.modifyFinish(parent, region, data);
end
local function validate(data)
+11 -11
View File
@@ -4,21 +4,21 @@ local AddonName, Private = ...
local WeakAuras = WeakAuras;
local L = WeakAuras.L;
WeakAuras.regionPrototype = {};
Private.regionPrototype = {};
-- Alpha
function WeakAuras.regionPrototype.AddAlphaToDefault(default)
function Private.regionPrototype.AddAlphaToDefault(default)
default.alpha = 1.0;
end
-- Adjusted Duration
function WeakAuras.regionPrototype.AddAdjustedDurationToDefault(default)
function Private.regionPrototype.AddAdjustedDurationToDefault(default)
default.useAdjustededMax = false;
default.useAdjustededMin = false;
end
function WeakAuras.regionPrototype.AddAdjustedDurationOptions(options, data, order)
function Private.regionPrototype.AddAdjustedDurationOptions(options, data, order)
options.useAdjustededMin = {
type = "toggle",
width = WeakAuras.normalWidth,
@@ -100,7 +100,7 @@ function Private.GetAnchorsForData(parentData, type)
end
-- Sound / Chat Message / Custom Code
function WeakAuras.regionPrototype.AddProperties(properties, defaultsForRegion)
function Private.regionPrototype.AddProperties(properties, defaultsForRegion)
properties["sound"] = {
display = L["Sound"],
action = "SoundPlay",
@@ -452,9 +452,9 @@ local function AnchorSubRegion(self, subRegion, anchorType, selfPoint, anchorPoi
end
end
WeakAuras.regionPrototype.AnchorSubRegion = AnchorSubRegion
Private.regionPrototype.AnchorSubRegion = AnchorSubRegion
function WeakAuras.regionPrototype.create(region)
function Private.regionPrototype.create(region)
local defaultsForRegion = Private.regionTypes[region.regionType] and Private.regionTypes[region.regionType].default;
region.SoundPlay = SoundPlay;
region.SoundRepeatStop = SoundRepeatStop;
@@ -500,7 +500,7 @@ end
-- SetDurationInfo
function WeakAuras.regionPrototype.modify(parent, region, data)
function Private.regionPrototype.modify(parent, region, data)
region.state = nil
region.states = nil
region.subRegionEvents:ClearSubscribers()
@@ -587,7 +587,7 @@ function WeakAuras.regionPrototype.modify(parent, region, data)
end, true)
end
function WeakAuras.regionPrototype.modifyFinish(parent, region, data)
function Private.regionPrototype.modifyFinish(parent, region, data)
-- Sync subRegions
if region.subRegions then
for index, subRegion in pairs(region.subRegions) do
@@ -674,7 +674,7 @@ local function TimerTickForSetDuration(self)
self:SetTime(max - adjustMin, self.expirationTime - adjustMin, self.inverse);
end
function WeakAuras.regionPrototype.AddSetDurationInfo(region)
function Private.regionPrototype.AddSetDurationInfo(region)
if (region.SetValue and region.SetTime) then
region.generatedSetDurationInfo = true;
@@ -704,7 +704,7 @@ function WeakAuras.regionPrototype.AddSetDurationInfo(region)
end
-- Expand/Collapse function
function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, parent, parentRegionType)
function Private.regionPrototype.AddExpandFunction(data, region, cloneId, parent, parentRegionType)
local uid = data.uid
local id = data.id
local inDynamicGroup = parentRegionType == "dynamicgroup";
+3 -3
View File
@@ -85,7 +85,7 @@ local properties = {
},
}
WeakAuras.regionPrototype.AddProperties(properties, default);
Private.regionPrototype.AddProperties(properties, default);
local function create(parent)
local frame = CreateFrame("Frame", nil, UIParent);
@@ -102,7 +102,7 @@ local function create(parent)
frame.foreground = foreground;
foreground:SetAllPoints(frame);
WeakAuras.regionPrototype.create(frame);
Private.regionPrototype.create(frame);
return frame;
end
@@ -151,7 +151,7 @@ local function SetFrameViaFrames(self, texture, frame)
end
local function modify(parent, region, data)
WeakAuras.regionPrototype.modify(parent, region, data);
Private.regionPrototype.modify(parent, region, data);
region.foreground = region.foreground or {}
region.background = region.background or {}
local pattern = "%.x(%d+)y(%d+)f(%d+)%.[tb][gl][ap]"
+6 -6
View File
@@ -52,7 +52,7 @@ local properties = {
},
}
WeakAuras.regionPrototype.AddProperties(properties, default);
Private.regionPrototype.AddProperties(properties, default);
local function GetProperties(data)
return properties;
@@ -71,13 +71,13 @@ local function create(parent)
region.duration = 0;
region.expirationTime = math.huge;
WeakAuras.regionPrototype.create(region);
Private.regionPrototype.create(region);
return region;
end
local function modify(parent, region, data)
WeakAuras.regionPrototype.modify(parent, region, data);
Private.regionPrototype.modify(parent, region, data);
local text = region.text;
local fontPath = SharedMedia:Fetch("font", data.font);
@@ -334,7 +334,7 @@ local function modify(parent, region, data)
region:ConfigureTextUpdate()
region:ConfigureSubscribers()
WeakAuras.regionPrototype.modifyFinish(parent, region, data);
Private.regionPrototype.modifyFinish(parent, region, data);
end
local function validate(data)
@@ -346,7 +346,7 @@ WeakAuras.RegisterRegionType("text", create, modify, default, GetProperties, val
-- Fallback region type
local function fallbackmodify(parent, region, data)
WeakAuras.regionPrototype.modify(parent, region, data);
Private.regionPrototype.modify(parent, region, data);
local text = region.text;
text:SetFont(STANDARD_TEXT_FONT, data.fontSize < 33 and data.fontSize or 33, data.outline and "OUTLINE" or nil);
@@ -363,7 +363,7 @@ local function fallbackmodify(parent, region, data)
region.Update = function() end
WeakAuras.regionPrototype.modifyFinish(parent, region, data);
Private.regionPrototype.modifyFinish(parent, region, data);
end
WeakAuras.RegisterRegionType("fallback", create, fallbackmodify, default);
+5 -5
View File
@@ -22,7 +22,7 @@ local default = {
frameStrata = 1
};
WeakAuras.regionPrototype.AddAlphaToDefault(default);
Private.regionPrototype.AddAlphaToDefault(default);
local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20;
@@ -62,7 +62,7 @@ local properties = {
}
}
WeakAuras.regionPrototype.AddProperties(properties, default);
Private.regionPrototype.AddProperties(properties, default);
local function create(parent)
local region = CreateFrame("Frame", nil, UIParent);
@@ -75,13 +75,13 @@ local function create(parent)
region.texture = texture;
texture:SetAllPoints(region);
WeakAuras.regionPrototype.create(region);
Private.regionPrototype.create(region);
return region;
end
local function modify(parent, region, data)
WeakAuras.regionPrototype.modify(parent, region, data);
Private.regionPrototype.modify(parent, region, data);
region.texture:SetTexture(data.texture);
region.texture:SetDesaturated(data.desaturate)
region:SetWidth(data.width);
@@ -230,7 +230,7 @@ local function modify(parent, region, data)
region.GetRotation = nil;
end
WeakAuras.regionPrototype.modifyFinish(parent, region, data);
Private.regionPrototype.modifyFinish(parent, region, data);
end
local function validate(data)
+2 -2
View File
@@ -2873,8 +2873,8 @@ function Private.SetRegion(data, cloneId)
local anim_cancelled = loginFinished and Private.CancelAnimation(region, true, true, true, true, true, true);
regionTypes[regionType].modify(parent, region, data);
WeakAuras.regionPrototype.AddSetDurationInfo(region);
WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, parent, parent.regionType)
Private.regionPrototype.AddSetDurationInfo(region);
Private.regionPrototype.AddExpandFunction(data, region, cloneId, parent, parent.regionType)
data.animation = data.animation or {};
data.animation.start = data.animation.start or {type = "none"};
+24 -4
View File
@@ -374,8 +374,17 @@ end
local function CreateHiddenAll(subOption)
return function(data, info)
local mainOptions = OptionsPrivate.EnsureOptions(data, subOption)
for i=1,#info do
mainOptions = mainOptions.args[info[i]];
end
if(#data.controlledChildren == 0) then
return true;
if mainOptions.hiddenAllIfAnyHidden then
return false
else
return true
end
end
for child in OptionsPrivate.Private.TraverseLeafs(data) do
@@ -387,13 +396,24 @@ local function CreateHiddenAll(subOption)
childOptionTable[i] = childOption;
end
if (childOption) then
if (not hiddenChild(childOptionTable, info)) then
return false;
local childHidden = hiddenChild(childOptionTable, info)
if mainOptions.hiddenAllIfAnyHidden then
if childHidden then
return true
end
else
if not childHidden then
return false
end
end
end
end
return true;
if mainOptions.hiddenAllIfAnyHidden then
return false
else
return true
end
end
end
+1 -1
View File
@@ -385,7 +385,7 @@ local function createOptions(id, data)
},
};
options = WeakAuras.regionPrototype.AddAdjustedDurationOptions(options, data, 36.5);
options = OptionsPrivate.Private.regionPrototype.AddAdjustedDurationOptions(options, data, 36.5);
local overlayInfo = OptionsPrivate.Private.GetOverlayInfo(data);
if (overlayInfo and next(overlayInfo)) then
@@ -288,7 +288,7 @@ local function createOptions(id, data)
name = "",
},
};
options = WeakAuras.regionPrototype.AddAdjustedDurationOptions(options, data, 57);
options = OptionsPrivate.Private.regionPrototype.AddAdjustedDurationOptions(options, data, 57);
local overlayInfo = OptionsPrivate.Private.GetOverlayInfo(data);
if (overlayInfo and next(overlayInfo)) then