From b0854d38e048dcefec62ea45e8634c4d5c18eeea Mon Sep 17 00:00:00 2001 From: NoM0Re Date: Thu, 16 Jan 2025 17:36:46 +0100 Subject: [PATCH] from retail --- WeakAuras/BossMods.lua | 31 +++++++++++++++++++++--------- WeakAuras/GenericTrigger.lua | 8 ++++++++ WeakAuras/Prototypes.lua | 28 ++++++++++++++++++++------- WeakAurasOptions/BuffTrigger2.lua | 1 + WeakAurasOptions/CommonOptions.lua | 6 ++++++ 5 files changed, 58 insertions(+), 16 deletions(-) diff --git a/WeakAuras/BossMods.lua b/WeakAuras/BossMods.lua index b5cc4c1..7502571 100644 --- a/WeakAuras/BossMods.lua +++ b/WeakAuras/BossMods.lua @@ -381,7 +381,9 @@ Private.event_prototypes["DBM Announce"] = { name = "spellId", init = "arg", display = L["Spell Id"], - type = "string" + type = "spell", + noValidation = true, + showExactOption = false, }, { name = "message", @@ -584,9 +586,11 @@ Private.event_prototypes["DBM Timer"] = { { name = "spellId", display = L["Spell Id"], - type = "string", store = true, - conditionType = "string" + type = "spell", + conditionType = "string", + noValidation = true, + showExactOption = false, }, { name = "message", @@ -986,7 +990,10 @@ Private.event_prototypes["BigWigs Message"] = { init = "arg", display = L["Key"], desc = L["The 'Key' value can be found in the BigWigs options of a specific spell"], - type = "longstring" + type = "spell", + conditionType = "string", + noValidation = true, + showExactOption = false, }, { name = "text", @@ -1175,8 +1182,10 @@ Private.event_prototypes["BigWigs Timer"] = { name = "spellId", display = L["Key"], desc = L["The 'Key' value can be found in the BigWigs options of a specific spell"], - type = "string", + type = "spell", conditionType = "string", + noValidation = true, + showExactOption = false, }, { name = "text", @@ -1339,9 +1348,11 @@ Private.event_prototypes["Boss Mod Announce"] = { name = "spellId", init = "arg", display = L["Key"], - type = "string", store = true, - conditionType = "string" + type = "spell", + conditionType = "string", + noValidation = true, + showExactOption = false, }, { name = "message", @@ -1544,9 +1555,11 @@ Private.event_prototypes["Boss Mod Timer"] = { { name = "spellId", display = L["Key"], - type = "string", store = true, - conditionType = "string" + type = "spell", + conditionType = "string", + noValidation = true, + showExactOption = false, }, { name = "message", diff --git a/WeakAuras/GenericTrigger.lua b/WeakAuras/GenericTrigger.lua index 2dd8f4b..7292a41 100644 --- a/WeakAuras/GenericTrigger.lua +++ b/WeakAuras/GenericTrigger.lua @@ -3786,6 +3786,13 @@ local commonConditions = { display = L["Total Duration"], type = "number", }, + paused = { + display = L["Is Paused"], + type = "bool", + test = function(state, needle) + return (state.paused and 1 or 0) == needle + end + }, value = { display = L["Progress Value"], type = "number", @@ -3844,6 +3851,7 @@ function GenericTrigger.GetTriggerConditions(data, triggernum) if (timedDuration) then result.expirationTime = commonConditions.expirationTime; result.duration = commonConditions.duration; + result.paused = commonConditions.paused end if (valueDuration) then diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index 9e2042f..6ec6f07 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -582,6 +582,27 @@ function WeakAuras.CheckNumericIds(loadids, currentId) return false; end +function WeakAuras.ValidateNumeric(info, val) + if val ~= nil and val ~= "" and (not tonumber(val) or tonumber(val) >= 2^31) then + return false; + end + return true +end + +function WeakAuras.ValidateTime(info, val) + if val ~= nil and val ~= "" then + if not tonumber(val) then + if val:sub(1,1) == "-" then + val = val:sub(2, #val) + end + return (val:match("^%d+:%d+:[%d%.]+$") or val:match("^%d+:[%d+%.]+$")) and true or false + elseif tonumber(val) >= 2^31 then + return false + end + end + return true +end + function WeakAuras.TimeToSeconds(val) if tonumber(val) then return tonumber(val) @@ -626,13 +647,6 @@ Private.tinySecondFormat = function(value) end end -function WeakAuras.ValidateNumeric(info, val) - if val ~= nil and val ~= "" and (not tonumber(val) or tonumber(val) >= 2^31) then - return false; - end - return true -end - function WeakAuras.ValidateNumericOrPercent(info, val) if val ~= nil and val ~= "" then local percent = string.match(val, "(%d+)%%") diff --git a/WeakAurasOptions/BuffTrigger2.lua b/WeakAurasOptions/BuffTrigger2.lua index 821c299..07d7c83 100644 --- a/WeakAurasOptions/BuffTrigger2.lua +++ b/WeakAurasOptions/BuffTrigger2.lua @@ -205,6 +205,7 @@ local function CreateNameOptions(aura_options, data, trigger, size, isExactSpell end, validate = isExactSpellId and WeakAuras.ValidateNumeric or nil, control = "WeakAurasInputFocus", + getWithFocus = function() return trigger[optionKey] and trigger[optionKey][i] or "" end } end -- VALIDATE ? diff --git a/WeakAurasOptions/CommonOptions.lua b/WeakAurasOptions/CommonOptions.lua index 735b7b5..2799cd5 100644 --- a/WeakAurasOptions/CommonOptions.lua +++ b/WeakAurasOptions/CommonOptions.lua @@ -721,6 +721,12 @@ local function replaceNameDescFuncs(intable, data, subOption) if(type(display) == "number") then display = math.floor(display * 100) / 100; else + local nullBytePos = display:find("\0", nil, true) + + if nullBytePos then + display = display:sub(1, nullBytePos - 1) + end + if #display > 50 then display = display:sub(1, 50) .. "..." end