-
-
Notifications
You must be signed in to change notification settings - Fork 318
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
Add itemInRange condition support to Equipment Slot triggers #5639
base: main
Are you sure you want to change the base?
Conversation
WeakAuras/Prototypes.lua
Outdated
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the itemId stored in state.itemId, and also need to handle it being nil.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@InfusOnWoW can you point me to where that state is constructed? I am not seeing itemId
in there at all. I did find state.name
which appears to be the item name (I'm just DevTools_Dump
ing and scrolling around like a noob)-- should I use that instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed f9c6fd5 which swaps to state.name
but it feels a bit spooky to use something generically called name
, I don't mind refactoring to something smarter just not sure where I ought to be looking as a reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think adding it too all triggers that have an itemId might be nice, although it's also a bit more involved. I wouldn't require that for a PR.
As to the item id, it's not saved in that trigger's state, but we should use the item id, not the name for checking:
Adding
{
name = "itemId",
display = L["ItemId"],
hidden = true,
init = "item",
test = "true",
store = true,
conditionType = "number",
operator_types = "only_equal",
},
In that trigger's data should be enough to add it to the state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@InfusOnWoW yeah seemed to work-- refactored accordingly. I tried to refactor Cooldown Progress (Item)
similarly but adding the itemId
block you gave me in the same way didn't give me access to state.itemId
. Is that just a misunderstanding on my part? Feels weird to leave that one checking state.itemname
.
It would make sense to automatically add this condition for all triggers with the field |
@mrbuds I agree, could you clarify if that's something you'd like done before merging this? If so unfortunately may be out of my depth. This is the first time I've looked at the codebase-- I'd be down to try with some nudging though. |
Description
This PR adds the
Item in Range
conditional used byCooldown Progress (Item)
triggers toCooldown Progress (Slot)
triggers.The motivation for the change is that many item slots in Classic for which you'd care about the cooldown can also have range limitations. Examples include:
Fixes #5638
Type of change
How Has This Been Tested
I created a new WeakAura with a
Cooldown Progress (Slot)
trigger and used the addedItem in Range
conditional. I was able to verify its behavior for both the Helmet and Trinket 1 slots. Here is an export of that WeakAura:Checklist
I duplicated code from
Cooldown Progress (Equipment Slot)
nearly 1:1 as I was not familiar enough with the structure of the file to avoid doing that. If there's something smarter to do here I'm happy to fix my implementation.