前往
大廳
主題

[ 魔獸世界 ] 11.2 SellRepair 自動賣灰修裝

。愔。 | 2025-08-26 14:40:40 | 巴幣 0 | 人氣 89

修復小巧UI賣灰修裝
##SellRepair

--SellRepair 自動賣灰修裝
local sellgrays= 1--自動賣灰裝(1:開 0:關)
local autorepair= 1--自動修裝備(1:開 0:關)
local UseGuildBank= 0--使用公會會費修裝(1:開 0:關)

local f = CreateFrame("Frame")
f:RegisterEvent("MERCHANT_SHOW")
f:SetScript("OnEvent", function()
if sellgrays then
local p,N,c,n=0
for bag = 0, 4 do
for slot = 1, C_Container.GetContainerNumSlots(bag) do
n = C_Container.GetContainerItemLink(bag, slot)
if n and string.find(n,"|cnIQ0:|") then
N={C_Item.GetItemInfo(n)}
c=GetItemCount(n) p=p+(N[11]*c)C_Container.UseContainerItem(bag, slot)
print("賣:"..n)
end
end
end
if p~=0 then
print("|cffffff00共售出:|r" ..C_CurrencyInfo.GetCoinText(p))
end
end

--自動修理(優先使用公會修理)
local g = CreateFrame("Frame")
g:RegisterEvent("MERCHANT_SHOW")
g:SetScript("OnEvent", function()
if autorepair and CanMerchantRepair() then
local cost = GetRepairAllCost()
local gbwm = GetGuildBankWithdrawMoney() - cost
local gbk = GetGuildBankMoney()
if cost > 0 then
local money = GetMoney()
if IsInGuild() then
local guildMoney = GetGuildBankWithdrawMoney()
if guildMoney > GetGuildBankMoney() then
guildMoney = GetGuildBankMoney()
end
if UseGuildBank == 1 and guildMoney >= cost and CanGuildBankRepair() then
RepairAllItems(1)
PlaySound("7994")
print("|cff00FFFF公款修理:|r"..C_CurrencyInfo.GetCoinTextureString(cost))
if gbk >= gbwm then
print("剩餘可用公修:".. C_CurrencyInfo.GetCoinTextureString(gbwm))
else
print("剩餘可用公修:".. C_CurrencyInfo.GetCoinTextureString(gbk))
end
return
end
end
if money > cost then
PlaySound("7994")
RepairAllItems()
print("|cffffff00自費修理:|r"..C_CurrencyInfo.GetCoinTextureString(cost))
else
print("|cff99CCFF".."餘額不足!。".."|r")
end
end
end
end)

更多創作