Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smallpatches #4671

Merged
merged 4 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions WeakAuras/BuffTrigger2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ local function UnitIsVisibleFixed(unit)
return unitVisible[unit]
end

local function UnitInRangeFixed(unit)
local inRange, checked = UnitInRange(unit)
return inRange or not checked
end

Private.ExecEnv.UnitInRangeFixed = UnitInRangeFixed

local function UnitInSubgroupOrPlayer(unit, includePets)
if includePets == nil then
return UnitInSubgroup(unit) or UnitIsUnit("player", unit)
Expand Down Expand Up @@ -1308,6 +1315,8 @@ local function MaxUnitCount(triggerInfo)
end
end



local function TriggerInfoApplies(triggerInfo, unit)
local controllingUnit = unit
if WeakAuras.UnitIsPet(unit) then
Expand Down Expand Up @@ -1392,15 +1401,15 @@ local function TriggerInfoApplies(triggerInfo, unit)
return false
end

if triggerInfo.npcId and select(6, strsplit('-', UnitGUID(unit) or '')) ~= triggerInfo.npcId then
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

if triggerInfo.inRange and not UnitInRange(unit) then
if triggerInfo.inRange and not UnitInRangeFixed(unit) then
return false
end

Expand Down Expand Up @@ -3143,7 +3152,7 @@ function BuffTrigger.Add(data)
local effectiveIgnoreDisconnected = groupTrigger and trigger.ignoreDisconnected
local effectiveIgnoreInvisible = groupTrigger and trigger.ignoreInvisible
local effectiveNameCheck = groupTrigger and trigger.useUnitName and trigger.unitName
local effectiveNpcId = trigger.unit == "nameplate" and trigger.useNpcId and trigger.npcId
local effectiveNpcId = trigger.unit == "nameplate" and trigger.useNpcId and Private.ExecEnv.ParseStringCheck(trigger.npcId)
local effectiveInRange = WeakAuras.IsRetail() and groupTrigger and trigger.inRange

if trigger.unit == "multi" then
Expand Down
8 changes: 4 additions & 4 deletions WeakAuras/Prototypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2258,7 +2258,7 @@ Private.event_prototypes = {
enable = function(trigger)
return WeakAuras.IsRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")
end,
init = "UnitInRange(unit)"
init = "Private.ExecEnv.UnitInRangeFixed(unit)"
},
{
name = "hostility",
Expand Down Expand Up @@ -3058,7 +3058,7 @@ Private.event_prototypes = {
enable = function(trigger)
return WeakAuras.IsRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")
end,
init = "UnitInRange(unit)"
init = "Private.ExecEnv.UnitInRangeFixed(unit)"
},
{
name = "nameplateType",
Expand Down Expand Up @@ -3617,7 +3617,7 @@ Private.event_prototypes = {
enable = function(trigger)
return WeakAuras.IsRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")
end,
init = "UnitInRange(unit)"
init = "Private.ExecEnv.UnitInRangeFixed(unit)"
},
{
name = "nameplateType",
Expand Down Expand Up @@ -3925,7 +3925,7 @@ Private.event_prototypes = {
enable = function(trigger)
return WeakAuras.IsRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")
end,
init = "UnitInRange(unit)"
init = "Private.ExecEnv.UnitInRangeFixed(unit)"
},
{
name = "nameplateType",
Expand Down
4 changes: 2 additions & 2 deletions WeakAuras/RegionTypes/Model.lua
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ local function ConfigureModel(region, model, data)
Private.StartProfileSystem("model");
if (event ~= "UNIT_MODEL_CHANGED" or UnitIsUnit(unitId, unit)) then
WeakAuras.SetModel(model, data.model_path, data.model_fileId, data.modelIsUnit, data.modelDisplayInfo)
if(data.advance and model:HasAnimation(data.sequence)) then
if data.advance then
model:SetAnimation(data.sequence)
else
model:SetAnimation(0)
Expand All @@ -181,7 +181,7 @@ local function ConfigureModel(region, model, data)
end

-- Enable model animation
if(data.advance and model:HasAnimation(data.sequence)) then
if data.advance then
model:SetAnimation(data.sequence)
else
model:SetAnimation(0)
Expand Down
4 changes: 2 additions & 2 deletions WeakAurasOptions/BuffTrigger2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1000,9 +1000,9 @@ local function GetBuffTriggerOptions(data, triggernum)
type = "input",
width = WeakAuras.normalWidth,
name = L["Npc ID"],
validate = ValidateNumeric,
hidden = function() return not (trigger.type == "aura2" and trigger.unit == "nameplate" and trigger.useNpcId) end,
order = 69.32
order = 69.32,
desc = L["Supports multiple entries, separated by commas"]
},
npcIdSpace = {
type = "description",
Expand Down
30 changes: 18 additions & 12 deletions WeakAurasOptions/OptionsFrames/IconPicker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,6 @@ local function ConstructIconPicker(frame)
local function iconPickerFill(subname, doSort)
scroll:ReleaseChildren();

-- Work around special numbers such as inf and nan
if (tonumber(subname)) then
local spellId = tonumber(subname);
if (abs(spellId) < math.huge and tostring(spellId) ~= "nan") then
subname = GetSpellInfo(spellId)
end
end

if subname then
subname = subname:lower();
end

local usedIcons = {};
local AddButton = function(name, icon)
local button = AceGUI:Create("WeakAurasIconButton");
Expand All @@ -57,6 +45,24 @@ local function ConstructIconPicker(frame)
usedIcons[icon] = true;
end

-- Work around special numbers such as inf and nan
if (tonumber(subname)) then
local spellId = tonumber(subname);
if (abs(spellId) < math.huge and tostring(spellId) ~= "nan") then
local name, _, icon = GetSpellInfo(spellId)
if name then
AddButton(name, icon)
end
return;
end
end

if subname then
subname = subname:lower();
end



local num = 0;
if(subname and subname ~= "") then
for name, icons in pairs(spellCache.Get()) do
Expand Down