偷懒用wbee做了个自动研磨草药。不能自动归集几个格中分别不足5个草药的。大佬看看给提个意见,怎么自动归集。
-- 查询Container
[Lua] 纯文本查看 复制代码 local grassToCheck = {"蛇信草", "塔兰德拉的玫瑰", "死亡荨麻", "金苜蓿"}
for bag = 0, 4 do
local numSlots = GetContainerNumSlots(bag)
for slot = 1, numSlots do
local itemLink = GetContainerItemLink(bag, slot)
if itemLink then
-- 获取物品名称和实际数量
local itemName = GetItemInfo(itemLink)
local _, itemCount = GetContainerItemInfo(bag, slot)
-- 检查数量是否大于4
if itemCount and itemCount > 4 then
for _, grass in ipairs(grassToCheck) do
if string.find(itemName, grass) then
CastSpellByName("研磨")
UseContainerItem(bag, slot)
return true
end
end
end
end
end
end
|