From 5521af916acb8f8ca2bfd73768e31862b502e6c1 Mon Sep 17 00:00:00 2001 From: NoM0Re <1629787+NoM0Re@users.noreply.github.com> Date: Sun, 30 Jun 2024 14:28:25 +0200 Subject: [PATCH] more fixes to nameplate and npcid --- WeakAuras/BuffTrigger2.lua | 6 +++- WeakAuras/Prototypes.lua | 73 +++++++++++++++++++++----------------- 2 files changed, 46 insertions(+), 33 deletions(-) diff --git a/WeakAuras/BuffTrigger2.lua b/WeakAuras/BuffTrigger2.lua index 0c70e80..1a562c3 100644 --- a/WeakAuras/BuffTrigger2.lua +++ b/WeakAuras/BuffTrigger2.lua @@ -1067,6 +1067,10 @@ local function TriggerInfoApplies(triggerInfo, unit) return false end + if triggerInfo.npcId and not triggerInfo.npcId:Check(select(6, strsplit('-', UnitGUID(unit) or ''))) then + return false + end + if triggerInfo.nameChecker and not triggerInfo.nameChecker:Check(WeakAuras.UnitNameWithRealm(unit)) then return false end @@ -2373,7 +2377,7 @@ function BuffTrigger.Add(data) local effectiveIgnoreInvisible = groupTrigger and trigger.ignoreInvisible local effectiveHostility = trigger.unit == "nameplate" and trigger.useHostility and trigger.hostility local effectiveNameCheck = groupTrigger and trigger.useUnitName and trigger.unitName - local effectiveNpcId = trigger.unit == "nameplate" and trigger.useNpcId and Private.ExecEnv.ParseStringCheck(trigger.npcId) + local effectiveNpcId = trigger.unit == "nameplate" and trigger.useNpcId and WeakAuras.ParseNameCheck(trigger.npcId) if trigger.unit == "multi" then BuffTrigger.InitMultiAura() diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index 0fb1549..b49be6b 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -1903,7 +1903,7 @@ Private.event_prototypes = { type = "toggle", width = WeakAuras.doubleWidth, enable = function(trigger) - return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" + return trigger.unit == "nameplate" or trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" end, init = "not UnitIsUnit(\"player\", unit)" }, @@ -1927,6 +1927,15 @@ Private.event_prototypes = { end, init = "UnitIsConnected(unit)" }, + { + name = "nameplateType", + display = L["Nameplate Type"], + type = "select", + init = "WeakAuras.GetPlayerReaction(unit)", + values = "hostility_types", + store = true, + conditionType = "select", + }, { hidden = true, test = "WeakAuras.UnitExistsFixed(unit, smart) and specificUnitCheck" @@ -5396,37 +5405,6 @@ Private.event_prototypes = { store = true, conditionType = "select", }, - { - name = "includePets", - display = WeakAuras.newFeatureString .. L["Include Pets"], - type = "select", - values = "include_pets_types", - width = WeakAuras.normalWidth, - test = "true", - enable = function(trigger) - return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" - end - }, - { - name = "ignoreSelf", - display = L["Ignore Self"], - type = "toggle", - width = WeakAuras.doubleWidth, - enable = function(trigger) - return trigger.unit == "nameplate" or trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" - end, - init = "not UnitIsUnit(\"player\", unit)" - }, - { - name = "onUpdateUnitTarget", - display = WeakAuras.newFeatureString .. L["Advanced Caster's Target Check"], - desc = L["Check nameplate's target every 0.2s"], - type = "toggle", - test = "true", - enable = function(trigger) - return trigger.unit == "nameplate" - end - }, { name = "sourceUnit", init = "unit", @@ -5535,6 +5513,37 @@ Private.event_prototypes = { end, reloadOptions = true }, + { + name = "includePets", + display = WeakAuras.newFeatureString .. L["Include Pets"], + type = "select", + values = "include_pets_types", + width = WeakAuras.normalWidth, + test = "true", + enable = function(trigger) + return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" + end + }, + { + name = "ignoreSelf", + display = L["Ignore Self"], + type = "toggle", + width = WeakAuras.doubleWidth, + enable = function(trigger) + return trigger.unit == "nameplate" or trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" + end, + init = "not UnitIsUnit(\"player\", unit)" + }, + { + name = "onUpdateUnitTarget", + display = WeakAuras.newFeatureString .. L["Advanced Caster's Target Check"], + desc = L["Check nameplate's target every 0.2s"], + type = "toggle", + test = "true", + enable = function(trigger) + return trigger.unit == "nameplate" + end + }, { name = "inverse", display = L["Inverse"],