-
Notifications
You must be signed in to change notification settings - Fork 0
/
SimpleRareElite.lua
291 lines (250 loc) · 8.4 KB
/
SimpleRareElite.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
SRE_VERSION = "|cFF00FF00SimpleRareElite v1.28|r";
local SimpleRareElite = CreateFrame('Frame', 'SimpleRareElite', UIParent)
local TargetFrame
-- Option GUI
function SimpleRareElite_GUI()
SREGui = {};
SREGui = CreateFrame("Frame", "SREGui", UIParent);
SREGui.name = "SimpleRareElite";
AddOptions(SREGui);
SRETitle = SREGui:CreateFontString("title", "OVERLAY")
SRETitle:SetFont("Fonts\\MORPHEUS.ttf", 25)
SRETitle:SetTextColor(1, 0.82, 0)
SRETitle:SetPoint("TOPLEFT", 20, -5)
SRETitle:SetText("SimpleRareElite")
SimpleRareElite_GUI_Skin()
SimpleRareElite_GUI_Frame_Level()
SimpleRareElite_GUI_ReloadUI();
end
function SimpleRareElite_GUI_Skin()
SRETitle1 = SREGui:CreateFontString("title1", "OVERLAY", "GameTooltipText")
SRETitle1:SetTextColor(1, 0.82, 0)
SRETitle1:SetPoint("TOPLEFT", 20, -50)
SRETitle1:SetText("Set Textures")
if not DDM then
CreateFrame("Button", "DDM", SREGui, "UIDropDownMenuTemplate")
end
DDM:ClearAllPoints()
DDM:SetPoint("TOPLEFT", 2, -70)
DDM:Show()
local items = {
"Blurry",
"Classic",
"Modern",
"Tiny",
}
local function OnClick(self)
UIDropDownMenu_SetSelectedID(DDM, self:GetID())
if (self:GetID() == 1) then
--Blurry
DEFAULT_CHAT_FRAME:AddMessage("SimpleRareElite is now set to use Blurry textures");
DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Change target to load texture|r");
skin = "blurry"
elseif (self:GetID() == 2) then
--Classic
DEFAULT_CHAT_FRAME:AddMessage("SimpleRareElite is now set to use Classic textures");
DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Change target to load texture|r");
skin = "classic"
elseif (self:GetID() == 3) then
--Modern
DEFAULT_CHAT_FRAME:AddMessage("SimpleRareElite is now set to use Modern textures");
DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Change target to load texture|r");
skin = "modern"
elseif (self:GetID() == 4) then
--Tiny
DEFAULT_CHAT_FRAME:AddMessage("SimpleRareElite is now set to use Tiny textures");
DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Change target to load texture|r");
skin = "tiny"
end
end
local function initialize(self, level)
local info = UIDropDownMenu_CreateInfo()
for k, v in pairs(items) do
info = UIDropDownMenu_CreateInfo()
info.text = v
info.value = v
info.func = OnClick
UIDropDownMenu_AddButton(info, level)
end
end
UIDropDownMenu_Initialize(DDM, initialize)
UIDropDownMenu_SetWidth(DDM, 100);
UIDropDownMenu_SetButtonWidth(DDM, 124)
UIDropDownMenu_SetSelectedID(DDM, 2)
UIDropDownMenu_JustifyText(DDM, "LEFT")
end
function SimpleRareElite_GUI_Frame_Level()
SRETitle2 = SREGui:CreateFontString("title2", "OVERLAY", "GameTooltipText")
SRETitle2:SetTextColor(1, 0.82, 0)
SRETitle2:SetPoint("TOPLEFT", 20, -110)
SRETitle2:SetText("Set Frame Level")
if not DDM1 then
CreateFrame("Button", "DDM1", SREGui, "UIDropDownMenuTemplate")
end
DDM1:ClearAllPoints()
DDM1:SetPoint("TOPLEFT", 2, -130)
DDM1:Show()
local items1 = {
"Above",
"Below",
}
local function OnClick1(self)
UIDropDownMenu_SetSelectedID(DDM1, self:GetID())
if (self:GetID() == 1) then
--Above
DEFAULT_CHAT_FRAME:AddMessage("SimpleRareElite is now set to show textures above buffs and health text");
fl = 12
StaticPopup_Hide("RELOADUI")
StaticPopup_Show("RELOADUI")
elseif (self:GetID() == 2) then
--Below
DEFAULT_CHAT_FRAME:AddMessage("SimpleRareElite is now set to show textures below buffs and health text");
fl = 1
StaticPopup_Hide("RELOADUI")
StaticPopup_Show("RELOADUI")
end
end
local function initialize1(self, level)
local info1 = UIDropDownMenu_CreateInfo()
for k, v in pairs(items1) do
info1 = UIDropDownMenu_CreateInfo()
info1.text = v
info1.value = v
info1.func = OnClick1
UIDropDownMenu_AddButton(info1, level)
end
end
UIDropDownMenu_Initialize(DDM1, initialize1)
UIDropDownMenu_SetWidth(DDM1, 100);
UIDropDownMenu_SetButtonWidth(DDM1, 124)
UIDropDownMenu_SetSelectedID(DDM1, 1)
UIDropDownMenu_JustifyText(DDM1, "LEFT")
end
function SimpleRareElite_GUI_ReloadUI()
StaticPopupDialogs["RELOADUI"] = {
text = "Changing this setting requires that you reload your User Interface",
button1 = "Accept",
button2 = "Cancel",
OnAccept = function()
ReloadUI();
end,
timeout = 0,
whileDead = true,
hideOnEscape = true,
preferredIndex = 3, -- avoid some UI taint, see http://www.wowace.com/announcements/how-to-avoid-some-ui-taint/
}
end
-- Set Textures
local function SetSimpleRareElite(Texture)
SimpleRareElite.Texture:SetTexture('Interface\\AddOns\\SimpleRareElite\\Textures\\' .. skin .. '\\' .. Texture)
SimpleRareElite.Texture:SetTexCoord(0, 1, 0, 1)
SimpleRareElite:ClearAllPoints()
if skin == 'blurry' then
--Blurry
if TargetFrame == ElvUF_Target then
SimpleRareElite:SetSize(120, 120)
SimpleRareElite:SetPoint('TOPRIGHT', TargetFrame, 'TOPRIGHT', 47, 25)
elseif TargetFrame == SUFUnittarget then
SimpleRareElite:SetSize(120, 120)
SimpleRareElite:SetPoint('TOPRIGHT', TargetFrame, 'TOPRIGHT', 47, 25)
elseif TargetFrame == oUF_TukuiTarget then
SimpleRareElite:SetSize(128, 128)
SimpleRareElite:SetPoint('TOPRIGHT', TargetFrame, 'TOPRIGHT', 52, 28)
end
elseif skin == 'classic' then
--Classic
SimpleRareElite:SetSize(256, 128)
if TargetFrame == ElvUF_Target then
SimpleRareElite:SetPoint('TOPRIGHT', TargetFrame, 'TOPRIGHT', 100, 15)
elseif TargetFrame == SUFUnittarget then
SimpleRareElite:SetPoint('TOPRIGHT', TargetFrame, 'TOPRIGHT', 100, 15)
elseif TargetFrame == oUF_TukuiTarget then
SimpleRareElite:SetPoint('TOPRIGHT', TargetFrame, 'TOPRIGHT', 102, 15)
end
elseif skin == 'modern' then
--Modern
if TargetFrame == ElvUF_Target then
SimpleRareElite:SetSize(100, 100)
SimpleRareElite:SetPoint('TOPRIGHT', TargetFrame, 'TOPRIGHT', 36, 8)
elseif TargetFrame == SUFUnittarget then
SimpleRareElite:SetSize(100, 100)
SimpleRareElite:SetPoint('TOPRIGHT', TargetFrame, 'TOPRIGHT', 36, 8)
elseif TargetFrame == oUF_TukuiTarget then
SimpleRareElite:SetSize(110, 110)
SimpleRareElite:SetPoint('TOPRIGHT', TargetFrame, 'TOPRIGHT', 41, 9)
end
elseif skin == 'tiny' then
--Tiny
if TargetFrame == ElvUF_Target then
SimpleRareElite:SetSize(100, 100)
SimpleRareElite:SetPoint('TOPRIGHT', TargetFrame, 'TOPRIGHT', 33, 8)
elseif TargetFrame == SUFUnittarget then
SimpleRareElite:SetSize(100, 100)
SimpleRareElite:SetPoint('TOPRIGHT', TargetFrame, 'TOPRIGHT', 33, 8)
elseif TargetFrame == oUF_TukuiTarget then
SimpleRareElite:SetSize(110, 110)
SimpleRareElite:SetPoint('TOPRIGHT', TargetFrame, 'TOPRIGHT', 38, 9)
end
end
SimpleRareElite:Show()
end
-- Load and Show Textures
local function CreateSimpleRareElite()
SimpleRareElite:RegisterEvent('PLAYER_LOGIN')
SimpleRareElite:RegisterEvent("ADDON_LOADED")
SimpleRareElite:SetScript('OnEvent', function(self, event, arg1)
self:Hide()
if event == "ADDON_LOADED" and arg1 == "SimpleRareElite" then
skin = skin or "modern"
fl = fl or 12
end
if event == 'PLAYER_LOGIN' then
TargetFrame = ElvUF_Target or oUF_TukuiTarget or SUFUnittarget
if not TargetFrame then
return
end
SimpleRareElite:SetParent(TargetFrame)
SimpleRareElite.Texture = SimpleRareElite:CreateTexture('ARTWORK')
SimpleRareElite:SetFrameLevel(fl)
SimpleRareElite.Texture:SetAllPoints()
self:RegisterEvent('PLAYER_TARGET_CHANGED')
elseif event == "PLAYER_TARGET_CHANGED" then
local TargetClass = UnitIsPlayer('target') and select(2, UnitClass('target')) or UnitClassification('target')
if TargetClass == 'worldboss' then
SetSimpleRareElite('worldboss.tga')
elseif TargetClass == 'elite' then
SetSimpleRareElite('elite.tga')
elseif TargetClass == 'rare' then
SetSimpleRareElite('rare.tga')
elseif TargetClass == 'rareelite' then
SetSimpleRareElite('rareelite.tga')
end
end
end)
end
-- Commands Function
local function InitSlashCommands()
SLASH_SRE1, SLASH_SRE2 = '/sre', '/simplerareelite';
function SlashCmdList.SRE(msg, editbox)
OpenOptions();
end
end
function OpenOptions()
if (Settings ~= nil) then
Settings.OpenToCategory(SREGui.categoryID)
else
InterfaceOptionsFrame_OpenToCategory(SREGui)
end
end
function AddOptions(SREGui)
if InterfaceOptions_AddCategory then
InterfaceOptions_AddCategory(SREGui)
else
local category = Settings.RegisterCanvasLayoutCategory(SREGui, SREGui.name);
Settings.RegisterAddOnCategory(category);
SREGui.categoryID = category:GetID()
end
end
CreateSimpleRareElite();
InitSlashCommands();
SimpleRareElite_GUI();