view ProspectMe_Value.lua @ 2:dabd5c6540ca v1.2.2-Beta

Fixed a bug with saved player configurations. Vetted some other minor updates.
author Vynn
date Tue, 16 Dec 2014 00:24:54 -0500
parents 69b46322ff1b
children 9c3883972403
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
	
	return tonumber(v)
end

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