-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNugArt.lua
403 lines (364 loc) · 12.6 KB
/
NugArt.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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
local NugArt = CreateFrame("Frame")
local MainMenuBarTexturesOffset = 0
local f = CreateFrame("Frame", "NugArtMainMenuBackground", UIParent)
f:SetFrameStrata("BACKGROUND")
f:SetPoint("BOTTOM",75+MainMenuBarTexturesOffset,0)
f:SetSize(50, 50)
f:SetScale(0.8)
f.MakeBackgroundTexture = function(self, name, numSlots)
local t = f:CreateTexture(name, "BACKGROUND", nil, 1)
t:SetAtlas("hud-MainMenuBar-small")
-- t:SetTexture("Interface\\MainMenuBar\\UI-MainMenuBar-Dwarf")
-- local crop = 0.01
-- local crop = 0.086
local crop = 0.01 + (0.0762*numSlots)
t:SetSize(550* crop, 49)
t:SetTexCoord(0, crop, 0, 1)
return t
end
local m = 0.75
local t1 = f:MakeBackgroundTexture("NugArtBackgroundLeft", 12.07)
t1:SetPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT",9,0)
t1:SetVertexColor(m,m,m)
local t2 = f:MakeBackgroundTexture("NugArtBackgroundRight", 7.15)
-- local t2 = f:MakeBackgroundTexture("NugArtBackgroundRight", 6.87)
t2:SetPoint("BOTTOMLEFT", f, "BOTTOMRIGHT",45,0)
t2:SetVertexColor(m,m,m)
local t3 = f:MakeBackgroundTexture("NugArtBackgroundRight2", 7.15)
t3:SetPoint("BOTTOMLEFT", t2, "BOTTOMRIGHT",-52,0)
t3:SetDrawLayer("BACKGROUND", -1)
t3:SetVertexColor(m,m,m)
if IsAddOnLoaded("oUF_NugVials") then
oUF_NugVials:SetScale(0.8)
oUF_NugVials:SetPoint("BOTTOM",150,0)
else
t2:SetDrawLayer("BACKGROUND", 0)
t2:SetPoint("BOTTOMLEFT", f, "BOTTOMRIGHT",-40,0)
end
-- Skull
-- local leftcap = f:CreateTexture("NugArtLeftCap", "BACKGROUND", nil, 2)
-- leftcap:SetSize(93, 93)
-- leftcap:SetTexture("Interface\\AddOns\\NugArt\\textures\\SkullCap4")
-- leftcap:SetPoint("BOTTOMRIGHT", t1, "BOTTOMLEFT",9,0)
-- Angel
local leftcap = f:CreateTexture("NugArtReftCap", "ARTWORK", nil, 2)
leftcap:SetSize(162, 81)
leftcap:SetTexture("Interface\\AddOns\\NugArt\\textures\\d3demonCap")
leftcap:SetTexCoord(1,0,0,1)
leftcap:SetPoint("BOTTOMRIGHT", t1, "BOTTOMLEFT",73,0)
local rightcap = f:CreateTexture("NugArtRightCap", "ARTWORK", nil, 2)
rightcap:SetSize(162, 81)
rightcap:SetTexture("Interface\\AddOns\\NugArt\\textures\\d3demonCap")
rightcap:SetPoint("BOTTOMLEFT", t3, "BOTTOMRIGHT",-73,0)
f:SetScript("OnEvent", function(self, event, ...)
return self[event](self, event, ...)
end)
f:RegisterEvent("PET_BATTLE_OPENING_START")
f:RegisterEvent("PET_BATTLE_CLOSE")
function f:PET_BATTLE_OPENING_START()
self:Hide()
end
function f:PET_BATTLE_CLOSE()
self:Show()
end
local textures = {
["Chatbg1"] = {
["strata"] = "BACKGROUND",
["to"] = "BOTTOMLEFT",
["scale"] = 2,
["layer"] = "BACKGROUND",
["layerLevel"] = -6,
["alpha"] = 0.6,
["width"] = 300,
["y"] = 0,
["x"] = -6,
["disable"] = false,
["height"] = 300,
["level"] = 0,
["point"] = "BOTTOMLEFT",
["texture"] = "Interface\\AddOns\\NugArt\\textures\\ABRight",
},
-- ["CapRight"] = {
-- ["strata"] = "MEDIUM",
-- ["point"] = "BOTTOM",
-- ["parent"] = "UIParent",
-- ["width"] = 240,
-- ["y"] = 0,
-- ["x"] = 422,
-- ["height"] = 120,
-- ["level"] = 5,
-- ["to"] = "BOTTOM",
-- ["texture"] = "Interface\\AddOns\\NugArt\\textures\\d3demonCap",
-- },
-- ["SkullCap"] = {
-- ["strata"] = "MEDIUM",
-- ["to"] = "BOTTOM",
-- ["parent"] = "UIParent",
-- ["width"] = 93,
-- ["y"] = 0,
-- ["x"] = -439,
-- ["height"] = 93,
-- ["level"] = 5,
-- ["point"] = "BOTTOM",
-- ["texture"] = "Interface\\AddOns\\NugArt\\textures\\SkullCap4",
-- },
["Chatbg2"] = {
["strata"] = "BACKGROUND",
["point"] = "BOTTOMLEFT",
["scale"] = 2,
["layer"] = "BACKGROUND",
["layerLevel"] = -5,
["width"] = 350,
["alpha"] = 0.6,
["y"] = -6,
["x"] = -6,
["disable"] = false,
["height"] = 350,
["level"] = 1,
["to"] = "BOTTOMLEFT",
["texture"] = "Interface\\AddOns\\NugArt\\textures\\HF-1",
},
-- ["ABbgleft"] = {
-- ["point"] = "BOTTOMRIGHT",
-- ["scale"] = 1.37,
-- ["alpha"] = 1,
-- ["width"] = 300,
-- ["y"] = -30,
-- ["x"] = -190,
-- ["disable"] = false,
-- ["height"] = 300,
-- ["parent"] = "UIParent",
-- ["to"] = "BOTTOM",
-- ["texture"] = "Interface\\AddOns\\NugArt\\textures\\ABLeft",
-- },
-- ["ABbgright"] = {
-- ["point"] = "BOTTOMLEFT",
-- ["scale"] = 1.37,
-- ["width"] = 300,
-- ["y"] = -30,
-- ["x"] = -190,
-- ["height"] = 300,
-- ["parent"] = "UIParent",
-- ["to"] = "BOTTOM",
-- ["texture"] = "Interface\\AddOns\\NugArt\\textures\\ABRight",
-- },
}
local frames = {}
function NugArt.Render()
local pr = textures
for name, opts in pairs(pr) do
if not frames[name] and not opts.disable then
frames[name] = CreateFrame("Frame","NugArt_"..name,UIParent)
frames[name].texture = frames[name]:CreateTexture(nil,"ARTWORK")
frames[name].texture:SetAllPoints(frames[name])
end
end
for name, f in pairs(frames) do
local opts = pr[name]
if opts and not opts.disable then
f:SetParent(opts.frameparent or UIParent)
f:SetHeight(opts.height or 64)
f:SetWidth(opts.width or 64)
f:SetScale(opts.scale or 1)
f:SetAlpha(opts.alpha or 1)
f:SetFrameStrata(opts.strata or "BACKGROUND")
f:SetFrameLevel(opts.level or 1)
f.texture:SetDrawLayer(opts.layer or "ARTWORK", opts.layerLevel or 0)
f.texture:SetTexture(opts.texture or "")
f:ClearAllPoints()
f:SetPoint(opts.point or "CENTER",opts.parent or "UIParent",opts.to or "CENTER",opts.x or 0,opts.y or 0)
f:Show()
else
f:Hide()
end
end
end
NugArt.Render()
-- MainMenuBarLeftEndCap:Hide()
-- MainMenuBarRightEndCap:Hide()
-- local m = 0.6
-- MainMenuBarLeftEndCap:SetVertexColor(m,m,m)
-- MainMenuBarRightEndCap:SetVertexColor(m,m,m)
-- MainMenuBarTexture0:SetVertexColor(m,m,m)
-- MainMenuBarTexture1:SetVertexColor(m,m,m)
-- MainMenuBarTexture2:SetVertexColor(m,m,m)
-- MainMenuBarTexture3:SetVertexColor(m,m,m)
-- MainMenuMaxLevelBar0:SetVertexColor(m,m,m)
-- MainMenuMaxLevelBar1:SetVertexColor(m,m,m)
-- MainMenuMaxLevelBar2:SetVertexColor(m,m,m)
-- MainMenuMaxLevelBar3:SetVertexColor(m,m,m)
--[[[--~ ***LAYER***
--~ BACKGROUND - Level 0. Place the background of your frame here.
--~ BORDER - Level 1. Place the artwork of your frame here .
--~ ARTWORK - Level 2. Place the artwork of your frame here.
--~ OVERLAY - Level 3. Place your text, objects, and buttons in this level.
--~ HIGHLIGHT - Level 4. Place your text, objects, and buttons in this level.
--~ ***STRATA***
--~ PARENT
--~ BACKGROUND
--~ LOW
--~ MEDIUM
--~ HIGH
--~ DIALOG
--~ FULLSCREEN
--~ FULLSCREEN_DIALOG
--~ TOOLTIP
--~ ***ALPHA MDOE***:
--~ DISABLE - opaque texture
--~ BLEND - normal painting on top of the background, obeying alpha channels if present in the image (uses alpha)
--~ ALPHAKEY - one-bit alpha
--~ ADD - additive blend
--~ MOD - modulating blend
NugArt = CreateFrame("Frame","NugArt")
NugArt:SetScript("OnEvent", function(self, event, ...)
self[event](self, event, ...)
end)
NugArt:RegisterEvent("ADDON_LOADED")
local frames = {}
local valid_options = {
["width"] = true,
["height"] = true,
["texture"] = true,
["disable"] = true,
["alpha"] = true,
["scale"] = true,
["strata"] = true,
["layer"] = true,
["level"] = true,
["frameparent"] = true,
["point"] = true,
["parent"] = true,
["to"] = true,
["x"] = true,
["y"] = true,
}
function NugArt.ADDON_LOADED(self,event,arg1)
if arg1 == "NugArt" then
NugArtProfile = NugArtProfile or "Default"
NugArtDB = NugArtDB or {}
NugArtDB.profiles = NugArtDB.profiles or {}
NugArtDB.profiles.Default = NugArtDB.profiles.Default or {}
NugArt.Render()
SLASH_NUGART1= "/na"
SLASH_NUGART2 = "/nugart"
SlashCmdList["NUGART"] = NugArt.SlashCmd
end
end
function NugArt.Render()
local pr = NugArtDB.profiles[NugArtProfile]
for name, opts in pairs(pr) do
if not frames[name] and not opts.disable then
frames[name] = CreateFrame("Frame","NugArt_"..name,UIParent)
frames[name].texture = frames[name]:CreateTexture(nil,"ARTWORK")
frames[name].texture:SetAllPoints(frames[name])
end
end
for name, f in pairs(frames) do
local opts = pr[name]
if opts and not opts.disable then
f:SetParent(opts.frameparent or "UIParent")
f:SetHeight(opts.height or 64)
f:SetWidth(opts.width or 64)
f:SetScale(opts.scale or 1)
f:SetAlpha(opts.alpha or 1)
f:SetFrameStrata(opts.strata or "BACKGROUND")
f:SetFrameLevel(opts.level or 1)
f.texture:SetDrawLayer(opts.layer or "ARTWORK")
f.texture:SetTexture(opts.texture or "")
f:ClearAllPoints()
f:SetPoint(opts.point or "CENTER",opts.parent or "UIParent",opts.to or "CENTER",opts.x or 0,opts.y or 0)
f:Show()
else
f:Hide()
end
end
end
function NugArt.SlashCmd(msg)
k,v = string.match(msg, "(%w+) ?(.*)")
if k == "help" or not k then print(Usage:
|cff00ff00/na|r create <name> - create new texture
|cff00ff00/na|r set name=<name> width=100 height=100 texture=&a\CapLeft point=BOTTOMLEFT parent=UIParent to=BOTTOM x=12 y=32 [disable=true/false scale=1 strata=HIGH level=1 layer=ARTWORK frameparent=TargetFrame alpha=0.8]
Only required option in set is name=, though you won't see anything without some neccesary fields (w,h,tex)
&a - shortcut to Interface\\AddOns\\NugArt\\textures
|cff00ff00/na|r info <name>
|cff00ff00/na|r delete <name>
|cff00ff00/na|r list
|cff00ff00/na|r newprofile
|cff00ff00/na|r listprofile
|cff00ff00/na|r deleteprofile
|cff00ff00/na|r changeprofile
)
elseif k == "set" then
local name, p = NugArt.Parse(v,valid_options)
if not name then print("name missing"); return end
for field, val in pairs(p) do
NugArtDB.profiles[NugArtProfile][name][field] = val
end
NugArt.Render()
elseif k == "list" then
print("Textures list:")
for name,tbl in pairs(NugArtDB.profiles[NugArtProfile]) do
print(string.format(" %s : %s",name,tbl.texture or "<No Texture>"))
end
elseif k == "info" then
if not NugArtDB.profiles[NugArtProfile][v] then print(v.." not exists"); return end
print("Details for "..v)
for opt,val in pairs(NugArtDB.profiles[NugArtProfile][v]) do
print(" "..opt.." = "..val)
end
elseif k == "create" then
if not string.match(v,"(%w+)") then print("incorrect name"); return end
NugArtDB.profiles[NugArtProfile][v] = {}
elseif k == "delete" or k == "del" then
if not NugArtDB.profiles[NugArtProfile][v] then print(v.." not exists"); return end
NugArtDB.profiles[NugArtProfile][v] = nil
NugArt.Render()
elseif k == "newprofile" then
if not string.match(v,"(%w+)") then print("incorrect name"); return end
NugArtDB.profiles[v] = {}
elseif k == "listprofile" then
print("NugArt profiles:")
for pf in pairs(NugArtDB.profiles) do
print(" "..pf)
end
elseif k == "changeprofile" then
if not NugArtDB.profiles[v] then print(v.." profile not exists"); return end
NugArtProfile = v
NugArt.Render()
elseif k == "delprofile" or k == "deleteprofile" then
if not NugArtDB.profiles[v] then print("invalid profile name") end
StaticPopupDialogs["NUGART_DELPROFILE"] = {
text = string.format("Confirm %s profile removal?",v),
button1 = "Confirm",
button2 = "Abort",
OnAccept = function()
NugArtDB.profiles[v] = nil
end,
timeout = 0,
whileDead = 1,
hideOnEscape = 0
};
StaticPopup_Show ("NUGART_DELPROFILE")
end
end
function NugArt.Parse(str,valid)
local fields = {}
local name
for opt,v in string.gmatch(str,"(%w*)=([%w%_%.%-%&%\\]+)") do
opt = string.lower(opt)
if opt == "name" then
name = v
elseif valid[opt] then
if v == "nil" then v = nil end
if v == "true" then v = true end
if v == "false" then v = false end
if tonumber(v) then v = tonumber(v) end
if opt == "texture" then v = string.gsub(v,"&a","Interface\\AddOns\\NugArt\\textures"); print("Texture path: "..v) end
if opt == "layer" or opt == "strata" or opt == "point" or opt == "to" then v = string.upper(v) end
fields[opt] = v
else
print(string.format('Unknown field "%s"',opt))
end
end
return name,fields
end]]