from retail

This commit is contained in:
NoM0Re
2025-01-25 18:42:10 +01:00
parent 103dc2137a
commit e8451987a3
9 changed files with 113 additions and 42 deletions
+2 -2
View File
@@ -3849,8 +3849,8 @@ function GenericTrigger.GetAdditionalProperties(data, triggernum)
local variables = GenericTrigger.GetTsuConditionVariables(data.id, triggernum) local variables = GenericTrigger.GetTsuConditionVariables(data.id, triggernum)
if (type(variables) == "table") then if (type(variables) == "table") then
for var, varData in pairs(variables) do for var, varData in pairs(variables) do
if (type(varData) == "table") and varData.display then if (type(varData) == "table") then
props[var] = varData.display props[var] = varData.display or var
end end
end end
end end
+3 -3
View File
@@ -3359,7 +3359,7 @@ Private.event_prototypes = {
test = "true", test = "true",
conditionType = "bool", conditionType = "bool",
conditionTest = function(state, needle) conditionTest = function(state, needle)
return state and state.show and ((IsUsableSpell(state.spellname) == 1 and true or false) == (needle == 1)) return state and state.show and (IsUsableSpell(state.spellname or "") == (needle == 1))
end, end,
conditionEvents = { conditionEvents = {
"SPELL_UPDATE_USABLE", "SPELL_UPDATE_USABLE",
@@ -3374,7 +3374,7 @@ Private.event_prototypes = {
test = "true", test = "true",
conditionType = "bool", conditionType = "bool",
conditionTest = function(state, needle) conditionTest = function(state, needle)
return state and state.show and ((select(2, IsUsableSpell(state.spellname)) == 1 and true or false) == (needle == 1)); return state and state.show and (select(2, IsUsableSpell(state.spellname or "")) == (needle == 1));
end, end,
conditionEvents = { conditionEvents = {
"SPELL_UPDATE_USABLE", "SPELL_UPDATE_USABLE",
@@ -4382,7 +4382,7 @@ Private.event_prototypes = {
charges = (duration == 0 or gcdCooldown) and 1 or 0; charges = (duration == 0 or gcdCooldown) and 1 or 0;
end end
local ready = startTime == 0 or charges > 0 local ready = startTime == 0 or charges > 0
local active = IsUsableSpell(spellName) and ready local active = IsUsableSpell(spellName or "") and ready
]=] ]=]
if(trigger.use_targetRequired) then if(trigger.use_targetRequired) then
ret = ret.."active = active and WeakAuras.IsSpellInRange(spellName or '', 'target')\n"; ret = ret.."active = active and WeakAuras.IsSpellInRange(spellName or '', 'target')\n";
@@ -1,30 +1,32 @@
if not WeakAuras.IsLibsOK() then return end if not WeakAuras.IsLibsOK() then return end
local Type, Version = "WeakAurasInput", 1 local Type, Version = "WeakAurasInput", 2
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 OnEditFocusGained = function(frame) local eventCallbacks = {
local self = frame.obj OnEditFocusGained = "OnEditFocusGained",
local option = self.userdata.option OnEditFocusLost = "OnEditFocusLost",
if option and option.callbacks and option.callbacks.OnEditFocusGained then OnEnterPressed = "OnEnterPressed",
option.callbacks.OnEditFocusGained(self) OnShow = "OnShow"
end }
end
local OnShow = function(frame) local function EventHandler(frame, event)
local self = frame.obj local self = frame.obj
local option = self.userdata.option local option = self.userdata.option
if option and option.callbacks and option.callbacks.OnShow then if option and option.callbacks and option.callbacks[event] then
option.callbacks.OnShow(self) option.callbacks[event](self)
end end
end end
local function Constructor() local function Constructor()
local widget = AceGUI:Create("EditBox") local widget = AceGUI:Create("EditBox")
widget.type = Type widget.type = Type
widget.editbox:HookScript("OnEditFocusGained", OnEditFocusGained)
widget.editbox:HookScript("OnShow", OnShow) for event, callback in pairs(eventCallbacks) do
widget.editbox:HookScript(event, function(frame) EventHandler(frame, callback) end)
end
return widget return widget
end end
@@ -1,6 +1,6 @@
if not WeakAuras.IsLibsOK() then return end if not WeakAuras.IsLibsOK() then return end
local Type, Version = "WeakAurasMultiLineEditBox", 38 local Type, Version = "WeakAurasMultiLineEditBox", 39
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
@@ -74,10 +74,15 @@ local function OnCursorChanged(self, _, y, _, cursorHeight)
end end
end end
local function OnEditFocusLost(self) -- EditBox local function OnEditFocusLost(frame) -- EditBox
self:HighlightText(0, 0) local self = frame.obj
self.obj:Fire("OnEditFocusLost") frame:HighlightText(0, 0)
self.obj.scrollFrame:EnableMouseWheel(false); self:Fire("OnEditFocusLost")
self.scrollFrame:EnableMouseWheel(false);
local option = self.userdata.option
if option and option.callbacks and option.callbacks.OnEditFocusLost then
option.callbacks.OnEditFocusLost(self)
end
end end
local function OnEnter(self) -- EditBox / ScrollFrame local function OnEnter(self) -- EditBox / ScrollFrame
+32 -8
View File
@@ -156,7 +156,13 @@ function OptionsPrivate.GetActionOptions(data)
callbacks = { callbacks = {
OnEditFocusGained = function(self) OnEditFocusGained = function(self)
local widget = dynamicTextInputs["start_message_dest"] local widget = dynamicTextInputs["start_message_dest"]
OptionsPrivate.ToggleTextReplacements(data, true, widget) OptionsPrivate.ToggleTextReplacements(data, widget, "OnEditFocusGained")
end,
OnEditFocusLost = function(self)
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEditFocusLost")
end,
OnEnterPressed = function(self)
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEnterPressed")
end, end,
OnShow = function(self) OnShow = function(self)
dynamicTextInputs["start_message_dest"] = self dynamicTextInputs["start_message_dest"] = self
@@ -173,7 +179,7 @@ function OptionsPrivate.GetActionOptions(data)
hidden = function() return data.actions.start.message_type ~= "WHISPER" end, hidden = function() return data.actions.start.message_type ~= "WHISPER" end,
func = function() func = function()
local widget = dynamicTextInputs["start_message_dest"] local widget = dynamicTextInputs["start_message_dest"]
OptionsPrivate.ToggleTextReplacements(data, nil, widget) OptionsPrivate.ToggleTextReplacements(data, widget, "ToggleButton")
end, end,
imageWidth = 24, imageWidth = 24,
imageHeight = 24, imageHeight = 24,
@@ -199,7 +205,13 @@ function OptionsPrivate.GetActionOptions(data)
callbacks = { callbacks = {
OnEditFocusGained = function(self) OnEditFocusGained = function(self)
local widget = dynamicTextInputs["start_message"] local widget = dynamicTextInputs["start_message"]
OptionsPrivate.ToggleTextReplacements(data, true, widget) OptionsPrivate.ToggleTextReplacements(data, widget, "OnEditFocusGained")
end,
OnEditFocusLost = function(self)
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEditFocusLost")
end,
OnEnterPressed = function(self)
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEnterPressed")
end, end,
OnShow = function(self) OnShow = function(self)
dynamicTextInputs["start_message"] = self dynamicTextInputs["start_message"] = self
@@ -215,7 +227,7 @@ function OptionsPrivate.GetActionOptions(data)
disabled = function() return not data.actions.start.do_message end, disabled = function() return not data.actions.start.do_message end,
func = function() func = function()
local widget = dynamicTextInputs["start_message"] local widget = dynamicTextInputs["start_message"]
OptionsPrivate.ToggleTextReplacements(data, nil, widget) OptionsPrivate.ToggleTextReplacements(data, widget, "ToggleButton")
end, end,
imageWidth = 24, imageWidth = 24,
imageHeight = 24, imageHeight = 24,
@@ -613,7 +625,13 @@ function OptionsPrivate.GetActionOptions(data)
callbacks = { callbacks = {
OnEditFocusGained = function(self) OnEditFocusGained = function(self)
local widget = dynamicTextInputs["finish_message_dest"] local widget = dynamicTextInputs["finish_message_dest"]
OptionsPrivate.ToggleTextReplacements(data, true, widget) OptionsPrivate.ToggleTextReplacements(data, widget, "OnEditFocusGained")
end,
OnEditFocusLost = function(self)
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEditFocusLost")
end,
OnEnterPressed = function(self)
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEnterPressed")
end, end,
OnShow = function(self) OnShow = function(self)
dynamicTextInputs["finish_message_dest"] = self dynamicTextInputs["finish_message_dest"] = self
@@ -630,7 +648,7 @@ function OptionsPrivate.GetActionOptions(data)
hidden = function() return data.actions.finish.message_type ~= "WHISPER" end, hidden = function() return data.actions.finish.message_type ~= "WHISPER" end,
func = function() func = function()
local widget = dynamicTextInputs["finish_message_dest"] local widget = dynamicTextInputs["finish_message_dest"]
OptionsPrivate.ToggleTextReplacements(data, nil, widget) OptionsPrivate.ToggleTextReplacements(data, widget, "ToggleButton")
end, end,
imageWidth = 24, imageWidth = 24,
imageHeight = 24, imageHeight = 24,
@@ -656,7 +674,13 @@ function OptionsPrivate.GetActionOptions(data)
callbacks = { callbacks = {
OnEditFocusGained = function(self) OnEditFocusGained = function(self)
local widget = dynamicTextInputs["finish_message"] local widget = dynamicTextInputs["finish_message"]
OptionsPrivate.ToggleTextReplacements(data, true, widget) OptionsPrivate.ToggleTextReplacements(data, widget, "OnEditFocusGained")
end,
OnEditFocusLost = function(self)
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEditFocusLost")
end,
OnEnterPressed = function(self)
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEnterPressed")
end, end,
OnShow = function(self) OnShow = function(self)
dynamicTextInputs["finish_message"] = self dynamicTextInputs["finish_message"] = self
@@ -672,7 +696,7 @@ function OptionsPrivate.GetActionOptions(data)
disabled = function() return not data.actions.finish.do_message end, disabled = function() return not data.actions.finish.do_message end,
func = function() func = function()
local widget = dynamicTextInputs["finish_message"] local widget = dynamicTextInputs["finish_message"]
OptionsPrivate.ToggleTextReplacements(data, nil, widget) OptionsPrivate.ToggleTextReplacements(data, widget, "ToggleButton")
end, end,
imageWidth = 24, imageWidth = 24,
imageHeight = 24, imageHeight = 24,
+16 -4
View File
@@ -935,7 +935,13 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA
callbacks = { callbacks = {
OnEditFocusGained = function(self) OnEditFocusGained = function(self)
local widget = dynamicTextInputs["condition" .. i .. "value" .. j .. "message dest"] local widget = dynamicTextInputs["condition" .. i .. "value" .. j .. "message dest"]
OptionsPrivate.ToggleTextReplacements(data, true, widget) OptionsPrivate.ToggleTextReplacements(data, widget, "OnEditFocusGained")
end,
OnEditFocusLost = function(self)
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEditFocusLost")
end,
OnEnterPressed = function(self)
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEnterPressed")
end, end,
OnShow = function(self) OnShow = function(self)
dynamicTextInputs["condition" .. i .. "value" .. j .. "message dest"] = self dynamicTextInputs["condition" .. i .. "value" .. j .. "message dest"] = self
@@ -955,7 +961,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA
end, end,
func = function() func = function()
local widget = dynamicTextInputs["condition" .. i .. "value" .. j .. "message dest"] local widget = dynamicTextInputs["condition" .. i .. "value" .. j .. "message dest"]
OptionsPrivate.ToggleTextReplacements(data, nil, widget) OptionsPrivate.ToggleTextReplacements(data, widget, "ToggleButton")
end, end,
imageWidth = 24, imageWidth = 24,
imageHeight = 24, imageHeight = 24,
@@ -995,7 +1001,13 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA
callbacks = { callbacks = {
OnEditFocusGained = function(self) OnEditFocusGained = function(self)
local widget = dynamicTextInputs["condition" .. i .. "value" .. j .. "message"] local widget = dynamicTextInputs["condition" .. i .. "value" .. j .. "message"]
OptionsPrivate.ToggleTextReplacements(data, true, widget) OptionsPrivate.ToggleTextReplacements(data, widget, "OnEditFocusGained")
end,
OnEditFocusLost = function(self)
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEditFocusLost")
end,
OnEnterPressed = function(self)
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEnterPressed")
end, end,
OnShow = function(self) OnShow = function(self)
dynamicTextInputs["condition" .. i .. "value" .. j .. "message"] = self dynamicTextInputs["condition" .. i .. "value" .. j .. "message"] = self
@@ -1012,7 +1024,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA
order = order, order = order,
func = function() func = function()
local widget = dynamicTextInputs["condition" .. i .. "value" .. j .. "message"] local widget = dynamicTextInputs["condition" .. i .. "value" .. j .. "message"]
OptionsPrivate.ToggleTextReplacements(data, nil, widget) OptionsPrivate.ToggleTextReplacements(data, widget, "ToggleButton")
end, end,
imageWidth = 24, imageWidth = 24,
imageHeight = 24, imageHeight = 24,
@@ -928,14 +928,33 @@ function OptionsPrivate.CreateFrame()
dynamicTextCodesFrame.label = dynamicTextCodesLabel dynamicTextCodesFrame.label = dynamicTextCodesLabel
dynamicTextCodesFrame:Hide() dynamicTextCodesFrame:Hide()
function OptionsPrivate.ToggleTextReplacements(data, show, widget) function OptionsPrivate.ToggleTextReplacements(data, widget, event)
if show or not dynamicTextCodesFrame:IsShown() then -- If the text edit has focus when the user clicks on the button, we'll get two events:
-- a) The OnEditFocusLost
-- b) The ToggleButton OnClick event
-- Since we want to hide the text replacement window in that case,
-- ignore the ToggleButton if it is directly after the OnEditFocusLost
local currentTime = GetTime()
if event == "ToggleButton"
and dynamicTextCodesFrame.lastCaller
and dynamicTextCodesFrame.lastCaller.event == "OnEditFocusLost"
and currentTime - dynamicTextCodesFrame.lastCaller.time < 0.2
then
return
end
dynamicTextCodesFrame.lastCaller = {
event = event,
time = currentTime,
}
if event == "OnEditFocusGained" or not dynamicTextCodesFrame:IsShown() then
dynamicTextCodesFrame:Show() dynamicTextCodesFrame:Show()
if OptionsPrivate.currentDynamicTextInput ~= widget then if OptionsPrivate.currentDynamicTextInput ~= widget then
OptionsPrivate.UpdateTextReplacements(dynamicTextCodesFrame, data) OptionsPrivate.UpdateTextReplacements(dynamicTextCodesFrame, data)
end end
OptionsPrivate.currentDynamicTextInput = widget OptionsPrivate.currentDynamicTextInput = widget
else elseif event == "OnEnterPressed" then
dynamicTextCodesFrame:Hide()
elseif not dynamicTextCodesFrame:IsMouseOver() then -- Prevents hiding when clicking inside the frame
dynamicTextCodesFrame:Hide() dynamicTextCodesFrame:Hide()
end end
end end
+5 -2
View File
@@ -43,7 +43,7 @@ local function createOptions(id, data)
__order = 1, __order = 1,
__dynamicTextCodes = function() __dynamicTextCodes = function()
local widget = dynamicTextInputs["displayText"] local widget = dynamicTextInputs["displayText"]
OptionsPrivate.ToggleTextReplacements(data, nil, widget) OptionsPrivate.ToggleTextReplacements(data, widget, "ToggleButton")
end, end,
displayText = { displayText = {
type = "input", type = "input",
@@ -65,7 +65,10 @@ local function createOptions(id, data)
callbacks = { callbacks = {
OnEditFocusGained = function(self) OnEditFocusGained = function(self)
local widget = dynamicTextInputs["displayText"] local widget = dynamicTextInputs["displayText"]
OptionsPrivate.ToggleTextReplacements(data, true, widget) OptionsPrivate.ToggleTextReplacements(data, widget, "OnEditFocusGained")
end,
OnEditFocusLost = function(self)
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEditFocusLost")
end, end,
OnShow = function(self) OnShow = function(self)
dynamicTextInputs["displayText"] = self dynamicTextInputs["displayText"] = self
@@ -59,7 +59,13 @@ local function createOptions(parentData, data, index, subIndex)
callbacks = { callbacks = {
OnEditFocusGained = function(self) OnEditFocusGained = function(self)
local widget = dynamicTextInputs[subIndex] local widget = dynamicTextInputs[subIndex]
OptionsPrivate.ToggleTextReplacements(parentData, true, widget) OptionsPrivate.ToggleTextReplacements(parentData, widget, "OnEditFocusGained")
end,
OnEditFocusLost = function(self)
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEditFocusLost")
end,
OnEnterPressed = function(self)
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEnterPressed")
end, end,
OnShow = function(self) OnShow = function(self)
dynamicTextInputs[subIndex] = self dynamicTextInputs[subIndex] = self
@@ -74,7 +80,7 @@ local function createOptions(parentData, data, index, subIndex)
order = 11.1, order = 11.1,
func = function() func = function()
local widget = dynamicTextInputs[subIndex] local widget = dynamicTextInputs[subIndex]
OptionsPrivate.ToggleTextReplacements(parentData, nil, widget) OptionsPrivate.ToggleTextReplacements(parentData, widget, "ToggleButton")
end, end,
imageWidth = 24, imageWidth = 24,
imageHeight = 24, imageHeight = 24,