adam@0
|
1 local addonName, AskMrRobot = ...
|
adam@0
|
2
|
adam@0
|
3 --if not addon.healthCheck then return end
|
adam@0
|
4 local L = AskMrRobot.L
|
adam@0
|
5
|
adam@0
|
6 local wow_ver = select(4, GetBuildInfo())
|
adam@0
|
7 local wow_500 = wow_ver >= 50000
|
adam@0
|
8 local UIPanelButtonTemplate = wow_500 and "UIPanelButtonTemplate" or "UIPanelButtonTemplate2"
|
adam@0
|
9
|
adam@0
|
10 local frame = CreateFrame("Frame", nil, InterfaceOptionsFramePanelContainer)
|
adam@0
|
11 frame.name = addonName
|
adam@0
|
12 frame:Hide()
|
adam@0
|
13
|
adam@0
|
14 -- Credits to Ace3, Tekkub, cladhaire and Tuller for some of the widget stuff.
|
adam@0
|
15
|
adam@0
|
16 local function newCheckbox(label, tooltipTitle, description, onClick)
|
adam@0
|
17 local check = CreateFrame("CheckButton", "AmrCheck" .. label, frame, "InterfaceOptionsCheckButtonTemplate")
|
adam@0
|
18 check:SetScript("OnClick", function(self)
|
adam@0
|
19 PlaySound(self:GetChecked() and "igMainMenuOptionCheckBoxOn" or "igMainMenuOptionCheckBoxOff")
|
adam@0
|
20 onClick(self, self:GetChecked() and true or false)
|
adam@0
|
21 end)
|
adam@0
|
22 check.label = _G[check:GetName() .. "Text"]
|
adam@0
|
23 check.label:SetText(label)
|
adam@0
|
24 check.tooltipText = tooltipTitle
|
adam@0
|
25 check.tooltipRequirement = description
|
adam@0
|
26 return check
|
adam@0
|
27 end
|
adam@0
|
28
|
adam@0
|
29 frame:SetScript("OnShow", function(frame)
|
adam@0
|
30 local title = frame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
adam@0
|
31 title:SetPoint("TOPLEFT", 16, -16)
|
adam@0
|
32 title:SetText(addonName)
|
adam@0
|
33
|
adam@0
|
34 local subTitleWrapper = CreateFrame("Frame", nil, frame)
|
adam@0
|
35 subTitleWrapper:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 0, -8)
|
adam@0
|
36 subTitleWrapper:SetPoint("RIGHT", -16, 0)
|
adam@0
|
37 local subtitle = subTitleWrapper:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
|
adam@0
|
38 subtitle:SetPoint("TOPLEFT", subTitleWrapper)
|
adam@0
|
39 subtitle:SetWidth(subTitleWrapper:GetRight() - subTitleWrapper:GetLeft())
|
adam@0
|
40 subtitle:SetJustifyH("LEFT")
|
adam@0
|
41 subtitle:SetNonSpaceWrap(false)
|
adam@0
|
42 subtitle:SetJustifyV("TOP")
|
adam@0
|
43 subtitle:SetText("Mr. Robot's addon can export your item information to his website, and import your optimizations into the game.")
|
adam@0
|
44 subTitleWrapper:SetHeight(subtitle:GetHeight())
|
adam@0
|
45
|
adam@0
|
46 local autoPopup = newCheckbox(
|
adam@0
|
47 "Show minimap icon",
|
adam@0
|
48 "Minimap Icon",
|
adam@0
|
49 "Show the Ask Mr. Robot minimap icon.",
|
adam@0
|
50 function(self, value)
|
adam@0
|
51 if AmrOptions.hideMapIcon then
|
adam@0
|
52 AmrOptions.hideMapIcon = false
|
adam@0
|
53 else
|
adam@0
|
54 AmrOptions.hideMapIcon = true
|
adam@0
|
55 end
|
adam@0
|
56 AskMrRobot.AmrUpdateMinimap();
|
adam@0
|
57 end
|
adam@0
|
58 )
|
adam@0
|
59 autoPopup:SetChecked(not AmrOptions.hideMapIcon)
|
adam@0
|
60 autoPopup:SetPoint("TOPLEFT", subTitleWrapper, "BOTTOMLEFT", -2, -16)
|
adam@0
|
61
|
adam@0
|
62 local autoReforge = newCheckbox(
|
adam@0
|
63 "Automatically show Mr. Robot's reforge window at the reforger",
|
adam@0
|
64 "Auto-Show Reforges",
|
adam@0
|
65 "When you have suggested reforges left to complete, automatically show Mr. Robot's reforge window when you visit a reforger.",
|
adam@0
|
66 function(self, value)
|
adam@0
|
67 if AmrOptions.manualShowReforge then
|
adam@0
|
68 AmrOptions.manualShowReforge = false
|
adam@0
|
69 else
|
adam@0
|
70 AmrOptions.manualShowReforge = true
|
adam@0
|
71 end
|
adam@0
|
72 end
|
adam@0
|
73 )
|
adam@0
|
74 autoReforge:SetChecked(not AmrOptions.manualShowReforge)
|
adam@0
|
75 autoReforge:SetPoint("TOPLEFT", subTitleWrapper, "BOTTOMLEFT", -2, -52)
|
adam@0
|
76
|
adam@0
|
77 local autoAh = newCheckbox(
|
adam@0
|
78 "Automatically show Mr. Robot's shopping list at the auction house",
|
adam@0
|
79 "Auto-Show Shopping List",
|
adam@0
|
80 "When your shopping list still has things left to buy, automatically show Mr. Robot's shopping list when you visit the auction house.",
|
adam@0
|
81 function(self, value)
|
adam@0
|
82 if AmrOptions.manualShowShop then
|
adam@0
|
83 AmrOptions.manualShowShop = false
|
adam@0
|
84 else
|
adam@0
|
85 AmrOptions.manualShowShop = true
|
adam@0
|
86 end
|
adam@0
|
87 end
|
adam@0
|
88 )
|
adam@0
|
89 autoAh:SetChecked(not AmrOptions.manualShowShop)
|
adam@0
|
90 autoAh:SetPoint("TOPLEFT", subTitleWrapper, "BOTTOMLEFT", -2, -88)
|
adam@0
|
91
|
adam@0
|
92 --[[
|
adam@0
|
93 AmrOptions.autoLog = AmrOptions.autoLog or {}
|
adam@0
|
94
|
adam@0
|
95 local autoCombatLog = newCheckbox(
|
adam@0
|
96 "Automatically turn on combat logging for Siege of Orgrimmar",
|
adam@0
|
97 "Automatically Log Siege of Orgrimmar",
|
adam@0
|
98 "When entering Siege of Orgrimmar, combat logging will be turned on. When leaving Siege of Orgrimmar, combat logging will be turned off.",
|
adam@0
|
99 function(self, value)
|
adam@0
|
100 if AmrOptions.autoLog[1136] then
|
adam@0
|
101 AmrOptions.autoLog[1136] = false
|
adam@0
|
102 else
|
adam@0
|
103 AmrOptions.autoLog[1136] = true
|
adam@0
|
104 end
|
adam@0
|
105 end
|
adam@0
|
106 )
|
adam@0
|
107 autoCombatLog:SetChecked(AmrOptions.autoLog[1136])
|
adam@0
|
108 autoCombatLog:SetPoint("TOPLEFT", subTitleWrapper, "BOTTOMLEFT", -2, -124)
|
adam@0
|
109 ]]
|
adam@0
|
110
|
adam@0
|
111 frame:SetScript("OnShow", nil)
|
adam@0
|
112 end)
|
adam@0
|
113 InterfaceOptions_AddCategory(frame)
|
adam@0
|
114
|