comparison ProspectMe_Tooltip.lua @ 46:a35539b8e151 Prospect Me 2

Updated the Tooltip to display a color coded profit margin. Red < 15%, Yellow <30%, Green >30%. Also added support for previous globalized constants
author Vynn <mischivin@gmail.com>
date Wed, 16 Nov 2016 00:47:56 -0500
parents 35c84e420f4a
children 4c684bba5777
comparison
equal deleted inserted replaced
45:b267cddd6496 46:a35539b8e151
1 local ORE = select(7,GetItemInfo(123918)) -- Get Ore Subclass from a known quantity (leystone ore)
2 local HERB = select(7,GetItemInfo(128304)) -- Get Herb Subclass from a known quantity (yseralline seed)
3
4 local Quality = { [0] = "Junk", [1]= "Common", [2] = "Uncommon", [3] = "Rare", [4] = "Epic", } 1 local Quality = { [0] = "Junk", [1]= "Common", [2] = "Uncommon", [3] = "Rare", [4] = "Epic", }
5 2
6 local function Initialize() 3 local function Initialize()
7 ProspectMe.FormatPrice = function (value) 4 ProspectMe.FormatPrice = function (value)
8 5
79 local lifetimeReturn = ProspectMe.GetReturn(item) 76 local lifetimeReturn = ProspectMe.GetReturn(item)
80 local subclass = select(7,GetItemInfo(item)) 77 local subclass = select(7,GetItemInfo(item))
81 --NumofEachQuality, Percent of Each Quality 78 --NumofEachQuality, Percent of Each Quality
82 self:AddLine(" ") 79 self:AddLine(" ")
83 self:AddLine("Prospect Me",0.5,1,0.5) 80 self:AddLine("Prospect Me",0.5,1,0.5)
84 if spellid == 225902 or spellid == 225904 or subclass == ORE then 81 if spellid == 225902 or spellid == 225904 or subclass == ProspectMe.Vars.ORE then
85 self:AddLine("Times Prospected: " .. ProspectMe.Results[item].TimesProspected) 82 self:AddLine("Times Prospected: " .. ProspectMe.Results[item].TimesProspected)
86 elseif spellid == 210116 or subclass == HERB then 83 elseif spellid == 210116 or subclass == ProspectMe.Vars.HERB then
87 self:AddLine("Times Milled: " .. ProspectMe.Results[item].TimesProspected) 84 self:AddLine("Times Milled: " .. ProspectMe.Results[item].TimesProspected)
88 else 85 else
89 self:AddLine("Times Processed: " .. ProspectMe.Results[item].TimesProspected) 86 self:AddLine("Times Processed: " .. ProspectMe.Results[item].TimesProspected)
90 end 87 end
91 if spellid then 88 if spellid then
96 end 93 end
97 if spellid == 225902 or spellid == 225904 then 94 if spellid == 225902 or spellid == 225904 then
98 self:AddDoubleLine("Cost to Mass Prospect: " .. ProspectMe.FormatPrice(ctp), " Average Return: " .. ProspectMe.FormatPrice(lifetimeReturn)) 95 self:AddDoubleLine("Cost to Mass Prospect: " .. ProspectMe.FormatPrice(ctp), " Average Return: " .. ProspectMe.FormatPrice(lifetimeReturn))
99 elseif spellid == 210116 then 96 elseif spellid == 210116 then
100 self:AddDoubleLine("Cost to Mass Mill: " .. ProspectMe.FormatPrice(ctp), " Average Return: " .. ProspectMe.FormatPrice(lifetimeReturn)) 97 self:AddDoubleLine("Cost to Mass Mill: " .. ProspectMe.FormatPrice(ctp), " Average Return: " .. ProspectMe.FormatPrice(lifetimeReturn))
101 elseif subclass == ORE then 98 elseif subclass == ProspectMe.Vars.ORE then
102 self:AddDoubleLine("Cost to Prospect: " .. ProspectMe.FormatPrice(ctp), " Average Return: " .. ProspectMe.FormatPrice(lifetimeReturn)) 99 self:AddDoubleLine("Cost to Prospect: " .. ProspectMe.FormatPrice(ctp), " Average Return: " .. ProspectMe.FormatPrice(lifetimeReturn))
103 elseif subclass == HERB then 100 elseif subclass == ProspectMe.Vars.HERB then
104 self:AddDoubleLine("Cost to Mill: " .. ProspectMe.FormatPrice(ctp), " Average Return: " .. ProspectMe.FormatPrice(lifetimeReturn)) 101 self:AddDoubleLine("Cost to Mill: " .. ProspectMe.FormatPrice(ctp), " Average Return: " .. ProspectMe.FormatPrice(lifetimeReturn))
105 else 102 else
106 self:AddDoubleLine("Cost to Process: " .. ProspectMe.FormatPrice(ctp), " Average Return: " .. ProspectMe.FormatPrice(lifetimeReturn)) 103 self:AddDoubleLine("Cost to Process: " .. ProspectMe.FormatPrice(ctp), " Average Return: " .. ProspectMe.FormatPrice(lifetimeReturn))
107 end 104 end
108 if lifetimeReturn-(ctp) > 0 then 105 self:AddLine(" ")
109 self:AddLine("Estimated Profit: " ..ProspectMe.FormatPrice(lifetimeReturn-(ctp))) 106 local margin = (lifetimeReturn/ctp*100)-100
110 self:AddLine(" ") 107 if margin > 30 then
108 self:AddLine("Estimated Profit: " .. ProspectMe.FormatPrice(lifetimeReturn-(ctp)) .. "\nMargin: |cff00ff00" .. string.format("[%.1f%%]", margin))
109 elseif margin > 15 then
110 self:AddLine("Estimated Profit: " .. ProspectMe.FormatPrice(lifetimeReturn-(ctp)) .. "\nMargin: |cffffff00" .. string.format("[%.1f%%]", margin))
111 elseif margin > 0 then
112 self:AddLine("Estimated Profit: " .. ProspectMe.FormatPrice(lifetimeReturn-(ctp)) .. "\nMargin: |cffff0000" .. string.format("[%.1f%%]", margin))
111 else 113 else
112 self:AddLine("No profit to be made",1,0,0) 114 self:AddLine("No profit to be made",1,0,0)
113 self:AddLine(" ")
114 end 115 end
116 self:AddLine(" ")
115 local t 117 local t
116 if IsAltKeyDown() == ProspectMe.Config.PerSession then 118 if IsAltKeyDown() == ProspectMe.Config.PerSession then
117 t = ProspectMe.Results 119 t = ProspectMe.Results
118 self:AddDoubleLine("Lifetime Results","Hold/Release Alt to toggle",0.5,0.5,1,0.5,0.5,0.5) 120 self:AddDoubleLine("Lifetime Results","Hold/Release Alt to toggle",0.5,0.5,1,0.5,0.5,0.5)
119 else 121 else