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