Skip to content

Commit

Permalink
Add itemInRange condition support to Equipment Slot triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
its-riece committed Jan 27, 2025
1 parent ee5a6a2 commit c7dffc4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions WeakAuras/Prototypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6080,6 +6080,28 @@ Private.event_prototypes = {
end,
statesParameter = "one",
args = {
{
name = "itemInRange",
display = WeakAuras.newFeatureString .. L["Item in Range"],
hidden = true,
test = "true",
conditionType = "bool",
conditionTest = function(state, needle)
if not state or not state.show or not UnitExists('target') then
return false
end
if InCombatLockdown() and not UnitCanAttack('player', 'target') then
return false
end
local itemSlot = state.trigger.itemSlot
local item = GetInventoryItemID("player", itemSlot or 0)
local itemName = item and C_Item.GetItemInfo(item) or nil
return C_Item.IsItemInRange(itemName, 'target') == (needle == 1)
end,
conditionEvents = AddTargetConditionEvents({
"WA_SPELL_RANGECHECK",
})
},
{
name = "itemSlot",
required = true,
Expand Down

0 comments on commit c7dffc4

Please sign in to comment.