m
Move page script moved page USERAPI EquipItemByLink to WoW:USERAPI EquipItemByLink without leaving a redirect
m (Made more future-safe.) |
m (Move page script moved page USERAPI EquipItemByLink to WoW:USERAPI EquipItemByLink without leaving a redirect) |
||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
{{userfunc}} | {{userfunc}} | ||
Equips the first matching item found in the player's bags (including the bank and bank bags). | |||
Checks the bank first, then carry-ons, then bank bags. | Checks the bank first, then carry-ons, then bank bags. | ||
local function EquipItemByLink(link) | local function EquipItemByLink(link) | ||
for bag=BANK_CONTAINER, NUM_BAG_SLOTS+NUM_BANKBAGSLOTS do | |||
for slot=1,GetContainerNumSlots(bag) do | |||
local item = GetContainerItemLink(bag, slot) | |||
if item and item == link then | |||
if CursorHasItem() or CursorHasMoney() or CursorHasSpell() then ClearCursor() end | |||
PickupContainerItem(bag, slot) | |||
AutoEquipCursorItem() | |||
return true | |||
end | |||
end | |||
end | |||
end | end | ||