本帖最后由 QQ_CAFE57 于 2024-9-5 11:54 AM 编辑
仅供参考,不通用(每个服的杂货商人的物品排序不一样)
[Lua] 纯文本查看 复制代码
if not AOTU_MERCHANT then
AOTU_MERCHANT = CreateFrame("Frame")
AOTU_MERCHANT:RegisterEvent("UNIT_MANE")
AOTU_MERCHANT:RegisterEvent("UNIT_HEALTH")
AOTU_MERCHANT:RegisterEvent("MERCHANT_SHOW")
AOTU_MERCHANT:SetScript("OnEvent", function(self,event,arg1)
if event == "MERCHANT_SHOW" then
--补充消耗品
if GetMerchantItemInfo(1)=='魔法酪饼' and GetItemCount(43523)<1 then
BuyMerchantItem(1,20)
end
local className, classFilename, classId = UnitClass('player')
--术士消耗品
if className == '术士' then
if GetMerchantItemInfo(11)=='灵魂碎片' and GetItemCount(6265)<100 then
BuyMerchantItem(11,100-GetItemCount(6265))
end
end
end
if (event == "UNIT_HEALTH" or event == "UNIT_MANE") and arg1 == 'player' then
local a = UnitMana('player')
local b = UnitManaMax('player')
local c = UnitHealth('player')
local d = UnitHealthMax('player')
local PN = ((a / b) * 100)
local PX = ((c / d) * 100)
local Combat = not UnitAffectingCombat('player')
--自动吃喝
if Combat and not UnitBuff('player','进食') then
if (PN<66 or PX<66) and GetItemCount(43523)>0 and GetItemCooldown(43523)<=0 then
RunMacroText('/use item:43523')
end
end
end
end)
end |