comparison ProspectMe_Tooltip.lua @ 39:b9c2260bf1b4 Prospect Me 2

Updated the tooltips to better reflect mass prospecting/milling cost/return, support tooltips on mouse over of the Mass Prospecting/Milling spells, and general tooltip formatting improvements
author Vynn <mischivin@gmail.com>
date Thu, 10 Nov 2016 16:01:43 -0500
parents 5cbaaee1e7db
children 55da4d54a2de
comparison
equal deleted inserted replaced
38:69c7955b75b1 39:b9c2260bf1b4
1 --PM_HERBSUBCLASS = select(6, GetAuctionItemSubClasses(6)) 1 local ORE = select(7,GetItemInfo(123918)) -- Get Ore Subclass from a known quantity (leystone ore)
2 --PM_ORESUBCLASS = select(4, GetAuctionItemSubClasses(6)) 2 local HERB = select(7,GetItemInfo(128304)) -- Get Herb Subclass from a known quantity (yseralline seed)
3 3
4 local Quality = { [0] = "Junk", [1]= "Common", [2] = "Uncommon", [3] = "Rare", [4] = "Epic", } 4 local Quality = { [0] = "Junk", [1]= "Common", [2] = "Uncommon", [3] = "Rare", [4] = "Epic", }
5 5
6 local function Initialize() 6 local function Initialize()
7 ProspectMe.FormatPrice = function (value) 7 ProspectMe.FormatPrice = function (value)
55 cleared = true 55 cleared = true
56 end 56 end
57 57
58 local function OnTooltipSetItem(self) 58 local function OnTooltipSetItem(self)
59 if cleared then 59 if cleared then
60 local name, tooltipLink = self:GetItem() 60 local tooltipLink = select(2, self:GetItem())
61 if tooltipLink then 61 local spellid = select(3, self:GetSpell())
62 local item = tonumber(tooltipLink:match("Hitem:(%d+)")) 62 local item = nil
63 if spellid == 225902 then
64 item = 123918
65 elseif spellid == 225904 then
66 item = 123919
67 elseif spellid == 210116 then
68 item = 128304
69 elseif tooltipLink then
70 item = tonumber(tooltipLink:match("Hitem:(%d+)"))
71 spellid = nil
72 else
73 item = nil
74 spellid = nil
75 end
76 if item then
63 if ProspectMe.Results[item] then 77 if ProspectMe.Results[item] then
64 local price = ProspectMe.GetItemValue(item) 78 local price = ProspectMe.GetItemValue(item)
65 local lifetimeReturn = ProspectMe.GetReturn(item) 79 local lifetimeReturn = ProspectMe.GetReturn(item)
66 --NumofEachQuality, Percent of Each Quality 80 --NumofEachQuality, Percent of Each Quality
67 self:AddLine(" ") 81 self:AddLine(" ")
68 self:AddLine("Prospect Me",0.5,1,0.5) 82 self:AddLine("Prospect Me",0.5,1,0.5)
69 self:AddLine("Times Processed: " .. ProspectMe.Results[item].TimesProspected) 83 self:AddLine("Times Processed: " .. ProspectMe.Results[item].TimesProspected)
70 self:AddDoubleLine("Cost to Process: " .. ProspectMe.FormatPrice(5 * price), " Average Return: " .. ProspectMe.FormatPrice(lifetimeReturn)) 84 if spellid then
71 if lifetimeReturn-(5 * price) > 0 then 85 ctp = price * 20
72 self:AddLine("Estimated Profit: " ..ProspectMe.FormatPrice(lifetimeReturn-(5 * price))) 86 lifetimeReturn = lifetimeReturn * 4
87 else
88 ctp = price * 5
89 end
90 if spellid == 225902 or spellid == 225904 then
91 self:AddDoubleLine("Cost to Mass Prospect: " .. ProspectMe.FormatPrice(ctp), " Average Return: " .. ProspectMe.FormatPrice(lifetimeReturn))
92 elseif spellid == 210116 then
93 self:AddDoubleLine("Cost to Mass Mill: " .. ProspectMe.FormatPrice(ctp), " Average Return: " .. ProspectMe.FormatPrice(lifetimeReturn))
94 elseif select(7,GetItemInfo(item)) == ORE then
95 self:AddDoubleLine("Cost to Prospect: " .. ProspectMe.FormatPrice(ctp), " Average Return: " .. ProspectMe.FormatPrice(lifetimeReturn))
96 elseif select(7,GetItemInfo(item)) == HERB then
97 self:AddDoubleLine("Cost to Mill: " .. ProspectMe.FormatPrice(ctp), " Average Return: " .. ProspectMe.FormatPrice(lifetimeReturn))
98 else
99 self:AddDoubleLine("Cost to Process: " .. ProspectMe.FormatPrice(ctp), " Average Return: " .. ProspectMe.FormatPrice(lifetimeReturn))
100 end
101 if lifetimeReturn-(ctp) > 0 then
102 self:AddLine("Estimated Profit: " ..ProspectMe.FormatPrice(lifetimeReturn-(ctp)))
73 self:AddLine(" ") 103 self:AddLine(" ")
74 else 104 else
75 self:AddLine("No profit to be made",1,0,0) 105 self:AddLine("No profit to be made",1,0,0)
76 self:AddLine(" ") 106 self:AddLine(" ")
77 end 107 end
105 end 135 end
106 self:AddDoubleLine(p .. select(2, GetItemInfo(result)) .. n, ProspectMe.FormatPrice(ProspectMe.GetItemValue(result))) 136 self:AddDoubleLine(p .. select(2, GetItemInfo(result)) .. n, ProspectMe.FormatPrice(ProspectMe.GetItemValue(result)))
107 end 137 end
108 end 138 end
109 end 139 end
110 self:AddLine(" ") 140 --self:AddLine(" ")
111 end 141 end
112 end 142 end
113 cleared = true 143 cleared = true
114 end 144 end
115 end 145 end