--: --------------------------------------------------------------------------------------------
--: shopFreeItem.lua
--: Purchase Year of Darkpaw free item
--: --------------------------------------------------------------------------------------------
local mq = require('mq')
local itemname = ''
while not mq.TLO.Window('MarketplaceWnd').Open() do
mq.TLO.Window('EQMainWnd/EQM_SCButton').LeftMouseUp()
mq.delay(2000)
end
-- select year of darkpaw
for i=1, mq.TLO.Window('MarketplaceWnd/MKPW_CategoriesTree').Items(), 1 do
local category = mq.TLO.Window('MarketplaceWnd/MKPW_CategoriesTree').List(i)()
if string.find(category, 'Familiars') then
mq.TLO.Window('MarketplaceWnd/MKPW_CategoriesTree').Select(i)
mq.delay(2000)
break
end
end
-- search for the zero cost item
for i=1, mq.TLO.Window('MarketplaceWnd/MKPW_ItemList').Items(), 1 do
if tonumber(mq.TLO.Window('MarketplaceWnd/MKPW_ItemList').List(i,5)()) == 0 then
itemname = mq.TLO.Window('MarketplaceWnd/MKPW_ItemList').List(i,3)()
print('\aymarketplace free item\ax = \ag'..itemname)
mq.TLO.Window('MarketplaceWnd/MKPW_ItemList').Select(i)
mq.delay(500)
break
end
end
-- check if you have it
if itemname ~= '' and
mq.TLO.FindItemCount(itemname)() == 0 and
mq.TLO.FindItemBankCount(itemname)() == 0
then
local item = mq.TLO.Window('MarketplaceWnd/MKPW_DetailsName').Text()
local cost = tonumber(mq.TLO.Window('MarketplaceWnd/MKPW_BuyTotal').Text())
print('Buy a '..item..' it costs '..cost)
-- go buy it / make sure it is really zero cost
if cost == 0 and item == itemname then
mq.TLO.Window('MarketplaceWnd/MKPW_BuyBtn').LeftMouseUp()
mq.delay(2000)
if mq.TLO.Window('MarketplaceWnd/MKPW_TaxInfoZipCodeLabel') then
mq.TLO.Window('MarketplaceWnd/MKPW_TaxInfoZipCodeEdit').SetText('88901')
mq.delay(1000)
mq.TLO.Window('MarketplaceWnd/MKPW_TaxInfoNextButton').LeftMouseUp()
mq.delay(1000)
end
mq.TLO.Window('MarketplaceWnd/MKPW_ConfirmPurchase_ConfirmBtn').LeftMouseUp()
while not mq.TLO.Window('ConfirmationDialogBox').Open() do
mq.delay(2000)
end
mq.TLO.Window('ConfirmationDialogBox/CD_OK_button').LeftMouseUp()
end
end
while mq.TLO.Window('MarketplaceWnd').Open() do
mq.TLO.Window('MarketplaceWnd').DoClose()
mq.delay(2000)
end