comparison ProspectMe_Value.lua @ 36:5cbaaee1e7db Prospect Me 2

Updated Tooltips to support V2
author Vynn <mischivin@gmail.com>
date Thu, 10 Nov 2016 12:26:14 -0500
parents 9c3883972403
children
comparison
equal deleted inserted replaced
35:705d0595006a 36:5cbaaee1e7db
1 function PM_GetItemValue(itemID) 1 local function Initialize ()
2 local v = nil 2 ProspectMe.GetItemValue = function (itemID)
3 if GetAuctionBuyout then -- if an installed addon supports Tekkub's GetAuctionBuyout API: Auctionator, AuctionLite, etc... 3 local v = nil
4 v = GetAuctionBuyout(itemID) 4
5 if GetAuctionBuyout then -- if an installed addon supports Tekkub's GetAuctionBuyout API: Auctionator, AuctionLite, etc...
6 v = GetAuctionBuyout(itemID)
7 elseif AucAdvanced then -- Auctioneer Support
8 v = AucAdvanced.API.GetMarketValue(PM_ItemTable[itemID].link)
9 end
10
11 if v == nil then -- provides a failsafe if Auctioneer, etc is set to Load on Demand
12 v = select(11, GetItemInfo(itemID))
13 end
14
15 if v == nil then -- provides a final failsafe - if we can't find anything, set it to 0 (TY peterwemm!)
16 v = 0.0
17 end
18
19 return tonumber(v)
5 end 20 end
6
7 if v == nil then
8 if AucAdvanced then -- Auctioneer Support
9 v = AucAdvanced.API.GetMarketValue(PM_ItemTable[itemID].link)
10 else -- if nothing else, use the vendor price!
11 v = PM_ItemTable[itemID].vendorPrice
12 end
13 end
14
15 if v == nil then -- provides a failsafe if Auctioneer, etc is set to Load on Demand
16 v = PM_ItemTable[itemID].vendorPrice
17 end
18
19 if v == nil then -- provides a final failsafe - if we can't find anything, set it to 0 (TY peterwemm!)
20 v = 0.0
21 end
22
23 return tonumber(v)
24 end 21 end
25 22
26 function PM_UpdateValues() 23 local frame = CreateFrame("FRAME", "ProspectMe_Value")
27 for k,v in pairs(PM_ItemTable) do 24 frame:RegisterEvent("VARIABLES_LOADED")
28 PM_ItemTable[k].price = PM_GetItemValue(k) 25 --frame:SetScript("OnEvent", EventHandler)
29 end 26 frame:SetScript("OnEvent", Initialize)
30 end