| Vynn@0 | 1 local ProspectMeFrame = CreateFrame( "Frame", "PM_ConfigFrame", InterfaceOptionsFramePanelContainer) | 
| Vynn@0 | 2 local Title = PM_ConfigFrame:CreateFontString( "ProspectMeTitle", nil, "GameFontNormalLarge") | 
| Vynn@0 | 3 local EpicToggle = CreateFrame( "CheckButton", "ProspectMeEpicToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" ) | 
| Vynn@0 | 4 local RareToggle = CreateFrame( "CheckButton", "ProspectMeRareToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" ) | 
| Vynn@0 | 5 local UncommonToggle = CreateFrame( "CheckButton", "ProspectMeUncommonToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" ) | 
| Vynn@0 | 6 local CommonToggle = CreateFrame( "CheckButton", "ProspectMeCommonToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" ) | 
| Vynn@0 | 7 local PoorToggle = CreateFrame( "CheckButton", "ProspectMePoorToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" ) | 
| mischivin@59 | 8 local EconToggle = CreateFrame( "CheckButton", "ProspectMeEconToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" ) | 
| Vynn@0 | 9 local SessionToggle = CreateFrame( "CheckButton", "ProspectMeSessionToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" ) | 
| Vynn@0 | 10 local PercentToggle = CreateFrame( "CheckButton", "ProspectMePercentToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" ) | 
| Vynn@0 | 11 local NumberToggle = CreateFrame( "CheckButton", "ProspectMeNumberToggle", ProspectMeFrame, "InterfaceOptionsCheckButtonTemplate" ) | 
| Vynn@0 | 12 local ResetResults = CreateFrame( "Button", "ProspectMeResetButton", ProspectMeFrame, "UIPanelButtonTemplate" ) | 
| Vynn@0 | 13 local ResetText = PM_ConfigFrame:CreateFontString( "ProspectMeResetText", nil, "GameFontNormal" ) | 
| Vynn@0 | 14 | 
| Vynn@0 | 15 local function SpewMessage(handle, msg) | 
| Vynn@0 | 16 	if handle == "loaded" then | 
| Vynn@0 | 17 		print(PM_LOADMSG) | 
| Vynn@0 | 18 	elseif handle == "help" then | 
| Vynn@0 | 19 		print(PM_HELPMSG) | 
| Vynn@0 | 20 		SpewMessage(PM_CONFIG, PM_CONFIGTOOLTIP) | 
| Vynn@0 | 21 		SpewMessage(PM_EPIC, PM_EPICTOOLTIP) | 
| Vynn@0 | 22 		SpewMessage(PM_RARE, PM_RARETOOLTIP) | 
| Vynn@0 | 23 		SpewMessage(PM_UNCOMMON, PM_UNCOMMONTOOLTIP) | 
| Vynn@0 | 24 		SpewMessage(PM_COMMON, PM_COMMONTOOLTIP) | 
| Vynn@0 | 25 		SpewMessage(PM_POOR, PM_POORTOOLTIP) | 
| mischivin@59 | 26 		SpewMEssage(PM_ECON, PM_ECONTOOLTIP) | 
| Vynn@0 | 27 		SpewMessage(PM_SESSION, PM_SESSIONTOOLTIP) | 
| Vynn@0 | 28 		SpewMessage(PM_PERCENT, PM_PERCENTTOOLTIP) | 
| Vynn@0 | 29 		SpewMessage(PM_NUMBER, PM_NUMBERTOOLTIP) | 
| Vynn@0 | 30 		SpewMessage(PM_RESET, PM_RESETTOOLTIP) | 
| Vynn@0 | 31 	else | 
| Vynn@0 | 32 		print("|cFFFFCC00" .. handle .. "|r - " .. msg) | 
| Vynn@0 | 33 	end | 
| Vynn@0 | 34 end | 
| Vynn@0 | 35 | 
| Vynn@0 | 36 local function ResetDatabase() | 
| mischivin@37 | 37 	if ProspectMe.Results then | 
| mischivin@37 | 38 		ProspectMe.Results = {} | 
| mischivin@17 | 39 	end | 
| Vynn@0 | 40 end | 
| Vynn@0 | 41 | 
| Vynn@0 | 42 local function UpdateConfig() | 
| mischivin@37 | 43 	ProspectMe.Config.ShowQualities.Junk = ProspectMePoorToggle:GetChecked() | 
| mischivin@37 | 44 	ProspectMe.Config.ShowQualities.Common = ProspectMeCommonToggle:GetChecked() | 
| mischivin@37 | 45 	ProspectMe.Config.ShowQualities.Uncommon = ProspectMeUncommonToggle:GetChecked() | 
| mischivin@37 | 46 	ProspectMe.Config.ShowQualities.Rare = ProspectMeRareToggle:GetChecked() | 
| mischivin@37 | 47 	ProspectMe.Config.ShowQualities.Epic = ProspectMeEpicToggle:GetChecked() | 
| mischivin@59 | 48 	ProspectMe.Config.ShowEconomics = ProspectMeEconToggle:GetChecked() | 
| mischivin@37 | 49 	ProspectMe.Config.PerSession = ProspectMeSessionToggle:GetChecked() | 
| mischivin@37 | 50 	ProspectMe.Config.ShowPercent = ProspectMePercentToggle:GetChecked() | 
| mischivin@37 | 51 	ProspectMe.Config.ShowNumber = ProspectMeNumberToggle:GetChecked() | 
| Vynn@0 | 52 end | 
| Vynn@0 | 53 | 
| Vynn@0 | 54 local function PM_ConfigInit() | 
| Vynn@0 | 55 	StaticPopupDialogs["PM_ConfirmReset"] = { | 
| Vynn@0 | 56   		text = PM_RESETWARNING, | 
| Vynn@0 | 57   		button1 = YES, | 
| Vynn@0 | 58   		button2 = NO, | 
| Vynn@0 | 59   		OnAccept = function() | 
| Vynn@0 | 60       		ResetDatabase() | 
| Vynn@0 | 61   		end, | 
| Vynn@0 | 62   		timeout = 30, | 
| Vynn@0 | 63   		whileDead = true, | 
| Vynn@0 | 64   		hideOnEscape = true, | 
| Vynn@0 | 65   		preferredIndex = 3, | 
| Vynn@0 | 66 		} | 
| Vynn@0 | 67 | 
| Vynn@0 | 68 	ProspectMeFrame.name = "Prospect Me" | 
| Vynn@0 | 69 | 
| Vynn@0 | 70 	ProspectMeTitle:SetPoint("TOP", 0, -16) | 
| Vynn@0 | 71 	ProspectMeTitle:SetText(GetAddOnMetadata("ProspectMe", "Title") .. " v" .. GetAddOnMetadata("ProspectMe", "Version")) | 
| Vynn@0 | 72 | 
| mischivin@59 | 73 	ProspectMeEconToggle:SetPoint( "TOPLEFT", 16, -46 ) | 
| mischivin@59 | 74 	ProspectMeEconToggle:SetScript("OnClick", UpdateConfig) | 
| mischivin@59 | 75 	ProspectMeEconToggle:SetChecked(ProspectMe.Config.ShowEconomics) | 
| mischivin@59 | 76 	ProspectMeEconToggleText:SetText(PM_ECONTOGGLE) | 
| mischivin@59 | 77 	ProspectMeEconToggle.tooltipText = PM_ECONTOOLTIP | 
| mischivin@59 | 78 | 
| Vynn@0 | 79 	ProspectMeSessionToggle:SetPoint( "TOPLEFT", 32, -46 ) | 
| Vynn@0 | 80 	ProspectMeSessionToggle:SetScript("OnClick", UpdateConfig) | 
| mischivin@37 | 81 	ProspectMeSessionToggle:SetChecked(ProspectMe.Config.PerSession) | 
| Vynn@0 | 82 	ProspectMeSessionToggleText:SetText(PM_SESSIONTOGGLE) | 
| Vynn@0 | 83 	ProspectMeSessionToggle.tooltipText = PM_SESSIONTOOLTIP | 
| Vynn@0 | 84 | 
| Vynn@0 | 85 	ProspectMePercentToggle:SetPoint( "TOPLEFT", 32, -70 ) | 
| Vynn@0 | 86 	ProspectMePercentToggle:SetScript("OnClick", UpdateConfig) | 
| mischivin@37 | 87 	ProspectMePercentToggle:SetChecked(ProspectMe.Config.ShowPercent) | 
| Vynn@0 | 88 	ProspectMePercentToggleText:SetText(PM_PERCENTTOGGLE) | 
| Vynn@0 | 89 	ProspectMePercentToggle.tooltipText = PM_PERCENTTOOLTIP | 
| Vynn@0 | 90 | 
| Vynn@0 | 91 	ProspectMeNumberToggle:SetPoint( "TOPLEFT", 32, -94 ) | 
| Vynn@0 | 92 	ProspectMeNumberToggle:SetScript("OnClick", UpdateConfig) | 
| mischivin@37 | 93 	ProspectMeNumberToggle:SetChecked(ProspectMe.Config.ShowNumber) | 
| Vynn@0 | 94 	ProspectMeNumberToggleText:SetText(PM_NUMBERTOGGLE) | 
| Vynn@0 | 95 	ProspectMeNumberToggle.tooltipText = PM_NUMBERTOOLTIP | 
| Vynn@0 | 96 | 
| mischivin@37 | 97 	ProspectMeEpicToggle:SetPoint( "TOPLEFT", 32, -118 ) | 
| Vynn@0 | 98 	ProspectMeEpicToggle:SetScript("OnClick", UpdateConfig) | 
| mischivin@37 | 99 	ProspectMeEpicToggle:SetChecked(ProspectMe.Config.ShowQualities.Epic) | 
| Vynn@0 | 100 	ProspectMeEpicToggleText:SetText(PM_EPICTOGGLE) | 
| Vynn@0 | 101 	ProspectMeEpicToggle.tooltipText = PM_EPICTOOLTIP | 
| Vynn@0 | 102 | 
| mischivin@37 | 103 	ProspectMeRareToggle:SetPoint( "TOPLEFT", 32, -142 ) | 
| Vynn@0 | 104 	ProspectMeRareToggle:SetScript("OnClick", UpdateConfig) | 
| mischivin@37 | 105 	ProspectMeRareToggle:SetChecked(ProspectMe.Config.ShowQualities.Rare) | 
| Vynn@0 | 106 	ProspectMeRareToggleText:SetText(PM_RARETOGGLE) | 
| Vynn@0 | 107 	ProspectMeRareToggle.tooltipText = PM_RARETOOLTIP | 
| Vynn@0 | 108 | 
| mischivin@37 | 109 	ProspectMeUncommonToggle:SetPoint( "TOPLEFT", 32, -166 ) | 
| Vynn@0 | 110 	ProspectMeUncommonToggle:SetScript("OnClick", UpdateConfig) | 
| mischivin@37 | 111 	ProspectMeUncommonToggle:SetChecked(ProspectMe.Config.ShowQualities.Uncommon) | 
| Vynn@0 | 112 	ProspectMeUncommonToggleText:SetText(PM_UNCOMMONTOGGLE) | 
| Vynn@0 | 113 	ProspectMeUncommonToggle.tooltipText = PM_UNCOMMONTOOLTIP | 
| Vynn@0 | 114 | 
| mischivin@37 | 115 	ProspectMeCommonToggle:SetPoint( "TOPLEFT", 32, -190 ) | 
| Vynn@0 | 116 	ProspectMeCommonToggle:SetScript("OnClick", UpdateConfig) | 
| mischivin@37 | 117 	ProspectMeCommonToggle:SetChecked(ProspectMe.Config.ShowQualities.Common) | 
| Vynn@0 | 118 	ProspectMeCommonToggleText:SetText(PM_COMMONTOGGLE) | 
| Vynn@0 | 119 	ProspectMeCommonToggle.tooltipText = PM_COMMONTOOLTIP | 
| Vynn@0 | 120 | 
| mischivin@37 | 121 	ProspectMePoorToggle:SetPoint( "TOPLEFT", 32, -214 ) | 
| Vynn@0 | 122 	ProspectMePoorToggle:SetScript("OnClick", UpdateConfig) | 
| mischivin@37 | 123 	ProspectMePoorToggle:SetChecked(ProspectMe.Config.ShowQualities.Poor) | 
| Vynn@0 | 124 	ProspectMePoorToggleText:SetText(PM_POORTOGGLE) | 
| Vynn@0 | 125 	ProspectMePoorToggle.tooltipText = PM_POORTOOLTIP | 
| Vynn@0 | 126 | 
| Vynn@0 | 127 	ProspectMeResetButton:SetPoint("TOP", 0, -310 ) | 
| Vynn@0 | 128 	ProspectMeResetButton:SetScript("OnClick", 	function(self) StaticPopup_Show("PM_ConfirmReset") end) | 
| Vynn@0 | 129 	ProspectMeResetButton:SetSize(250, 25) | 
| Vynn@0 | 130 	ProspectMeResetButton:SetText(PM_RESETBUTTON) | 
| Vynn@0 | 131 | 
| Vynn@0 | 132 	ProspectMeResetText:SetPoint("TOP", 0, -286) | 
| Vynn@0 | 133 	ProspectMeResetText:SetText(PM_RESETTOOLTIP) | 
| Vynn@0 | 134 | 
| Vynn@0 | 135 	InterfaceOptions_AddCategory(ProspectMeFrame) | 
| Vynn@0 | 136 | 
| Vynn@0 | 137 end | 
| Vynn@0 | 138 | 
| mischivin@37 | 139 local function EventHandler(event, arg1) | 
| mischivin@37 | 140 	if (ProspectMe.Config) then | 
| Vynn@0 | 141 		PM_ConfigInit() | 
| Vynn@0 | 142 	end | 
| Vynn@0 | 143 	SpewMessage("loaded") | 
| Vynn@0 | 144 end | 
| Vynn@0 | 145 | 
| Vynn@0 | 146 function SlashCmdList.PROSPECTME(msg, editbox) | 
| Vynn@0 | 147 	if msg == PM_CONFIG then | 
| Vynn@0 | 148 		InterfaceOptionsFrame_OpenToCategory(ProspectMeFrame) | 
| mischivin@59 | 149 	elseif msg == PM_ECON then | 
| mischivin@59 | 150 		ProspectMeEconToggle:SetChecked(not ProspectMeEconToggle:GetChecked()) | 
| Vynn@0 | 151 		UpdateConfig() | 
| Vynn@0 | 152 	elseif msg == PM_EPIC then | 
| Vynn@0 | 153 		ProspectMeEpicToggle:SetChecked(not ProspectMeEpicToggle:GetChecked()) | 
| Vynn@0 | 154 		UpdateConfig() | 
| Vynn@0 | 155 	elseif msg == PM_RARE then | 
| Vynn@0 | 156 		ProspectMeRareToggle:SetChecked(not ProspectMeRareToggle:GetChecked()) | 
| Vynn@0 | 157 		UpdateConfig() | 
| Vynn@0 | 158 	elseif msg == PM_UNCOMMON then | 
| Vynn@0 | 159 		ProspectMeUncommonToggle:SetChecked(not ProspectMeUncommonToggle:GetChecked()) | 
| Vynn@0 | 160 		UpdateConfig() | 
| Vynn@0 | 161 	elseif msg == PM_COMMON then | 
| Vynn@0 | 162 		ProspectMeCommonToggle:SetChecked(not ProspectMeCommonToggle:GetChecked()) | 
| Vynn@0 | 163 		UpdateConfig() | 
| Vynn@0 | 164 	elseif msg == PM_POOR then | 
| Vynn@0 | 165 		ProspectMePoorToggle:SetChecked(not ProspectMePoorToggle:GetChecked()) | 
| Vynn@0 | 166 		UpdateConfig() | 
| Vynn@0 | 167 	elseif msg == PM_SESSION then | 
| Vynn@0 | 168 		ProspectMeSessionToggle:SetChecked(not ProspectMeSessionToggle:GetChecked()) | 
| Vynn@0 | 169 		UpdateConfig() | 
| Vynn@0 | 170 	elseif msg == PM_PERCENT then | 
| Vynn@0 | 171 		ProspectMePercentToggle:SetChecked(not ProspectMePercentToggle:GetChecked()) | 
| Vynn@0 | 172 		UpdateConfig() | 
| Vynn@0 | 173 	elseif msg == PM_NUMBER then | 
| Vynn@0 | 174 		ProspectMeNumberToggle:SetChecked(not ProspectMeNumberToggle:GetChecked()) | 
| Vynn@0 | 175 		UpdateConfig() | 
| Vynn@0 | 176 	elseif msg == PM_RESET then | 
| Vynn@0 | 177 		StaticPopup_Show("PM_ConfirmReset") | 
| Vynn@0 | 178 	else | 
| Vynn@0 | 179 		SpewMessage("help") | 
| Vynn@0 | 180 	end | 
| Vynn@0 | 181 end | 
| Vynn@0 | 182 | 
| Vynn@0 | 183 ProspectMeFrame:RegisterEvent("VARIABLES_LOADED") | 
| mischivin@37 | 184 ProspectMeFrame:SetScript("OnEvent", EventHandler) |