分区:插件 更新时间:2022-10-31 原文地址:http://wowdata.top/blog/18
必须要说一下,这个代码只是用来学习探讨,直接放到游戏里面,是不能运行的,需要改一改。
代码讲解看这个视频: https://www.bilibili.com/video/BV1824y1u7Wm
宏:
/run BuyItems("黑莲花", 20)
-- 定义一个全局函数BuyItems
function BuyItems(itemName, itemQuantity)
-- 获取总共购买的数量
local totalCount = 0
-- 循环搜索拍卖行
local function searchAuction(itemName, page)
local numBatchAuctions = GetNumAuctionItems("list")
for i = 1, numBatchAuctions do
local itemNameAuction, _, itemCountAuction, _, _, _, _, _, buyoutPrice, _, _, _, _, _, _, _ = GetAuctionItemInfo("list", i)
if itemNameAuction and string.find(itemNameAuction, itemName) then
local canBuyCount = math.min(itemCountAuction, itemQuantity - totalCount)
PlaceAuctionBid("list", i, buyoutPrice, canBuyCount)
totalCount = totalCount + canBuyCount
end
end
if totalCount < itemQuantity and numBatchAuctions == 50 and page < 10 then
C_Timer.After(1, function() QueryAuctionItems(itemName, nil, nil, 0, 0, 0, page + 1, nil, nil) end)
else
print("共收购了" .. totalCount .. "件" .. itemName .. "。")
end
end
-- 循环打开拍卖行窗口并搜索物品---这段老胡认为是无用的
local function openAuction()
if not AuctionFrame:IsVisible() then
ShowUIPanel(AuctionFrame)
end
if AuctionFrameBrowse:IsVisible() then
SearchBoxText:SetText(itemName)
AuctionFrameBrowse_Search()
searchAuction(itemName, 0)
else
C_Timer.After(1, openAuction)
end
end
-- 循环打开拍卖行窗口并搜索物品
openAuction()
-- 循环搜索背包和行囊并使用物品
for bag = 0, 4 do
for slot = 1, GetContainerNumSlots(bag) do
local name = GetContainerItemLink(bag, slot)
if name and string.find(name, itemName) then
local _, itemCount = GetContainerItemInfo(bag, slot)
if totalCount < itemQuantity then
if (totalCount + itemCount) <= itemQuantity then
totalCount = totalCount + itemCount
UseContainerItem(bag, slot)
else
local remaining = itemQuantity - totalCount
totalCount = totalCount + remaining
UseContainerItem(bag, slot, remaining)
end
end
end
end
end
end
分区 | 标题 | 更新时间 |
---|---|---|
公告 | 【置顶】 魔兽插件、地精群(QQ群、微信群) | 2022-10-29 |
WA | 【置顶】 战场排队宏、进场宏、打完离场WA、释放尸体WA | 2022-10-29 |
WA | 【置顶】 自动跟随WA,配合宏命令,10.27更新(老胡原创) | 2022-10-28 |
WA | 【置顶】 双采切换WA,自动切换搜矿和搜草药,2023.1.29更新(支持官服和335私服,其他版本未测试) | 2022-10-28 |
WA | 自动上马WA(demo,不具备实用价值) | 2022-11-07 |
日入万金 | 日入万金系列:与赚钱相关的视频 | 2022-11-06 |
WA | 护盾WA(支持法师、牧师、术士) | 2022-11-03 |
插件 | 魔兽世界拍卖行收货插件--chatgpt写的 | 2022-10-31 |
游戏攻略 | 魔兽世界API | 2022-10-31 |
游戏攻略 | 各个主城的武器大师 | 2022-10-31 |
宏命令 | 宏命令:发送生活技能 | 2022-10-29 |
宏命令 | 宏命令:公屏发装备链接 | 2022-10-29 |
宏命令 | 宏命令:坐骑宏,自动判定飞行坐骑和陆地坐骑 | 2022-10-29 |
插件 | 正式服拍卖钓鱼、反钓鱼源代码(老胡原创) | 2022-10-29 |
软件 | 跳 跳 !!!!!!!!! | 2022-10-29 |
插件 | WLK物品分组数据(可以直接导入到TSM) | 2022-10-29 |
插件 | 双采声音提醒插件Minimap Alert | 2022-10-29 |
宏命令 | 宏命令:防暂离宏命令,防止小退 | 2022-10-29 |
Python | python实现魔兽世界自动登录,跟排队说拜拜 | 2022-10-29 |
宏命令 | WLK单刷祖格老虎、DK马必备宏命令(单人成团) | 2022-10-29 |