Mercurial > wow > prospect-me
comparison ProspectMe_Tooltip.lua @ 58:f9b6c0305908
Added an integrity check to incoming data to make sure the ItemID is a valid ore/herb
Updated tooltips to allow hiding of the economics data (in addition to the existing toggles for granular results)
Updated tooltips to give better hints when the player hasn't prospected/milled an item before
author | Vynn <mischivin@gmail.com> |
---|---|
date | Mon, 28 Nov 2016 12:09:11 -0500 |
parents | 60f990099d03 |
children |
comparison
equal
deleted
inserted
replaced
57:8d7cc246ec11 | 58:f9b6c0305908 |
---|---|
98 end | 98 end |
99 self:AddDoubleLine("Prospect Me","Times " .. skilltext .. ": " .. color .. ProspectMe.Results[item].TimesProspected,1,0.82,0,1,1,1) | 99 self:AddDoubleLine("Prospect Me","Times " .. skilltext .. ": " .. color .. ProspectMe.Results[item].TimesProspected,1,0.82,0,1,1,1) |
100 self:AddLine(" ") | 100 self:AddLine(" ") |
101 | 101 |
102 -- Economics Text Block | 102 -- Economics Text Block |
103 local spelltext | 103 if ProspectMe.Config.ShowEconomics then |
104 if spellid == 225902 or spellid == 225904 then | 104 local spelltext |
105 spelltext = "Mass Prospect" | 105 if spellid == 225902 or spellid == 225904 then |
106 elseif spellid == 210116 then | 106 spelltext = "Mass Prospect" |
107 spelltext = "Mass Mill" | 107 elseif spellid == 210116 then |
108 elseif subclass == ProspectMe.Vars.ORE then | 108 spelltext = "Mass Mill" |
109 spelltext = "Prospect" | 109 elseif subclass == ProspectMe.Vars.ORE then |
110 elseif subclass == ProspectMe.Vars.HERB then | 110 spelltext = "Prospect" |
111 spelltext = "Mill" | 111 elseif subclass == ProspectMe.Vars.HERB then |
112 else | 112 spelltext = "Mill" |
113 spelltext = "Process" | 113 else |
114 spelltext = "Process" | |
115 end | |
116 if spellid then | |
117 ctp = price * 20 | |
118 lifetimeReturn = lifetimeReturn * 4 | |
119 end | |
120 local profit = lifetimeReturn - ctp | |
121 local margin = (lifetimeReturn / ctp * 100) - 100 | |
122 self:AddDoubleLine("Estimated Profit: " .. ProspectMe.FormatPrice(profit), "Cost to " .. spelltext .. ": " .. ProspectMe.FormatPrice(ctp),1,1,1,1,1,1) | |
123 if margin < 15 then | |
124 color = "|cffff0000" | |
125 elseif margin < 30 then | |
126 color = "|cffffff00" | |
127 else | |
128 color = "|cff00ff00" | |
129 end | |
130 self:AddDoubleLine("Margin: " .. color .. string.format("[%.1f%%]", margin), "Average Return: " .. ProspectMe.FormatPrice(lifetimeReturn),1,1,1,1,1,1) | |
131 self:AddLine(" ") | |
114 end | 132 end |
115 if spellid then | |
116 ctp = price * 20 | |
117 lifetimeReturn = lifetimeReturn * 4 | |
118 end | |
119 local profit = lifetimeReturn - ctp | |
120 local margin = (lifetimeReturn / ctp * 100) - 100 | |
121 self:AddDoubleLine("Estimated Profit: " .. ProspectMe.FormatPrice(profit), "Cost to " .. spelltext .. ": " .. ProspectMe.FormatPrice(ctp),1,1,1,1,1,1) | |
122 if margin < 15 then | |
123 color = "|cffff0000" | |
124 elseif margin < 30 then | |
125 color = "|cffffff00" | |
126 else | |
127 color = "|cff00ff00" | |
128 end | |
129 self:AddDoubleLine("Margin: " .. color .. string.format("[%.1f%%]", margin), "Average Return: " .. ProspectMe.FormatPrice(lifetimeReturn),1,1,1,1,1,1) | |
130 self:AddLine(" ") | |
131 | 133 |
132 -- Results Text Block | 134 -- Results Text Block |
133 local t | 135 local quals = ProspectMe.Config.ShowQualities |
134 if IsAltKeyDown() == ProspectMe.Config.PerSession then | 136 if quals.Junk or quals.Common or quals.Uncommon or quals.Rare or quals.Epic then |
135 t = ProspectMe.Results | 137 local hint = true |
136 self:AddDoubleLine("Lifetime Results","Hold Alt to display",1,0.82,0,0.5,0.5,0.5) | 138 local tab |
137 else | 139 if IsAltKeyDown() == ProspectMe.Config.PerSession then |
138 t = ProspectMe.Session | 140 tab = ProspectMe.Results |
139 self:AddDoubleLine("Session Results","Hold Alt to display",1,0.82,0,0.5,0.5,0.5) | 141 self:AddDoubleLine("Lifetime Results","Hold Alt to display",1,0.82,0,0.5,0.5,0.5) |
140 end | 142 else |
141 if t[item] then | 143 tab = ProspectMe.Session |
142 for q = 7, 0, -1 do | 144 self:AddDoubleLine("Session Results","Hold Alt to display",1,0.82,0,0.5,0.5,0.5) |
143 for result, num in pairs(t[item]) do | 145 end |
144 if result ~= "TimesProspected" and select(3, GetItemInfo(result)) == q and ProspectMe.Config.ShowQualities[Quality[q]] then | 146 if tab[item] then |
145 local p, n = "", "" | 147 for q = 7, 0, -1 do |
146 if ProspectMe.Config.ShowPercent then | 148 for result, num in pairs(tab[item]) do |
147 p = num/t[item].TimesProspected*100 | 149 if result ~= "TimesProspected" and select(3, GetItemInfo(result)) == q and ProspectMe.Config.ShowQualities[Quality[q]] then |
148 if p < 10 then | 150 hint = false |
149 p = string.format("|cffffffff[%.1f%%] ", p) | 151 local p, n = "", "" |
152 if ProspectMe.Config.ShowPercent then | |
153 p = num/tab[item].TimesProspected*100 | |
154 if p < 10 then | |
155 p = string.format("|cffffffff[%.1f%%] ", p) | |
156 else | |
157 p = string.format("|cffffffff[%.0f%%] ", p) | |
158 end | |
150 else | 159 else |
151 p = string.format("|cffffffff[%.0f%%] ", p) | 160 p = "" |
152 end | 161 end |
153 else | 162 if ProspectMe.Config.ShowNumber then |
154 p = "" | 163 n = "|cffffffffx" .. num |
164 else | |
165 n = "" | |
166 end | |
167 self:AddDoubleLine(p .. select(2, GetItemInfo(result)) .. n, ProspectMe.FormatPrice(ProspectMe.GetItemValue(result))) | |
155 end | 168 end |
156 if ProspectMe.Config.ShowNumber then | |
157 n = "|cffffffffx" .. num | |
158 else | |
159 n = "" | |
160 end | |
161 self:AddDoubleLine(p .. select(2, GetItemInfo(result)) .. n, ProspectMe.FormatPrice(ProspectMe.GetItemValue(result))) | |
162 end | 169 end |
163 end | 170 end |
164 end | 171 end |
172 if hint then | |
173 if spellid == 225902 or spellid == 225904 or subclass == ProspectMe.Vars.ORE then | |
174 self:AddLine("|cffffffffTry Prospecting some ore to see your results!") | |
175 elseif spellid == 210116 or subclass == ProspectMe.Vars.HERB then | |
176 self:AddLine("|cffffffffTry Milling some plants to see your results!") | |
177 else | |
178 self:Addline("|cffffffffTry processing some material to see your results!") | |
179 end | |
180 end | |
181 | |
165 --self:AddLine(" ") | 182 --self:AddLine(" ") |
166 end | 183 end |
167 end | 184 end |
168 cleared = true | 185 cleared = true |
169 end | 186 end |