annotate ProspectMe_Value.lua @ 40:97fe62d4385d Prospect Me 2

Fix for when too many containers are locked by the UI simultaneously. This could happen, for example, when using the built in "Clean Up Bags" feature.
author Vynn <mischivin@gmail.com>
date Thu, 10 Nov 2016 16:09:28 -0500
parents 5cbaaee1e7db
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@36 7 elseif AucAdvanced then -- Auctioneer Support
mischivin@36 8 v = AucAdvanced.API.GetMarketValue(PM_ItemTable[itemID].link)
mischivin@36 9 end
mischivin@36 10
mischivin@36 11 if v == nil then -- provides a failsafe if Auctioneer, etc is set to Load on Demand
mischivin@36 12 v = select(11, GetItemInfo(itemID))
mischivin@36 13 end
mischivin@36 14
mischivin@36 15 if v == nil then -- provides a final failsafe - if we can't find anything, set it to 0 (TY peterwemm!)
mischivin@36 16 v = 0.0
mischivin@36 17 end
mischivin@36 18
mischivin@36 19 return tonumber(v)
Vynn@0 20 end
Vynn@0 21 end
Vynn@0 22
mischivin@36 23 local frame = CreateFrame("FRAME", "ProspectMe_Value")
mischivin@36 24 frame:RegisterEvent("VARIABLES_LOADED")
mischivin@36 25 --frame:SetScript("OnEvent", EventHandler)
mischivin@36 26 frame:SetScript("OnEvent", Initialize)