From 05281f5270d312c9bd4bca969ea0b0172690b00a Mon Sep 17 00:00:00 2001 From: shagu Date: Thu, 7 Aug 2025 12:51:25 +0200 Subject: [PATCH] macro-tweaks: add missing function to find item --- mods/macro-tweaks.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mods/macro-tweaks.lua b/mods/macro-tweaks.lua index 83ffb8a..1fa3b49 100644 --- a/mods/macro-tweaks.lua +++ b/mods/macro-tweaks.lua @@ -38,6 +38,23 @@ module.enable = function(self) end) end + local function FindItem(item) + for bag = 4, 0, -1 do + for slot = 1, GetContainerNumSlots(bag) do + local itemLink = GetContainerItemLink(bag,slot) + if itemLink then + local _, _, parse = strfind(itemLink, "(%d+):") + local query = GetItemInfo(parse) + if query and query ~= "" and string.lower(query) == string.lower(item) then + return bag, slot + end + end + end + end + + return nil + end + -- add /use and /equip to the macro api: -- https://wowwiki.fandom.com/wiki/Making_a_macro -- supported arguments: