changeset 60:155fa49865f2 v2.7.1.2-Alpha

Changed directory structure around to clean it up a bit.
author Vynn <mischivin@gmail.com>
date Mon, 28 Nov 2016 12:28:35 -0500
parents ef591210a1e4
children c3dc8c711bcf
files Modules/ProspectMe_Config.lua Modules/ProspectMe_Migrate.lua Modules/ProspectMe_Tooltip.lua Modules/ProspectMe_Value.lua ProspectMe.toc ProspectMe_Config.lua ProspectMe_Migrate.lua ProspectMe_Tooltip.lua ProspectMe_Value.lua
diffstat 9 files changed, 456 insertions(+), 454 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Modules/ProspectMe_Config.lua	Mon Nov 28 12:28:35 2016 -0500
@@ -0,0 +1,184 @@
+local ProspectMeFrame = CreateFrame( "Frame", "PM_ConfigFrame", InterfaceOptionsFramePanelContainer)
+local Title = PM_ConfigFrame:CreateFontString( "ProspectMeTitle", nil, "GameFontNormalLarge")
+local EpicToggle = CreateFrame( "CheckButton", "ProspectMeEpicToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" )
+local RareToggle = CreateFrame( "CheckButton", "ProspectMeRareToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" )
+local UncommonToggle = CreateFrame( "CheckButton", "ProspectMeUncommonToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" )
+local CommonToggle = CreateFrame( "CheckButton", "ProspectMeCommonToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" )
+local PoorToggle = CreateFrame( "CheckButton", "ProspectMePoorToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" )
+local EconToggle = CreateFrame( "CheckButton", "ProspectMeEconToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" )
+local SessionToggle = CreateFrame( "CheckButton", "ProspectMeSessionToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" )
+local PercentToggle = CreateFrame( "CheckButton", "ProspectMePercentToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" )
+local NumberToggle = CreateFrame( "CheckButton", "ProspectMeNumberToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" )
+local ResetResults = CreateFrame( "Button", "ProspectMeResetButton", ProspectMeFrame, "UIPanelButtonTemplate" )
+local ResetText = PM_ConfigFrame:CreateFontString( "ProspectMeResetText", nil, "GameFontNormal" )
+
+local function SpewMessage(handle, msg)
+	if handle == "loaded" then
+		print(PM_LOADMSG)
+	elseif handle == "help" then
+		print(PM_HELPMSG)
+		SpewMessage(PM_CONFIG, PM_CONFIGTOOLTIP)
+		SpewMessage(PM_EPIC, PM_EPICTOOLTIP)
+		SpewMessage(PM_RARE, PM_RARETOOLTIP)
+		SpewMessage(PM_UNCOMMON, PM_UNCOMMONTOOLTIP)
+		SpewMessage(PM_COMMON, PM_COMMONTOOLTIP)
+		SpewMessage(PM_POOR, PM_POORTOOLTIP)
+		SpewMEssage(PM_ECON, PM_ECONTOOLTIP)
+		SpewMessage(PM_SESSION, PM_SESSIONTOOLTIP)
+		SpewMessage(PM_PERCENT, PM_PERCENTTOOLTIP)
+		SpewMessage(PM_NUMBER, PM_NUMBERTOOLTIP)
+		SpewMessage(PM_RESET, PM_RESETTOOLTIP)
+	else
+		print("|cFFFFCC00" .. handle .. "|r - " .. msg)
+	end
+end
+
+local function ResetDatabase()
+	if ProspectMe.Results then
+		ProspectMe.Results = {}
+	end
+end
+
+local function UpdateConfig()
+	ProspectMe.Config.ShowQualities.Junk = ProspectMePoorToggle:GetChecked()
+	ProspectMe.Config.ShowQualities.Common = ProspectMeCommonToggle:GetChecked()
+	ProspectMe.Config.ShowQualities.Uncommon = ProspectMeUncommonToggle:GetChecked()
+	ProspectMe.Config.ShowQualities.Rare = ProspectMeRareToggle:GetChecked()
+	ProspectMe.Config.ShowQualities.Epic = ProspectMeEpicToggle:GetChecked()
+	ProspectMe.Config.ShowEconomics = ProspectMeEconToggle:GetChecked()
+	ProspectMe.Config.PerSession = ProspectMeSessionToggle:GetChecked()
+	ProspectMe.Config.ShowPercent = ProspectMePercentToggle:GetChecked()
+	ProspectMe.Config.ShowNumber = ProspectMeNumberToggle:GetChecked()
+end
+
+local function PM_ConfigInit()
+	StaticPopupDialogs["PM_ConfirmReset"] = {
+  		text = PM_RESETWARNING,
+  		button1 = YES,
+  		button2 = NO,
+  		OnAccept = function()
+      		ResetDatabase()
+  		end,
+  		timeout = 30,
+  		whileDead = true,
+  		hideOnEscape = true,
+  		preferredIndex = 3,
+		}
+
+	ProspectMeFrame.name = "Prospect Me"
+ 
+	ProspectMeTitle:SetPoint("TOP", 0, -16)
+	ProspectMeTitle:SetText(GetAddOnMetadata("ProspectMe", "Title") .. " v" .. GetAddOnMetadata("ProspectMe", "Version"))
+   	
+	ProspectMeEconToggle:SetPoint( "TOPLEFT", 16, -46 )
+	ProspectMeEconToggle:SetScript("OnClick", UpdateConfig)
+	ProspectMeEconToggle:SetChecked(ProspectMe.Config.ShowEconomics)
+	ProspectMeEconToggleText:SetText(PM_ECONTOGGLE)
+	ProspectMeEconToggle.tooltipText = PM_ECONTOOLTIP
+
+	ProspectMeSessionToggle:SetPoint( "TOPLEFT", 32, -46 )
+	ProspectMeSessionToggle:SetScript("OnClick", UpdateConfig)
+	ProspectMeSessionToggle:SetChecked(ProspectMe.Config.PerSession)
+	ProspectMeSessionToggleText:SetText(PM_SESSIONTOGGLE)
+	ProspectMeSessionToggle.tooltipText = PM_SESSIONTOOLTIP
+	
+	ProspectMePercentToggle:SetPoint( "TOPLEFT", 32, -70 )
+	ProspectMePercentToggle:SetScript("OnClick", UpdateConfig)
+	ProspectMePercentToggle:SetChecked(ProspectMe.Config.ShowPercent)
+	ProspectMePercentToggleText:SetText(PM_PERCENTTOGGLE)
+	ProspectMePercentToggle.tooltipText = PM_PERCENTTOOLTIP
+  
+	ProspectMeNumberToggle:SetPoint( "TOPLEFT", 32, -94 )
+	ProspectMeNumberToggle:SetScript("OnClick", UpdateConfig)
+	ProspectMeNumberToggle:SetChecked(ProspectMe.Config.ShowNumber)
+	ProspectMeNumberToggleText:SetText(PM_NUMBERTOGGLE)
+	ProspectMeNumberToggle.tooltipText = PM_NUMBERTOOLTIP
+
+	ProspectMeEpicToggle:SetPoint( "TOPLEFT", 32, -118 )
+	ProspectMeEpicToggle:SetScript("OnClick", UpdateConfig)
+	ProspectMeEpicToggle:SetChecked(ProspectMe.Config.ShowQualities.Epic)
+	ProspectMeEpicToggleText:SetText(PM_EPICTOGGLE)
+	ProspectMeEpicToggle.tooltipText = PM_EPICTOOLTIP
+	
+	ProspectMeRareToggle:SetPoint( "TOPLEFT", 32, -142 )
+	ProspectMeRareToggle:SetScript("OnClick", UpdateConfig)
+	ProspectMeRareToggle:SetChecked(ProspectMe.Config.ShowQualities.Rare)
+	ProspectMeRareToggleText:SetText(PM_RARETOGGLE)
+	ProspectMeRareToggle.tooltipText = PM_RARETOOLTIP
+		
+	ProspectMeUncommonToggle:SetPoint( "TOPLEFT", 32, -166 )
+	ProspectMeUncommonToggle:SetScript("OnClick", UpdateConfig)
+	ProspectMeUncommonToggle:SetChecked(ProspectMe.Config.ShowQualities.Uncommon)
+	ProspectMeUncommonToggleText:SetText(PM_UNCOMMONTOGGLE)
+	ProspectMeUncommonToggle.tooltipText = PM_UNCOMMONTOOLTIP
+	
+	ProspectMeCommonToggle:SetPoint( "TOPLEFT", 32, -190 )
+	ProspectMeCommonToggle:SetScript("OnClick", UpdateConfig)
+	ProspectMeCommonToggle:SetChecked(ProspectMe.Config.ShowQualities.Common)
+	ProspectMeCommonToggleText:SetText(PM_COMMONTOGGLE)
+	ProspectMeCommonToggle.tooltipText = PM_COMMONTOOLTIP
+	
+	ProspectMePoorToggle:SetPoint( "TOPLEFT", 32, -214 )
+	ProspectMePoorToggle:SetScript("OnClick", UpdateConfig)
+	ProspectMePoorToggle:SetChecked(ProspectMe.Config.ShowQualities.Poor)
+	ProspectMePoorToggleText:SetText(PM_POORTOGGLE)
+	ProspectMePoorToggle.tooltipText = PM_POORTOOLTIP
+
+	ProspectMeResetButton:SetPoint("TOP", 0, -310 )
+	ProspectMeResetButton:SetScript("OnClick", 	function(self) StaticPopup_Show("PM_ConfirmReset") end)
+	ProspectMeResetButton:SetSize(250, 25)
+	ProspectMeResetButton:SetText(PM_RESETBUTTON)
+
+	ProspectMeResetText:SetPoint("TOP", 0, -286)
+	ProspectMeResetText:SetText(PM_RESETTOOLTIP)
+
+	InterfaceOptions_AddCategory(ProspectMeFrame)
+
+end
+
+local function EventHandler(event, arg1)
+	if (ProspectMe.Config) then
+		PM_ConfigInit()
+	end
+	SpewMessage("loaded")
+end
+
+function SlashCmdList.PROSPECTME(msg, editbox)
+	if msg == PM_CONFIG then
+		InterfaceOptionsFrame_OpenToCategory(ProspectMeFrame)
+	elseif msg == PM_ECON then
+		ProspectMeEconToggle:SetChecked(not ProspectMeEconToggle:GetChecked())
+		UpdateConfig()
+	elseif msg == PM_EPIC then
+		ProspectMeEpicToggle:SetChecked(not ProspectMeEpicToggle:GetChecked())
+		UpdateConfig()
+	elseif msg == PM_RARE then
+		ProspectMeRareToggle:SetChecked(not ProspectMeRareToggle:GetChecked())
+		UpdateConfig()
+	elseif msg == PM_UNCOMMON then
+		ProspectMeUncommonToggle:SetChecked(not ProspectMeUncommonToggle:GetChecked())
+		UpdateConfig()
+	elseif msg == PM_COMMON then
+		ProspectMeCommonToggle:SetChecked(not ProspectMeCommonToggle:GetChecked())
+		UpdateConfig()		
+	elseif msg == PM_POOR then
+		ProspectMePoorToggle:SetChecked(not ProspectMePoorToggle:GetChecked())
+		UpdateConfig()
+	elseif msg == PM_SESSION then
+		ProspectMeSessionToggle:SetChecked(not ProspectMeSessionToggle:GetChecked())
+		UpdateConfig()
+	elseif msg == PM_PERCENT then
+		ProspectMePercentToggle:SetChecked(not ProspectMePercentToggle:GetChecked())
+		UpdateConfig()
+	elseif msg == PM_NUMBER then
+		ProspectMeNumberToggle:SetChecked(not ProspectMeNumberToggle:GetChecked())
+		UpdateConfig()
+	elseif msg == PM_RESET then
+		StaticPopup_Show("PM_ConfirmReset")
+	else
+		SpewMessage("help")
+	end
+end
+
+ProspectMeFrame:RegisterEvent("VARIABLES_LOADED")
+ProspectMeFrame:SetScript("OnEvent", EventHandler)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Modules/ProspectMe_Migrate.lua	Mon Nov 28 12:28:35 2016 -0500
@@ -0,0 +1,41 @@
+local ORE = select(7,GetItemInfo(123918))
+local HERB = select(7,GetItemInfo(128304))
+
+local function Initialize ()
+	ProspectMe.Migrate = function ()
+		print("Attempting to migrate ProspectMe database")
+		if PM_ResultsTable then
+			print("|cffffff00ProspectMe v1 database found|r")
+			for Container, Item in pairs(PM_ResultsTable) do
+				local C = tonumber(Container)
+				local B = nil
+				local RT = {}
+				for Result, Quantity in pairs (Item) do
+					if Result == "timesProspected" then
+						B = Quantity
+					else 
+						RT[tonumber(Result)] = Quantity
+					end
+				end
+				if select(7,GetItemInfo(C)) == ORE or select(7,GetItemInfo(C)) == HERB then
+					ProspectMe.AddEntry(C, B, RT)
+				end
+			end
+			print("|cff00ff00Database migrated sucessfully!|r")
+			PM_ResultsTable = nil
+			PM_ItemTable = nil
+			PM_Config = nil
+		else
+			print("|cffff0000Error, ProspectMe v1 database not found|r")
+		end
+	end
+
+	if PM_ResultsTable then
+		print("ProspectMe v1 database found, to migrate your database to v2 run the command |cff00ff00/script ProspectMe.Migrate()|r \n |cffff0000Warning, this action is irreversable!|r")
+	end
+end
+
+local frame = CreateFrame("FRAME", "ProspectMe_Value")
+frame:RegisterEvent("VARIABLES_LOADED")
+--frame:SetScript("OnEvent", EventHandler)
+frame:SetScript("OnEvent", Initialize)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Modules/ProspectMe_Tooltip.lua	Mon Nov 28 12:28:35 2016 -0500
@@ -0,0 +1,198 @@
+local Quality = { [0] = "Junk", [1]= "Common", [2] = "Uncommon", [3] = "Rare", [4] = "Epic", }
+
+local function Initialize()
+	ProspectMe.FormatPrice = function (value)
+
+		local GSC_GOLD="ffffd100"
+		local GSC_SILVER="ffe6e6e6"
+		local GSC_COPPER="ffc8602c"
+
+		local g, s, c
+		local digits = 0
+		local gsc
+
+		g = math.floor(value/10000)
+		s = math.fmod(math.floor(value/100),100)
+		c = math.fmod(value,100)
+
+
+		digits = math.floor(math.log10(value)+1)
+
+		if ( digits < 3 ) then
+			gsc = string.format("   |c%s%2d|r",  GSC_COPPER, c)
+		elseif ( digits < 5 ) then
+			gsc = string.format("|c%s%2d|r |c%s%02d|r", GSC_SILVER, s, GSC_COPPER, c)
+		elseif ( digits < 7 ) then
+			gsc = string.format("|c%s%2d|r |c%s%02d|r", GSC_GOLD, g, GSC_SILVER, s)
+		elseif ( digits < 9 ) then
+			gsc = string.format("|c%s%5d|r", GSC_GOLD, g)
+		else
+			gsc = string.format("|c%s%2.1fk|r", GSC_GOLD, g/1000)
+		end
+
+		return gsc
+	end
+
+	ProspectMe.GetReturn = function (containerID)
+		local averageReturn = 0
+		if ProspectMe.Results[containerID].TimesProspected > 0 then
+			for itemID, num in pairs(ProspectMe.Results[containerID]) do
+				if itemID ~= "TimesProspected" then
+					averageReturn = averageReturn + ProspectMe.GetItemValue(itemID) * num 
+				end
+			end
+			averageReturn = averageReturn/ProspectMe.Results[containerID].TimesProspected
+		end
+			return tonumber(string.format("%.0f", averageReturn))
+	end
+end
+
+local cleared = true
+local function OnTooltipCleared(self)
+   cleared = true   
+end
+ 
+local function OnTooltipSetItem(self)
+	if cleared then
+		local tooltipLink = select(2, self:GetItem())
+		local spellid = select(3, self:GetSpell())
+		local item = nil
+		if spellid == 225902 then
+			item = 123918
+		elseif spellid == 225904 then
+			item = 123919
+		elseif spellid == 210116 then
+			item = 128304
+		elseif tooltipLink then 
+			item = tonumber(tooltipLink:match("Hitem:(%d+)"))
+			spellid = nil
+		else
+			item = nil
+			spellid = nil
+		end
+		if item then
+			if ProspectMe.Results[item] then
+				local price = ProspectMe.GetItemValue(item)
+				local lifetimeReturn = ProspectMe.GetReturn(item)
+				local subclass = select(7,GetItemInfo(item))
+				local ctp = price * 5
+				--NumofEachQuality, Percent of Each Quality
+				self:AddLine(" ")
+				local color
+				if ProspectMe.Results[item].TimesProspected < 100 then
+					color = "|cffff0000"
+				elseif ProspectMe.Results[item].TimesProspected < 200 then
+					color = "|cffffff00"
+				else
+					color = "|cff00ff00"
+				end
+				
+				-- SKill Text Block ""
+				local skilltext
+				if spellid == 225902 or spellid == 225904 or subclass == ProspectMe.Vars.ORE then
+					skilltext = "Prospected"
+				elseif spellid == 210116 or subclass == ProspectMe.Vars.HERB then
+					skilltext = "Milled"
+				else
+					skilltext = "Processed"
+				end
+				self:AddDoubleLine("Prospect Me","Times " .. skilltext .. ":  " .. color .. ProspectMe.Results[item].TimesProspected,1,0.82,0,1,1,1)
+				self:AddLine(" ")
+				
+				-- Economics Text Block
+				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
+				
+				-- Results Text Block
+				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 = ""
+									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
+					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
+			cleared = true
+		end
+	end
+end
+ 
+GameTooltip:HookScript("OnTooltipCleared", OnTooltipCleared)
+GameTooltip:HookScript("OnTooltipSetItem", OnTooltipSetItem)
+ItemRefTooltip:HookScript("OnTooltipCleared", OnTooltipCleared)
+ItemRefTooltip:HookScript("OnTooltipSetItem", OnTooltipSetItem)
+
+local frame = CreateFrame("FRAME", "ProspectMe_Value")
+frame:RegisterEvent("VARIABLES_LOADED")
+--frame:SetScript("OnEvent", EventHandler)
+frame:SetScript("OnEvent", Initialize)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Modules/ProspectMe_Value.lua	Mon Nov 28 12:28:35 2016 -0500
@@ -0,0 +1,26 @@
+local function Initialize ()
+	ProspectMe.GetItemValue = function (itemID)
+		local v = nil
+		
+		if GetAuctionBuyout then -- if an installed addon supports Tekkub's GetAuctionBuyout API: Auctionator, AuctionLite, etc...
+			v = GetAuctionBuyout(itemID)
+		elseif AucAdvanced then -- Auctioneer Support
+			v = AucAdvanced.API.GetMarketValue(PM_ItemTable[itemID].link)
+		end
+		
+		if v == nil then -- provides a failsafe if Auctioneer, etc is set to Load on Demand
+			v = select(11, GetItemInfo(itemID))
+		end
+		
+		if v == nil then -- provides a final failsafe - if we can't find anything, set it to 0 (TY peterwemm!)
+			v = 0.0
+		end
+
+		return tonumber(v)
+	end
+end
+
+local frame = CreateFrame("FRAME", "ProspectMe_Value")
+frame:RegisterEvent("VARIABLES_LOADED")
+--frame:SetScript("OnEvent", EventHandler)
+frame:SetScript("OnEvent", Initialize)
\ No newline at end of file
--- a/ProspectMe.toc	Mon Nov 28 12:11:42 2016 -0500
+++ b/ProspectMe.toc	Mon Nov 28 12:28:35 2016 -0500
@@ -9,9 +9,11 @@
 ## X-Email: 
 
 localization.lua
-ProspectMe.lua
-ProspectMe_Value.lua
-ProspectMe_Tooltip.lua
-ProspectMe_Config.lua
-ProspectMe_Migrate.lua
 
+Modules\ProspectMe_Value.lua
+Modules\ProspectMe_Tooltip.lua
+Modules\ProspectMe_Config.lua
+Modules\ProspectMe_Migrate.lua
+Modules\ProspectMe_Tables.lua
+
+ProspectMe.lua
\ No newline at end of file
--- a/ProspectMe_Config.lua	Mon Nov 28 12:11:42 2016 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
-local ProspectMeFrame = CreateFrame( "Frame", "PM_ConfigFrame", InterfaceOptionsFramePanelContainer)
-local Title = PM_ConfigFrame:CreateFontString( "ProspectMeTitle", nil, "GameFontNormalLarge")
-local EpicToggle = CreateFrame( "CheckButton", "ProspectMeEpicToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" )
-local RareToggle = CreateFrame( "CheckButton", "ProspectMeRareToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" )
-local UncommonToggle = CreateFrame( "CheckButton", "ProspectMeUncommonToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" )
-local CommonToggle = CreateFrame( "CheckButton", "ProspectMeCommonToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" )
-local PoorToggle = CreateFrame( "CheckButton", "ProspectMePoorToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" )
-local EconToggle = CreateFrame( "CheckButton", "ProspectMeEconToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" )
-local SessionToggle = CreateFrame( "CheckButton", "ProspectMeSessionToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" )
-local PercentToggle = CreateFrame( "CheckButton", "ProspectMePercentToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" )
-local NumberToggle = CreateFrame( "CheckButton", "ProspectMeNumberToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" )
-local ResetResults = CreateFrame( "Button", "ProspectMeResetButton", ProspectMeFrame, "UIPanelButtonTemplate" )
-local ResetText = PM_ConfigFrame:CreateFontString( "ProspectMeResetText", nil, "GameFontNormal" )
-
-local function SpewMessage(handle, msg)
-	if handle == "loaded" then
-		print(PM_LOADMSG)
-	elseif handle == "help" then
-		print(PM_HELPMSG)
-		SpewMessage(PM_CONFIG, PM_CONFIGTOOLTIP)
-		SpewMessage(PM_EPIC, PM_EPICTOOLTIP)
-		SpewMessage(PM_RARE, PM_RARETOOLTIP)
-		SpewMessage(PM_UNCOMMON, PM_UNCOMMONTOOLTIP)
-		SpewMessage(PM_COMMON, PM_COMMONTOOLTIP)
-		SpewMessage(PM_POOR, PM_POORTOOLTIP)
-		SpewMEssage(PM_ECON, PM_ECONTOOLTIP)
-		SpewMessage(PM_SESSION, PM_SESSIONTOOLTIP)
-		SpewMessage(PM_PERCENT, PM_PERCENTTOOLTIP)
-		SpewMessage(PM_NUMBER, PM_NUMBERTOOLTIP)
-		SpewMessage(PM_RESET, PM_RESETTOOLTIP)
-	else
-		print("|cFFFFCC00" .. handle .. "|r - " .. msg)
-	end
-end
-
-local function ResetDatabase()
-	if ProspectMe.Results then
-		ProspectMe.Results = {}
-	end
-end
-
-local function UpdateConfig()
-	ProspectMe.Config.ShowQualities.Junk = ProspectMePoorToggle:GetChecked()
-	ProspectMe.Config.ShowQualities.Common = ProspectMeCommonToggle:GetChecked()
-	ProspectMe.Config.ShowQualities.Uncommon = ProspectMeUncommonToggle:GetChecked()
-	ProspectMe.Config.ShowQualities.Rare = ProspectMeRareToggle:GetChecked()
-	ProspectMe.Config.ShowQualities.Epic = ProspectMeEpicToggle:GetChecked()
-	ProspectMe.Config.ShowEconomics = ProspectMeEconToggle:GetChecked()
-	ProspectMe.Config.PerSession = ProspectMeSessionToggle:GetChecked()
-	ProspectMe.Config.ShowPercent = ProspectMePercentToggle:GetChecked()
-	ProspectMe.Config.ShowNumber = ProspectMeNumberToggle:GetChecked()
-end
-
-local function PM_ConfigInit()
-	StaticPopupDialogs["PM_ConfirmReset"] = {
-  		text = PM_RESETWARNING,
-  		button1 = YES,
-  		button2 = NO,
-  		OnAccept = function()
-      		ResetDatabase()
-  		end,
-  		timeout = 30,
-  		whileDead = true,
-  		hideOnEscape = true,
-  		preferredIndex = 3,
-		}
-
-	ProspectMeFrame.name = "Prospect Me"
- 
-	ProspectMeTitle:SetPoint("TOP", 0, -16)
-	ProspectMeTitle:SetText(GetAddOnMetadata("ProspectMe", "Title") .. " v" .. GetAddOnMetadata("ProspectMe", "Version"))
-   	
-	ProspectMeEconToggle:SetPoint( "TOPLEFT", 16, -46 )
-	ProspectMeEconToggle:SetScript("OnClick", UpdateConfig)
-	ProspectMeEconToggle:SetChecked(ProspectMe.Config.ShowEconomics)
-	ProspectMeEconToggleText:SetText(PM_ECONTOGGLE)
-	ProspectMeEconToggle.tooltipText = PM_ECONTOOLTIP
-
-	ProspectMeSessionToggle:SetPoint( "TOPLEFT", 32, -46 )
-	ProspectMeSessionToggle:SetScript("OnClick", UpdateConfig)
-	ProspectMeSessionToggle:SetChecked(ProspectMe.Config.PerSession)
-	ProspectMeSessionToggleText:SetText(PM_SESSIONTOGGLE)
-	ProspectMeSessionToggle.tooltipText = PM_SESSIONTOOLTIP
-	
-	ProspectMePercentToggle:SetPoint( "TOPLEFT", 32, -70 )
-	ProspectMePercentToggle:SetScript("OnClick", UpdateConfig)
-	ProspectMePercentToggle:SetChecked(ProspectMe.Config.ShowPercent)
-	ProspectMePercentToggleText:SetText(PM_PERCENTTOGGLE)
-	ProspectMePercentToggle.tooltipText = PM_PERCENTTOOLTIP
-  
-	ProspectMeNumberToggle:SetPoint( "TOPLEFT", 32, -94 )
-	ProspectMeNumberToggle:SetScript("OnClick", UpdateConfig)
-	ProspectMeNumberToggle:SetChecked(ProspectMe.Config.ShowNumber)
-	ProspectMeNumberToggleText:SetText(PM_NUMBERTOGGLE)
-	ProspectMeNumberToggle.tooltipText = PM_NUMBERTOOLTIP
-
-	ProspectMeEpicToggle:SetPoint( "TOPLEFT", 32, -118 )
-	ProspectMeEpicToggle:SetScript("OnClick", UpdateConfig)
-	ProspectMeEpicToggle:SetChecked(ProspectMe.Config.ShowQualities.Epic)
-	ProspectMeEpicToggleText:SetText(PM_EPICTOGGLE)
-	ProspectMeEpicToggle.tooltipText = PM_EPICTOOLTIP
-	
-	ProspectMeRareToggle:SetPoint( "TOPLEFT", 32, -142 )
-	ProspectMeRareToggle:SetScript("OnClick", UpdateConfig)
-	ProspectMeRareToggle:SetChecked(ProspectMe.Config.ShowQualities.Rare)
-	ProspectMeRareToggleText:SetText(PM_RARETOGGLE)
-	ProspectMeRareToggle.tooltipText = PM_RARETOOLTIP
-		
-	ProspectMeUncommonToggle:SetPoint( "TOPLEFT", 32, -166 )
-	ProspectMeUncommonToggle:SetScript("OnClick", UpdateConfig)
-	ProspectMeUncommonToggle:SetChecked(ProspectMe.Config.ShowQualities.Uncommon)
-	ProspectMeUncommonToggleText:SetText(PM_UNCOMMONTOGGLE)
-	ProspectMeUncommonToggle.tooltipText = PM_UNCOMMONTOOLTIP
-	
-	ProspectMeCommonToggle:SetPoint( "TOPLEFT", 32, -190 )
-	ProspectMeCommonToggle:SetScript("OnClick", UpdateConfig)
-	ProspectMeCommonToggle:SetChecked(ProspectMe.Config.ShowQualities.Common)
-	ProspectMeCommonToggleText:SetText(PM_COMMONTOGGLE)
-	ProspectMeCommonToggle.tooltipText = PM_COMMONTOOLTIP
-	
-	ProspectMePoorToggle:SetPoint( "TOPLEFT", 32, -214 )
-	ProspectMePoorToggle:SetScript("OnClick", UpdateConfig)
-	ProspectMePoorToggle:SetChecked(ProspectMe.Config.ShowQualities.Poor)
-	ProspectMePoorToggleText:SetText(PM_POORTOGGLE)
-	ProspectMePoorToggle.tooltipText = PM_POORTOOLTIP
-
-	ProspectMeResetButton:SetPoint("TOP", 0, -310 )
-	ProspectMeResetButton:SetScript("OnClick", 	function(self) StaticPopup_Show("PM_ConfirmReset") end)
-	ProspectMeResetButton:SetSize(250, 25)
-	ProspectMeResetButton:SetText(PM_RESETBUTTON)
-
-	ProspectMeResetText:SetPoint("TOP", 0, -286)
-	ProspectMeResetText:SetText(PM_RESETTOOLTIP)
-
-	InterfaceOptions_AddCategory(ProspectMeFrame)
-
-end
-
-local function EventHandler(event, arg1)
-	if (ProspectMe.Config) then
-		PM_ConfigInit()
-	end
-	SpewMessage("loaded")
-end
-
-function SlashCmdList.PROSPECTME(msg, editbox)
-	if msg == PM_CONFIG then
-		InterfaceOptionsFrame_OpenToCategory(ProspectMeFrame)
-	elseif msg == PM_ECON then
-		ProspectMeEconToggle:SetChecked(not ProspectMeEconToggle:GetChecked())
-		UpdateConfig()
-	elseif msg == PM_EPIC then
-		ProspectMeEpicToggle:SetChecked(not ProspectMeEpicToggle:GetChecked())
-		UpdateConfig()
-	elseif msg == PM_RARE then
-		ProspectMeRareToggle:SetChecked(not ProspectMeRareToggle:GetChecked())
-		UpdateConfig()
-	elseif msg == PM_UNCOMMON then
-		ProspectMeUncommonToggle:SetChecked(not ProspectMeUncommonToggle:GetChecked())
-		UpdateConfig()
-	elseif msg == PM_COMMON then
-		ProspectMeCommonToggle:SetChecked(not ProspectMeCommonToggle:GetChecked())
-		UpdateConfig()		
-	elseif msg == PM_POOR then
-		ProspectMePoorToggle:SetChecked(not ProspectMePoorToggle:GetChecked())
-		UpdateConfig()
-	elseif msg == PM_SESSION then
-		ProspectMeSessionToggle:SetChecked(not ProspectMeSessionToggle:GetChecked())
-		UpdateConfig()
-	elseif msg == PM_PERCENT then
-		ProspectMePercentToggle:SetChecked(not ProspectMePercentToggle:GetChecked())
-		UpdateConfig()
-	elseif msg == PM_NUMBER then
-		ProspectMeNumberToggle:SetChecked(not ProspectMeNumberToggle:GetChecked())
-		UpdateConfig()
-	elseif msg == PM_RESET then
-		StaticPopup_Show("PM_ConfirmReset")
-	else
-		SpewMessage("help")
-	end
-end
-
-ProspectMeFrame:RegisterEvent("VARIABLES_LOADED")
-ProspectMeFrame:SetScript("OnEvent", EventHandler)
\ No newline at end of file
--- a/ProspectMe_Migrate.lua	Mon Nov 28 12:11:42 2016 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-local ORE = select(7,GetItemInfo(123918))
-local HERB = select(7,GetItemInfo(128304))
-
-local function Initialize ()
-	ProspectMe.Migrate = function ()
-		print("Attempting to migrate ProspectMe database")
-		if PM_ResultsTable then
-			print("|cffffff00ProspectMe v1 database found|r")
-			for Container, Item in pairs(PM_ResultsTable) do
-				local C = tonumber(Container)
-				local B = nil
-				local RT = {}
-				for Result, Quantity in pairs (Item) do
-					if Result == "timesProspected" then
-						B = Quantity
-					else 
-						RT[tonumber(Result)] = Quantity
-					end
-				end
-				if select(7,GetItemInfo(C)) == ORE or select(7,GetItemInfo(C)) == HERB then
-					ProspectMe.AddEntry(C, B, RT)
-				end
-			end
-			print("|cff00ff00Database migrated sucessfully!|r")
-			PM_ResultsTable = nil
-			PM_ItemTable = nil
-			PM_Config = nil
-		else
-			print("|cffff0000Error, ProspectMe v1 database not found|r")
-		end
-	end
-
-	if PM_ResultsTable then
-		print("ProspectMe v1 database found, to migrate your database to v2 run the command |cff00ff00/script ProspectMe.Migrate()|r \n |cffff0000Warning, this action is irreversable!|r")
-	end
-end
-
-local frame = CreateFrame("FRAME", "ProspectMe_Value")
-frame:RegisterEvent("VARIABLES_LOADED")
---frame:SetScript("OnEvent", EventHandler)
-frame:SetScript("OnEvent", Initialize)
\ No newline at end of file
--- a/ProspectMe_Tooltip.lua	Mon Nov 28 12:11:42 2016 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,198 +0,0 @@
-local Quality = { [0] = "Junk", [1]= "Common", [2] = "Uncommon", [3] = "Rare", [4] = "Epic", }
-
-local function Initialize()
-	ProspectMe.FormatPrice = function (value)
-
-		local GSC_GOLD="ffffd100"
-		local GSC_SILVER="ffe6e6e6"
-		local GSC_COPPER="ffc8602c"
-
-		local g, s, c
-		local digits = 0
-		local gsc
-
-		g = math.floor(value/10000)
-		s = math.fmod(math.floor(value/100),100)
-		c = math.fmod(value,100)
-
-
-		digits = math.floor(math.log10(value)+1)
-
-		if ( digits < 3 ) then
-			gsc = string.format("   |c%s%2d|r",  GSC_COPPER, c)
-		elseif ( digits < 5 ) then
-			gsc = string.format("|c%s%2d|r |c%s%02d|r", GSC_SILVER, s, GSC_COPPER, c)
-		elseif ( digits < 7 ) then
-			gsc = string.format("|c%s%2d|r |c%s%02d|r", GSC_GOLD, g, GSC_SILVER, s)
-		elseif ( digits < 9 ) then
-			gsc = string.format("|c%s%5d|r", GSC_GOLD, g)
-		else
-			gsc = string.format("|c%s%2.1fk|r", GSC_GOLD, g/1000)
-		end
-
-		return gsc
-	end
-
-	ProspectMe.GetReturn = function (containerID)
-		local averageReturn = 0
-		if ProspectMe.Results[containerID].TimesProspected > 0 then
-			for itemID, num in pairs(ProspectMe.Results[containerID]) do
-				if itemID ~= "TimesProspected" then
-					averageReturn = averageReturn + ProspectMe.GetItemValue(itemID) * num 
-				end
-			end
-			averageReturn = averageReturn/ProspectMe.Results[containerID].TimesProspected
-		end
-			return tonumber(string.format("%.0f", averageReturn))
-	end
-end
-
-local cleared = true
-local function OnTooltipCleared(self)
-   cleared = true   
-end
- 
-local function OnTooltipSetItem(self)
-	if cleared then
-		local tooltipLink = select(2, self:GetItem())
-		local spellid = select(3, self:GetSpell())
-		local item = nil
-		if spellid == 225902 then
-			item = 123918
-		elseif spellid == 225904 then
-			item = 123919
-		elseif spellid == 210116 then
-			item = 128304
-		elseif tooltipLink then 
-			item = tonumber(tooltipLink:match("Hitem:(%d+)"))
-			spellid = nil
-		else
-			item = nil
-			spellid = nil
-		end
-		if item then
-			if ProspectMe.Results[item] then
-				local price = ProspectMe.GetItemValue(item)
-				local lifetimeReturn = ProspectMe.GetReturn(item)
-				local subclass = select(7,GetItemInfo(item))
-				local ctp = price * 5
-				--NumofEachQuality, Percent of Each Quality
-				self:AddLine(" ")
-				local color
-				if ProspectMe.Results[item].TimesProspected < 100 then
-					color = "|cffff0000"
-				elseif ProspectMe.Results[item].TimesProspected < 200 then
-					color = "|cffffff00"
-				else
-					color = "|cff00ff00"
-				end
-				
-				-- SKill Text Block ""
-				local skilltext
-				if spellid == 225902 or spellid == 225904 or subclass == ProspectMe.Vars.ORE then
-					skilltext = "Prospected"
-				elseif spellid == 210116 or subclass == ProspectMe.Vars.HERB then
-					skilltext = "Milled"
-				else
-					skilltext = "Processed"
-				end
-				self:AddDoubleLine("Prospect Me","Times " .. skilltext .. ":  " .. color .. ProspectMe.Results[item].TimesProspected,1,0.82,0,1,1,1)
-				self:AddLine(" ")
-				
-				-- Economics Text Block
-				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
-				
-				-- Results Text Block
-				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 = ""
-									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
-					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
-			cleared = true
-		end
-	end
-end
- 
-GameTooltip:HookScript("OnTooltipCleared", OnTooltipCleared)
-GameTooltip:HookScript("OnTooltipSetItem", OnTooltipSetItem)
-ItemRefTooltip:HookScript("OnTooltipCleared", OnTooltipCleared)
-ItemRefTooltip:HookScript("OnTooltipSetItem", OnTooltipSetItem)
-
-local frame = CreateFrame("FRAME", "ProspectMe_Value")
-frame:RegisterEvent("VARIABLES_LOADED")
---frame:SetScript("OnEvent", EventHandler)
-frame:SetScript("OnEvent", Initialize)
\ No newline at end of file
--- a/ProspectMe_Value.lua	Mon Nov 28 12:11:42 2016 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-local function Initialize ()
-	ProspectMe.GetItemValue = function (itemID)
-		local v = nil
-		
-		if GetAuctionBuyout then -- if an installed addon supports Tekkub's GetAuctionBuyout API: Auctionator, AuctionLite, etc...
-			v = GetAuctionBuyout(itemID)
-		elseif AucAdvanced then -- Auctioneer Support
-			v = AucAdvanced.API.GetMarketValue(PM_ItemTable[itemID].link)
-		end
-		
-		if v == nil then -- provides a failsafe if Auctioneer, etc is set to Load on Demand
-			v = select(11, GetItemInfo(itemID))
-		end
-		
-		if v == nil then -- provides a final failsafe - if we can't find anything, set it to 0 (TY peterwemm!)
-			v = 0.0
-		end
-
-		return tonumber(v)
-	end
-end
-
-local frame = CreateFrame("FRAME", "ProspectMe_Value")
-frame:RegisterEvent("VARIABLES_LOADED")
---frame:SetScript("OnEvent", EventHandler)
-frame:SetScript("OnEvent", Initialize)
\ No newline at end of file