vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | -- Yarr, we be pirates! oSkin/Skinner code. Tired of fucking supporting both mods and a bastard child of the first at once. |
2 | local _G = getfenv(0) |
||
3 | |||
4 | local backdrop = { |
||
5 | bgFile = "Interface\\ChatFrame\\ChatFrameBackground", tile = true, tileSize = 16, |
||
6 | edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", edgeSize = 16, |
||
7 | insets = {left = 4, right = 4, top = 4, bottom = 4}, |
||
8 | } |
||
9 | |||
10 | local gradientOn = {"VERTICAL", .1, .1, .1, 0, .25, .25, .25, 1} |
||
11 | local gradientOff = {"VERTICAL", 0, 0, 0, 1, 0, 0, 0, 1} |
||
12 | |||
13 | -- Pickup settings from installed mods |
||
14 | local sdb = (oSkin and oSkin.db.profile or nil) or (Skinner and Skinner.db.profile or nil) or { |
||
15 | BackdropBorder = {r = 0.5, g = 0.5, b = 0.5, a = 1}, |
||
16 | Backdrop = {r = 0, g = 0, b = 0, a = 0.9}, |
||
17 | FadeHeight = {enable = false, value = 500, force = false}, |
||
18 | Gradient = true, |
||
19 | } |
||
20 | |||
21 | |||
22 | function XLoot:Skin(frame, header, bba, ba, fh, bd) |
||
23 | if not frame then return end |
||
24 | |||
25 | frame:SetBackdrop(bd or backdrop) |
||
26 | frame:SetBackdropBorderColor(sdb.BackdropBorder.r or .5, sdb.BackdropBorder.g or .5, sdb.BackdropBorder.b or .5, bba or sdb.BackdropBorder.a or 1) |
||
27 | frame:SetBackdropColor(sdb.Backdrop.r or 0, sdb.Backdrop.g or 0, sdb.Backdrop.b or 0, ba or sdb.Backdrop.a or .9) |
||
28 | |||
29 | if not frame.tfade then frame.tfade = frame:CreateTexture(nil, "BORDER") end |
||
30 | frame.tfade:SetTexture("Interface\\ChatFrame\\ChatFrameBackground") |
||
31 | |||
32 | if sdb.FadeHeight.enable and (sdb.FadeHeight.force or not fh) then |
||
33 | fh = sdb.FadeHeight.value <= math.ceil(frame:GetHeight()) and sdb.FadeHeight.value or math.ceil(frame:GetHeight()) |
||
34 | end |
||
35 | |||
36 | frame.tfade:SetPoint("TOPLEFT", frame, "TOPLEFT", 4, -4) |
||
37 | if fh then frame.tfade:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", -4, -fh) |
||
38 | else frame.tfade:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -4, 4) end |
||
39 | |||
40 | frame.tfade:SetBlendMode("ADD") |
||
41 | frame.tfade:SetGradientAlpha(unpack(sdb.Gradient and gradientOn or gradientOff)) |
||
42 | |||
43 | if header and _G[frame:GetName().."Header"] then |
||
44 | _G[frame:GetName().."Header"]:Hide() |
||
45 | _G[frame:GetName().."Header"]:SetPoint("TOP", frame, "TOP", 0, 7) |
||
46 | end |
||
47 | |||
48 | end |
||
49 | |||
50 | function XLoot:QualityBorder(button) |
||
51 | local frame = button.wrapper or button |
||
52 | local border = frame:CreateTexture(button:GetName() .. "QualBorder", "OVERLAY") |
||
53 | border:SetTexture("Interface\\Buttons\\UI-ActionButton-Border") |
||
54 | border:SetBlendMode("ADD") |
||
55 | border:SetAlpha(0.5) |
||
56 | border:SetHeight(button:GetHeight()*1.8) |
||
57 | border:SetWidth(button:GetWidth()*1.8) |
||
58 | border:SetPoint("CENTER", frame, "CENTER", 0, 1) |
||
59 | border:Hide() |
||
60 | return border |
||
61 | end |
||
62 | |||
63 | function XLoot:QualityBorderResize(frame, hmult, ymult, hoff, yoff) |
||
64 | local border = _G[frame:GetName().."QualBorder"] |
||
65 | local width, height = frame:GetWidth(), frame:GetHeight() |
||
66 | border:SetHeight(height*(ymult or 1.62)) |
||
67 | border:SetWidth(width*(hmult or 1.72)) |
||
68 | border:SetPoint("CENTER", frame, "CENTER", hoff or 5, yoff or 1) |
||
69 | end |
||
70 | |||
71 | function XLoot:BackdropFrame(frame, bgcolor, bordercolor) |
||
72 | frame:SetBackdrop( { bgFile = "Interface/Tooltips/UI-Tooltip-Background", |
||
73 | edgeFile = "Interface/Tooltips/UI-Tooltip-Border", |
||
74 | tile = true, tileSize = 32, edgeSize = 15, |
||
75 | insets = { left = 4, right = 4, top = 4, bottom = 4 }}) |
||
76 | frame:SetBackdropColor(unpack(bgcolor)) |
||
77 | frame:SetBackdropBorderColor(unpack(bordercolor)) |
||
78 | end |
||
79 | |||
80 | function XLoot:ItemButtonWrapper(button, woff, hoff, edgesize, borderinset) |
||
81 | local wrapper = button.wrapper or CreateFrame("Frame", button:GetName().."Wrapper", button) |
||
82 | wrapper:SetWidth(button:GetWidth()+(woff or 10)) |
||
83 | wrapper:SetHeight(button:GetHeight()+(hoff or 10)) |
||
84 | wrapper:ClearAllPoints() |
||
85 | wrapper:SetPoint("CENTER", button, "CENTER") |
||
86 | self:Skin(wrapper) |
||
87 | if edgesize then |
||
88 | local backdrop = wrapper:GetBackdrop() |
||
89 | backdrop.edgeSize = edgesize |
||
90 | wrapper:SetBackdrop(backdrop) |
||
91 | end |
||
92 | wrapper:SetBackdropColor(1, 1, 1, 0) |
||
93 | wrapper:SetBackdropBorderColor(.7, .7, .7, 1) |
||
94 | wrapper:Show() |
||
95 | return wrapper |
||
96 | end |
||
97 | |||
98 | -- Substitute oSkin function, full credit to oSkin devs :) |
||
99 | function XLoot:oSkinTooltipModded(frame) |
||
100 | if not frame.tfade then frame.tfade = frame:CreateTexture(nil, "BORDER") end |
||
101 | frame.tfade:SetTexture("Interface\\ChatFrame\\ChatFrameBackground") |
||
102 | |||
103 | frame.tfade:SetPoint("TOPLEFT", frame, "TOPLEFT",1,-1) |
||
104 | frame.tfade:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT",-1,1) |
||
105 | |||
106 | frame.tfade:SetBlendMode("ADD") |
||
107 | frame.tfade.alphagradient = { "VERTICAL", .1, .1, .1, 0, .2, .2, .2, 0.6 } |
||
108 | frame.tfade:SetGradientAlpha("VERTICAL", .1, .1, .1, 0, .2, .2, .2, 0.6) |
||
109 | |||
110 | frame.tfade:SetPoint("TOPLEFT", frame, "TOPLEFT", 6, -6) |
||
111 | frame.tfade:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", -6, -30) |
||
112 | end |