from retail

This commit is contained in:
NoM0Re
2025-01-16 15:41:34 +01:00
parent 24196cd7ce
commit c090302487
7 changed files with 90 additions and 117 deletions
+3 -3
View File
@@ -747,7 +747,7 @@ local function runDynamicConditionFunctions(funcs)
end end
end end
local function UpdateDynamicConditonsStates(self, event) local function UpdateDynamicConditionsStates(self, event)
if (globalDynamicConditionFuncs[event]) then if (globalDynamicConditionFuncs[event]) then
for i, func in ipairs(globalDynamicConditionFuncs[event]) do for i, func in ipairs(globalDynamicConditionFuncs[event]) do
func(globalConditionState); func(globalConditionState);
@@ -757,7 +757,7 @@ end
local function handleDynamicConditions(self, event) local function handleDynamicConditions(self, event)
Private.StartProfileSystem("dynamic conditions") Private.StartProfileSystem("dynamic conditions")
UpdateDynamicConditonsStates(self, event) UpdateDynamicConditionsStates(self, event)
if (dynamicConditions[event]) then if (dynamicConditions[event]) then
runDynamicConditionFunctions(dynamicConditions[event]); runDynamicConditionFunctions(dynamicConditions[event]);
end end
@@ -883,7 +883,7 @@ function Private.RegisterForGlobalConditions(uid)
UpdateDynamicConditionsPerUnitState(dynamicConditionsFrame, event, unit) UpdateDynamicConditionsPerUnitState(dynamicConditionsFrame, event, unit)
else else
pcall(dynamicConditionsFrame.RegisterEvent, dynamicConditionsFrame, event); pcall(dynamicConditionsFrame.RegisterEvent, dynamicConditionsFrame, event);
UpdateDynamicConditonsStates(dynamicConditionsFrame, event) UpdateDynamicConditionsStates(dynamicConditionsFrame, event)
end end
end end
end end
+6 -3
View File
@@ -1796,10 +1796,10 @@ function GenericTrigger.Add(data, region)
end end
if warnAboutCLEUEvents then if warnAboutCLEUEvents then
Private.AuraWarnings.UpdateWarning(data.uid, "spamy_event_warning", "warning", Private.AuraWarnings.UpdateWarning(data.uid, "spammy_event_warning", "warning",
L["COMBAT_LOG_EVENT_UNFILTERED with no filter can trigger frame drops in raid environment. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Deprecated-CLEU"]) L["COMBAT_LOG_EVENT_UNFILTERED with no filter can trigger frame drops in raid environment. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Deprecated-CLEU"])
else else
Private.AuraWarnings.UpdateWarning(data.uid, "spamy_event_warning") Private.AuraWarnings.UpdateWarning(data.uid, "spammy_event_warning")
end end
end end
@@ -3183,7 +3183,10 @@ do
end end
function WeakAuras.GetDBMStage() function WeakAuras.GetDBMStage()
return DBM:GetStage() if DBM then
return DBM:GetStage()
end
return 0, 0
end end
function WeakAuras.GetDBMTimerById(id) function WeakAuras.GetDBMTimerById(id)
+1 -1
View File
@@ -410,7 +410,7 @@ function RealTimeProfilingWindow:GetBar(name)
else else
local bar = CreateFrame("Frame", nil, self.barsFrame) local bar = CreateFrame("Frame", nil, self.barsFrame)
self.bars[name] = bar self.bars[name] = bar
WeakAuras.Mixin(bar, SmoothStatusBarMixin) WeakAuras.Mixin(bar, Private.SmoothStatusBarMixin)
bar.name = name bar.name = name
bar.parent = self bar.parent = self
bar:SetHeight(self.barHeight) bar:SetHeight(self.barHeight)
+3 -3
View File
@@ -4070,7 +4070,7 @@ Private.event_prototypes = {
trigger.use_cloneId and "true" or "false", trigger.use_cloneId and "true" or "false",
trigger.use_extend and tonumber(trigger.extend or 0) or 0, trigger.use_extend and tonumber(trigger.extend or 0) or 0,
trigger.use_remaining and "true" or "false", trigger.use_remaining and "true" or "false",
trigger.remaining or 0, trigger.remaining and tonumber(trigger.remaining or 0) or 0,
trigger.use_dbmType and trigger.dbmType or "nil", trigger.use_dbmType and trigger.dbmType or "nil",
trigger.remaining_operator or "<" trigger.remaining_operator or "<"
) )
@@ -4310,7 +4310,7 @@ Private.event_prototypes = {
trigger.use_cloneId and "true" or "false", trigger.use_cloneId and "true" or "false",
trigger.use_extend and tonumber(trigger.extend or 0) or 0, trigger.use_extend and tonumber(trigger.extend or 0) or 0,
trigger.use_remaining and "true" or "false", trigger.use_remaining and "true" or "false",
type(trigger.remaining) == "number" and trigger.remaining or 0, trigger.remaining and tonumber(trigger.remaining or 0) or 0,
trigger.use_emphasized == nil and "nil" or trigger.use_emphasized and "true" or "false", trigger.use_emphasized == nil and "nil" or trigger.use_emphasized and "true" or "false",
trigger.use_cast == nil and "nil" or trigger.use_cast and "true" or "false", trigger.use_cast == nil and "nil" or trigger.use_cast and "true" or "false",
trigger.use_isCooldown == nil and "nil" or trigger.use_isCooldown and "true" or "false", trigger.use_isCooldown == nil and "nil" or trigger.use_isCooldown and "true" or "false",
@@ -4918,7 +4918,7 @@ Private.event_prototypes = {
trigger.use_totemNamePattern and trigger.totemNamePattern_operator or "", trigger.use_totemNamePattern and trigger.totemNamePattern_operator or "",
trigger.use_clones and "true" or "false", trigger.use_clones and "true" or "false",
trigger.use_inverse and "true" or "false", trigger.use_inverse and "true" or "false",
trigger.use_remaining and trigger.remaining or "nil", trigger.use_remaining and tonumber(trigger.remaining or 0) or "nil",
trigger.use_remaining and trigger.remaining_operator or "<"); trigger.use_remaining and trigger.remaining_operator or "<");
return ret; return ret;
end, end,
@@ -203,6 +203,9 @@ local function SoundPlayHelper(self)
end end
local function hasSound(options) local function hasSound(options)
--if options.sound_type == "Stop" then
--return true
--end
if (options.sound == " custom") then if (options.sound == " custom") then
if (options.sound_path and options.sound_path ~= "") then if (options.sound_path and options.sound_path ~= "") then
return true return true
@@ -3,7 +3,7 @@ if not WeakAuras.IsLibsOK() then return end
local AddonName, Private = ... local AddonName, Private = ...
-- This is a more or less 1:1 copy of SmoothStatusBarMixin except that it -- This is a more or less 1:1 copy of SmoothStatusBarMixin except that it
-- doesn't clamp the targetValue in ProcesSmoothStatusBars, because that's incorrect for us -- doesn't clamp the targetValue in ProcessSmoothStatusBars, because that's incorrect for us
local g_updatingBars = {}; local g_updatingBars = {};
local function IsCloseEnough(bar, newValue, targetValue) local function IsCloseEnough(bar, newValue, targetValue)
@@ -1,95 +1,64 @@
if not WeakAuras.IsLibsOK() then return end if not WeakAuras.IsLibsOK() then return end
local Type, Version = "WeakAurasTwoColumnDropdown", 4 local Type, Version = "WeakAurasTwoColumnDropdown", 6
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
local tconcat = table.concat local secondLevelMt = {} -- Tag for our tables
local select = select local function CreateSecondLevelTable()
local assert, loadstring = assert, loadstring local t = {}
local setmetatable, rawset = setmetatable, rawset setmetatable(t, secondLevelMt)
local xpcall = xpcall return t
local function errorhandler(err)
return geterrorhandler()(err)
end end
local function CreateDispatcher(argCount) local function IsSecondLevelTable(t)
local code = [[ return getmetatable(t) == secondLevelMt
local xpcall, eh = ...
local method, ARGS
local function call() return method(ARGS) end
local function dispatch(func, ...)
method = func
if not method then return end
ARGS = ...
return xpcall(call, eh)
end
return dispatch
]]
local ARGS = {}
for i = 1, argCount do ARGS[i] = "arg"..i end
code = code:gsub("ARGS", tconcat(ARGS, ", "))
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(xpcall, errorhandler)
end end
local Dispatchers = setmetatable({}, {__index=function(self, argCount) local function CompareValues(a, b)
local dispatcher = CreateDispatcher(argCount) if type(a) == "table" and type(b) == "table" then
rawset(self, argCount, dispatcher) for ak, av in pairs(a) do
return dispatcher if b[ak] ~= av then
end}) return false
Dispatchers[0] = function(func)
return xpcall(func, errorhandler)
end
local function safecall(func, ...)
return Dispatchers[select("#", ...)](func, ...)
end
AceGUI:RegisterLayout("TwoColumn",
function(content, children)
local height = 0
local width = content.width or content:GetWidth() or 0
for i = 1, #children do
local child = children[i]
local frame = child.frame
frame:ClearAllPoints()
if child.userdata.hideMe then
frame:Hide()
else
frame:Show()
end end
if i == 1 then
frame:SetPoint("TOPLEFT", content)
else
frame:SetPoint("TOPLEFT", children[i-1].frame, "TOPRIGHT")
end
if child.width == "relative" then
child:SetWidth(width * child.relWidth)
if child.DoLayout then
child:DoLayout()
end
end
height = max(height, frame.height or frame:GetHeight() or 0)
end end
safecall(content.obj.LayoutFinished, content.obj, nil, height) for bk, bv in pairs(b) do
end) if a[bk] ~= bv then
return false
end
end
return true
else
return a == b
end
end
local methods = { local methods = {
["DoLayout"] = function(self, mode)
self.mode = mode
if mode == "one" then
self.firstDropdown.frame:Show()
self.secondDropDown.frame:Hide()
self.firstDropdown.frame:SetAllPoints(self.frame)
else
local halfWidth = self.frame:GetWidth() / 2
self.firstDropdown.frame:Show()
self.secondDropDown.frame:Show()
self.firstDropdown.frame:ClearAllPoints()
self.firstDropdown.frame:SetPoint("TOPLEFT", self.frame)
self.firstDropdown.frame:SetPoint("BOTTOMRIGHT", self.frame, "BOTTOMLEFT", halfWidth, 0)
self.secondDropDown.frame:SetPoint("TOPLEFT", self.frame, halfWidth, 0)
self.secondDropDown.frame:SetPoint("BOTTOMRIGHT", self.frame, "BOTTOMRIGHT")
end
end,
["OnAcquire"] = function(widget) ["OnAcquire"] = function(widget)
local firstDropdown = AceGUI:Create("Dropdown") local firstDropdown = AceGUI:Create("Dropdown")
local secondDropDown = AceGUI:Create("Dropdown") local secondDropDown = AceGUI:Create("Dropdown")
firstDropdown:SetRelativeWidth(0.5) firstDropdown:SetParent(widget)
secondDropDown:SetParent(widget)
firstDropdown:SetPulloutWidth(200) firstDropdown:SetPulloutWidth(200)
secondDropDown:SetRelativeWidth(0.5)
secondDropDown:SetLabel(" ") secondDropDown:SetLabel(" ")
secondDropDown:SetPulloutWidth(200) secondDropDown:SetPulloutWidth(200)
secondDropDown.userdata.defaultSelection = {} secondDropDown.userdata.defaultSelection = {}
@@ -97,18 +66,10 @@ local methods = {
widget.firstDropdown = firstDropdown widget.firstDropdown = firstDropdown
widget.secondDropDown = secondDropDown widget.secondDropDown = secondDropDown
widget:SetLayout("TwoColumn")
widget.SetLayout = function()
-- AceGui wants to set a default layout, but we don't want that
end
widget:AddChild(firstDropdown)
widget:AddChild(secondDropDown)
local OnFirstDropdownValueChanged = function(self, event, value) local OnFirstDropdownValueChanged = function(self, event, value)
local displayName = widget.userdata.firstList[value] local displayName = widget.userdata.firstList[value]
local treeValue = widget.userdata.tree[displayName] local treeValue = widget.userdata.tree[displayName]
if type(treeValue) == "table" then if IsSecondLevelTable(treeValue) then
local oldValue local oldValue
if widget.userdata.secondList then if widget.userdata.secondList then
local v = widget.secondDropDown:GetValue() local v = widget.secondDropDown:GetValue()
@@ -125,10 +86,7 @@ local methods = {
local oldValueIndex = tIndexOf(secondList, oldValue) local oldValueIndex = tIndexOf(secondList, oldValue)
widget.userdata.secondList = secondList widget.userdata.secondList = secondList
widget.secondDropDown:SetList(secondList) widget.secondDropDown:SetList(secondList)
widget.firstDropdown:SetRelativeWidth(0.5) widget:DoLayout("two")
widget.secondDropDown:SetRelativeWidth(0.5)
widget.secondDropDown.userdata.hideMe = false
widget:DoLayout()
if (oldValueIndex) then if (oldValueIndex) then
widget.secondDropDown:SetValue(oldValueIndex) widget.secondDropDown:SetValue(oldValueIndex)
@@ -151,10 +109,8 @@ local methods = {
end end
end end
else else
widget.firstDropdown:SetRelativeWidth(1)
widget.secondDropDown.userdata.hideMe = true
widget.userdata.secondList = nil widget.userdata.secondList = nil
widget:DoLayout() widget:DoLayout("one")
widget:Fire("OnValueChanged", treeValue) widget:Fire("OnValueChanged", treeValue)
end end
end end
@@ -180,27 +136,37 @@ local methods = {
firstDropdown:SetCallback("OnLeave", FireOnLeave) firstDropdown:SetCallback("OnLeave", FireOnLeave)
secondDropDown:SetCallback("OnEnter", FireOnEnter) secondDropDown:SetCallback("OnEnter", FireOnEnter)
secondDropDown:SetCallback("OnLeave", FireOnLeave) secondDropDown:SetCallback("OnLeave", FireOnLeave)
widget:DoLayout("two")
end, end,
["OnRelease"] = function(self) ["OnRelease"] = function(self)
self.firstDropdown:SetCallback("OnValueChanged", nil)
self.secondDropDown:SetCallback("OnValueChanged", nil)
self.firstDropdown:SetCallback("OnEnter", nil)
self.firstDropdown:SetCallback("OnLeave", nil)
self.secondDropDown:SetCallback("OnEnter", nil)
self.secondDropDown:SetCallback("OnLeave", nil)
AceGUI:Release(self.firstDropdown)
AceGUI:Release(self.secondDropDown)
self.firstDropdown = nil
self.secondDropDown = nil
end, end,
["SetLabel"] = function(self, ...) ["SetLabel"] = function(self, ...)
self.firstDropdown:SetLabel(...) self.firstDropdown:SetLabel(...)
end, end,
["SetValue"] = function(self, value) ["SetValue"] = function(self, value)
for displayName, treeValue in pairs(self.userdata.tree) do for displayName, treeValue in pairs(self.userdata.tree) do
if treeValue == value then if CompareValues(treeValue, value) then
self.firstDropdown:SetRelativeWidth(1) self:DoLayout("one")
self.secondDropDown.userdata.hideMe = true
self:DoLayout()
self.firstDropdown:SetValue(tIndexOf(self.userdata.firstList, displayName)) self.firstDropdown:SetValue(tIndexOf(self.userdata.firstList, displayName))
return return
elseif type(treeValue) == "table" then elseif IsSecondLevelTable(treeValue) then
for displayName2, key in pairs(treeValue) do for displayName2, key in pairs(treeValue) do
if (key == value) then if CompareValues(key, value) then
self.firstDropdown:SetRelativeWidth(0.5) self:DoLayout("two")
self.secondDropDown:SetRelativeWidth(0.5)
self.secondDropDown.userdata.hideMe = false
self:DoLayout()
local index = tIndexOf(self.userdata.firstList, displayName); local index = tIndexOf(self.userdata.firstList, displayName);
self.firstDropdown:SetValue(index) self.firstDropdown:SetValue(index)
self.firstDropdown:OnFirstDropdownValueChanged("", index) self.firstDropdown:OnFirstDropdownValueChanged("", index)
@@ -210,9 +176,7 @@ local methods = {
end end
end end
end end
self.firstDropdown:SetRelativeWidth(1) self:DoLayout("one")
self.secondDropDown.userdata.hideMe = true
self:DoLayout()
self.firstDropdown:SetValue(nil) self.firstDropdown:SetValue(nil)
end, end,
["GetValue"] = function(self) ["GetValue"] = function(self)
@@ -222,7 +186,7 @@ local methods = {
if not treeValue then if not treeValue then
return nil return nil
end end
if type(treeValue) ~= "table" then if not IsSecondLevelTable(treeValue) then
return treeValue return treeValue
end end
@@ -239,7 +203,7 @@ local methods = {
if type(displayName) == "table" then if type(displayName) == "table" then
local base = displayName[1] local base = displayName[1]
local suffix = displayName[2] local suffix = displayName[2]
tree[base] = tree[base] or {} tree[base] = tree[base] or CreateSecondLevelTable()
tree[base][suffix] = key tree[base][suffix] = key
if displayName[3] == true then if displayName[3] == true then
self.secondDropDown.userdata.defaultSelection[base] = suffix self.secondDropDown.userdata.defaultSelection[base] = suffix
@@ -257,6 +221,9 @@ local methods = {
table.sort(firstList) table.sort(firstList)
self.userdata.firstList = firstList self.userdata.firstList = firstList
self.firstDropdown:SetList(firstList, order, itemType) self.firstDropdown:SetList(firstList, order, itemType)
end,
["OnWidthSet"] = function(self)
self:DoLayout(self.mode)
end end
} }
@@ -277,7 +244,7 @@ local function Constructor()
for method, func in pairs(methods) do for method, func in pairs(methods) do
widget[method] = func widget[method] = func
end end
return AceGUI:RegisterAsContainer(widget) return AceGUI:RegisterAsWidget(widget)
end end
AceGUI:RegisterWidgetType(Type, Constructor, Version) AceGUI:RegisterWidgetType(Type, Constructor, Version)