comparison ProspectMe_Tooltip.lua @ 13:e6eec48ecf14

Minor optimization to the Prospect Me tooltip.
author Geoff Brock <mischivin@gmail.com>
date Wed, 17 Aug 2016 13:58:48 -0400
parents 69b46322ff1b
children 4a10e5d1618c
comparison
equal deleted inserted replaced
12:c5a66cdf45e2 13:e6eec48ecf14
55 if cleared then 55 if cleared then
56 local name, tooltipLink = self:GetItem() 56 local name, tooltipLink = self:GetItem()
57 if tooltipLink then 57 if tooltipLink then
58 local item = tooltipLink:match("Hitem:(%d+)") 58 local item = tooltipLink:match("Hitem:(%d+)")
59 if PM_ResultsTable[item] then 59 if PM_ResultsTable[item] then
60 local lifetimeReturn = PM_GetReturn(item)
60 --NumofEachQuality, Percent of Each Quality 61 --NumofEachQuality, Percent of Each Quality
61 self:AddLine(" ") 62 self:AddLine(" ")
62 self:AddLine("Prospect Me",0.5,1,0.5) 63 self:AddLine("Prospect Me",0.5,1,0.5)
63 if PM_ItemTable[item].subclass == PM_ORESUBCLASS then 64 if PM_ItemTable[item].subclass == PM_ORESUBCLASS then
64 self:AddLine("Times Prospected: " .. PM_ResultsTable[item].timesProspected) 65 self:AddLine("Times Prospected: " .. PM_ResultsTable[item].timesProspected)
66 elseif PM_ItemTable[item].subclass == PM_HERBSUBCLASS then 67 elseif PM_ItemTable[item].subclass == PM_HERBSUBCLASS then
67 self:AddLine("Times Milled: " .. PM_ResultsTable[item].timesProspected) 68 self:AddLine("Times Milled: " .. PM_ResultsTable[item].timesProspected)
68 self:AddDoubleLine("Cost to Mill: " .. PM_FormatPrice(5 * PM_ItemTable[item].price), " Average Return: " .. PM_FormatPrice(PM_GetReturn(item))) 69 self:AddDoubleLine("Cost to Mill: " .. PM_FormatPrice(5 * PM_ItemTable[item].price), " Average Return: " .. PM_FormatPrice(PM_GetReturn(item)))
69 70
70 end 71 end
71 if PM_GetReturn(item)-(5 * PM_ItemTable[item].price) > 0 then 72 if lifetimeReturn-(5 * PM_ItemTable[item].price) > 0 then
72 self:AddLine("Estimated Profit: " .. PM_FormatPrice(PM_GetReturn(item)-(5 * PM_ItemTable[item].price))) 73 self:AddLine("Estimated Profit: " .. PM_FormatPrice(lifetimeReturn-(5 * PM_ItemTable[item].price)))
73 self:AddLine(" ") 74 self:AddLine(" ")
74 else 75 else
75 self:AddLine("No profit to be made",1,0,0) 76 self:AddLine("No profit to be made",1,0,0)
76 self:AddLine(" ") 77 self:AddLine(" ")
77 end 78 end