annotate Modules/ProspectMe_Value.lua @ 63:17897a788554 v2.7.1.2

Updated Auction API support to explicitly (instead of implicitly via Auctioneer API) work with TSM Fixed a bug that was left over from the transition to v2.
author Vynn <mischivin@gmail.com>
date Thu, 08 Dec 2016 23:04:44 -0500
parents 155fa49865f2
children
rev   line source
mischivin@36 1 local function Initialize ()
mischivin@36 2 ProspectMe.GetItemValue = function (itemID)
mischivin@36 3 local v = nil
mischivin@36 4
mischivin@36 5 if GetAuctionBuyout then -- if an installed addon supports Tekkub's GetAuctionBuyout API: Auctionator, AuctionLite, etc...
mischivin@36 6 v = GetAuctionBuyout(itemID)
mischivin@63 7 elseif TSMAPI then -- TSM's Support
mischivin@63 8 v = TSMAPI:GetItemValue(itemID, "DBMinBuyout")
mischivin@36 9 elseif AucAdvanced then -- Auctioneer Support
mischivin@63 10 v = AucAdvanced.API.GetMarketValue(select(2, GetItemInfo(itemID)))
mischivin@36 11 end
mischivin@36 12
mischivin@36 13 if v == nil then -- provides a failsafe if Auctioneer, etc is set to Load on Demand
mischivin@36 14 v = select(11, GetItemInfo(itemID))
mischivin@36 15 end
mischivin@36 16
mischivin@36 17 if v == nil then -- provides a final failsafe - if we can't find anything, set it to 0 (TY peterwemm!)
mischivin@36 18 v = 0.0
mischivin@36 19 end
mischivin@36 20
mischivin@36 21 return tonumber(v)
Vynn@0 22 end
Vynn@0 23 end
Vynn@0 24
mischivin@36 25 local frame = CreateFrame("FRAME", "ProspectMe_Value")
mischivin@36 26 frame:RegisterEvent("VARIABLES_LOADED")
mischivin@36 27 --frame:SetScript("OnEvent", EventHandler)
mischivin@36 28 frame:SetScript("OnEvent", Initialize)