-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
pet.lua
131 lines (100 loc) · 3.7 KB
/
pet.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
local addonName, ns = ...
local colors = ns.colors
function ns.oUF_NugGenericSmallFrame(addCastbar, colorClass, addAltPower)
return function(self, unit)
return ns.oUF_NugGenericSmallFrame1(self, unit, addCastbar, colorClass, addAltPower)
end
end
function ns.oUF_NugGenericSmallFrame1(self, unit, addCastbar, colorClass, addAltPower)
local m=0.45
-- local height = 100*m
-- local width = 255*m
local width = 278*m
local height = 120*m
self:SetHeight(height)
self:SetWidth(width)
self:SetScript("OnEnter", UnitFrame_OnEnter)
self:SetScript("OnLeave", UnitFrame_OnLeave)
self:RegisterForClicks"anyup"
-- self:SetAttribute("*type2", nil) -- disable right click
self.colors = colors
local hpw = 97
local hph = 17
local texture = [[Interface\AddOns\oUF_NugTarget\statusbar1.tga]]
local hp = CreateFrame("StatusBar",nil,self)
hp:SetFrameStrata("LOW")
hp:SetStatusBarTexture(texture)
hp:GetStatusBarTexture():SetDrawLayer("ARTWORK",1)
hp:SetHeight(hph)
hp:SetWidth(hpw)
hp:SetPoint("TOPLEFT",self,"TOPLEFT",14,-11)
hp.colorTapping = true
hp.colorDisconnected = true
hp.colorHealth = true
hp.colorClass = colorClass
-- hp.frequentUpdates = true
-- hp.Smooth = true
hp.bg = hp:CreateTexture(nil, "BORDER")
hp.bg:SetAllPoints(hp)
hp.bg:SetTexture(texture)
hp.bg.multiplier = 0.4
-- hp.model = CreateFrame("Frame")
self.Health = hp
local mph = 9
local mp = CreateFrame("StatusBar",nil,self)
mp:SetFrameStrata("LOW")
mp:SetStatusBarTexture(texture)
mp:GetStatusBarTexture():SetDrawLayer("ARTWORK",1)
mp:SetHeight(mph)
mp:SetWidth(hpw)
mp:SetPoint("TOPLEFT",self,"TOPLEFT",14,-31)
mp.colorPower = true
mp.colorDisconnected = true
mp.colorTapping = true
mp.frequentUpdates = true
mp.bg = mp:CreateTexture(nil, "BORDER")
mp.bg:SetAllPoints(mp)
mp.bg:SetTexture(texture)
mp.bg.multiplier = 0.3
self.Power = mp
-- local bgw = 278*m
-- local bgh = 120*m
local bg = hp:CreateTexture(nil,"ARTWORK")
bg:SetDrawLayer("ARTWORK", 7)
bg:SetAllPoints(self)
bg:SetTexture[[Interface\AddOns\oUF_NugTarget\target\petBG]]
bg:SetTexCoord(0, 278/512, 0, 0.95)
if addCastbar then
local cw,ch = 155, 18
local castbar = ns:CreateCastbar(self, cw, ch, true)
castbar:SetColor(0.6, 0, 1)
castbar:SetPoint("TOPLEFT", self, "BOTTOMLEFT",10,1)
self.Castbar = castbar
end
if addAltPower then
-- Position and size
local AlternativePower = CreateFrame('StatusBar', nil, self, BackdropTemplateMixin and "BackdropTemplate")
AlternativePower:SetHeight(10)
AlternativePower:SetWidth(90)
AlternativePower:EnableMouse(true)
local texture = [[Interface\AddOns\oUF_NugTarget\castbar.tga]]
-- local texture = "Interface\\BUTTONS\\WHITE8X8"
AlternativePower:SetStatusBarTexture(texture)
local color = {1,0.6,0.2}
local mul = 0.4
AlternativePower:SetStatusBarColor(unpack(color))
local bg = AlternativePower:CreateTexture(nil, "BACKGROUND")
bg:SetTexture(texture)
bg:SetVertexColor(color[1]*mul, color[2]*mul, color[3]*mul)
bg:SetAllPoints(AlternativePower)
local backdrop = {
bgFile = "Interface\\BUTTONS\\WHITE8X8", tile = true, tileSize = 0,
insets = {left = -2, right = -2, top = -2, bottom = -2},
}
AlternativePower:SetBackdrop(backdrop)
AlternativePower:SetBackdropColor(0, 0, 0, 0.5)
AlternativePower:SetPoint('TOPRIGHT', self, "LEFT",-5, 5)
-- Register with oUF
self.AlternativePower = AlternativePower
end
end