Stanzilla / WoWUIBugs

World of Warcraft UI Bug Tracker
153 stars 7 forks source link

GetActionInfo() returns garbage data in id field for item macros #495

Open mbattersby opened 8 months ago

mbattersby commented 8 months ago

actionType, id, subType = GetActionInfo(actionID)

has been changed in 10.2 to return subType when actionType == "macro" and id information for that subType. Previous behaviour was actionType == "macro" would return macroID in id and subType was nil.

This works well for type == "macro" and subType == "spell" , returning the spell ID in id and saving a call to GetMacroSpell.

However for type == "macro" and subType == "item" it is [edit] always returning actionID-1 in the id field, instead of what I believe should be the itemID.

[Edit: previous workaround info was wrong.]

You can get the spell ID if the item casts a spell like the below, but there's no way to get the itemID as neither the itemID nor the macroID are available.

local actionType, id, subType = GetActionInfo(actionID)
if actionType == "macro" and subType == "item" then
    local itemSpellID = C_ActionBar.GetItemActionOnEquipSpellID(actionID)
end

Edit: I don't think the above reliably works, the spell it returns is not always the same as GetItemSpell.

mbattersby commented 8 months ago

Test case is simple (compare 10.1.7 live versus 10.2 xptr).

  1. Create a macro to use an item (e.g., "/use 14" for trinket slot 2).
  2. Drag the macro onto the first action bar slot (actionID 1).
  3. /dump GetActionInfo(1)

Same issue exists if instead of a slot in (1) you put an item name.

zaphon commented 7 months ago

For my addon I am trying to save the action bars, so I need the actual Macro, but I found that if it's a macro I can use GetActionText(slot) to get the Macro Name and pass that to GetMacroInfo(Macro Name) as a work around (not sure what happens if there are 2 macros with same name).