Advertisement
alexdubovyck

repair

Jan 3rd, 2016
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.73 KB | None | 0 0
  1. 7.1. Autosell grey trash and repair:
  2. Code:
  3. local g = CreateFrame("Frame")
  4. g:RegisterEvent("MERCHANT_SHOW")
  5.  
  6. g:SetScript("OnEvent", function()  
  7.         local bag, slot
  8.         for bag = 0, 4 do
  9.                 for slot = 0, GetContainerNumSlots(bag) do
  10.                         local link = GetContainerItemLink(bag, slot)
  11.                         if link and (select(3, GetItemInfo(link)) == 0) then
  12.                                 UseContainerItem(bag, slot)
  13.                         end
  14.                 end
  15.         end
  16.  
  17.         if(CanMerchantRepair()) then
  18.                 local cost = GetRepairAllCost()
  19.                 if cost > 0 then
  20.                         local money = GetMoney()
  21.                         if IsInGuild() then
  22.                                 local guildMoney = GetGuildBankWithdrawMoney()
  23.                                 if guildMoney > GetGuildBankMoney() then
  24.                                         guildMoney = GetGuildBankMoney()
  25.                                 end
  26.                                 if guildMoney > cost and CanGuildBankRepair() then
  27.                                         RepairAllItems(1)
  28.                                         print(format("|cfff07100Repair cost covered by G-Bank: %.1fg|r", cost * 0.0001))
  29.                                         return
  30.                                 end
  31.                         end
  32.                         if money > cost then
  33.                                 RepairAllItems()
  34.                                 print(format("|cffead000Repair cost: %.1fg|r", cost * 0.0001))
  35.                         else
  36.                                 print("Not enough gold to cover the repair cost.")
  37.                         end
  38.                 end
  39.         end
  40. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement