view ProspectMe_Value.lua @ 20:4a10e5d1618c

Hardcoded the subclass detection in Legion - will work 100% in english clients, not so sure about non-english clients, so please report back if it breaks for you!
author Geoff Brock <mischivin@gmail.com>
date Sun, 04 Sep 2016 21:51:07 -0400
parents 9c3883972403
children 5cbaaee1e7db
line wrap: on
line source
function PM_GetItemValue(itemID)
	local v = nil
	if GetAuctionBuyout then -- if an installed addon supports Tekkub's GetAuctionBuyout API: Auctionator, AuctionLite, etc...
		v = GetAuctionBuyout(itemID)
	end
	
	if v == nil then
		if AucAdvanced then -- Auctioneer Support
			v = AucAdvanced.API.GetMarketValue(PM_ItemTable[itemID].link)
		else -- if nothing else, use the vendor price!
			v = PM_ItemTable[itemID].vendorPrice
		end
	end
	
	if v == nil then -- provides a failsafe if Auctioneer, etc is set to Load on Demand
		v = PM_ItemTable[itemID].vendorPrice
	end
	
	if v == nil then -- provides a final failsafe - if we can't find anything, set it to 0 (TY peterwemm!)
		v = 0.0
	end

	return tonumber(v)
end

function PM_UpdateValues()
	for k,v in pairs(PM_ItemTable) do
		PM_ItemTable[k].price = PM_GetItemValue(k)
	end
end