BIMSbot
http://bimsbot.ru/forum/

Аддон для продажи дорогого гира
http://bimsbot.ru/forum/viewtopic.php?f=26&t=3827
Страница 1 из 1

Автор:  CoreFun [ 01 окт 2012, 16:37 ]
Заголовок сообщения:  Аддон для продажи дорогого гира

Часть зелёнки я сразу продаю вендору,остальное распыляю. Возможно кому-то пригодится аддон для продажи дорогого шмота.
Файл .lua:
local GREEN_MIN_PRICE = 20;-- вся зелень дороже 20г будет продана
local BLUE_MIN_PRICE = 7;-- вся синь дороже 7г будет продана
-- фиолет не продаётся
----------------------------------------------------------------------------
local frame = CreateFrame("FRAME", "sellexpence")
frame:RegisterEvent("MERCHANT_SHOW")
local time2sell = nil;

local function _onEvent(self, event, ...)
   local arg1 = ...
   if event == "MERCHANT_SHOW" then
      time2sell = GetTime()
   end
end

local function _onUpdate()
   if time2sell and (GetTime() - time2sell > 2) then
      time2sell = nil
      local bag,slot
      local currPrice
      local item

      for bag = 0,4 do
         for slot = 1,GetContainerNumSlots(bag) do
            item = GetContainerItemLink(bag,slot)
            if item then
               -- is it grey quality item?
               local grey = string.find(item,"|cff9d9d9d")
               local grin = string.find(item,"|cff1eff00")
               local blue = string.find(item,"|cff0070dd")
               
               if (grey or grin or blue) then
                  currPrice = select(11, GetItemInfo(item)) * select(2, GetContainerItemInfo(bag, slot))
                  -- this should get rid of problems with grey items, that cant be sell to a vendor
                  if (grey and currPrice>0)or(grin and currPrice>GREEN_MIN_PRICE*10000)or(blue and currPrice>BLUE_MIN_PRICE*10000) then
                     PickupContainerItem(bag, slot)
                     PickupMerchantItem()
                  end
               end
            end
         end
      end
   end
end
frame:SetScript("OnEvent", _onEvent)
frame:SetScript("OnUpdate", _onUpdate)

Продаёт с задержкой в 2 секунды, чтобы дать боту и другим аддонам (SellJunk) сделать своё дело. Цена настроена на шмот Каты.
Файл .toc:
## Author: By Myself
## Interface: 50001
## Title: SellExpencive
## Version: 0.1
sellexpence.lua


Вложения:
Комментарий к файлу: Аддон
sellexpence.zip [1.15 KiB]
Скачиваний: 297

Страница 1 из 1 Часовой пояс: UTC + 2 часа [ Летнее время ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/