# HG changeset patch # User Vynn # Date 1480352951 18000 # Node ID f9b6c0305908edd00a00dae52aa722574bccdf9c # Parent 8d7cc246ec1129651c5e9292adda58df874f338c 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 diff -r 8d7cc246ec11 -r f9b6c0305908 Modules/ProspectMe_Tables.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Modules/ProspectMe_Tables.lua Mon Nov 28 12:09:11 2016 -0500 @@ -0,0 +1,105 @@ +local function Initialize () + + --clear out tables before setting them fresh on load + ProspectMe.Tables = {} + + ProspectMe.Tables.Herbs = { + [765] = 1, -- Silverleaf + [785] = 0, -- Mageroyal + [2447] = 1, -- Peacebloom + [2449] = 1, -- Earthroot + [2450] = 25, -- Briarthorn + [2452] = 25, -- Swiftthistle + [2453] = 25, -- Bruiseweed + [3355] = 75, -- Wild Steelbloom + [3356] = 75, -- Kingsblood + [3357] = 75, -- Liferoot + [3358] = 125, -- Khadgar's Whisker + [3369] = 75, -- Grave Moss + [3818] = 125, -- Fadeleaf + [3819] = 125, -- Dragon's Teeth + [3820] = 25, -- Stranglekelp + [3821] = 125, -- Goldthorn + [4625] = 175, -- Firebloom + [8831] = 175, -- Purple Lotus + [8836] = 175, -- Arthas' Tears + [8838] = 175, -- Sungrass + [8839] = 175, -- Blindweed + [8845] = 175, -- Ghost Mushroom + [8846] = 175, -- Gromsblood + [13463] = 225, -- Dreamfoil + [13464] = 225, -- Golden Sansam + [13465] = 225, -- Mountain Silversage + [13466] = 225, -- Sorrowmoss + [13467] = 200, -- Icecap + [22785] = 275, -- Felweed + [22786] = 275, -- Dreaming Glory + [22787] = 275, -- Ragveil + [22789] = 275, -- Terocone + [22790] = 275, -- Ancient Lichen + [22791] = 275, -- Netherbloom + [22792] = 275, -- Nightmare Vine + [22793] = 275, -- Mana Thistle + [36901] = 325, -- Goldclover + [36903] = 325, -- Adder's Tongue + [36904] = 325, -- Tiger Lily + [36905] = 325, -- Lichbloom + [36906] = 325, -- Icethorn + [36907] = 325, -- Talandra's Rose + [37921] = 325, -- Deadnettle + [39970] = 325, -- Fire Leaf + [52983] = 425, -- Cinderbloom + [52984] = 425, -- Stormvine + [52985] = 450, -- Azshara's Veil + [52986] = 450, -- Heartblossom + [52987] = 475, -- Twilight Jasmine + [52988] = 475, -- Whiptail + [72234] = 500, -- Green Tea Leaf + [72235] = 500, -- Silkweed + [72237] = 500, -- Rain Poppy + [79010] = 500, -- Snow Lily + [79011] = 500, -- Fool's Cap + [89639] = 500, -- Desecrated Herb + [109124] = 0, -- Frostweed + [109125] = 0, -- Fireweed + [109126] = 0, -- Gorgrond Flytrap + [109127] = 0, -- Starflower + [109128] = 0, -- Nagrand Arrowbloom + [109129] = 0, -- Talador Orchid + [109130] = 0, -- Chameleon Lotus + [124101] = 0, -- Aethril + [124102] = 0, -- Dreamleaf + [124103] = 0, -- Foxflower + [124104] = 0, -- Fjarnskaggl + [124105] = 0, -- Starlight Rose + [124106] = 0, -- Felwort + [128304] = 0, -- Yseralline Seed + } + + ProspectMe.Tables.Ores = { + [2770] = 1, -- Copper Ore + [2771] = 50, -- Tin Ore + [2772] = 125, -- Iron Ore + [3858] = 175, -- Mithril Ore + [10620] = 250, -- Thorium Ore + [23424] = 275, -- Fel Iron Ore + [23425] = 325, -- Adamantite Ore + [36909] = 350, -- Cobalt Ore + [36910] = 450, -- Titanium Ore + [36912] = 400, -- Saronite Ore + [52183] = 500, -- Pyrite Ore + [52185] = 475, -- Elementium Ore + [53038] = 425, -- Obsidium Ore + [72092] = 500, -- Ghost Iron Ore + [72093] = 550, -- Kyparite + [72094] = 600, -- Black Trillium Ore + [72103] = 600, -- White Trillium Ore + [123918] = 0, -- Leystone Ore + [123919] = 0, -- Felslate + } + +end + +local frame = CreateFrame("FRAME", "ProspectMe_Tables") +frame:RegisterEvent("VARIABLES_LOADED") +frame:SetScript("OnEvent", Initialize) \ No newline at end of file diff -r 8d7cc246ec11 -r f9b6c0305908 ProspectMe.lua --- a/ProspectMe.lua Sun Nov 20 23:15:57 2016 -0500 +++ b/ProspectMe.lua Mon Nov 28 12:09:11 2016 -0500 @@ -55,6 +55,7 @@ PerSession = false, ShowPercent = true, ShowNumber = true, + ShowEconomics = true, } end if not ProspectMe.Results then @@ -124,27 +125,30 @@ Expects the Item ID and pairs of arguments in table with key being the result's ItemID and value being the quantity returned ]] ProspectMe.AddEntry = function (ItemID, BatchSize, ResultsTable) - if not ProspectMe.Results[ItemID] then - ProspectMe.Results[ItemID] = { TimesProspected = 0 } + if ProspectMe.Tables.Ores[ItemID] or ProspectMe.Tables.Herbs[ItemID] then + if not ProspectMe.Results[ItemID] then + ProspectMe.Results[ItemID] = { TimesProspected = 0 } + end + if not ProspectMe.Session[ItemID] then + ProspectMe.Session[ItemID] = { TimesProspected = 0 } + end + for k, v in pairs(ResultsTable) do + if not ProspectMe.Results[ItemID][k] then + ProspectMe.Results[ItemID][k] = v + else + ProspectMe.Results[ItemID][k] = ProspectMe.Results[ItemID][k] + v + end + if not ProspectMe.Session[ItemID][k] then + ProspectMe.Session[ItemID][k] = v + else + ProspectMe.Session[ItemID][k] = ProspectMe.Session[ItemID][k] + v + end + end + ProspectMe.Results[ItemID].TimesProspected = ProspectMe.Results[ItemID].TimesProspected + BatchSize + ProspectMe.Session[ItemID].TimesProspected = ProspectMe.Session[ItemID].TimesProspected + BatchSize + else + print("Attempted to create invalid entry for ID: ", ItemID) end - if not ProspectMe.Session[ItemID] then - ProspectMe.Session[ItemID] = { TimesProspected = 0 } - end - for k, v in pairs(ResultsTable) do - if not ProspectMe.Results[ItemID][k] then - ProspectMe.Results[ItemID][k] = v - else - ProspectMe.Results[ItemID][k] = ProspectMe.Results[ItemID][k] + v - end - if not ProspectMe.Session[ItemID][k] then - ProspectMe.Session[ItemID][k] = v - else - ProspectMe.Session[ItemID][k] = ProspectMe.Session[ItemID][k] + v - end - end - ProspectMe.Results[ItemID].TimesProspected = ProspectMe.Results[ItemID].TimesProspected + BatchSize - ProspectMe.Session[ItemID].TimesProspected = ProspectMe.Session[ItemID].TimesProspected + BatchSize - end --[[ diff -r 8d7cc246ec11 -r f9b6c0305908 ProspectMe_Tooltip.lua --- a/ProspectMe_Tooltip.lua Sun Nov 20 23:15:57 2016 -0500 +++ b/ProspectMe_Tooltip.lua Mon Nov 28 12:09:11 2016 -0500 @@ -100,68 +100,85 @@ self:AddLine(" ") -- Economics Text Block - local spelltext - if spellid == 225902 or spellid == 225904 then - spelltext = "Mass Prospect" - elseif spellid == 210116 then - spelltext = "Mass Mill" - elseif subclass == ProspectMe.Vars.ORE then - spelltext = "Prospect" - elseif subclass == ProspectMe.Vars.HERB then - spelltext = "Mill" - else - spelltext = "Process" + if ProspectMe.Config.ShowEconomics then + local spelltext + if spellid == 225902 or spellid == 225904 then + spelltext = "Mass Prospect" + elseif spellid == 210116 then + spelltext = "Mass Mill" + elseif subclass == ProspectMe.Vars.ORE then + spelltext = "Prospect" + elseif subclass == ProspectMe.Vars.HERB then + spelltext = "Mill" + else + spelltext = "Process" + end + if spellid then + ctp = price * 20 + lifetimeReturn = lifetimeReturn * 4 + end + local profit = lifetimeReturn - ctp + local margin = (lifetimeReturn / ctp * 100) - 100 + self:AddDoubleLine("Estimated Profit: " .. ProspectMe.FormatPrice(profit), "Cost to " .. spelltext .. ": " .. ProspectMe.FormatPrice(ctp),1,1,1,1,1,1) + if margin < 15 then + color = "|cffff0000" + elseif margin < 30 then + color = "|cffffff00" + else + color = "|cff00ff00" + end + self:AddDoubleLine("Margin: " .. color .. string.format("[%.1f%%]", margin), "Average Return: " .. ProspectMe.FormatPrice(lifetimeReturn),1,1,1,1,1,1) + self:AddLine(" ") end - if spellid then - ctp = price * 20 - lifetimeReturn = lifetimeReturn * 4 - end - local profit = lifetimeReturn - ctp - local margin = (lifetimeReturn / ctp * 100) - 100 - self:AddDoubleLine("Estimated Profit: " .. ProspectMe.FormatPrice(profit), "Cost to " .. spelltext .. ": " .. ProspectMe.FormatPrice(ctp),1,1,1,1,1,1) - if margin < 15 then - color = "|cffff0000" - elseif margin < 30 then - color = "|cffffff00" - else - color = "|cff00ff00" - end - self:AddDoubleLine("Margin: " .. color .. string.format("[%.1f%%]", margin), "Average Return: " .. ProspectMe.FormatPrice(lifetimeReturn),1,1,1,1,1,1) - self:AddLine(" ") -- Results Text Block - local t - if IsAltKeyDown() == ProspectMe.Config.PerSession then - t = ProspectMe.Results - self:AddDoubleLine("Lifetime Results","Hold Alt to display",1,0.82,0,0.5,0.5,0.5) - else - t = ProspectMe.Session - self:AddDoubleLine("Session Results","Hold Alt to display",1,0.82,0,0.5,0.5,0.5) - end - if t[item] then - for q = 7, 0, -1 do - for result, num in pairs(t[item]) do - if result ~= "TimesProspected" and select(3, GetItemInfo(result)) == q and ProspectMe.Config.ShowQualities[Quality[q]] then - local p, n = "", "" - if ProspectMe.Config.ShowPercent then - p = num/t[item].TimesProspected*100 - if p < 10 then - p = string.format("|cffffffff[%.1f%%] ", p) + local quals = ProspectMe.Config.ShowQualities + if quals.Junk or quals.Common or quals.Uncommon or quals.Rare or quals.Epic then + local hint = true + local tab + if IsAltKeyDown() == ProspectMe.Config.PerSession then + tab = ProspectMe.Results + self:AddDoubleLine("Lifetime Results","Hold Alt to display",1,0.82,0,0.5,0.5,0.5) + else + tab = ProspectMe.Session + self:AddDoubleLine("Session Results","Hold Alt to display",1,0.82,0,0.5,0.5,0.5) + end + if tab[item] then + for q = 7, 0, -1 do + for result, num in pairs(tab[item]) do + if result ~= "TimesProspected" and select(3, GetItemInfo(result)) == q and ProspectMe.Config.ShowQualities[Quality[q]] then + hint = false + local p, n = "", "" + if ProspectMe.Config.ShowPercent then + p = num/tab[item].TimesProspected*100 + if p < 10 then + p = string.format("|cffffffff[%.1f%%] ", p) + else + p = string.format("|cffffffff[%.0f%%] ", p) + end else - p = string.format("|cffffffff[%.0f%%] ", p) + p = "" end - else - p = "" + if ProspectMe.Config.ShowNumber then + n = "|cffffffffx" .. num + else + n = "" + end + self:AddDoubleLine(p .. select(2, GetItemInfo(result)) .. n, ProspectMe.FormatPrice(ProspectMe.GetItemValue(result))) end - if ProspectMe.Config.ShowNumber then - n = "|cffffffffx" .. num - else - n = "" - end - self:AddDoubleLine(p .. select(2, GetItemInfo(result)) .. n, ProspectMe.FormatPrice(ProspectMe.GetItemValue(result))) end end end + if hint then + if spellid == 225902 or spellid == 225904 or subclass == ProspectMe.Vars.ORE then + self:AddLine("|cffffffffTry Prospecting some ore to see your results!") + elseif spellid == 210116 or subclass == ProspectMe.Vars.HERB then + self:AddLine("|cffffffffTry Milling some plants to see your results!") + else + self:Addline("|cffffffffTry processing some material to see your results!") + end + end + --self:AddLine(" ") end end