vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | tinsert(UISpecialFrames, "CT_RAMenuFrame"); |
2 | CT_RA_Ressers = { }; |
||
3 | CT_RAMenu_Locked = 1; |
||
4 | CT_RA_PartyMembers = { }; |
||
5 | CT_RA_InCombat = nil; |
||
6 | |||
7 | function CT_RAMenu_OnLoad() |
||
8 | CT_RAMenuFrameHomeButton1Text:SetText("General Options"); |
||
9 | CT_RAMenuFrameHomeButton2Text:SetText("Buff Options"); |
||
10 | CT_RAMenuFrameHomeButton3Text:SetText("Misc Options"); |
||
11 | CT_RAMenuFrameHomeButton4Text:SetText("Additional Options"); |
||
12 | CT_RAMenuFrameHomeButton5Text:SetText("Debuff Curing"); |
||
13 | CT_RAMenuFrameHomeButton6Text:SetText("Option Sets"); |
||
14 | |||
15 | CT_RAMenuFrameHomeButton1Description:SetText("Change general stuff, such as whether to show mana bars, etc etc."); |
||
16 | CT_RAMenuFrameHomeButton2Description:SetText("Change the way Buffs and Debuffs are displayed."); |
||
17 | CT_RAMenuFrameHomeButton3Description:SetText("Things that do not fit in other categories go here."); |
||
18 | CT_RAMenuFrameHomeButton4Description:SetText("Regulating message spam, scaling of windows, etc."); |
||
19 | CT_RAMenuFrameHomeButton5Description:SetText("Configure the debuff curing feature."); |
||
20 | CT_RAMenuFrameHomeButton6Description:SetText("Save and load sets of options for easier setup."); |
||
21 | end |
||
22 | |||
23 | function CT_RAMenu_OnShow() |
||
24 | CT_RAMenu_ShowHome(); |
||
25 | this:SetScale(1/UIParent:GetScale()*0.8); |
||
26 | CT_RAMenuFrameHomeButton1:SetScale(0.9111); |
||
27 | CT_RAMenuFrameHomeButton2:SetScale(0.9111); |
||
28 | CT_RAMenuFrameHomeButton3:SetScale(0.9111); |
||
29 | CT_RAMenuFrameHomeButton4:SetScale(0.9111); |
||
30 | CT_RAMenuFrameHomeButton5:SetScale(0.9111); |
||
31 | CT_RAMenuFrameHomeButton6:SetScale(0.9111); |
||
32 | end |
||
33 | |||
34 | function CT_RAMenuButton_OnClick(id) |
||
35 | if ( not id ) then |
||
36 | id = this:GetID(); |
||
37 | end |
||
38 | CT_RAMenuFrameHome:Hide(); |
||
39 | if ( id == 1 ) then |
||
40 | CT_RAMenuFrameGeneral:Show(); |
||
41 | elseif ( id == 2 ) then |
||
42 | CT_RAMenuFrameBuffs:Show(); |
||
43 | elseif ( id == 3 ) then |
||
44 | CT_RAMenuFrameMisc:Show(); |
||
45 | elseif ( id == 4 ) then |
||
46 | CT_RAMenuFrameAdditional:Show(); |
||
47 | elseif ( id == 5 ) then |
||
48 | CT_RAMenuFrameDebuff:Show(); |
||
49 | elseif ( id == 6 ) then |
||
50 | CT_RAMenuFrameOptionSets:Show(); |
||
51 | end |
||
52 | end |
||
53 | |||
54 | function CT_RAMenu_ShowHome() |
||
55 | CT_RAMenuFrameHome:Show(); |
||
56 | CT_RAMenuFrameGeneral:Hide(); |
||
57 | CT_RAMenuFrameBuffs:Hide(); |
||
58 | CT_RAMenuFrameMisc:Hide(); |
||
59 | CT_RAMenuFrameAdditional:Hide(); |
||
60 | CT_RAMenuFrameDebuff:Hide(); |
||
61 | CT_RAMenuFrameOptionSets:Hide(); |
||
62 | end |
||
63 | |||
64 | function CT_RAMenu_UpdateMenu() |
||
65 | local tempOptions = CT_RAMenu_Options["temp"]; |
||
66 | local admiralsHat, foundDampen; |
||
67 | for k, v in tempOptions["BuffArray"] do |
||
68 | if ( v["name"] == CT_RA_DAMPENMAGIC ) then |
||
69 | foundDampen = k; |
||
70 | elseif ( v["name"] == CT_RA_ADMIRALSHAT ) then |
||
71 | admiralsHat = k; |
||
72 | elseif ( v["name"] == "Don du fauve" ) then |
||
73 | -- Change name of buffs.. Not a too great way of doing it, but it works (I'll fix this design as soon as possible, it's terrible I know) |
||
74 | tempOptions["BuffArray"][k]["name"] = CT_RA_MARKOFTHEWILD[2]; |
||
75 | elseif ( v["name"] == "Marque du fauve" ) then |
||
76 | tempOptions["BuffArray"][k]["name"] = CT_RA_MARKOFTHEWILD[1]; |
||
77 | elseif ( v["name"] == CT_RA_BLESSINGOFMIGHT[1] ) then |
||
78 | tempOptions["BuffArray"][k]["name"] = CT_RA_BLESSINGOFMIGHT; |
||
79 | elseif ( v["name"] == CT_RA_BLESSINGOFWISDOM[1] ) then |
||
80 | tempOptions["BuffArray"][k]["name"] = CT_RA_BLESSINGOFWISDOM; |
||
81 | elseif ( v["name"] == CT_RA_BLESSINGOFKINGS[1] ) then |
||
82 | tempOptions["BuffArray"][k]["name"] = CT_RA_BLESSINGOFKINGS; |
||
83 | elseif ( v["name"] == CT_RA_BLESSINGOFSALVATION[1] ) then |
||
84 | tempOptions["BuffArray"][k]["name"] = CT_RA_BLESSINGOFSALVATION; |
||
85 | elseif ( v["name"] == CT_RA_BLESSINGOFLIGHT[1] ) then |
||
86 | tempOptions["BuffArray"][k]["name"] = CT_RA_BLESSINGOFLIGHT; |
||
87 | elseif ( v["name"] == CT_RA_BLESSINGOFSANCTUARY[1] ) then |
||
88 | tempOptions["BuffArray"][k]["name"] = CT_RA_BLESSINGOFSANCTUARY; |
||
89 | elseif ( v["name"] == CT_RA_DIVINESPIRIT[1] ) then |
||
90 | tempOptions["BuffArray"][k]["name"] = CT_RA_DIVINESPIRIT; |
||
91 | elseif ( v["name"] == CT_RA_SHADOWPROTECTION[1] ) then |
||
92 | tempOptions["BuffArray"][k]["name"] = CT_RA_SHADOWPROTECTION; |
||
93 | end |
||
94 | end |
||
95 | if ( admiralsHat ) then |
||
96 | tremove(tempOptions["BuffArray"], admiralsHat); |
||
97 | end |
||
98 | if ( not foundDampen ) then |
||
99 | tinsert(tempOptions["BuffArray"], { ["show"] = -1, ["name"] = CT_RA_AMPLIFYMAGIC, ["index"] = 20 }); |
||
100 | tinsert(tempOptions["BuffArray"], { ["show"] = -1, ["name"] = CT_RA_DAMPENMAGIC, ["index"] = 21 }); |
||
101 | end |
||
102 | for i = 1, 6, 1 do |
||
103 | if ( type(tempOptions["DebuffColors"][i]["type"]) == "table" ) then |
||
104 | getglobal("CT_RAMenuFrameBuffsDebuff" .. i .. "Text"):SetText(string.gsub(tempOptions["DebuffColors"][i]["type"][CT_RA_GetLocale()], "_", " ")); |
||
105 | else |
||
106 | getglobal("CT_RAMenuFrameBuffsDebuff" .. i .. "Text"):SetText(string.gsub(tempOptions["DebuffColors"][i]["type"], "_", " ")); |
||
107 | end |
||
108 | local val = tempOptions["DebuffColors"][i]; |
||
109 | getglobal("CT_RAMenuFrameBuffsDebuff" .. i .. "SwatchNormalTexture"):SetVertexColor(val.r, val.g, val.b); |
||
110 | |||
111 | if ( val["id"] ~= -1 ) then |
||
112 | getglobal("CT_RAMenuFrameBuffsDebuff" .. i .. "CheckButton"):SetChecked(1); |
||
113 | getglobal("CT_RAMenuFrameBuffsDebuff" .. i .. "Text"):SetTextColor(1, 1, 1); |
||
114 | else |
||
115 | getglobal("CT_RAMenuFrameBuffsDebuff" .. i .. "CheckButton"):SetChecked(nil); |
||
116 | getglobal("CT_RAMenuFrameBuffsDebuff" .. i .. "Text"):SetTextColor(0.3, 0.3, 0.3); |
||
117 | end |
||
118 | end |
||
119 | for key, val in tempOptions["BuffArray"] do |
||
120 | if ( val["show"] ~= -1 ) then |
||
121 | getglobal("CT_RAMenuFrameBuffsBuff" .. key .. "CheckButton"):SetChecked(1); |
||
122 | getglobal("CT_RAMenuFrameBuffsBuff" .. key .. "Text"):SetTextColor(1, 1, 1); |
||
123 | else |
||
124 | getglobal("CT_RAMenuFrameBuffsBuff" .. key .. "CheckButton"):SetChecked(nil); |
||
125 | getglobal("CT_RAMenuFrameBuffsBuff" .. key .. "Text"):SetTextColor(0.3, 0.3, 0.3); |
||
126 | end |
||
127 | local spell = val["name"]; |
||
128 | if ( type(spell) == "table" ) then |
||
129 | getglobal("CT_RAMenuFrameBuffsBuff" .. key .. "Text"):SetText(spell[1]); |
||
130 | getglobal("CT_RAMenuFrameBuffsBuff" .. key).tooltip = spell[1] .. " & " .. spell[2]; |
||
131 | else |
||
132 | getglobal("CT_RAMenuFrameBuffsBuff" .. key .. "Text"):SetText(spell); |
||
133 | getglobal("CT_RAMenuFrameBuffsBuff" .. key).tooltip = nil; |
||
134 | end |
||
135 | end |
||
136 | CT_RAMenuFrameBuffsNotifyDebuffs:SetChecked(tempOptions["NotifyDebuffs"]); |
||
137 | |||
138 | for i = 1, 8, 1 do |
||
139 | getglobal("CT_RAMenuFrameBuffsNotifyDebuffsGroup" .. i .. "Text"):SetText("Group " .. i); |
||
140 | if ( not tempOptions["NotifyDebuffs"] or ( not tempOptions["NotifyDebuffs"]["main"] and tempOptions["NotifyDebuffs"]["hidebuffs"] ) ) then |
||
141 | getglobal("CT_RAMenuFrameBuffsNotifyDebuffsGroup" .. i .. "Text"):SetTextColor(0.3, 0.3, 0.3); |
||
142 | getglobal("CT_RAMenuFrameBuffsNotifyDebuffsGroup" .. i .. "CheckButton"):Disable(); |
||
143 | getglobal("CT_RAMenuFrameBuffsNotifyDebuffsClass" .. i .. "Text"):SetTextColor(0.3, 0.3, 0.3); |
||
144 | getglobal("CT_RAMenuFrameBuffsNotifyDebuffsClass" .. i .. "CheckButton"):Disable(); |
||
145 | end |
||
146 | getglobal("CT_RAMenuFrameBuffsNotifyDebuffs"):SetChecked(tempOptions["NotifyDebuffs"]["main"]); |
||
147 | getglobal("CT_RAMenuFrameBuffsNotifyBuffs"):SetChecked(not tempOptions["NotifyDebuffs"]["hidebuffs"]); |
||
148 | |||
149 | getglobal("CT_RAMenuFrameBuffsNotifyDebuffsGroup" .. i .. "CheckButton"):SetChecked(tempOptions["NotifyDebuffs"][i]); |
||
150 | getglobal("CT_RAMenuFrameBuffsNotifyDebuffsClass" .. i .. "CheckButton"):SetChecked(tempOptions["NotifyDebuffsClass"][i]); |
||
151 | end |
||
152 | for k, v in CT_RA_ClassPositions do |
||
153 | if ( k ~= CT_RA_SHAMAN or ( UnitFactionGroup("player") and UnitFactionGroup("player") == "Horde" ) ) then |
||
154 | getglobal("CT_RAMenuFrameBuffsNotifyDebuffsClass" .. v .. "Text"):SetText(k); |
||
155 | end |
||
156 | end |
||
157 | CT_RAMenuFrameGeneralDisplayShowMPCB:SetChecked(tempOptions["HideMP"]); |
||
158 | CT_RAMenuFrameGeneralDisplayShowRPCB:SetChecked(tempOptions["HideRP"]); |
||
159 | if ( tempOptions["MemberHeight"] == 32 ) then |
||
160 | CT_RAMenuFrameGeneralDisplayShowHealthCB:SetChecked(1); |
||
161 | else |
||
162 | CT_RAMenuFrameGeneralDisplayShowHealthCB:SetChecked(nil); |
||
163 | end |
||
164 | |||
165 | CT_RAMenuFrameGeneralDisplayShowGroupsCB:SetChecked(not tempOptions["HideNames"]); |
||
166 | CT_RAMenuFrameGeneralDisplayLockGroupsCB:SetChecked(tempOptions["LockGroups"]); |
||
167 | CT_RAMenuFrameGeneralDisplayWindowColorSwatchNormalTexture:SetVertexColor(tempOptions["DefaultColor"].r, tempOptions["DefaultColor"].g, tempOptions["DefaultColor"].b); |
||
168 | CT_RAMenuFrameGeneralDisplayShowHPSwatchNormalTexture:SetVertexColor(tempOptions["PercentColor"].r, tempOptions["PercentColor"].g, tempOptions["PercentColor"].b); |
||
169 | CT_RAMenuFrameGeneralDisplayAlertColorSwatchNormalTexture:SetVertexColor(tempOptions["DefaultAlertColor"].r, tempOptions["DefaultAlertColor"].g, tempOptions["DefaultAlertColor"].b); |
||
170 | |||
171 | CT_RA_UpdateRaidGroupColors(); |
||
172 | CT_RA_UpdateRaidMovability(); |
||
173 | if ( tempOptions["ShowHP"] ) then |
||
174 | UIDropDownMenu_SetSelectedID(CT_RAMenuFrameGeneralDisplayHealthDropDown, tempOptions["ShowHP"]); |
||
175 | else |
||
176 | UIDropDownMenu_SetSelectedID(CT_RAMenuFrameGeneralDisplayHealthDropDown, 5); |
||
177 | end |
||
178 | if ( tempOptions["ShowDebuffs"] ) then |
||
179 | UIDropDownMenu_SetSelectedID(CT_RAMenuFrameBuffsBuffsDropDown, 2); |
||
180 | CT_RAMenuFrameBuffsBuffsDropDownText:SetText("Show debuffs"); |
||
181 | elseif ( tempOptions["ShowBuffsDebuffed"] ) then |
||
182 | UIDropDownMenu_SetSelectedID(CT_RAMenuFrameBuffsBuffsDropDown, 3); |
||
183 | CT_RAMenuFrameBuffsBuffsDropDownText:SetText("Show buffs until debuffed"); |
||
184 | else |
||
185 | UIDropDownMenu_SetSelectedID(CT_RAMenuFrameBuffsBuffsDropDown, 1); |
||
186 | CT_RAMenuFrameBuffsBuffsDropDownText:SetText("Show buffs"); |
||
187 | end |
||
188 | local num = 0; |
||
189 | if ( tempOptions["ShowGroups"] ) then |
||
190 | for k, v in tempOptions["ShowGroups"] do |
||
191 | num = num + 1; |
||
192 | getglobal("CT_RAOptionsGroupCB" .. k):SetChecked(1); |
||
193 | end |
||
194 | if ( num > 0 ) then |
||
195 | CT_RACheckAllGroups:SetChecked(1); |
||
196 | else |
||
197 | CT_RACheckAllGroups:SetChecked(nil); |
||
198 | end |
||
199 | else |
||
200 | for i = 1, 8, 1 do |
||
201 | getglobal("CT_RAOptionsGroupCB" .. i):SetChecked(nil); |
||
202 | end |
||
203 | end |
||
204 | CT_RAMenuFrameGeneralMiscHideOfflineCB:SetChecked(tempOptions["HideOffline"]); |
||
205 | CT_RAMenuFrameGeneralMiscSortAlphaCB:SetChecked(tempOptions["SubSortByName"]); |
||
206 | CT_RAMenuFrameGeneralMiscBorderCB:SetChecked(tempOptions["HideBorder"]); |
||
207 | CT_RAMenuFrameGeneralMiscRemoveSpacingCB:SetChecked(tempOptions["HideSpace"]); |
||
208 | CT_RAMenuFrameGeneralMiscShowHorizontalCB:SetChecked(tempOptions["ShowHorizontal"]); |
||
209 | CT_RAMenuFrameGeneralMiscShowReversedCB:SetChecked(tempOptions["ShowReversed"]); |
||
210 | CT_RAMenuFrameGeneralMiscShowMTsCB:SetChecked(not tempOptions["HideMTs"]); |
||
211 | CT_RAMenuFrameGeneralMiscShowMetersCB:SetChecked( (tempOptions["StatusMeters"] and tempOptions["StatusMeters"]["Show"] ) ); |
||
212 | CT_RAMenuFrameMiscNotificationsShowTankDeathCB:SetChecked(not tempOptions["HideTankNotifications"]); |
||
213 | CT_RAMenuFrameMiscNotificationsPlayRSSoundCB:SetChecked(tempOptions["PlayRSSound"]); |
||
214 | CT_RAMenuFrameMiscNotificationsSendRARSCB:SetChecked(tempOptions["SendRARS"]); |
||
215 | CT_RAMenuFrameMiscDisplayShowAFKCB:SetChecked(tempOptions["ShowAFK"]); |
||
216 | CT_RAMenuFrameMiscDisplayShowTooltipCB:SetChecked(not tempOptions["HideTooltip"]); |
||
217 | CT_RAMenuFrameMiscNotificationsDisableQueryCB:SetChecked(tempOptions["DisableQuery"]); |
||
218 | CT_RAMenuFrameMiscNotificationsNotifyGroupChangeCB:SetChecked(tempOptions["NotifyGroupChange"]); |
||
219 | CT_RAMenuFrameMiscNotificationsNotifyGroupChangeCBSound:SetChecked(tempOptions["NotifyGroupChangeSound"]); |
||
220 | CT_RAMenuFrameMiscDisplayNoColorChangeCB:SetChecked(tempOptions["HideColorChange"]); |
||
221 | CT_RAMenuFrameMiscDisplayShowResMonitorCB:SetChecked(tempOptions["ShowMonitor"]); |
||
222 | CT_RAMenuFrameMiscDisplayHideButtonCB:SetChecked(tempOptions["HideButton"]); |
||
223 | CT_RAMenuFrameMiscDisplayShowPTTCB:SetChecked(tempOptions["ShowPTT"]); |
||
224 | CT_RAMenuFrameMiscDisplayShowMTTTCB:SetChecked(tempOptions["ShowMTTT"]); |
||
225 | CT_RAMenuFrameAdditionalEMShowCB:SetChecked(tempOptions["ShowEmergency"]); |
||
226 | CT_RAMenuFrameMiscNotificationsAggroNotifierCB:SetChecked(tempOptions["AggroNotifier"]); |
||
227 | CT_RAMenuFrameMiscNotificationsAggroNotifierSoundCB:SetChecked(tempOptions["AggroNotifierSound"]); |
||
228 | CT_RAMenuFrameMiscDisplayColorLeaderCB:SetChecked( ( not tempOptions["leaderColor"] or tempOptions["leaderColor"].enabled ) ); |
||
229 | |||
230 | if ( tempOptions["leaderColor"] ) then |
||
231 | CT_RAMenuFrameMiscDisplayColorLeaderColorSwatchNormalTexture:SetVertexColor(tempOptions["leaderColor"].r, tempOptions["leaderColor"].g, tempOptions["leaderColor"].b); |
||
232 | else |
||
233 | CT_RAMenuFrameMiscDisplayColorLeaderColorSwatchNormalTexture:SetVertexColor(1, 1, 0); |
||
234 | end |
||
235 | |||
236 | if ( not tempOptions["HideBorder"] ) then |
||
237 | CT_RAMenuFrameGeneralMiscRemoveSpacingCB:Disable(); |
||
238 | CT_RAMenuFrameGeneralMiscRemoveSpacingText:SetTextColor(0.3, 0.3, 0.3); |
||
239 | end |
||
240 | |||
241 | local numMts = tempOptions["ShowNumMTs"]; |
||
242 | if ( numMts == 1 ) then |
||
243 | CT_RAMenuFrameGeneralMTsSubtract:Disable(); |
||
244 | elseif ( numMts == 10 ) then |
||
245 | CT_RAMenuFrameGeneralMTsAdd:Disable(); |
||
246 | end |
||
247 | CT_RAMenuFrameGeneralMTsNum:SetText(numMts or 10); |
||
248 | |||
249 | if ( not tempOptions["AggroNotifier"] ) then |
||
250 | CT_RAMenuFrameMiscNotificationsAggroNotifierSoundCB:Disable(); |
||
251 | CT_RAMenuFrameMiscNotificationsAggroNotifierSound:SetTextColor(0.3, 0.3, 0.3); |
||
252 | end |
||
253 | if ( not tempOptions["ShowEmergency"] ) then |
||
254 | CT_RAMenuFrameAdditionalEMPartyCB:Disable(); |
||
255 | CT_RAMenuFrameAdditionalEMPartyText:SetTextColor(0.3, 0.3, 0.3); |
||
256 | CT_RAMenuFrameAdditionalEMOutsideRaidCB:Disable(); |
||
257 | CT_RAMenuFrameAdditionalEMOutsideRaidText:SetTextColor(0.3, 0.3, 0.3); |
||
258 | end |
||
259 | CT_RAMenuFrameAdditionalEMPartyCB:SetChecked(tempOptions["ShowEmergencyParty"]); |
||
260 | CT_RAMenuFrameAdditionalEMOutsideRaidCB:SetChecked(tempOptions["ShowEmergencyOutsideRaid"]); |
||
261 | if ( tempOptions["HideButton"] ) then |
||
262 | CT_RASets_Button:Hide(); |
||
263 | else |
||
264 | CT_RASets_Button:Show(); |
||
265 | end |
||
266 | if ( not tempOptions["NotifyGroupChange"] ) then |
||
267 | CT_RAMenuFrameMiscNotificationsNotifyGroupChangeCBSound:Disable(); |
||
268 | CT_RAMenuFrameMiscNotificationsNotifyGroupChangeSound:SetTextColor(0.3, 0.3, 0.3); |
||
269 | else |
||
270 | CT_RAMenuFrameMiscNotificationsNotifyGroupChangeCBSound:Enable(); |
||
271 | CT_RAMenuFrameMiscNotificationsNotifyGroupChangeSound:SetTextColor(1, 1, 1); |
||
272 | end |
||
273 | if ( not tempOptions["ShowMTTT"] ) then |
||
274 | CT_RAMenuFrameMiscDisplayNoColorChangeCB:Disable(); |
||
275 | CT_RAMenuFrameMiscDisplayNoColorChange:SetTextColor(0.3, 0.3, 0.3); |
||
276 | else |
||
277 | CT_RAMenuFrameMiscDisplayNoColorChangeCB:Enable(); |
||
278 | CT_RAMenuFrameMiscDisplayNoColorChange:SetTextColor(1, 1, 1); |
||
279 | end |
||
280 | if ( tempOptions["WindowScaling"] ) then |
||
281 | CT_RAMenuGlobalFrame.scaleupdate = 0.1; |
||
282 | end |
||
283 | if ( tempOptions["SORTTYPE"] == "class" ) then |
||
284 | CT_RA_SetSortType("class"); |
||
285 | elseif ( tempOptions["SORTTYPE"] == "custom" ) then |
||
286 | CT_RA_SetSortType("custom"); |
||
287 | elseif ( tempOptions["SORTTYPE"] == "virtual" ) then |
||
288 | CT_RA_SetSortType("virtual"); |
||
289 | else |
||
290 | CT_RA_SetSortType("group"); |
||
291 | end |
||
292 | if ( tempOptions["StatusMeters"] ) then |
||
293 | CT_RAMetersFrame:SetBackdropColor(tempOptions["StatusMeters"]["Background"].r, tempOptions["StatusMeters"]["Background"].g, tempOptions["StatusMeters"]["Background"].b, tempOptions["StatusMeters"]["Background"].a); |
||
294 | CT_RAMetersFrame:SetBackdropBorderColor(1, 1, 1, tempOptions["StatusMeters"]["Background"].a); |
||
295 | if ( tempOptions["StatusMeters"]["Show"] and GetNumRaidMembers() > 0 ) then |
||
296 | CT_RAMetersFrame:Show(); |
||
297 | else |
||
298 | CT_RAMetersFrame:Hide(); |
||
299 | end |
||
300 | end |
||
301 | if ( tempOptions["EMBG"] ) then |
||
302 | CT_RA_EmergencyFrame:SetBackdropColor(tempOptions["EMBG"].r, tempOptions["EMBG"].g, tempOptions["EMBG"].b, tempOptions["EMBG"].a); |
||
303 | CT_RA_EmergencyFrame:SetBackdropBorderColor(1, 1, 1, tempOptions["EMBG"].a); |
||
304 | end |
||
305 | if ( tempOptions["RMBG"] ) then |
||
306 | CT_RA_ResFrame:SetBackdropColor(tempOptions["RMBG"].r, tempOptions["RMBG"].g, tempOptions["RMBG"].b, tempOptions["RMBG"].a); |
||
307 | CT_RA_ResFrame:SetBackdropBorderColor(1, 1, 1, tempOptions["RMBG"].a); |
||
308 | end |
||
309 | if ( tempOptions["ShowHP"] ) then |
||
310 | local table = { "Show Values", "Show Percentages", "Show Deficit", "Show only MTT HP %" }; |
||
311 | UIDropDownMenu_SetSelectedID(CT_RAMenuFrameGeneralDisplayHealthDropDown, tempOptions["ShowHP"]); |
||
312 | CT_RAMenuFrameGeneralDisplayHealthDropDownText:SetText(table[tempOptions["ShowHP"]]); |
||
313 | else |
||
314 | UIDropDownMenu_SetSelectedID(CT_RAMenuFrameGeneralDisplayHealthDropDown, 5); |
||
315 | CT_RAMenuFrameGeneralDisplayHealthDropDownText:SetText("Show None"); |
||
316 | end |
||
317 | CT_RAMenuAdditional_Scaling_OnShow(CT_RAMenuFrameAdditionalScalingSlider1); |
||
318 | CT_RAMenuAdditional_ScalingMT_OnShow(CT_RAMenuFrameAdditionalScalingSlider2); |
||
319 | CT_RAMenuAdditional_EM_OnShow(CT_RAMenuFrameAdditionalEMSlider); |
||
320 | CT_RAMenuAdditional_EM_OnShow(CT_RAMenuFrameAdditionalEMSlider2); |
||
321 | CT_RAMenuAdditional_BG_OnShow(CT_RAMenuFrameAdditionalBGSlider); |
||
322 | CT_RA_Emergency_UpdateHealth(); |
||
323 | CT_RAMenu_UpdateWindowPositions(); |
||
324 | end |
||
325 | |||
326 | function CT_RAMenuBuffs_OnEvent(event) |
||
327 | local changed; |
||
328 | for k, v in CT_RAMenu_Options do |
||
329 | if ( v["WindowPositions"] and v["WindowPositions"]["CT_RA_EmergencyFrame"] ) then |
||
330 | CT_RAMenu_Options[k]["WindowPositions"]["CT_RA_EmergencyFrame"] = nil; |
||
331 | changed = 1; |
||
332 | end |
||
333 | end |
||
334 | if ( changed ) then |
||
335 | CT_RAMenu_SaveWindowPositions(); |
||
336 | CT_RAMenu_UpdateWindowPositions(); |
||
337 | end |
||
338 | if ( not CT_RA_ModVersion or CT_RA_ModVersion ~= CT_RA_VersionNumber ) then |
||
339 | if ( not CT_RA_ModVersion or CT_RA_ModVersion < 1.465 ) then |
||
340 | CT_RA_UpdateFrame.showDialog = 5; |
||
341 | end |
||
342 | if ( not CT_RA_ModVersion or CT_RA_ModVersion < 1.165 ) then |
||
343 | DEFAULT_CHAT_FRAME:AddMessage("<CTRaid> All options reset due to new options format. We apoligize for this.", 1, 1, 0); |
||
344 | CT_RA_ResetOptions(); |
||
345 | end |
||
346 | CT_RA_ModVersion = CT_RA_VersionNumber; |
||
347 | end |
||
348 | if ( not CT_RAMenu_Options["temp"] or CT_RAMenu_Options["temp"]["unchanged"] ) then |
||
349 | CT_RAMenu_Options["temp"] = { }; |
||
350 | for k, v in CT_RAMenu_Options[CT_RAMenu_CurrSet] do |
||
351 | CT_RAMenu_Options["temp"][k] = v; |
||
352 | end |
||
353 | CT_RAMenu_Options["temp"]["unchanged"] = nil; |
||
354 | end |
||
355 | CT_RAMenu_UpdateMenu(); |
||
356 | CT_RASets_Button:SetPoint("TOPLEFT", "Minimap", "TOPLEFT", 52 - (80 * cos(CT_RASets_ButtonPosition)), (80 * sin(CT_RASets_ButtonPosition)) - 52); |
||
357 | if ( CT_RAMenu_Locked == 0 ) then |
||
358 | CT_RAMenuFrameHomeLock:SetText("Lock"); |
||
359 | end |
||
360 | |||
361 | if ( CT_RAMenu_Options["temp"]["ShowMonitor"] and GetNumRaidMembers() > 0 ) then |
||
362 | CT_RA_ResFrame:Show(); |
||
363 | end |
||
364 | |||
365 | CT_RA_UpdateRaidGroup(0); |
||
366 | end |
||
367 | |||
368 | function CT_RAMenuNotify_SetChecked() |
||
369 | if ( this == CT_RAMenuFrameBuffsNotifyDebuffs ) then |
||
370 | CT_RAMenu_Options["temp"]["NotifyDebuffs"]["main"] = this:GetChecked(); |
||
371 | else |
||
372 | CT_RAMenu_Options["temp"]["NotifyDebuffs"]["hidebuffs"] = not this:GetChecked(); |
||
373 | end |
||
374 | for i = 1, 8, 1 do |
||
375 | if ( not CT_RAMenu_Options["temp"]["NotifyDebuffs"]["main"] and CT_RAMenu_Options["temp"]["NotifyDebuffs"]["hidebuffs"] ) then |
||
376 | getglobal("CT_RAMenuFrameBuffsNotifyDebuffsGroup" .. i .. "Text"):SetTextColor(0.3, 0.3, 0.3); |
||
377 | getglobal("CT_RAMenuFrameBuffsNotifyDebuffsGroup" .. i .. "CheckButton"):Disable(); |
||
378 | getglobal("CT_RAMenuFrameBuffsNotifyDebuffsClass" .. i .. "Text"):SetTextColor(0.3, 0.3, 0.3); |
||
379 | getglobal("CT_RAMenuFrameBuffsNotifyDebuffsClass" .. i .. "CheckButton"):Disable(); |
||
380 | else |
||
381 | getglobal("CT_RAMenuFrameBuffsNotifyDebuffsGroup" .. i .. "Text"):SetTextColor(1, 1, 1); |
||
382 | getglobal("CT_RAMenuFrameBuffsNotifyDebuffsGroup" .. i .. "CheckButton"):Enable(); |
||
383 | getglobal("CT_RAMenuFrameBuffsNotifyDebuffsClass" .. i .. "Text"):SetTextColor(1, 1, 1); |
||
384 | getglobal("CT_RAMenuFrameBuffsNotifyDebuffsClass" .. i .. "CheckButton"):Enable(); |
||
385 | end |
||
386 | end |
||
387 | end |
||
388 | |||
389 | function CT_RAMenuGeneralMisc_AddMTs() |
||
390 | local new = ( CT_RAMenu_Options["temp"]["ShowNumMTs"] or 9 ) + 1; |
||
391 | if ( new == 10 ) then |
||
392 | this:Disable(); |
||
393 | end |
||
394 | CT_RAMenuFrameGeneralMTsSubtract:Enable(); |
||
395 | CT_RAMenu_Options["temp"]["ShowNumMTs"] = new; |
||
396 | CT_RAMenuFrameGeneralMTsNum:SetText(new); |
||
397 | end |
||
398 | |||
399 | function CT_RAMenuGeneralMisc_SubtractMTs() |
||
400 | local new = ( CT_RAMenu_Options["temp"]["ShowNumMTs"] or 10 ) - 1; |
||
401 | if ( new == 1 ) then |
||
402 | this:Disable(); |
||
403 | end |
||
404 | CT_RAMenuFrameGeneralMTsAdd:Enable(); |
||
405 | CT_RAMenu_Options["temp"]["ShowNumMTs"] = new; |
||
406 | CT_RAMenuFrameGeneralMTsNum:SetText(new); |
||
407 | end |
||
408 | |||
409 | function CT_RAMenuNotifyGroup_SetChecked() |
||
410 | CT_RAMenu_Options["temp"]["NotifyDebuffs"][this:GetParent():GetID()] = this:GetChecked(); |
||
411 | end |
||
412 | |||
413 | function CT_RAMenuNotifyClass_SetChecked() |
||
414 | CT_RAMenu_Options["temp"]["NotifyDebuffsClass"][this:GetParent():GetID()] = this:GetChecked(); |
||
415 | end |
||
416 | |||
417 | function CT_RAMenuDebuff_OnClick() |
||
418 | local frame = this:GetParent(); |
||
419 | local type = getglobal(this:GetParent():GetName() .. "Text"):GetText(); |
||
420 | type = gsub(type, " ", ""); |
||
421 | frame.r = CT_RAMenu_Options["temp"]["DebuffColors"][frame:GetID()]["r"]; |
||
422 | frame.g = CT_RAMenu_Options["temp"]["DebuffColors"][frame:GetID()]["g"]; |
||
423 | frame.b = CT_RAMenu_Options["temp"]["DebuffColors"][frame:GetID()]["b"]; |
||
424 | frame.opacity = CT_RAMenu_Options["temp"]["DebuffColors"][frame:GetID()]["a"]; |
||
425 | frame.opacityFunc = CT_RAMenuDebuff_SetColor; |
||
426 | frame.swatchFunc = CT_RAMenuDebuff_SetOpacity; |
||
427 | frame.hasOpacity = 1; |
||
428 | ColorPickerFrame.frame = frame; |
||
429 | CloseMenus(); |
||
430 | UIDropDownMenuButton_OpenColorPicker(frame); |
||
431 | end |
||
432 | |||
433 | function CT_RAMenuDebuff_SetColor() |
||
434 | local type = getglobal(ColorPickerFrame.frame:GetName() .. "Text"):GetText(); |
||
435 | local r, g, b = ColorPickerFrame:GetColorRGB(); |
||
436 | CT_RAMenu_Options["temp"]["DebuffColors"][ColorPickerFrame.frame:GetID()]["r"] = r; |
||
437 | CT_RAMenu_Options["temp"]["DebuffColors"][ColorPickerFrame.frame:GetID()]["g"] = g; |
||
438 | CT_RAMenu_Options["temp"]["DebuffColors"][ColorPickerFrame.frame:GetID()]["b"] = b; |
||
439 | getglobal(ColorPickerFrame.frame:GetName() .. "SwatchNormalTexture"):SetVertexColor(r, g, b); |
||
440 | end |
||
441 | |||
442 | function CT_RAMenuDebuff_SetOpacity() |
||
443 | local type = getglobal(ColorPickerFrame.frame:GetName() .. "Text"):GetText(); |
||
444 | local a = OpacitySliderFrame:GetValue(); |
||
445 | CT_RAMenu_Options["temp"]["DebuffColors"][ColorPickerFrame.frame:GetID()]["a"] = a; |
||
446 | end |
||
447 | |||
448 | function CT_RAMenuBuff_Move(move) |
||
449 | |||
450 | if ( string.find(this:GetParent():GetName(), "Debuff") ) then |
||
451 | -- Debuff |
||
452 | if ( not getglobal("CT_RAMenuFrameBuffsDebuff" .. (this:GetParent():GetID()+move) .. "Text") ) then return; end |
||
453 | local temp = getglobal("CT_RAMenuFrameBuffsDebuff" .. (this:GetParent():GetID()+move) .. "Text"):GetText(); |
||
454 | local temp2 = getglobal(this:GetParent():GetName() .. "Text"):GetText(); |
||
455 | getglobal("CT_RAMenuFrameBuffsDebuff" .. (this:GetParent():GetID()+move) .. "Text"):SetText(temp2); |
||
456 | getglobal(this:GetParent():GetName() .. "Text"):SetText(temp); |
||
457 | |||
458 | local temparr = CT_RAMenu_Options["temp"]["DebuffColors"][this:GetParent():GetID()]; |
||
459 | local temparr2 = CT_RAMenu_Options["temp"]["DebuffColors"][this:GetParent():GetID()+move]; |
||
460 | CT_RAMenu_Options["temp"]["DebuffColors"][this:GetParent():GetID()] = temparr2; |
||
461 | CT_RAMenu_Options["temp"]["DebuffColors"][this:GetParent():GetID()+move] = temparr; |
||
462 | |||
463 | getglobal("CT_RAMenuFrameBuffsDebuff" .. this:GetParent():GetID()+move .. "SwatchNormalTexture"):SetVertexColor(temparr.r, temparr.g, temparr.b); |
||
464 | getglobal("CT_RAMenuFrameBuffsDebuff" .. this:GetParent():GetID() .. "SwatchNormalTexture"):SetVertexColor(temparr2.r, temparr2.g, temparr2.b); |
||
465 | |||
466 | if ( temparr2["id"] ~= -1 ) then |
||
467 | getglobal(this:GetParent():GetName() .. "CheckButton"):SetChecked(1); |
||
468 | getglobal(this:GetParent():GetName() .. "Text"):SetTextColor(1, 1, 1); |
||
469 | else |
||
470 | getglobal(this:GetParent():GetName() .. "Text"):SetTextColor(0.3, 0.3, 0.3); |
||
471 | getglobal(this:GetParent():GetName() .. "CheckButton"):SetChecked(nil); |
||
472 | end |
||
473 | if ( temparr["id"] ~= -1 ) then |
||
474 | getglobal("CT_RAMenuFrameBuffsDebuff" .. (this:GetParent():GetID()+move) .. "CheckButton"):SetChecked(1); |
||
475 | getglobal("CT_RAMenuFrameBuffsDebuff" .. (this:GetParent():GetID()+move) .. "Text"):SetTextColor(1, 1, 1); |
||
476 | else |
||
477 | getglobal("CT_RAMenuFrameBuffsDebuff" .. (this:GetParent():GetID()+move) .. "Text"):SetTextColor(0.3, 0.3, 0.3); |
||
478 | getglobal("CT_RAMenuFrameBuffsDebuff" .. (this:GetParent():GetID()+move) .. "CheckButton"):SetChecked(nil); |
||
479 | end |
||
480 | |||
481 | else |
||
482 | -- Buff |
||
483 | if ( not getglobal("CT_RAMenuFrameBuffsBuff" .. (this:GetParent():GetID()+move) .. "Text") ) then return; end |
||
484 | local temp = getglobal("CT_RAMenuFrameBuffsBuff" .. (this:GetParent():GetID()+move) .. "Text"):GetText(); |
||
485 | local temp2 = getglobal(this:GetParent():GetName() .. "Text"):GetText(); |
||
486 | getglobal("CT_RAMenuFrameBuffsBuff" .. (this:GetParent():GetID()+move) .. "Text"):SetText(temp2); |
||
487 | getglobal(this:GetParent():GetName() .. "Text"):SetText(temp); |
||
488 | |||
489 | local temparr = CT_RAMenu_Options["temp"]["BuffArray"][this:GetParent():GetID()]; |
||
490 | local temparr2 = CT_RAMenu_Options["temp"]["BuffArray"][this:GetParent():GetID()+move]; |
||
491 | CT_RAMenu_Options["temp"]["BuffArray"][this:GetParent():GetID()] = temparr2; |
||
492 | CT_RAMenu_Options["temp"]["BuffArray"][this:GetParent():GetID()+move] = temparr; |
||
493 | if ( temparr2["show"] ~= -1 ) then |
||
494 | getglobal(this:GetParent():GetName() .. "CheckButton"):SetChecked(1); |
||
495 | getglobal(this:GetParent():GetName() .. "Text"):SetTextColor(1, 1, 1); |
||
496 | else |
||
497 | getglobal(this:GetParent():GetName() .. "Text"):SetTextColor(0.3, 0.3, 0.3); |
||
498 | getglobal(this:GetParent():GetName() .. "CheckButton"):SetChecked(nil); |
||
499 | end |
||
500 | if ( temparr["show"] ~= -1 ) then |
||
501 | getglobal("CT_RAMenuFrameBuffsBuff" .. (this:GetParent():GetID()+move) .. "CheckButton"):SetChecked(1); |
||
502 | getglobal("CT_RAMenuFrameBuffsBuff" .. (this:GetParent():GetID()+move) .. "Text"):SetTextColor(1, 1, 1); |
||
503 | else |
||
504 | getglobal("CT_RAMenuFrameBuffsBuff" .. (this:GetParent():GetID()+move) .. "Text"):SetTextColor(0.3, 0.3, 0.3); |
||
505 | getglobal("CT_RAMenuFrameBuffsBuff" .. (this:GetParent():GetID()+move) .. "CheckButton"):SetChecked(nil); |
||
506 | end |
||
507 | end |
||
508 | CT_RA_UpdateRaidGroup(2); |
||
509 | end |
||
510 | |||
511 | function CT_RAMenuBuff_ShowToggle() |
||
512 | local newid; |
||
513 | if ( this:GetChecked() ) then |
||
514 | newid = this:GetParent():GetID(); |
||
515 | getglobal(this:GetParent():GetName() .. "Text"):SetTextColor(1, 1, 1); |
||
516 | else |
||
517 | getglobal(this:GetParent():GetName() .. "Text"):SetTextColor(0.3, 0.3, 0.3); |
||
518 | newid = -1; |
||
519 | end |
||
520 | local type = getglobal(this:GetParent():GetName() .. "Text"):GetText(); |
||
521 | if ( string.find(this:GetParent():GetName(), "Debuff") ) then |
||
522 | -- Debuff |
||
523 | CT_RAMenu_Options["temp"]["DebuffColors"][this:GetParent():GetID()].id = newid; |
||
524 | else |
||
525 | -- Buff |
||
526 | if ( this:GetChecked() ) then |
||
527 | CT_RAMenu_Options["temp"]["BuffArray"][this:GetParent():GetID()]["show"] = 1; |
||
528 | else |
||
529 | CT_RAMenu_Options["temp"]["BuffArray"][this:GetParent():GetID()]["show"] = -1; |
||
530 | end |
||
531 | end |
||
532 | CT_RA_UpdateRaidGroup(2); |
||
533 | end |
||
534 | |||
535 | function CT_RAMenuDisplay_ShowMP() |
||
536 | CT_RAMenu_Options["temp"]["HideMP"] = this:GetChecked(); |
||
537 | CT_RA_UpdateRaidGroup(0); |
||
538 | CT_RA_UpdateMTs(); |
||
539 | end |
||
540 | |||
541 | function CT_RAMenuDisplay_ShowRP() |
||
542 | CT_RAMenu_Options["temp"]["HideRP"] = this:GetChecked(); |
||
543 | CT_RA_UpdateRaidGroup(0); |
||
544 | CT_RA_UpdateMTs(); |
||
545 | end |
||
546 | |||
547 | function CT_RAMenuDisplay_ShowHealth() |
||
548 | if ( not this:GetChecked() ) then |
||
549 | CT_RAMenu_Options["temp"]["MemberHeight"] = CT_RAMenu_Options["temp"]["MemberHeight"]+8; |
||
550 | else |
||
551 | CT_RAMenu_Options["temp"]["MemberHeight"] = CT_RAMenu_Options["temp"]["MemberHeight"]-8; |
||
552 | end |
||
553 | CT_RA_UpdateRaidGroup(0); |
||
554 | CT_RA_UpdateMTs(); |
||
555 | end |
||
556 | |||
557 | function CT_RAMenuDisplay_ShowHP() |
||
558 | if ( this:GetChecked() ) then |
||
559 | if ( CT_RAMenuFrameGeneralDisplayShowHPPercentCB:GetChecked() ) then |
||
560 | CT_RAMenu_Options["temp"]["ShowHP"] = 2; |
||
561 | else |
||
562 | CT_RAMenu_Options["temp"]["ShowHP"] = 1; |
||
563 | end |
||
564 | else |
||
565 | CT_RAMenu_Options["temp"]["ShowHP"] = nil; |
||
566 | end |
||
567 | if ( this:GetChecked() ) then |
||
568 | CT_RAMenuFrameGeneralDisplayHealthPercentsText:SetTextColor(1, 1, 1); |
||
569 | CT_RAMenuFrameGeneralDisplayShowHPPercentCB:Enable(); |
||
570 | CT_RAMenuFrameGeneralDisplayShowHPSwatchNormalTexture:SetVertexColor(CT_RAMenu_Options["temp"]["PercentColor"].r, CT_RAMenu_Options["temp"]["PercentColor"].g, CT_RAMenu_Options["temp"]["PercentColor"].b); |
||
571 | CT_RAMenuFrameGeneralDisplayShowHPSwatchBG:SetVertexColor(1, 1, 1); |
||
572 | else |
||
573 | CT_RAMenuFrameGeneralDisplayHealthPercentsText:SetTextColor(0.3, 0.3, 0.3); |
||
574 | CT_RAMenuFrameGeneralDisplayShowHPPercentCB:Disable(); |
||
575 | CT_RAMenuFrameGeneralDisplayShowHPSwatchNormalTexture:SetVertexColor(0.3, 0.3, 0.3); |
||
576 | CT_RAMenuFrameGeneralDisplayShowHPSwatchBG:SetVertexColor(0.3, 0.3, 0.3); |
||
577 | end |
||
578 | for i = 1, GetNumRaidMembers(), 1 do |
||
579 | if ( CT_RA_Stats[UnitName("raid" .. i)] ) then |
||
580 | CT_RA_UpdateUnitHealth(getglobal("CT_RAMember" .. i), CT_RA_Stats[UnitName("raid" .. i)]["Health"], CT_RA_Stats[UnitName("raid" .. i)]["Healthmax"]); |
||
581 | end |
||
582 | end |
||
583 | CT_RA_UpdateMTs(); |
||
584 | end |
||
585 | |||
586 | function CT_RAMenuDisplay_ShowHPPercents() |
||
587 | if ( this:GetChecked() ) then |
||
588 | CT_RAMenu_Options["temp"]["ShowHP"] = 2; |
||
589 | else |
||
590 | CT_RAMenu_Options["temp"]["ShowHP"] = 1; |
||
591 | end |
||
592 | for i = 1, GetNumRaidMembers(), 1 do |
||
593 | if ( CT_RA_Stats[UnitName("raid" .. i)] ) then |
||
594 | CT_RA_UpdateUnitHealth(getglobal("CT_RAMember" .. i), CT_RA_Stats[UnitName("raid" .. i)]["Health"], CT_RA_Stats[UnitName("raid" .. i)]["Healthmax"]); |
||
595 | end |
||
596 | end |
||
597 | end |
||
598 | |||
599 | function CT_RAMenuDisplay_ShowGroupNames() |
||
600 | CT_RAMenu_Options["temp"]["HideNames"] = not this:GetChecked(); |
||
601 | CT_RA_UpdateVisibility(); |
||
602 | end |
||
603 | |||
604 | function CT_RAMenuDisplay_ChangeWC() |
||
605 | local frame = this:GetParent(); |
||
606 | frame.r = CT_RAMenu_Options["temp"]["DefaultColor"]["r"]; |
||
607 | frame.g = CT_RAMenu_Options["temp"]["DefaultColor"]["g"]; |
||
608 | frame.b = CT_RAMenu_Options["temp"]["DefaultColor"]["b"]; |
||
609 | frame.opacity = CT_RAMenu_Options["temp"]["DefaultColor"]["a"]; |
||
610 | frame.opacityFunc = CT_RAMenuDisplay_SetOpacity; |
||
611 | frame.swatchFunc = CT_RAMenuDisplay_SetColor; |
||
612 | frame.cancelFunc = CT_RAMenuDisplay_CancelColor; |
||
613 | frame.hasOpacity = 1; |
||
614 | CloseMenus(); |
||
615 | UIDropDownMenuButton_OpenColorPicker(frame); |
||
616 | end |
||
617 | |||
618 | function CT_RAMenuDisplay_SetColor() |
||
619 | local r, g, b = ColorPickerFrame:GetColorRGB(); |
||
620 | CT_RAMenu_Options["temp"]["DefaultColor"]["r"] = r; |
||
621 | CT_RAMenu_Options["temp"]["DefaultColor"]["g"] = g; |
||
622 | CT_RAMenu_Options["temp"]["DefaultColor"]["b"] = b; |
||
623 | CT_RAMenuFrameGeneralDisplayWindowColorSwatchNormalTexture:SetVertexColor(r, g, b); |
||
624 | CT_RA_UpdateRaidGroupColors(); |
||
625 | end |
||
626 | |||
627 | function CT_RAMenuDisplay_SetOpacity() |
||
628 | CT_RAMenu_Options["temp"]["DefaultColor"]["a"] = OpacitySliderFrame:GetValue(); |
||
629 | CT_RA_UpdateRaidGroupColors(); |
||
630 | end |
||
631 | |||
632 | function CT_RAMenuDisplay_CancelColor(val) |
||
633 | CT_RAMenu_Options["temp"]["DefaultColor"]["r"] = val.r; |
||
634 | CT_RAMenu_Options["temp"]["DefaultColor"]["g"] = val.g; |
||
635 | CT_RAMenu_Options["temp"]["DefaultColor"]["b"] = val.b; |
||
636 | CT_RAMenu_Options["temp"]["DefaultColor"]["a"] = val.opacity; |
||
637 | CT_RAMenuFrameGeneralDisplayWindowColorSwatchNormalTexture:SetVertexColor(val.r, val.g, val.b); |
||
638 | CT_RA_UpdateRaidGroupColors(); |
||
639 | end |
||
640 | |||
641 | function CT_RAMenuDisplay_LockGroups() |
||
642 | CT_RAMenu_Options["temp"]["LockGroups"] = this:GetChecked(); |
||
643 | CT_RA_UpdateVisibility(); |
||
644 | end |
||
645 | |||
646 | function CT_RAMenuFrameGeneralMiscDropDown_OnLoad() |
||
647 | UIDropDownMenu_Initialize(this, CT_RAMenuFrameGeneralMiscDropDown_Initialize); |
||
648 | UIDropDownMenu_SetWidth(130); |
||
649 | UIDropDownMenu_SetSelectedID(CT_RAMenuFrameGeneralMiscDropDown, 1); |
||
650 | end |
||
651 | |||
652 | function CT_RAMenuFrameGeneralMiscDropDown_Initialize() |
||
653 | local info = {}; |
||
654 | info.text = "Group"; |
||
655 | info.func = CT_RAMenuFrameGeneralMiscDropDown_OnClick; |
||
656 | UIDropDownMenu_AddButton(info); |
||
657 | |||
658 | info = {}; |
||
659 | info.text = "Class"; |
||
660 | info.func = CT_RAMenuFrameGeneralMiscDropDown_OnClick; |
||
661 | UIDropDownMenu_AddButton(info); |
||
662 | |||
663 | info = {}; |
||
664 | info.text = "Custom"; |
||
665 | info.func = CT_RAMenuFrameGeneralMiscDropDown_OnClick; |
||
666 | UIDropDownMenu_AddButton(info); |
||
667 | |||
668 | info = {}; |
||
669 | info.text = "Virtual"; |
||
670 | info.func = CT_RAMenuFrameGeneralMiscDropDown_OnClick; |
||
671 | UIDropDownMenu_AddButton(info); |
||
672 | end |
||
673 | |||
674 | |||
675 | function CT_RAMenuFrameGeneralMiscDropDown_OnClick() |
||
676 | UIDropDownMenu_SetSelectedID(CT_RAMenuFrameGeneralMiscDropDown, this:GetID()); |
||
677 | if ( this:GetID() == 1 ) then |
||
678 | CT_RA_SetSortType("group"); |
||
679 | elseif ( this:GetID() == 2 ) then |
||
680 | CT_RA_SetSortType("class"); |
||
681 | elseif ( this:GetID() == 3 ) then |
||
682 | CT_RA_SetSortType("custom"); |
||
683 | elseif ( this:GetID() == 4 ) then |
||
684 | CT_RA_SetSortType("virtual"); |
||
685 | end |
||
686 | CT_RA_UpdateRaidGroup(0); |
||
687 | CT_RA_UpdateMTs(); |
||
688 | CT_RAOptions_Update(); |
||
689 | end |
||
690 | |||
691 | function CT_RAMenuFrameBuffsBuffsDropDown_OnLoad() |
||
692 | UIDropDownMenu_Initialize(this, CT_RAMenuFrameBuffsBuffsDropDown_Initialize); |
||
693 | UIDropDownMenu_SetWidth(180); |
||
694 | UIDropDownMenu_SetSelectedID(CT_RAMenuFrameBuffsBuffsDropDown, 1); |
||
695 | end |
||
696 | |||
697 | function CT_RAMenuFrameBuffsBuffsDropDown_Initialize() |
||
698 | local info = {}; |
||
699 | info.text = "Show buffs"; |
||
700 | info.func = CT_RAMenuFrameBuffsBuffsDropDown_OnClick; |
||
701 | UIDropDownMenu_AddButton(info); |
||
702 | |||
703 | info = {}; |
||
704 | info.text = "Show debuffs"; |
||
705 | info.func = CT_RAMenuFrameBuffsBuffsDropDown_OnClick; |
||
706 | UIDropDownMenu_AddButton(info); |
||
707 | |||
708 | info = {}; |
||
709 | info.text = "Show buffs until debuffed"; |
||
710 | info.func = CT_RAMenuFrameBuffsBuffsDropDown_OnClick; |
||
711 | UIDropDownMenu_AddButton(info); |
||
712 | end |
||
713 | |||
714 | |||
715 | function CT_RAMenuFrameBuffsBuffsDropDown_OnClick() |
||
716 | UIDropDownMenu_SetSelectedID(CT_RAMenuFrameBuffsBuffsDropDown, this:GetID()); |
||
717 | if ( this:GetID() == 1 ) then |
||
718 | CT_RAMenu_Options["temp"]["ShowDebuffs"] = nil; |
||
719 | CT_RAMenu_Options["temp"]["ShowBuffsDebuffed"] = nil; |
||
720 | elseif ( this:GetID() == 2 ) then |
||
721 | CT_RAMenu_Options["temp"]["ShowDebuffs"] = 1; |
||
722 | CT_RAMenu_Options["temp"]["ShowBuffsDebuffed"] = nil; |
||
723 | else |
||
724 | CT_RAMenu_Options["temp"]["ShowDebuffs"] = nil; |
||
725 | CT_RAMenu_Options["temp"]["ShowBuffsDebuffed"] = 1; |
||
726 | end |
||
727 | CT_RA_UpdateRaidGroup(0); |
||
728 | CT_RA_UpdateMTs(); |
||
729 | CT_RAOptions_Update(); |
||
730 | end |
||
731 | |||
732 | function CT_RAMenuFrameGeneralDisplayHealthDropDown_OnLoad() |
||
733 | UIDropDownMenu_Initialize(this, CT_RAMenuFrameGeneralDisplayHealthDropDown_Initialize); |
||
734 | UIDropDownMenu_SetWidth(130); |
||
735 | UIDropDownMenu_SetSelectedID(CT_RAMenuFrameGeneralDisplayHealthDropDown, 1); |
||
736 | end |
||
737 | |||
738 | function CT_RAMenuFrameGeneralDisplayHealthDropDown_Initialize() |
||
739 | local info = {}; |
||
740 | info.text = "Show Values"; |
||
741 | info.func = CT_RAMenuFrameGeneralDisplayHealthDropDown_OnClick; |
||
742 | UIDropDownMenu_AddButton(info); |
||
743 | |||
744 | info = {}; |
||
745 | info.text = "Show Percentages"; |
||
746 | info.func = CT_RAMenuFrameGeneralDisplayHealthDropDown_OnClick; |
||
747 | UIDropDownMenu_AddButton(info); |
||
748 | |||
749 | info = {}; |
||
750 | info.text = "Show Deficit"; |
||
751 | info.func = CT_RAMenuFrameGeneralDisplayHealthDropDown_OnClick; |
||
752 | UIDropDownMenu_AddButton(info); |
||
753 | |||
754 | info = {}; |
||
755 | info.text = "Show only MTT HP %"; |
||
756 | info.func = CT_RAMenuFrameGeneralDisplayHealthDropDown_OnClick; |
||
757 | UIDropDownMenu_AddButton(info); |
||
758 | |||
759 | info = {}; |
||
760 | info.text = "Show None"; |
||
761 | info.func = CT_RAMenuFrameGeneralDisplayHealthDropDown_OnClick; |
||
762 | UIDropDownMenu_AddButton(info); |
||
763 | end |
||
764 | |||
765 | |||
766 | function CT_RAMenuFrameGeneralDisplayHealthDropDown_OnClick() |
||
767 | UIDropDownMenu_SetSelectedID(CT_RAMenuFrameGeneralDisplayHealthDropDown, this:GetID()); |
||
768 | if ( this:GetID() < 5 ) then |
||
769 | CT_RAMenu_Options["temp"]["ShowHP"] = this:GetID(); |
||
770 | else |
||
771 | CT_RAMenu_Options["temp"]["ShowHP"] = nil; |
||
772 | end |
||
773 | CT_RA_UpdateRaidGroup(0); |
||
774 | CT_RAOptions_Update(); |
||
775 | end |
||
776 | |||
777 | function CT_RAMenu_General_ResetWindows() |
||
778 | CT_RAGroupDrag1:ClearAllPoints(); |
||
779 | CT_RAGroupDrag2:ClearAllPoints(); |
||
780 | CT_RAGroupDrag3:ClearAllPoints(); |
||
781 | CT_RAGroupDrag4:ClearAllPoints(); |
||
782 | CT_RAGroupDrag5:ClearAllPoints(); |
||
783 | CT_RAGroupDrag6:ClearAllPoints(); |
||
784 | CT_RAGroupDrag7:ClearAllPoints(); |
||
785 | CT_RAGroupDrag8:ClearAllPoints(); |
||
786 | CT_RAMTGroupDrag:ClearAllPoints(); |
||
787 | CT_RA_EmergencyFrameDrag:ClearAllPoints(); |
||
788 | |||
789 | CT_RAGroupDrag1:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", 950, -35); |
||
790 | CT_RAGroupDrag2:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", 950, -275); |
||
791 | CT_RAGroupDrag3:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", 855, -35); |
||
792 | CT_RAGroupDrag4:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", 855, -275); |
||
793 | CT_RAGroupDrag5:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", 760, -35); |
||
794 | CT_RAGroupDrag6:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", 760, -275); |
||
795 | CT_RAGroupDrag7:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", 665, -35); |
||
796 | CT_RAGroupDrag8:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", 665, -275); |
||
797 | CT_RAMTGroupDrag:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", 570, -35); |
||
798 | CT_RA_EmergencyFrameDrag:SetPoint("CENTER", "UIParent", "CENTER"); |
||
799 | CT_RA_LinkDrag(CT_RA_EmergencyFrame, CT_RA_EmergencyFrameDrag, "TOP", "TOP", 0, -12); |
||
800 | CT_RAMenu_SaveWindowPositions(); |
||
801 | end |
||
802 | |||
803 | function CT_RAMenuDisplay_ChangeAC() |
||
804 | local frame = this:GetParent(); |
||
805 | frame.r = CT_RAMenu_Options["temp"]["DefaultAlertColor"]["r"]; |
||
806 | frame.g = CT_RAMenu_Options["temp"]["DefaultAlertColor"]["g"]; |
||
807 | frame.b = CT_RAMenu_Options["temp"]["DefaultAlertColor"]["b"]; |
||
808 | frame.swatchFunc = CT_RAMenuDisplay_SetAlertColor; |
||
809 | frame.cancelFunc = CT_RAMenuDisplay_CancelAlertColor; |
||
810 | CloseMenus(); |
||
811 | UIDropDownMenuButton_OpenColorPicker(frame); |
||
812 | end |
||
813 | |||
814 | function CT_RAMenuDisplay_SetAlertColor() |
||
815 | local r, g, b = ColorPickerFrame:GetColorRGB(); |
||
816 | CT_RAMenu_Options["temp"]["DefaultAlertColor"]["r"] = r; |
||
817 | CT_RAMenu_Options["temp"]["DefaultAlertColor"]["g"] = g; |
||
818 | CT_RAMenu_Options["temp"]["DefaultAlertColor"]["b"] = b; |
||
819 | CT_RAMenuFrameGeneralDisplayAlertColorSwatchNormalTexture:SetVertexColor(r, g, b); |
||
820 | end |
||
821 | |||
822 | function CT_RAMenuDisplay_CancelAlertColor(val) |
||
823 | CT_RAMenu_Options["temp"]["DefaultAlertColor"]["r"] = val.r; |
||
824 | CT_RAMenu_Options["temp"]["DefaultAlertColor"]["g"] = val.g; |
||
825 | CT_RAMenu_Options["temp"]["DefaultAlertColor"]["b"] = val.b; |
||
826 | CT_RAMenuFrameGeneralDisplayAlertColorSwatchNormalTexture:SetVertexColor(val.r, val.g, val.b); |
||
827 | end |
||
828 | |||
829 | function CT_RAMenuDisplay_ChangeWC() |
||
830 | local frame = this:GetParent(); |
||
831 | frame.r = CT_RAMenu_Options["temp"]["DefaultColor"]["r"]; |
||
832 | frame.g = CT_RAMenu_Options["temp"]["DefaultColor"]["g"]; |
||
833 | frame.b = CT_RAMenu_Options["temp"]["DefaultColor"]["b"]; |
||
834 | frame.opacity = CT_RAMenu_Options["temp"]["DefaultColor"]["a"]; |
||
835 | frame.opacityFunc = CT_RAMenuDisplay_SetOpacity; |
||
836 | frame.swatchFunc = CT_RAMenuDisplay_SetColor; |
||
837 | frame.cancelFunc = CT_RAMenuDisplay_CancelColor; |
||
838 | frame.hasOpacity = 1; |
||
839 | CloseMenus(); |
||
840 | UIDropDownMenuButton_OpenColorPicker(frame); |
||
841 | end |
||
842 | |||
843 | function CT_RAMenuDisplay_ChangeTC() |
||
844 | local frame = this:GetParent(); |
||
845 | frame.r = CT_RAMenu_Options["temp"]["PercentColor"]["r"]; |
||
846 | frame.g = CT_RAMenu_Options["temp"]["PercentColor"]["g"]; |
||
847 | frame.b = CT_RAMenu_Options["temp"]["PercentColor"]["b"]; |
||
848 | frame.swatchFunc = CT_RAMenuDisplayPercent_SetColor; |
||
849 | frame.cancelFunc = CT_RAMenuDisplayPercent_CancelColor; |
||
850 | CloseMenus(); |
||
851 | UIDropDownMenuButton_OpenColorPicker(frame); |
||
852 | end |
||
853 | |||
854 | function CT_RAMenuDisplayPercent_SetColor() |
||
855 | local r, g, b = ColorPickerFrame:GetColorRGB(); |
||
856 | CT_RAMenu_Options["temp"]["PercentColor"] = { ["r"] = r, ["g"] = g, ["b"] = b }; |
||
857 | CT_RAMenuFrameGeneralDisplayShowHPSwatchNormalTexture:SetVertexColor(r, g, b); |
||
858 | CT_RA_UpdateRaidGroupColors(); |
||
859 | end |
||
860 | |||
861 | function CT_RAMenuDisplayPercent_CancelColor(val) |
||
862 | CT_RAMenu_Options["temp"]["PercentColor"] = { r = val.r, g = val.g, b = val.b }; |
||
863 | CT_RAMenuFrameGeneralDisplayShowHPSwatchNormalTexture:SetVertexColor(val.r, val.g, val.b); |
||
864 | CT_RA_UpdateRaidGroupColors(); |
||
865 | end |
||
866 | |||
867 | function CT_RAMenuGeneral_HideOffline() |
||
868 | CT_RAMenu_Options["temp"]["HideOffline"] = this:GetChecked(); |
||
869 | CT_RA_UpdateRaidGroup(0); |
||
870 | end |
||
871 | |||
872 | function CT_RAMenuGeneral_HideShort() |
||
873 | CT_RAMenu_Options["temp"]["HideShort"] = this:GetChecked(); |
||
874 | CT_RA_UpdateRaidGroup(0); |
||
875 | end |
||
876 | |||
877 | function CT_RAMenuBuff_ShowDebuffs() |
||
878 | CT_RAMenu_Options["temp"]["ShowDebuffs"] = this:GetChecked(); |
||
879 | CT_RA_UpdateRaidGroup(0); |
||
880 | end |
||
881 | |||
882 | function CT_RAMenuGeneral_HideBorder() |
||
883 | CT_RAMenu_Options["temp"]["HideBorder"] = this:GetChecked(); |
||
884 | CT_RA_UpdateRaidGroup(0); |
||
885 | CT_RA_UpdateMTs(); |
||
886 | CT_RA_UpdatePTs(); |
||
887 | if ( this:GetChecked() ) then |
||
888 | CT_RAMenuFrameGeneralMiscRemoveSpacingCB:Enable(); |
||
889 | CT_RAMenuFrameGeneralMiscRemoveSpacingText:SetTextColor(1, 1, 1); |
||
890 | else |
||
891 | CT_RAMenuFrameGeneralMiscRemoveSpacingCB:Disable(); |
||
892 | CT_RAMenuFrameGeneralMiscRemoveSpacingText:SetTextColor(0.3, 0.3, 0.3); |
||
893 | end |
||
894 | end |
||
895 | |||
896 | function CT_RAMenuGeneral_RemoveSpacing() |
||
897 | CT_RAMenu_Options["temp"]["HideSpace"] = this:GetChecked(); |
||
898 | CT_RA_UpdateRaidGroup(0); |
||
899 | CT_RA_UpdateMTs(); |
||
900 | CT_RA_UpdatePTs(); |
||
901 | end |
||
902 | |||
903 | function CT_RAMenu_Misc_ShowTankDeath() |
||
904 | CT_RAMenu_Options["temp"]["HideTankNotifications"] = not this:GetChecked(); |
||
905 | end |
||
906 | |||
907 | function CT_RAMenuGeneral_ShowHorizontal() |
||
908 | CT_RAMenu_Options["temp"]["ShowHorizontal"] = this:GetChecked(); |
||
909 | CT_RA_UpdateRaidGroup(0); |
||
910 | end |
||
911 | |||
912 | function CT_RAMenuGeneral_ShowReversed() |
||
913 | CT_RAMenu_Options["temp"]["ShowReversed"] = this:GetChecked(); |
||
914 | CT_RA_UpdateRaidGroup(0); |
||
915 | CT_RA_UpdateMTs(); |
||
916 | CT_RA_UpdatePTs(); |
||
917 | end |
||
918 | |||
919 | function CT_RAMenuGeneral_ShowMTs() |
||
920 | CT_RAMenu_Options["temp"]["HideMTs"] = not this:GetChecked(); |
||
921 | CT_RA_UpdateRaidGroup(3); |
||
922 | CT_RA_UpdateMTs(); |
||
923 | end |
||
924 | |||
925 | function CT_RAMenuGeneral_ShowMeters() |
||
926 | if ( not CT_RAMenu_Options["temp"]["StatusMeters"] ) then |
||
927 | CT_RAMenu_Options["temp"]["StatusMeters"] = { |
||
928 | ["Health Display"] = { }, |
||
929 | ["Mana Display"] = { }, |
||
930 | ["Raid Health"] = { }, |
||
931 | ["Raid Mana"] = { }, |
||
932 | ["Background"] = { |
||
933 | ["r"] = 0, |
||
934 | ["g"] = 0, |
||
935 | ["b"] = 1, |
||
936 | ["a"] = 0.5 |
||
937 | } |
||
938 | }; |
||
939 | end |
||
940 | CT_RAMenu_Options["temp"]["StatusMeters"]["Show"] = this:GetChecked(); |
||
941 | if ( this:GetChecked() ) then |
||
942 | CT_RAMetersFrame:Show(); |
||
943 | CT_RAMeters_UpdateWindow(); |
||
944 | else |
||
945 | CT_RAMetersFrame:Hide(); |
||
946 | end |
||
947 | end |
||
948 | |||
949 | function CT_RAMenuMisc_Slider_OnChange() |
||
950 | local spell = CT_RAMenu_Options["temp"]["ClassHealings"][CT_RA_GetLocale()][UnitClass("player")][this:GetID()]; |
||
951 | local realVal = 0; |
||
952 | if ( CT_RAMenu_Options["temp"]["UsePercentValues"] ) then |
||
953 | realVal = this:GetValue(); |
||
954 | CT_RAMenu_Options["temp"]["ClassHealings"][CT_RA_GetLocale()][UnitClass("player")][this:GetID()][5] = realVal; |
||
955 | if ( type(spell[1]) == "table" ) then |
||
956 | getglobal(this:GetName() .. "Text"):SetText(spell[1][1] .. ": " .. realVal .. "%"); |
||
957 | else |
||
958 | getglobal(this:GetName() .. "Text"):SetText(spell[1] .. ": " .. realVal .. "%"); |
||
959 | end |
||
960 | else |
||
961 | realVal = 5000-this:GetValue(); |
||
962 | CT_RAMenu_Options["temp"]["ClassHealings"][CT_RA_GetLocale()][UnitClass("player")][this:GetID()][3] = realVal; |
||
963 | if ( type(spell[1]) == "table" ) then |
||
964 | getglobal(this:GetName() .. "Text"):SetText(spell[1][1] .. ": -" .. realVal); |
||
965 | else |
||
966 | getglobal(this:GetName() .. "Text"):SetText(spell[1] .. ": -" .. realVal); |
||
967 | end |
||
968 | end |
||
969 | end |
||
970 | |||
971 | function CT_RAMenuMisc_OnUpdate(elapsed) |
||
972 | if ( this.scaleupdate ) then |
||
973 | this.scaleupdate = this.scaleupdate - elapsed; |
||
974 | if ( this.scaleupdate <= 0 ) then |
||
975 | this.scaleupdate = 10; |
||
976 | if ( CT_RAMenu_Options["temp"]["WindowScaling"] ) then |
||
977 | local newScaling = CT_RAMenu_Options["temp"]["WindowScaling"]; |
||
978 | for i = 1, 40, 1 do |
||
979 | if ( i <= 8 ) then |
||
980 | getglobal("CT_RAGroupDrag" .. i):SetWidth(CT_RAGroup1:GetWidth()*newScaling+(22*newScaling)); |
||
981 | getglobal("CT_RAGroupDrag" .. i):SetHeight(CT_RAMember1:GetHeight()*newScaling/2); |
||
982 | getglobal("CT_RAGroup" .. i):SetScale(newScaling); |
||
983 | end |
||
984 | getglobal("CT_RAMember" .. i):SetScale(newScaling); |
||
985 | end |
||
986 | end |
||
987 | if ( CT_RAMenu_Options["temp"]["MTScaling"] ) then |
||
988 | local newScaling = CT_RAMenu_Options["temp"]["MTScaling"]; |
||
989 | for i = 1, 10, 1 do |
||
990 | getglobal("CT_RAMTGroupMember" .. i):SetScale(newScaling); |
||
991 | getglobal("CT_RAPTGroupMember" .. i):SetScale(newScaling); |
||
992 | end |
||
993 | CT_RAMTGroup:SetScale(newScaling); |
||
994 | CT_RAPTGroup:SetScale(newScaling); |
||
995 | CT_RAMTGroupDrag:SetWidth(CT_RAMTGroup:GetWidth()*newScaling+(22*newScaling)); |
||
996 | CT_RAMTGroupDrag:SetHeight(CT_RAMTGroupMember1:GetHeight()*newScaling/2); |
||
997 | CT_RAPTGroupDrag:SetWidth(CT_RAPTGroup:GetWidth()*newScaling+(22*newScaling)); |
||
998 | CT_RAPTGroupDrag:SetHeight(CT_RAPTGroupMember1:GetHeight()*newScaling/2); |
||
999 | end |
||
1000 | if ( CT_RAMenu_Options["temp"]["EMScaling"] ) then |
||
1001 | local newScaling = CT_RAMenu_Options["temp"]["EMScaling"]; |
||
1002 | CT_RA_EmergencyFrame:SetScale(newScaling); |
||
1003 | CT_RA_EmergencyFrameDrag:SetWidth(CT_RA_EmergencyFrame:GetWidth()*newScaling+(27.5*newScaling)); |
||
1004 | CT_RA_EmergencyFrameDrag:SetHeight(CT_RA_EmergencyFrame:GetHeight()*newScaling/5); |
||
1005 | end |
||
1006 | end |
||
1007 | end |
||
1008 | end |
||
1009 | |||
1010 | function CT_RA_SpellStartCast(spell) |
||
1011 | if ( spell[1] == CT_RA_RESURRECTION or spell[1] == CT_RA_ANCESTRALSPIRIT or spell[1] == CT_RA_REBIRTH or spell[1] == CT_RA_REDEMPTION ) then |
||
1012 | CT_RA_AddMessage("RES " .. spell[2]); |
||
1013 | CT_RA_Ressers[UnitName("player")] = spell[2]; |
||
1014 | CT_RA_UpdateResFrame(); |
||
1015 | end |
||
1016 | end |
||
1017 | |||
1018 | function CT_RA_SpellEndCast() |
||
1019 | if ( CT_RA_Ressers[UnitName("player")] ) then |
||
1020 | CT_RA_AddMessage("RESNO"); |
||
1021 | end |
||
1022 | end |
||
1023 | |||
1024 | function CT_RAMenuMisc_OnEvent(event) |
||
1025 | if ( event == "PLAYER_REGEN_ENABLED" ) then |
||
1026 | CT_RA_InCombat = nil; |
||
1027 | elseif ( event == "PLAYER_REGEN_DISABLED" ) then |
||
1028 | CT_RA_InCombat = 1; |
||
1029 | end |
||
1030 | end |
||
1031 | |||
1032 | function CT_RAMenuAdditional_Scaling_OnShow(slider) |
||
1033 | if ( not slider ) then |
||
1034 | slider = this; |
||
1035 | end |
||
1036 | getglobal(slider:GetName().."High"):SetText("150%"); |
||
1037 | getglobal(slider:GetName().."Low"):SetText("50%"); |
||
1038 | if ( not CT_RAMenu_Options["temp"]["WindowScaling"] ) then |
||
1039 | CT_RAMenu_Options["temp"]["WindowScaling"] = 1; |
||
1040 | end |
||
1041 | getglobal(slider:GetName() .. "Text"):SetText("Group Scaling - " .. floor(CT_RAMenu_Options["temp"]["WindowScaling"]*100+0.5) .. "%"); |
||
1042 | |||
1043 | slider:SetMinMaxValues(0.5, 1.5); |
||
1044 | slider:SetValueStep(0.01); |
||
1045 | slider:SetValue(CT_RAMenu_Options["temp"]["WindowScaling"]); |
||
1046 | end |
||
1047 | |||
1048 | function CT_RAMenuAdditional_Scaling_OnValueChanged() |
||
1049 | CT_RAMenu_Options["temp"]["WindowScaling"] = floor(this:GetValue()*100+0.5)/100; |
||
1050 | getglobal(this:GetName() .. "Text"):SetText("Group Scaling - " .. floor(this:GetValue()*100+0.5) .. "%"); |
||
1051 | local newScaling = CT_RAMenu_Options["temp"]["WindowScaling"]; |
||
1052 | for i = 1, 40, 1 do |
||
1053 | if ( i <= 8 ) then |
||
1054 | getglobal("CT_RAGroupDrag" .. i):SetWidth(CT_RAGroup1:GetWidth()*newScaling+(22*newScaling)); |
||
1055 | getglobal("CT_RAGroupDrag" .. i):SetHeight(CT_RAMember1:GetHeight()*newScaling/2); |
||
1056 | getglobal("CT_RAGroup" .. i):SetScale(newScaling); |
||
1057 | end |
||
1058 | getglobal("CT_RAMember" .. i):SetScale(newScaling); |
||
1059 | end |
||
1060 | end |
||
1061 | |||
1062 | function CT_RAMenuAdditional_EM_OnShow(slider) |
||
1063 | if ( not slider ) then |
||
1064 | slider = this; |
||
1065 | end |
||
1066 | local id = slider:GetID(); |
||
1067 | |||
1068 | if ( not CT_RAMenu_Options["temp"]["EMThreshold"] ) then |
||
1069 | CT_RAMenu_Options["temp"]["EMThreshold"] = 0.9; |
||
1070 | end |
||
1071 | if ( not CT_RAMenu_Options["temp"]["EMScaling"] ) then |
||
1072 | CT_RAMenu_Options["temp"]["EMScaling"] = 1; |
||
1073 | end |
||
1074 | |||
1075 | local tbl = { |
||
1076 | ["hl"] = { |
||
1077 | { "99%", "25%" }, |
||
1078 | { "150%", "50%" } |
||
1079 | }, |
||
1080 | ["title"] = { |
||
1081 | "Health Threshold - " .. floor(CT_RAMenu_Options["temp"]["EMThreshold"]*100+0.5) .. "%", |
||
1082 | "Scaling - " .. floor(CT_RAMenu_Options["temp"]["EMScaling"]*100+0.5) .. "%" |
||
1083 | }, |
||
1084 | ["tooltip"] = { |
||
1085 | "Regulates the health threshold of when to display the health bars.", |
||
1086 | "Rescales the window to make it larger or smaller." |
||
1087 | }, |
||
1088 | ["minmax"] = { |
||
1089 | { 0.25, 0.99 }, |
||
1090 | { 0.5, 1.5 } |
||
1091 | }, |
||
1092 | ["value"] = { |
||
1093 | CT_RAMenu_Options["temp"]["EMThreshold"], |
||
1094 | CT_RAMenu_Options["temp"]["EMScaling"] |
||
1095 | } |
||
1096 | }; |
||
1097 | getglobal(slider:GetName().."High"):SetText(tbl["hl"][id][1]); |
||
1098 | getglobal(slider:GetName().."Low"):SetText(tbl["hl"][id][2]); |
||
1099 | getglobal(slider:GetName() .. "Text"):SetText(tbl["title"][id]); |
||
1100 | slider.tooltipText = tbl["tooltip"][id]; |
||
1101 | slider:SetMinMaxValues(tbl["minmax"][id][1], tbl["minmax"][id][2]); |
||
1102 | slider:SetValueStep(0.01); |
||
1103 | slider:SetValue(tbl["value"][id]); |
||
1104 | end |
||
1105 | |||
1106 | function CT_RAMenuAdditional_EM_OnValueChanged() |
||
1107 | if ( this:GetID() == 1 ) then |
||
1108 | CT_RAMenu_Options["temp"]["EMThreshold"] = floor(this:GetValue()*100+0.5)/100; |
||
1109 | getglobal(this:GetName() .. "Text"):SetText("Health Threshold - " .. floor(this:GetValue()*100+0.5) .. "%"); |
||
1110 | CT_RA_Emergency_UpdateHealth(); |
||
1111 | else |
||
1112 | CT_RAMenu_Options["temp"]["EMScaling"] = floor(this:GetValue()*100+0.5)/100; |
||
1113 | getglobal(this:GetName() .. "Text"):SetText("Scaling - " .. floor(this:GetValue()*100+0.5) .. "%"); |
||
1114 | |||
1115 | local newScaling = CT_RAMenu_Options["temp"]["EMScaling"]; |
||
1116 | CT_RA_EmergencyFrame:SetScale(newScaling); |
||
1117 | CT_RA_EmergencyFrameDrag:SetWidth(CT_RA_EmergencyFrame:GetWidth()*newScaling+(27.5*newScaling)); |
||
1118 | CT_RA_EmergencyFrameDrag:SetHeight(CT_RA_EmergencyFrame:GetHeight()*newScaling/5); |
||
1119 | end |
||
1120 | end |
||
1121 | |||
1122 | function CT_RAMenuAdditional_BG_OnShow(slider) |
||
1123 | if ( not slider ) then |
||
1124 | slider = this; |
||
1125 | end |
||
1126 | if ( not CT_RAMenu_Options["temp"]["BGOpacity"] ) then |
||
1127 | CT_RAMenu_Options["temp"]["BGOpacity"] = 0.4; |
||
1128 | end |
||
1129 | getglobal(slider:GetName().."High"):SetText("75%"); |
||
1130 | getglobal(slider:GetName().."Low"):SetText("0%"); |
||
1131 | getglobal(slider:GetName() .. "Text"):SetText("Background Opacity - " .. floor(CT_RAMenu_Options["temp"]["BGOpacity"]*100+0.5) .. "%"); |
||
1132 | |||
1133 | slider:SetMinMaxValues(0, 0.75); |
||
1134 | slider:SetValueStep(0.01); |
||
1135 | slider:SetValue(CT_RAMenu_Options["temp"]["BGOpacity"]); |
||
1136 | end |
||
1137 | |||
1138 | function CT_RAMenuAdditional_BG_OnValueChanged() |
||
1139 | CT_RAMenu_Options["temp"]["BGOpacity"] = floor(this:GetValue()*100+0.5)/100; |
||
1140 | getglobal(this:GetName() .. "Text"):SetText("Background Opacity - " .. floor(this:GetValue()*100+0.5) .. "%"); |
||
1141 | CT_RA_UpdateRaidGroup(1); |
||
1142 | end |
||
1143 | |||
1144 | function CT_RAMenuAdditional_Alpha_OnShow(slider) |
||
1145 | if ( not slider ) then |
||
1146 | slider = this; |
||
1147 | end |
||
1148 | if ( not CT_RAMenu_Options["temp"]["DefaultAlpha"] ) then |
||
1149 | CT_RAMenu_Options["temp"]["DefaultAlpha"] = 1; |
||
1150 | end |
||
1151 | local val = CT_RAMenu_Options["temp"]["DefaultAlpha"]; |
||
1152 | local formattedVal = floor(val*100+0.5) |
||
1153 | getglobal(slider:GetName().."High"):SetText("Off"); |
||
1154 | getglobal(slider:GetName().."Low"):SetText("25%"); |
||
1155 | |||
1156 | if ( formattedVal == 100 ) then |
||
1157 | getglobal(slider:GetName() .. "Text"):SetText("Frame Alpha - Off (100%)"); |
||
1158 | else |
||
1159 | getglobal(slider:GetName() .. "Text"):SetText("Frame Alpha - " .. formattedVal .. "%"); |
||
1160 | end |
||
1161 | |||
1162 | slider:SetMinMaxValues(0.25, 1); |
||
1163 | slider:SetValueStep(0.01); |
||
1164 | slider:SetValue(val); |
||
1165 | end |
||
1166 | |||
1167 | function CT_RAMenuAdditional_Alpha_OnValueChanged() |
||
1168 | CT_RAMenu_Options["temp"]["DefaultAlpha"] = floor(this:GetValue()*100+0.5)/100; |
||
1169 | local formattedVal = floor(this:GetValue()*100+0.5); |
||
1170 | if ( formattedVal == 100 ) then |
||
1171 | getglobal(this:GetName() .. "Text"):SetText("Frame Alpha - Off (100%)"); |
||
1172 | else |
||
1173 | getglobal(this:GetName() .. "Text"):SetText("Frame Alpha - " .. formattedVal .. "%"); |
||
1174 | end |
||
1175 | -- Update the health specifically |
||
1176 | for i = 1, 40, 1 do |
||
1177 | CT_RA_UpdateUnitHealth(getglobal("CT_RAMember"..i)); |
||
1178 | end |
||
1179 | end |
||
1180 | |||
1181 | function CT_RAMenuAdditional_ScalingMT_OnShow(slider) |
||
1182 | if ( not slider ) then |
||
1183 | slider = this; |
||
1184 | end |
||
1185 | getglobal(slider:GetName().."High"):SetText("150%"); |
||
1186 | getglobal(slider:GetName().."Low"):SetText("50%"); |
||
1187 | if ( not CT_RAMenu_Options["temp"]["MTScaling"] ) then |
||
1188 | CT_RAMenu_Options["temp"]["MTScaling"] = 1; |
||
1189 | end |
||
1190 | getglobal(slider:GetName() .. "Text"):SetText("MT/PT Scaling - " .. floor(CT_RAMenu_Options["temp"]["MTScaling"]*100+0.5) .. "%"); |
||
1191 | |||
1192 | slider:SetMinMaxValues(0.5, 1.5); |
||
1193 | slider:SetValueStep(0.01); |
||
1194 | slider:SetValue(CT_RAMenu_Options["temp"]["MTScaling"]); |
||
1195 | end |
||
1196 | |||
1197 | function CT_RAMenuAdditional_ScalingMT_OnValueChanged() |
||
1198 | CT_RAMenu_Options["temp"]["MTScaling"] = floor(this:GetValue()*100+0.5)/100; |
||
1199 | getglobal(this:GetName() .. "Text"):SetText("MT/PT Scaling - " .. floor(this:GetValue()*100+0.5) .. "%"); |
||
1200 | |||
1201 | local newScaling = CT_RAMenu_Options["temp"]["MTScaling"]; |
||
1202 | for i = 1, 10, 1 do |
||
1203 | getglobal("CT_RAMTGroupMember" .. i):SetScale(newScaling); |
||
1204 | getglobal("CT_RAPTGroupMember" .. i):SetScale(newScaling); |
||
1205 | end |
||
1206 | CT_RAMTGroup:SetScale(newScaling); |
||
1207 | CT_RAPTGroup:SetScale(newScaling); |
||
1208 | CT_RAMTGroupDrag:SetWidth(CT_RAMTGroup:GetWidth()*newScaling+(22*newScaling)); |
||
1209 | CT_RAMTGroupDrag:SetHeight(CT_RAMTGroupMember1:GetHeight()*newScaling/2); |
||
1210 | CT_RAPTGroupDrag:SetWidth(CT_RAPTGroup:GetWidth()*newScaling+(22*newScaling)); |
||
1211 | CT_RAPTGroupDrag:SetHeight(CT_RAPTGroupMember1:GetHeight()*newScaling/2); |
||
1212 | end |
||
1213 | |||
1214 | function CT_RA_GetLocale() |
||
1215 | local locale = strsub(GetLocale(), 1, 2); |
||
1216 | if ( locale == "fr" or locale == "de" ) then |
||
1217 | return locale; |
||
1218 | else |
||
1219 | return "en"; |
||
1220 | end |
||
1221 | end |
||
1222 | |||
1223 | function CT_RAMenu_Misc_PlaySound() |
||
1224 | CT_RAMenu_Options["temp"]["PlayRSSound"] = this:GetChecked(); |
||
1225 | end |
||
1226 | |||
1227 | function CT_RAMenu_Misc_AggroNotifier() |
||
1228 | CT_RAMenu_Options["temp"]["AggroNotifier"] = this:GetChecked(); |
||
1229 | if ( not this:GetChecked() ) then |
||
1230 | CT_RAMenuFrameMiscNotificationsAggroNotifierSoundCB:Disable(); |
||
1231 | CT_RAMenuFrameMiscNotificationsAggroNotifierSound:SetTextColor(0.3, 0.3, 0.3); |
||
1232 | else |
||
1233 | CT_RAMenuFrameMiscNotificationsAggroNotifierSoundCB:Enable(); |
||
1234 | CT_RAMenuFrameMiscNotificationsAggroNotifierSound:SetTextColor(1, 1, 1); |
||
1235 | end |
||
1236 | end |
||
1237 | |||
1238 | function CT_RAMenu_Misc_AggroNotifierSound() |
||
1239 | CT_RAMenu_Options["temp"]["AggroNotifierSound"] = this:GetChecked(); |
||
1240 | end |
||
1241 | |||
1242 | function CT_RAMenu_Additional_ShowEmergency() |
||
1243 | CT_RAMenu_Options["temp"]["ShowEmergency"] = this:GetChecked(); |
||
1244 | if ( not this:GetChecked() ) then |
||
1245 | CT_RAMenuFrameAdditionalEMPartyCB:Disable(); |
||
1246 | CT_RAMenuFrameAdditionalEMPartyText:SetTextColor(0.3, 0.3, 0.3); |
||
1247 | CT_RAMenuFrameAdditionalEMOutsideRaidCB:Disable(); |
||
1248 | CT_RAMenuFrameAdditionalEMOutsideRaidText:SetTextColor(0.3, 0.3, 0.3); |
||
1249 | else |
||
1250 | CT_RAMenuFrameAdditionalEMPartyCB:Enable(); |
||
1251 | CT_RAMenuFrameAdditionalEMPartyText:SetTextColor(1, 1, 1); |
||
1252 | CT_RAMenuFrameAdditionalEMOutsideRaidCB:Enable(); |
||
1253 | CT_RAMenuFrameAdditionalEMOutsideRaidText:SetTextColor(1, 1, 1); |
||
1254 | end |
||
1255 | CT_RA_Emergency_UpdateHealth(); |
||
1256 | end |
||
1257 | |||
1258 | function CT_RAMenu_Additional_ShowEmergencyParty() |
||
1259 | CT_RAMenu_Options["temp"]["ShowEmergencyParty"] = this:GetChecked(); |
||
1260 | CT_RA_Emergency_UpdateHealth(); |
||
1261 | end |
||
1262 | |||
1263 | function CT_RAMenu_Additional_ShowEmergencyOutsideRaid() |
||
1264 | CT_RAMenu_Options["temp"]["ShowEmergencyOutsideRaid"] = this:GetChecked(); |
||
1265 | CT_RA_Emergency_UpdateHealth(); |
||
1266 | end |
||
1267 | |||
1268 | function CT_RAMenu_Misc_SendRARS() |
||
1269 | CT_RAMenu_Options["temp"]["SendRARS"] = this:GetChecked(); |
||
1270 | end |
||
1271 | |||
1272 | function CT_RAMenu_Misc_ShowAFK() |
||
1273 | CT_RAMenu_Options["temp"]["ShowAFK"] = this:GetChecked(); |
||
1274 | CT_RA_UpdateRaidGroup(1); |
||
1275 | end |
||
1276 | |||
1277 | function CT_RAMenu_Misc_ShowPTT() |
||
1278 | CT_RAMenu_Options["temp"]["ShowPTT"] = this:GetChecked(); |
||
1279 | CT_RA_UpdatePTs(); |
||
1280 | end |
||
1281 | |||
1282 | function CT_RAMenu_Misc_ShowMTTT() |
||
1283 | CT_RAMenu_Options["temp"]["ShowMTTT"] = this:GetChecked(); |
||
1284 | if ( not this:GetChecked() ) then |
||
1285 | CT_RAMenuFrameMiscDisplayNoColorChangeCB:Disable(); |
||
1286 | CT_RAMenuFrameMiscDisplayNoColorChange:SetTextColor(0.3, 0.3, 0.3); |
||
1287 | else |
||
1288 | CT_RAMenuFrameMiscDisplayNoColorChangeCB:Enable(); |
||
1289 | CT_RAMenuFrameMiscDisplayNoColorChange:SetTextColor(1, 1, 1); |
||
1290 | end |
||
1291 | CT_RA_UpdateMTs(); |
||
1292 | end |
||
1293 | |||
1294 | function CT_RAMenu_Misc_NoColorChange() |
||
1295 | CT_RAMenu_Options["temp"]["HideColorChange"] = this:GetChecked(); |
||
1296 | end |
||
1297 | |||
1298 | function CT_RAMenu_Misc_ShowTooltip() |
||
1299 | CT_RAMenu_Options["temp"]["HideTooltip"] = not this:GetChecked(); |
||
1300 | end |
||
1301 | |||
1302 | function CT_RAMenu_Misc_DisableQuery() |
||
1303 | CT_RAMenu_Options["temp"]["DisableQuery"] = this:GetChecked(); |
||
1304 | end |
||
1305 | |||
1306 | function CT_RAMenu_Misc_ShowResMonitor() |
||
1307 | CT_RAMenu_Options["temp"]["ShowMonitor"] = this:GetChecked(); |
||
1308 | if ( this:GetChecked() and GetNumRaidMembers() > 0 ) then |
||
1309 | CT_RA_ResFrame:Show(); |
||
1310 | else |
||
1311 | CT_RA_ResFrame:Hide(); |
||
1312 | end |
||
1313 | end |
||
1314 | |||
1315 | function CT_RAMenu_Misc_HideButton() |
||
1316 | CT_RAMenu_Options["temp"]["HideButton"] = this:GetChecked(); |
||
1317 | if ( this:GetChecked() ) then |
||
1318 | CT_RASets_Button:Hide(); |
||
1319 | else |
||
1320 | CT_RASets_Button:Show(); |
||
1321 | end |
||
1322 | end |
||
1323 | |||
1324 | function CT_RAMenuGeneral_SortAlpha() |
||
1325 | CT_RAMenu_Options["temp"]["SubSortByName"] = this:GetChecked(); |
||
1326 | CT_RA_UpdateRaidGroup(3); |
||
1327 | CT_RAOptions_Update(); |
||
1328 | end |
||
1329 | |||
1330 | function CT_RAMenu_Misc_ColorLeader() |
||
1331 | if ( CT_RAMenu_Options["temp"]["leaderColor"] ) then |
||
1332 | CT_RAMenu_Options["temp"]["leaderColor"].enabled = this:GetChecked(); |
||
1333 | else |
||
1334 | CT_RAMenu_Options["temp"]["leaderColor"] = { |
||
1335 | r = 1, g = 1, b = 0, enabled = true |
||
1336 | }; |
||
1337 | end |
||
1338 | end |
||
1339 | |||
1340 | function CT_RAMenu_Misc_ColorLeader_ShowColorPicker(frame) |
||
1341 | if ( not CT_RAMenu_Options["temp"]["leaderColor"] ) then |
||
1342 | CT_RAMenu_Options["temp"]["leaderColor"] = { |
||
1343 | r = 1, g = 1, b = 0, enabled = true |
||
1344 | }; |
||
1345 | end |
||
1346 | frame.r = CT_RAMenu_Options["temp"]["leaderColor"].r; |
||
1347 | frame.g = CT_RAMenu_Options["temp"]["leaderColor"].g; |
||
1348 | frame.b = CT_RAMenu_Options["temp"]["leaderColor"].b; |
||
1349 | frame.swatchFunc = CT_RAMenu_Misc_ColorLeader_SetColor; |
||
1350 | frame.cancelFunc = CT_RAMenu_Misc_ColorLeader_CancelColor; |
||
1351 | UIDropDownMenuButton_OpenColorPicker(frame); |
||
1352 | end |
||
1353 | |||
1354 | function CT_RAMenu_Misc_ColorLeader_SetColor() |
||
1355 | local r, g, b = ColorPickerFrame:GetColorRGB(); |
||
1356 | CT_RAMenu_Options["temp"]["leaderColor"].r = r; |
||
1357 | CT_RAMenu_Options["temp"]["leaderColor"].g = g; |
||
1358 | CT_RAMenu_Options["temp"]["leaderColor"].b = b; |
||
1359 | CT_RAMenuFrameMiscDisplayColorLeaderColorSwatchNormalTexture:SetVertexColor(CT_RAMenu_Options["temp"]["leaderColor"].r, CT_RAMenu_Options["temp"]["leaderColor"].g, CT_RAMenu_Options["temp"]["leaderColor"].b); |
||
1360 | end |
||
1361 | |||
1362 | function CT_RAMenu_Misc_ColorLeader_CancelColor() |
||
1363 | CT_RAMenu_Options["temp"]["leaderColor"].r = CT_RAMenuFrameMiscDisplayColorLeaderColorSwatch.r; |
||
1364 | CT_RAMenu_Options["temp"]["leaderColor"].g = CT_RAMenuFrameMiscDisplayColorLeaderColorSwatch.g; |
||
1365 | CT_RAMenu_Options["temp"]["leaderColor"].b = CT_RAMenuFrameMiscDisplayColorLeaderColorSwatch.b; |
||
1366 | CT_RAMenuFrameMiscDisplayColorLeaderColorSwatchNormalTexture:SetVertexColor(CT_RAMenu_Options["temp"]["leaderColor"].r, CT_RAMenu_Options["temp"]["leaderColor"].g, CT_RAMenu_Options["temp"]["leaderColor"].b); |
||
1367 | end |
||
1368 | |||
1369 | function CT_RAMenu_Misc_NotifyGroupChange() |
||
1370 | CT_RAMenu_Options["temp"]["NotifyGroupChange"] = this:GetChecked(); |
||
1371 | if ( not this:GetChecked() ) then |
||
1372 | CT_RAMenuFrameMiscNotificationsNotifyGroupChangeCBSound:Disable(); |
||
1373 | CT_RAMenuFrameMiscNotificationsNotifyGroupChangeSound:SetTextColor(0.3, 0.3, 0.3); |
||
1374 | else |
||
1375 | CT_RAMenuFrameMiscNotificationsNotifyGroupChangeCBSound:Enable(); |
||
1376 | CT_RAMenuFrameMiscNotificationsNotifyGroupChangeSound:SetTextColor(1, 1, 1); |
||
1377 | end |
||
1378 | end |
||
1379 | |||
1380 | function CT_RAMenu_Misc_NotifyGroupChangeSound() |
||
1381 | CT_RAMenu_Options["temp"]["NotifyGroupChangeSound"] = this:GetChecked(); |
||
1382 | end |
||
1383 | |||
1384 | function CT_RA_UpdateResFrame() |
||
1385 | local text = ""; |
||
1386 | local playerTarget, playerName = UnitName("target"), UnitName("player"); |
||
1387 | for key, val in CT_RA_Ressers do |
||
1388 | if ( strlen(text) > 0 ) then |
||
1389 | text = text .. "\n"; |
||
1390 | end |
||
1391 | if ( val == playerTarget and key ~= playerName ) then |
||
1392 | -- Color gold if we're targeting this player. |
||
1393 | text = text .. "|c00FFD100" .. key .. ": " .. val .. "|r"; |
||
1394 | else |
||
1395 | text = text .. key .. ": " .. val; |
||
1396 | end |
||
1397 | end |
||
1398 | CT_RA_ResFrameText:SetText(text); |
||
1399 | CT_RA_ResFrame:SetWidth(max(CT_RA_ResFrameText:GetWidth()+15, 175)); |
||
1400 | CT_RA_ResFrame:SetHeight(max(CT_RA_ResFrameText:GetHeight()+25, 50)); |
||
1401 | end |
||
1402 | |||
1403 | function CT_RAMenuHelp_LoadText() |
||
1404 | local texts = { |
||
1405 | "|c00FFFFFFShow Group Names -|r Turns on/off the headers for each group\n\n|c00FFFFFFLock Group Positions -|r Locks all CTRA windows in place\n\n|c00FFFFFFHide Mana Bars -|r Hides all players mana bars\n\n|c00FFFFFFHide Health Bars -|r Hides all players health bars\n\n|c00FFFFFFHide Rage/Energy Bars -|r Hides all players rage and energy bars\n\n|c00FFFFFFHealth Type -|r Allows you to show players health as a percentage,\nactual value, missing hp, only the percentage on MainTank targets,\nor not at all. You can also customize the color the text is shown in\n\n|c00FFFFFFWindow BG Color -|r Changes the color of CTRA window\nbackgrounds, dragging the slider all the way to 100%\nmakes them transparent\n\n|c00FFFFFFAlert Message Color -|r Sets the color the /rs alert messages\nshow in the middle of your screen", |
||
1406 | "|c00FFFFFFHide offline members -|r Allows you to hide members who\nare offline, so they don't show in CTRA groups\n\n|c00FFFFFFHide short duration debuffs -|r Allows you to hide debuffs with\na duration under 10 seconds\n\n|c00FFFFFFHide border -|r Allows you to hide the border of each CTRA window\n\n|c00FFFFFFSort Type -|r Sort by either group, class, or custom.Sorting\nby Class displays each member in a class category, sorting\nby Custom allows you to change who shows up in which groups", |
||
1407 | "Allows you to be notified via chat when someone\nbecomes debuffed with the types listed above,\nas well as allows you to be notified when someone\nloses a buff you are able to recast\n\n|c00FFFFFFNOTE:|r To quickly debuff a cured player, or recast a\nfaded buff, map a hotkey via the game key bindings\nmenu (|c00FFFFFFEscape|r > |c00FFFFFFKey Bindings|r > |c00FFFFFFCT_RaidAssist section|r)\nto one-click recast or cure"; |
||
1408 | "Allows you to scale the CTRA group and MT windows.", |
||
1409 | CT_RAMENU_BUFFSDESCRIPT, |
||
1410 | CT_RAMENU_BUFFSTOOLTIP, |
||
1411 | CT_RAMENU_DEBUFFSTOOLTIP, |
||
1412 | CT_RAMENU_ADDITIONALEMTOOLTIP, |
||
1413 | "Allows you to change the name and details of the selected set. In any of the three bottom fields, you can use an asterix (|c00FFFFFF*|r) as a wildcard for zero or more characters. You can also use regular expressions, if you have the knowledge to use that.", |
||
1414 | "Allows you to regulate the classes this set will attempt to cure matching debuffs on." |
||
1415 | }; |
||
1416 | this.text = texts[this:GetID()]; |
||
1417 | end |
||
1418 | |||
1419 | function CT_RAMenuHelp_SetTooltip() |
||
1420 | local uiX, uiY = UIParent:GetCenter(); |
||
1421 | local thisX, thisY = this:GetCenter(); |
||
1422 | |||
1423 | local anchor = ""; |
||
1424 | if ( thisY > uiY ) then |
||
1425 | anchor = "BOTTOM"; |
||
1426 | else |
||
1427 | anchor = "TOP"; |
||
1428 | end |
||
1429 | |||
1430 | if ( thisX < uiX ) then |
||
1431 | if ( anchor == "TOP" ) then |
||
1432 | anchor = "TOPLEFT"; |
||
1433 | else |
||
1434 | anchor = "BOTTOMRIGHT"; |
||
1435 | end |
||
1436 | else |
||
1437 | if ( anchor == "TOP" ) then |
||
1438 | anchor = "TOPRIGHT"; |
||
1439 | else |
||
1440 | anchor = "BOTTOMLEFT"; |
||
1441 | end |
||
1442 | end |
||
1443 | GameTooltip:SetOwner(this, "ANCHOR_" .. anchor); |
||
1444 | end |
||
1445 | |||
1446 | function CT_RAMenu_SaveWindowPositions() |
||
1447 | CT_RAMenu_Options["temp"]["WindowPositions"] = { }; |
||
1448 | local left, top, uitop; |
||
1449 | for i = 1, 8, 1 do |
||
1450 | local frame = getglobal("CT_RAGroupDrag" .. i); |
||
1451 | left, top, uitop = frame:GetLeft(), frame:GetTop(), UIParent:GetTop(); |
||
1452 | if ( left and top and uitop ) then |
||
1453 | CT_RAMenu_Options["temp"]["WindowPositions"][frame:GetName()] = { left, top-uitop }; |
||
1454 | end |
||
1455 | end |
||
1456 | left, top, uitop = CT_RAMTGroupDrag:GetLeft(), CT_RAMTGroupDrag:GetTop(), UIParent:GetTop(); |
||
1457 | if ( left and top and uitop ) then |
||
1458 | CT_RAMenu_Options["temp"]["WindowPositions"]["CT_RAMTGroupDrag"] = { left, top-uitop }; |
||
1459 | end |
||
1460 | left, top, uitop = CT_RA_EmergencyFrameDrag:GetLeft(), CT_RA_EmergencyFrameDrag:GetTop(), UIParent:GetTop(); |
||
1461 | if ( left and top and uitop ) then |
||
1462 | CT_RAMenu_Options["temp"]["WindowPositions"]["CT_RA_EmergencyFrameDrag"] = { left, top-uitop }; |
||
1463 | end |
||
1464 | end |
||
1465 | |||
1466 | function CT_RAMenu_UpdateWindowPositions() |
||
1467 | if ( CT_RAMenu_Options["temp"]["WindowPositions"] ) then |
||
1468 | for k, v in CT_RAMenu_Options["temp"]["WindowPositions"] do |
||
1469 | getglobal(k):ClearAllPoints(); |
||
1470 | getglobal(k):SetPoint("TOPLEFT" , "UIParent", "TOPLEFT", v[1], v[2]); |
||
1471 | end |
||
1472 | end |
||
1473 | end |
||
1474 | |||
1475 | function CT_RAMenu_CopyTable(source) |
||
1476 | local dest = { }; |
||
1477 | if ( type(source) == "table" ) then |
||
1478 | for k, v in source do |
||
1479 | dest[k] = CT_RAMenu_CopyTable(v); |
||
1480 | end |
||
1481 | return dest; |
||
1482 | else |
||
1483 | return source; |
||
1484 | end |
||
1485 | end |
||
1486 | |||
1487 | function CT_RAMenu_CopySet(copyFrom, copyTo) |
||
1488 | CT_RAMenu_Options[copyTo] = nil; |
||
1489 | CT_RAMenu_Options[copyTo] = CT_RAMenu_CopyTable(CT_RAMenu_Options[copyFrom]); |
||
1490 | CT_RAMenu_UpdateOptionSets(); |
||
1491 | end |
||
1492 | |||
1493 | function CT_RAMenu_DeleteSet(name) |
||
1494 | if ( name ~= "Default" ) then |
||
1495 | if ( CT_RAMenu_CurrSet == name ) then |
||
1496 | CT_RAMenu_CurrSet = "Default"; |
||
1497 | CT_RAMenu_Options["temp"] = CT_RAMenu_CopyTable(CT_RAMenu_Options[CT_RAMenu_CurrSet]); |
||
1498 | end |
||
1499 | CT_RAMenu_Options[name] = nil; |
||
1500 | CT_RAMenu_UpdateOptionSets(); |
||
1501 | CT_RA_UpdateRaidGroup(0); |
||
1502 | CT_RA_UpdateMTs(); |
||
1503 | CT_RAMenu_UpdateMenu(); |
||
1504 | CT_RAOptions_Update(); |
||
1505 | end |
||
1506 | end |
||
1507 | |||
1508 | function CT_RAMenu_CompareTable(t1, t2) |
||
1509 | if ( not t1 or not t2 ) then |
||
1510 | return false; |
||
1511 | else |
||
1512 | if ( t1 == false ) then |
||
1513 | t1 = nil; |
||
1514 | end |
||
1515 | if ( t2 == false ) then |
||
1516 | t2 = nil; |
||
1517 | end |
||
1518 | if ( type(t1) ~= type(t2) ) then |
||
1519 | return false; |
||
1520 | elseif ( type(t1) ~= "table" ) then |
||
1521 | return ( t1 == t2 ); |
||
1522 | end |
||
1523 | end |
||
1524 | |||
1525 | for key, val in t1 do |
||
1526 | if ( key ~= "unchanged" and val ~= false ) then |
||
1527 | if ( type(val) ~= "table" ) then |
||
1528 | if ( not t2[key] or ( t2[key] ~= val and t2[key] ~= false ) ) then |
||
1529 | return false; |
||
1530 | end |
||
1531 | else |
||
1532 | if ( not CT_RAMenu_CompareTable(val, t2[key]) ) then |
||
1533 | return false; |
||
1534 | end |
||
1535 | end |
||
1536 | end |
||
1537 | end |
||
1538 | |||
1539 | for key, val in t2 do |
||
1540 | if ( key ~= "unchanged" and val ~= false ) then |
||
1541 | if ( type(val) ~= "table" ) then |
||
1542 | if ( not t1[key] or ( t1[key] ~= val and t1[key] ~= false ) ) then |
||
1543 | return false; |
||
1544 | end |
||
1545 | else |
||
1546 | if ( not CT_RAMenu_CompareTable(val, t1[key]) ) then |
||
1547 | return false; |
||
1548 | end |
||
1549 | end |
||
1550 | end |
||
1551 | end |
||
1552 | |||
1553 | return true; |
||
1554 | end |
||
1555 | |||
1556 | function CT_RAMenu_ExistsSet(set) |
||
1557 | for k, v in CT_RAMenu_Options do |
||
1558 | if ( strlower(k) == strlower(set) ) then |
||
1559 | return true; |
||
1560 | end |
||
1561 | end |
||
1562 | return nil; |
||
1563 | end |
||
1564 | |||
1565 | function CT_RAMenu_UpdateOptionSets() |
||
1566 | local num = 0; |
||
1567 | local postfix = ""; |
||
1568 | if ( not CT_RAMenu_CompareTable(CT_RAMenu_Options["temp"], CT_RAMenu_Options[CT_RAMenu_CurrSet]) ) then |
||
1569 | postfix = "*"; |
||
1570 | CT_RAMenuFrameOptionSetsUndo:Enable(); |
||
1571 | CT_RAMenuFrameOptionSetsSave:Enable(); |
||
1572 | else |
||
1573 | CT_RAMenuFrameOptionSetsUndo:Disable(); |
||
1574 | CT_RAMenuFrameOptionSetsSave:Disable(); |
||
1575 | end |
||
1576 | CT_RAMenuFrameOptionSetsCurrentSet:SetText("Current Set: |c00FFFF00" .. CT_RAMenu_CurrSet .. "|r" .. postfix); |
||
1577 | for k, v in CT_RAMenu_Options do |
||
1578 | if ( k ~= "temp" ) then |
||
1579 | num = num + 1; |
||
1580 | local obj = getglobal("CT_RAMenuFrameOptionSetsSet" .. num); |
||
1581 | getglobal(obj:GetName() .. "Name"):SetText(k); |
||
1582 | obj.setName = k; |
||
1583 | -- Make sure last line is hidden |
||
1584 | if ( num == 8 ) then |
||
1585 | getglobal(obj:GetName() .. "Line"):Hide(); |
||
1586 | else |
||
1587 | getglobal(obj:GetName() .. "Line"):Show(); |
||
1588 | end |
||
1589 | |||
1590 | -- Disallow loading the current set |
||
1591 | if ( k == CT_RAMenu_CurrSet ) then |
||
1592 | getglobal(obj:GetName() .. "Load"):Disable(); |
||
1593 | getglobal(obj:GetName() .. "Name"):SetTextColor(1, 1, 1); |
||
1594 | else |
||
1595 | getglobal(obj:GetName() .. "Load"):Enable(); |
||
1596 | getglobal(obj:GetName() .. "Name"):SetTextColor(0.66, 0.66, 0.66); |
||
1597 | end |
||
1598 | |||
1599 | -- Disallow deleting the default set |
||
1600 | if ( k == "Default" ) then |
||
1601 | getglobal(obj:GetName() .. "Delete"):Disable(); |
||
1602 | else |
||
1603 | getglobal(obj:GetName() .. "Delete"):Enable(); |
||
1604 | end |
||
1605 | obj:Show(); |
||
1606 | end |
||
1607 | end |
||
1608 | for i = num+1, 8, 1 do |
||
1609 | getglobal("CT_RAMenuFrameOptionSetsSet" .. i):Hide(); |
||
1610 | end |
||
1611 | end |
||
1612 | |||
1613 | tinsert(UISpecialFrames, "CT_RA_PriorityFrame"); |
||
1614 | |||
1615 | function CT_RAMenuFrameDebuff_Update() |
||
1616 | local numEntries = getn(CT_RA_DebuffTemplates); |
||
1617 | |||
1618 | FauxScrollFrame_Update(CT_RAMenuFrameDebuffUseScrollFrame, numEntries, 12, 25); |
||
1619 | |||
1620 | for i = 1, 12, 1 do |
||
1621 | local button = getglobal("CT_RAMenuFrameDebuffUseSet" .. i); |
||
1622 | local mouseOver = getglobal("CT_RAMenuFrameDebuffUseSet" .. i .. "MO"); |
||
1623 | local index = i + FauxScrollFrame_GetOffset(CT_RAMenuFrameDebuffUseScrollFrame); |
||
1624 | if ( index <= numEntries ) then |
||
1625 | if ( index == CT_RAMenuFrameDebuff.selectedIndex ) then |
||
1626 | button.isHighlighted = 1; |
||
1627 | mouseOver:SetVertexColor(1, 1, 1, 0.25); |
||
1628 | mouseOver:Show(); |
||
1629 | else |
||
1630 | if ( not button.isOver ) then |
||
1631 | mouseOver:Hide(); |
||
1632 | end |
||
1633 | button.isHighlighted = nil; |
||
1634 | mouseOver:SetVertexColor(1, 1, 1, 0.1); |
||
1635 | end |
||
1636 | button:Show(); |
||
1637 | local name = CT_RA_DebuffTemplates[index]["name"]; |
||
1638 | if ( not name or name == "" ) then |
||
1639 | name = "<No name set>"; |
||
1640 | end |
||
1641 | getglobal(button:GetName() .. "Name"):SetText(name); |
||
1642 | else |
||
1643 | button:Hide(); |
||
1644 | end |
||
1645 | end |
||
1646 | |||
1647 | end |
||
1648 | |||
1649 | function CT_RAMenuFrameDebuff_UpdateSet() |
||
1650 | CT_RAMenuFrameDebuff_Update(); |
||
1651 | local set = CT_RAMenuFrameDebuff.selectedIndex; |
||
1652 | if ( not set ) then |
||
1653 | CT_RAMenuFrameDebuffSettingsNameEB:Hide(); |
||
1654 | CT_RAMenuFrameDebuffSettingsDebuffTitleEB:Hide(); |
||
1655 | CT_RAMenuFrameDebuffSettingsDebuffTypeEB:Hide(); |
||
1656 | CT_RAMenuFrameDebuffSettingsDebuffDescriptEB:Hide(); |
||
1657 | for i = 1, 10, 1 do |
||
1658 | getglobal("CT_RAMenuFrameDebuffClassesClass" .. i):SetTextColor(0.3, 0.3, 0.3); |
||
1659 | getglobal("CT_RAMenuFrameDebuffClassesClass" .. i .. "CB"):Disable(); |
||
1660 | getglobal("CT_RAMenuFrameDebuffClassesClass" .. i .. "CB"):SetChecked(1); |
||
1661 | end |
||
1662 | CT_RAMenuFrameDebuffDelete:Disable(); |
||
1663 | CT_RAMenuFrameDebuffEdit:Disable(); |
||
1664 | else |
||
1665 | local tbl = CT_RA_DebuffTemplates[set]; |
||
1666 | CT_RAMenuFrameDebuffSettingsNameEB:Show(); |
||
1667 | CT_RAMenuFrameDebuffSettingsDebuffTitleEB:Show(); |
||
1668 | CT_RAMenuFrameDebuffSettingsDebuffTypeEB:Show(); |
||
1669 | CT_RAMenuFrameDebuffSettingsDebuffDescriptEB:Show(); |
||
1670 | CT_RAMenuFrameDebuffSettingsNameEB:SetText(string.gsub(tbl["name"] or "", "%.%*", "*")); |
||
1671 | CT_RAMenuFrameDebuffSettingsDebuffTitleEB:SetText(string.gsub(tbl["debuffName"] or "*", "%.%*", "*")); |
||
1672 | CT_RAMenuFrameDebuffSettingsDebuffTypeEB:SetText(string.gsub(tbl["debuffType"] or "*", "%.%*", "*")); |
||
1673 | CT_RAMenuFrameDebuffSettingsDebuffDescriptEB:SetText(string.gsub(tbl["debuffDesc"] or "*", "%.%*", "*")); |
||
1674 | local classTbl = { |
||
1675 | CT_RA_WARRIOR, CT_RA_PALADIN, CT_RA_HUNTER, CT_RA_ROGUE, CT_RA_MAGE, CT_RA_WARLOCK, CT_RA_PRIEST, CT_RA_DRUID, CT_RA_SHAMAN, CT_RA_PETS |
||
1676 | }; |
||
1677 | |||
1678 | for i = 1, 10, 1 do |
||
1679 | getglobal("CT_RAMenuFrameDebuffClassesClass" .. i):SetTextColor(1, 1, 1); |
||
1680 | getglobal("CT_RAMenuFrameDebuffClassesClass" .. i .. "CB"):Enable(); |
||
1681 | getglobal("CT_RAMenuFrameDebuffClassesClass" .. i .. "CB"):SetChecked(tbl["affectClasses"][classTbl[i]]); |
||
1682 | end |
||
1683 | CT_RAMenuFrameDebuffDelete:Enable(); |
||
1684 | CT_RAMenuFrameDebuffEdit:Enable(); |
||
1685 | |||
1686 | end |
||
1687 | end |
||
1688 | |||
1689 | function CT_RAMenuDebuff_MoveSetDown() |
||
1690 | local id = this:GetParent():GetID() + FauxScrollFrame_GetOffset(CT_RAMenuFrameDebuffUseScrollFrame); |
||
1691 | if ( id < getn(CT_RA_DebuffTemplates) ) then |
||
1692 | if ( ( CT_RAMenuFrameDebuff.selectedIndex or 0 ) == id ) then |
||
1693 | CT_RAMenuFrameDebuff.selectedIndex = id+1; |
||
1694 | elseif ( ( CT_RAMenuFrameDebuff.selectedIndex or 0 ) == id+1 ) then |
||
1695 | CT_RAMenuFrameDebuff.selectedIndex = id; |
||
1696 | end |
||
1697 | tinsert(CT_RA_DebuffTemplates, id, tremove(CT_RA_DebuffTemplates, id+1)); |
||
1698 | end |
||
1699 | CT_RAMenuFrameDebuff_UpdateSet(); |
||
1700 | end |
||
1701 | |||
1702 | function CT_RAMenuDebuff_MoveSetUp() |
||
1703 | local id = this:GetParent():GetID() + FauxScrollFrame_GetOffset(CT_RAMenuFrameDebuffUseScrollFrame); |
||
1704 | if ( id > 1 ) then |
||
1705 | if ( ( CT_RAMenuFrameDebuff.selectedIndex or 0 ) == id ) then |
||
1706 | CT_RAMenuFrameDebuff.selectedIndex = id-1; |
||
1707 | elseif ( ( CT_RAMenuFrameDebuff.selectedIndex or 0 ) == id-1 ) then |
||
1708 | CT_RAMenuFrameDebuff.selectedIndex = id; |
||
1709 | end |
||
1710 | tinsert(CT_RA_DebuffTemplates, id-1, tremove(CT_RA_DebuffTemplates, id)); |
||
1711 | end |
||
1712 | CT_RAMenuFrameDebuff_UpdateSet(); |
||
1713 | end |
||
1714 | |||
1715 | function CT_RAMenuDebuff_NewSet() |
||
1716 | tinsert(CT_RA_DebuffTemplates, 1, { |
||
1717 | ["name"] = "<New set>", |
||
1718 | ["debuffName"] = ".*", |
||
1719 | ["debuffDesc"] = ".*", |
||
1720 | ["debuffType"] = ".*", |
||
1721 | ["affectClasses"] = { |
||
1722 | [CT_RA_WARRIOR] = 1, |
||
1723 | [CT_RA_DRUID] = 1, |
||
1724 | [CT_RA_MAGE] = 1, |
||
1725 | [CT_RA_WARLOCK] = 1, |
||
1726 | [CT_RA_ROGUE] = 1, |
||
1727 | [CT_RA_HUNTER] = 1, |
||
1728 | [CT_RA_PRIEST] = 1, |
||
1729 | [CT_RA_PALADIN] = 1, |
||
1730 | [CT_RA_SHAMAN] = 1, |
||
1731 | [CT_RA_PETS] = 1 |
||
1732 | }, |
||
1733 | ["cureOrder"] = { |
||
1734 | 1, 2, 3, 4, 5, 6, 7 |
||
1735 | } |
||
1736 | }); |
||
1737 | CT_RAMenuFrameDebuffSettingsNameEB:ClearFocus(); |
||
1738 | CT_RAMenuFrameDebuffSettingsDebuffTitleEB:ClearFocus(); |
||
1739 | CT_RAMenuFrameDebuffSettingsDebuffTypeEB:ClearFocus(); |
||
1740 | CT_RAMenuFrameDebuffSettingsDebuffDescriptEB:ClearFocus(); |
||
1741 | CT_RAMenuFrameDebuff.selectedIndex = 1; |
||
1742 | CT_RAMenuFrameDebuff_UpdateSet(); |
||
1743 | end |
||
1744 | |||
1745 | function CT_RAMenuDebuff_DeleteSet() |
||
1746 | if ( CT_RAMenuFrameDebuff.selectedIndex ) then |
||
1747 | tremove(CT_RA_DebuffTemplates, CT_RAMenuFrameDebuff.selectedIndex); |
||
1748 | CT_RAMenuFrameDebuff.selectedIndex = nil; |
||
1749 | CT_RAMenuFrameDebuff_UpdateSet(); |
||
1750 | end |
||
1751 | end |
||
1752 | |||
1753 | function CT_RA_Priority_OnUpdate() |
||
1754 | if ( CT_RA_PriorityFrame.moving ) then |
||
1755 | local numUsed, numAvailable = 0, 0; |
||
1756 | CT_RA_PriorityFrame.isOver = nil; |
||
1757 | for i=1, 17, 1 do |
||
1758 | slot = getglobal("CT_RA_PriorityFramePriority" .. i); |
||
1759 | if ( slot.currParent == "CT_RA_PriorityFrameAvailable" ) then |
||
1760 | numAvailable = numAvailable + 1; |
||
1761 | elseif ( slot.currParent == "CT_RA_PriorityFrameUse" ) then |
||
1762 | numUsed = numUsed + 1; |
||
1763 | end |
||
1764 | if ( MouseIsOver(slot) and CT_RA_PriorityFrame.moving ~= slot ) then |
||
1765 | slot:SetBackdropBorderColor(1, 1, 0, 1); |
||
1766 | CT_RA_PriorityFrame.isOver = slot; |
||
1767 | else |
||
1768 | slot:SetBackdropBorderColor(1, 1, 1, 1); |
||
1769 | end |
||
1770 | end |
||
1771 | if ( MouseIsOver(CT_RA_PriorityFrameAvailable) ) then |
||
1772 | CT_RA_PriorityFrame.isOverParent = "CT_RA_PriorityFrameAvailable"; |
||
1773 | CT_RA_PriorityFrame.numInParent = numAvailable; |
||
1774 | elseif ( MouseIsOver(CT_RA_PriorityFrameUse) ) then |
||
1775 | CT_RA_PriorityFrame.isOverParent = "CT_RA_PriorityFrameUse"; |
||
1776 | CT_RA_PriorityFrame.numInParent = numUsed; |
||
1777 | else |
||
1778 | CT_RA_PriorityFrame.numInParent = nil; |
||
1779 | CT_RA_PriorityFrame.isOverParent = nil; |
||
1780 | end |
||
1781 | else |
||
1782 | for i = 1, 17, 1 do |
||
1783 | getglobal("CT_RA_PriorityFramePriority" .. i):SetBackdropBorderColor(1, 1, 1, 1); |
||
1784 | end |
||
1785 | end |
||
1786 | end |
||
1787 | |||
1788 | function CT_RA_Priority_SetPosition() |
||
1789 | if ( CT_RA_PriorityFrame.isOver ) then |
||
1790 | local tempParent, tempIndex = this.currParent, this.currIndex; |
||
1791 | |||
1792 | CT_RA_PriorityFrame.isOver:ClearAllPoints(); |
||
1793 | this:ClearAllPoints(); |
||
1794 | |||
1795 | CT_RA_PriorityFrame.isOver:SetPoint("TOP", this.currParent, "TOP", 0, -5-(33*(this.currIndex-1))); |
||
1796 | this:SetPoint("TOP", CT_RA_PriorityFrame.isOver.currParent, "TOP", 0, -5-(33*(CT_RA_PriorityFrame.isOver.currIndex-1))); |
||
1797 | |||
1798 | this.currParent = CT_RA_PriorityFrame.isOver.currParent; |
||
1799 | this.currIndex = CT_RA_PriorityFrame.isOver.currIndex; |
||
1800 | CT_RA_PriorityFrame.isOver.currParent = tempParent; |
||
1801 | CT_RA_PriorityFrame.isOver.currIndex = tempIndex; |
||
1802 | |||
1803 | elseif ( CT_RA_PriorityFrame.isOverParent ) then |
||
1804 | for i = 1, 17, 1 do |
||
1805 | if ( i ~= this:GetID() ) then |
||
1806 | local slot = getglobal("CT_RA_PriorityFramePriority" .. i); |
||
1807 | if ( slot.currParent == this.currParent and slot.currIndex > this.currIndex ) then |
||
1808 | slot.currIndex = slot.currIndex - 1; |
||
1809 | end |
||
1810 | end |
||
1811 | end |
||
1812 | if ( CT_RA_PriorityFrame.isOverParent == this.currParent ) then |
||
1813 | this.currParent = CT_RA_PriorityFrame.isOverParent; |
||
1814 | this.currIndex = CT_RA_PriorityFrame.numInParent; |
||
1815 | else |
||
1816 | this.currParent = CT_RA_PriorityFrame.isOverParent; |
||
1817 | this.currIndex = CT_RA_PriorityFrame.numInParent+1; |
||
1818 | end |
||
1819 | this:ClearAllPoints(); |
||
1820 | this:SetPoint("TOP", CT_RA_PriorityFrame.isOverParent, "TOP", 0, -5-(33*(this.currIndex-1))); |
||
1821 | end |
||
1822 | |||
1823 | CT_RA_Priority_ClearPositions(); |
||
1824 | end |
||
1825 | |||
1826 | function CT_RA_Priority_ClearPositions() |
||
1827 | for i = 1, 17, 1 do |
||
1828 | local btn = getglobal("CT_RA_PriorityFramePriority" .. i); |
||
1829 | btn:ClearAllPoints(); |
||
1830 | btn:SetPoint("TOP", btn.currParent, "TOP", 0, -5-(33*(btn.currIndex-1)) ); |
||
1831 | end |
||
1832 | end |
||
1833 | |||
1834 | function CT_RA_Priority_InitPriorities() |
||
1835 | local tbl = { |
||
1836 | { "Target", 1, 1, 0 }, |
||
1837 | { "Player", 0, 1, 0 }, |
||
1838 | { "Party", 0.7, 0.7, 1 }, |
||
1839 | { "Raid", 1, 0.5, 0 }, |
||
1840 | { "Pet", 0, 1, 1 }, |
||
1841 | { "Party's Pets", 0, 1, 0.7 }, |
||
1842 | { "Raid's Pets", 0, 1, 0.5 }, |
||
1843 | { "Main Tanks", 1, 0, 0 }, |
||
1844 | { CT_RA_WARRIOR, 0.78, 0.61, 0.43 }, |
||
1845 | { CT_RA_DRUID, 1.0, 0.49, 0.04 }, |
||
1846 | { CT_RA_MAGE, 0.41, 0.8, 0.94 }, |
||
1847 | { CT_RA_WARLOCK, 0.58, 0.51, 0.79 }, |
||
1848 | { CT_RA_ROGUE, 1.0, 0.96, 0.41 }, |
||
1849 | { CT_RA_HUNTER, 0.67, 0.83, 0.45 }, |
||
1850 | { CT_RA_PRIEST, 1.0, 1.0, 1.0 }, |
||
1851 | { CT_RA_PALADIN, 0.96, 0.55, 0.73 }, |
||
1852 | { CT_RA_SHAMAN, 0.96, 0.55, 0.73 } |
||
1853 | }; |
||
1854 | local classTbl = { |
||
1855 | [9] = CT_RA_WARRIOR, |
||
1856 | [10] = CT_RA_DRUID, |
||
1857 | [11] = CT_RA_MAGE, |
||
1858 | [12] = CT_RA_WARLOCK, |
||
1859 | [13] = CT_RA_ROGUE, |
||
1860 | [14] = CT_RA_HUNTER, |
||
1861 | [15] = CT_RA_PRIEST, |
||
1862 | [16] = CT_RA_PALADIN, |
||
1863 | [17] = CT_RA_SHAMAN |
||
1864 | }; |
||
1865 | local numUsed, numAvailable = 0, 0; |
||
1866 | local debuffTbl = CT_RA_DebuffTemplates[CT_RAMenuFrameDebuff.selectedIndex]; |
||
1867 | CT_RA_PriorityFrameSave:SetText("Editing set '|c00FFFFFF" .. debuffTbl["name"] .. "|r'."); |
||
1868 | for i = 1, 17, 1 do |
||
1869 | local used; |
||
1870 | if ( i > 8 and not debuffTbl["affectClasses"][classTbl[i]] ) then |
||
1871 | getglobal("CT_RA_PriorityFramePriority" .. i):Hide(); |
||
1872 | else |
||
1873 | getglobal("CT_RA_PriorityFramePriority" .. i):Show(); |
||
1874 | end |
||
1875 | for k, v in debuffTbl["cureOrder"] do |
||
1876 | if ( v == i and ( i <= 8 or debuffTbl["affectClasses"][classTbl[i]] ) ) then |
||
1877 | used = k; |
||
1878 | break; |
||
1879 | end |
||
1880 | end |
||
1881 | getglobal("CT_RA_PriorityFramePriority" .. i):ClearAllPoints(); |
||
1882 | getglobal("CT_RA_PriorityFramePriority" .. i .. "Name"):SetText(tbl[i][1]); |
||
1883 | getglobal("CT_RA_PriorityFramePriority" .. i):SetBackdropColor(tbl[i][2], tbl[i][3], tbl[i][4], 0.5); |
||
1884 | if ( used ) then |
||
1885 | numUsed = numUsed + 1; |
||
1886 | getglobal("CT_RA_PriorityFramePriority" .. i):SetPoint("TOP", "CT_RA_PriorityFrameUse", "TOP", 0, -5-(33*(used-1)) ); |
||
1887 | getglobal("CT_RA_PriorityFramePriority" .. i).currParent = "CT_RA_PriorityFrameUse"; |
||
1888 | getglobal("CT_RA_PriorityFramePriority" .. i).currIndex = used; |
||
1889 | elseif ( getglobal("CT_RA_PriorityFramePriority" .. i):IsVisible() ) then |
||
1890 | numAvailable = numAvailable + 1; |
||
1891 | getglobal("CT_RA_PriorityFramePriority" .. i):SetPoint("TOP", "CT_RA_PriorityFrameAvailable", "TOP", 0, -5-(33*(numAvailable-1)) ); |
||
1892 | getglobal("CT_RA_PriorityFramePriority" .. i).currParent = "CT_RA_PriorityFrameAvailable"; |
||
1893 | getglobal("CT_RA_PriorityFramePriority" .. i).currIndex = numAvailable; |
||
1894 | end |
||
1895 | end |
||
1896 | end |
||
1897 | |||
1898 | function CT_RA_Priority_SavePriorities() |
||
1899 | local tbl = CT_RA_DebuffTemplates[CT_RAMenuFrameDebuff.selectedIndex]; |
||
1900 | CT_RA_DebuffTemplates[CT_RAMenuFrameDebuff.selectedIndex]["cureOrder"] = { }; |
||
1901 | for i = 1, 17, 1 do |
||
1902 | local btn = getglobal("CT_RA_PriorityFramePriority" .. i); |
||
1903 | if ( btn.currParent == "CT_RA_PriorityFrameUse" ) then |
||
1904 | CT_RA_DebuffTemplates[CT_RAMenuFrameDebuff.selectedIndex]["cureOrder"][btn.currIndex] = btn:GetID(); |
||
1905 | end |
||
1906 | end |
||
1907 | end |
||
1908 | |||
1909 | function CT_RADebuff_SaveClass() |
||
1910 | local tbl = { |
||
1911 | CT_RA_WARRIOR, CT_RA_PALADIN, CT_RA_HUNTER, CT_RA_ROGUE, CT_RA_MAGE, CT_RA_WARLOCK, CT_RA_PRIEST, CT_RA_DRUID, CT_RA_SHAMAN, CT_RA_PETS |
||
1912 | }; |
||
1913 | CT_RA_DebuffTemplates[CT_RAMenuFrameDebuff.selectedIndex]["affectClasses"][tbl[this:GetID()]] = this:GetChecked(); |
||
1914 | end |
||
1915 | |||
1916 | function CT_RADebuff_SaveName() |
||
1917 | local text = this:GetText() or ""; |
||
1918 | text = string.gsub(text, "*", ".*"); |
||
1919 | CT_RA_DebuffTemplates[CT_RAMenuFrameDebuff.selectedIndex]["name"] = text; |
||
1920 | CT_RAMenuFrameDebuff_UpdateSet(); |
||
1921 | end |
||
1922 | |||
1923 | function CT_RADebuff_SaveTitle() |
||
1924 | local text = this:GetText() or ""; |
||
1925 | text = string.gsub(text, "*", ".*"); |
||
1926 | CT_RA_DebuffTemplates[CT_RAMenuFrameDebuff.selectedIndex]["debuffName"] = text; |
||
1927 | CT_RAMenuFrameDebuff_UpdateSet(); |
||
1928 | end |
||
1929 | |||
1930 | function CT_RADebuff_SaveType() |
||
1931 | local text = this:GetText() or ""; |
||
1932 | text = string.gsub(text, "*", ".*"); |
||
1933 | CT_RA_DebuffTemplates[CT_RAMenuFrameDebuff.selectedIndex]["debuffType"] = text; |
||
1934 | CT_RAMenuFrameDebuff_UpdateSet(); |
||
1935 | end |
||
1936 | |||
1937 | function CT_RADebuff_SaveDescript() |
||
1938 | local text = this:GetText() or ""; |
||
1939 | text = string.gsub(text, "*", ".*"); |
||
1940 | CT_RA_DebuffTemplates[CT_RAMenuFrameDebuff.selectedIndex]["debuffDesc"] = text; |
||
1941 | CT_RAMenuFrameDebuff_UpdateSet(); |
||
1942 | end |