Code: Select all
local function GetBagItemID( bagIndex )
local inventoryIndex = GetBagItemInfo( bagIndex )
local link = GetBagItemLink(inventoryIndex)
if not link then outt("--"); return end
local _, data, _ = ParseHyperlink(link)
if data and data ~= "" then
local _,_,ret = string.find(data, "(%x+)")
return tonumber(ret, 16)
end
end
function ahStuff(stuff,fact)
if not fact then fact=1 end
if not ahIndex or ahIndex>=60 then ahIndex=20 end
ahIndex=ahIndex+1
local i=ahIndex
outt(i)
local inventoryIndex, icon, name, itemCount, locked, invalid = GetBagItemInfo ( i )
while ((i<61) and (string.find(name, stuff)==nil)) do
i=i+1
inventoryIndex, icon, name, itemCount, locked, invalid = GetBagItemInfo ( i )
end
outt(i)
ahIndex=i
outt(ahIndex)
itemId=GetBagItemID(i)
AAH.History.UpdateSellItemHistory(itemid)
outt(tostring(GetBagItemID(i)))
PickupBagItem(GetBagItemInfo(i))
ClickAuctionItemButton()
price=AAH_SavedHistoryTable[itemId] and AAH_SavedHistoryTable[itemId]["avg"]
if price~=nil then
p=fact*price
outt(name.." "..tostring(p))
ii=0
while p>100 do p=math.floor(p/10);ii=ii+1 end
while ii>0 do p=p*10;ii=ii-1 end
CreateAuctionItem(4, p, 1, p);
end
ClickAuctionItemButton()
PickupBagItem(GetBagItemInfo(i))
end
ahStuff("Recipe",0.6)
This is what I spam on an alt that sells my recipes (at 0.6 avg price)
Horrible and unformatted code, maybe it helps.
PS: The AH history needs to be in memory already, it just skips items we dont know the history of
PS2: This contains code that is defined elsewhere (function outt()), maybe other stuff too, so take this more as a pointer rather than as working code
