Details | Compare with Previous | View Log
Line No. | Rev | Author | Line |
---|---|---|---|
1 | 2 | Wildbreath-135052 | --[[------------------------------------------------------------------------- |
2 | Wildbreath-135052 | Trond A Ekseth grants anyone the right to use this work for any purpose, |
|
3 | Wildbreath-135052 | without any conditions, unless such conditions are required by law. |
|
4 | Wildbreath-135052 | ALZA uses this right to conquer the whole world! |
|
5 | Wildbreath-135052 | ---------------------------------------------------------------------------]] |
|
6 | Wildbreath-135052 | ||
7 | Wildbreath-135052 | --[[ Options start here ]] |
|
8 | Wildbreath-135052 | local settings = oUF_Settings |
|
9 | Wildbreath-135052 | --[[ Options end ]] |
|
10 | Wildbreath-135052 | ||
11 | Wildbreath-135052 | --[[ Font creation func ]] |
|
12 | Wildbreath-135052 | -- arguments: parent (parent frame of fontstring), justify (horisontal justification, optional) |
|
13 | Wildbreath-135052 | -- returns: FontString |
|
14 | Wildbreath-135052 | local createFs = function(parent, justify, ownfsize) |
|
15 | Wildbreath-135052 | local f = parent:CreateFontString(nil, "OVERLAY") |
|
16 | Wildbreath-135052 | f:SetFont(settings.font, ownfsize or settings.fsize, "THINOUTLINE") |
|
17 | Wildbreath-135052 | if(justify) then f:SetJustifyH(justify) end |
|
18 | Wildbreath-135052 | return f |
|
19 | Wildbreath-135052 | end |
|
20 | Wildbreath-135052 | ||
21 | Wildbreath-135052 | local function SecondsToTimeAbbrev(time) |
|
22 | Wildbreath-135052 | local hr, m, s, text |
|
23 | Wildbreath-135052 | if time <= 0 then text = "" |
|
24 | Wildbreath-135052 | elseif(time < 3600 and time > 60) then |
|
25 | Wildbreath-135052 | hr = floor(time / 3600) |
|
26 | Wildbreath-135052 | m = floor(mod(time, 3600) / 60 + 1) |
|
27 | Wildbreath-135052 | s = mod(time, 60) |
|
28 | Wildbreath-135052 | text = format("%dм %dÑ", m, s) |
|
29 | Wildbreath-135052 | elseif time < 60 then |
|
30 | Wildbreath-135052 | m = floor(time / 60) |
|
31 | Wildbreath-135052 | s = mod(time, 60) |
|
32 | Wildbreath-135052 | text = (m == 0 and format("%dÑ", s)) |
|
33 | Wildbreath-135052 | else |
|
34 | Wildbreath-135052 | hr = floor(time / 3600 + 1) |
|
35 | Wildbreath-135052 | text = format("%dÑ", hr) |
|
36 | Wildbreath-135052 | end |
|
37 | Wildbreath-135052 | return text |
|
38 | Wildbreath-135052 | end |
|
39 | Wildbreath-135052 | ||
40 | Wildbreath-135052 | --[[ Right click menu ]] |
|
41 | Wildbreath-135052 | local menu = function(self) |
|
42 | Wildbreath-135052 | local unit = self.unit:sub(1, -2) |
|
43 | Wildbreath-135052 | local cunit = self.unit:gsub("(.)", string.upper, 1) |
|
44 | Wildbreath-135052 | ||
45 | Wildbreath-135052 | if(unit=="party" or unit=="partypet") then |
|
46 | Wildbreath-135052 | ToggleDropDownMenu(1, nil, _G["PartyMemberFrame"..self.id.."DropDown"], "cursor") |
|
47 | Wildbreath-135052 | elseif(_G[cunit.."FrameDropDown"]) then |
|
48 | Wildbreath-135052 | ToggleDropDownMenu(1, nil, _G[cunit.."FrameDropDown"], "cursor") |
|
49 | Wildbreath-135052 | end |
|
50 | Wildbreath-135052 | end |
|
51 | Wildbreath-135052 | ||
52 | Wildbreath-135052 | --[[ Short numbarz! ]] |
|
53 | Wildbreath-135052 | local format = string.format |
|
54 | Wildbreath-135052 | ||
55 | Wildbreath-135052 | local siValue = function(val) |
|
56 | Wildbreath-135052 | if val >= 10000000 then |
|
57 | Wildbreath-135052 | return format("%.1fm", val / 1000000) |
|
58 | Wildbreath-135052 | elseif val >= 1000000 then |
|
59 | Wildbreath-135052 | return format("%.2fm", val / 1000000) |
|
60 | Wildbreath-135052 | elseif val >= 100000 then |
|
61 | Wildbreath-135052 | return format("%.0fk", val / 1000) |
|
62 | Wildbreath-135052 | elseif val >= 10000 then |
|
63 | Wildbreath-135052 | return format("%.1fk", val / 1000) |
|
64 | Wildbreath-135052 | else |
|
65 | Wildbreath-135052 | return val |
|
66 | Wildbreath-135052 | end |
|
67 | Wildbreath-135052 | end |
|
68 | Wildbreath-135052 | ||
69 | Wildbreath-135052 | --[[ Health update ]] |
|
70 | Wildbreath-135052 | local ColorGradient = oUF.ColorGradient -- we need it for hp and druid power coloring |
|
71 | Wildbreath-135052 | local unpack = unpack |
|
72 | Wildbreath-135052 | ||
73 | Wildbreath-135052 | local OverrideUpdateHealth = function(self, event, unit, bar, min, max) -- this func replaces standart health update func |
|
74 | Wildbreath-135052 | local r, g, b = 1, 1, 1 |
|
75 | Wildbreath-135052 | ||
76 | Wildbreath-135052 | if(max~=0) then |
|
77 | Wildbreath-135052 | r, g, b = ColorGradient(min/max, 1, 0, 0, 1, 1, 0, 0, 1, 0) -- we color percent hp by color gradient from green to red |
|
78 | Wildbreath-135052 | end |
|
79 | Wildbreath-135052 | ||
80 | Wildbreath-135052 | if(not UnitIsConnected(unit)) then |
|
81 | Wildbreath-135052 | bar:SetValue(0) |
|
82 | Wildbreath-135052 | bar.value:SetText("Off") |
|
83 | Wildbreath-135052 | elseif(UnitIsDead(unit)) then |
|
84 | Wildbreath-135052 | bar:SetValue(0) |
|
85 | Wildbreath-135052 | bar.value:SetText("Dead") |
|
86 | Wildbreath-135052 | elseif(UnitIsGhost(unit)) then |
|
87 | Wildbreath-135052 | bar:SetValue(0) |
|
88 | Wildbreath-135052 | bar.value:SetText("Ghost") |
|
89 | Wildbreath-135052 | else |
|
90 | Wildbreath-135052 | if(unit=="player") then |
|
91 | Wildbreath-135052 | bar.value:SetFormattedText("|cff%02x%02x%02x%s|r %s", r*255, g*255, b*255, siValue(min), siValue(max)) -- text for player: "curhp percenthp" |
|
92 | Wildbreath-135052 | elseif(unit=="pet") then |
|
93 | Wildbreath-135052 | bar.value:SetFormattedText("%s", siValue(min)) -- text for pet: "shortcurhp" |
|
94 | Wildbreath-135052 | elseif(unit=="target") then |
|
95 | Wildbreath-135052 | bar.value:SetFormattedText("%s |cff%02x%02x%02x%.1f|r", siValue(min), r*255, g*255, b*255, (min/max)*100) -- text for target: "shortcurhp percenthp" |
|
96 | Wildbreath-135052 | else |
|
97 | Wildbreath-135052 | bar.value:SetText() -- no hp text for others. Feel free to add other units. Info about SetFormattedText can be found on wowwiki.com |
|
98 | Wildbreath-135052 | end |
|
99 | Wildbreath-135052 | end |
|
100 | Wildbreath-135052 | ||
101 | Wildbreath-135052 | if(settings.ClassColor==true) then -- determine what color to use |
|
102 | Wildbreath-135052 | if(UnitIsPlayer(unit)) then |
|
103 | Wildbreath-135052 | local _, englass = UnitClass(unit) |
|
104 | Wildbreath-135052 | if(self.colors.class[englass]) then |
|
105 | Wildbreath-135052 | r, g, b = unpack(self.colors.class[englass]) |
|
106 | Wildbreath-135052 | end |
|
107 | Wildbreath-135052 | else |
|
108 | Wildbreath-135052 | r, g, b = UnitSelectionColor(unit) |
|
109 | Wildbreath-135052 | end |
|
110 | Wildbreath-135052 | else |
|
111 | Wildbreath-135052 | r, g, b = unpack(OwnColor) |
|
112 | Wildbreath-135052 | end |
|
113 | Wildbreath-135052 | ||
114 | Wildbreath-135052 | if(UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit)) then -- grey color for tapped mobs |
|
115 | Wildbreath-135052 | r, g, b = .6, .6, .6 |
|
116 | Wildbreath-135052 | end |
|
117 | Wildbreath-135052 | ||
118 | Wildbreath-135052 | if(unit=="pet" and GetPetHappiness()) then -- petframe is colored by happiness |
|
119 | Wildbreath-135052 | r, g, b = unpack(self.colors.happiness[GetPetHappiness()]) |
|
120 | Wildbreath-135052 | end |
|
121 | Wildbreath-135052 | ||
122 | Wildbreath-135052 | bar:SetStatusBarColor(r, g, b) -- hp bar coloring |
|
123 | Wildbreath-135052 | bar.bg:SetVertexColor(r, g, b, .2) -- hp background - same color but 20% opacity |
|
124 | Wildbreath-135052 | if(self.Castbar) then -- same with castbar |
|
125 | Wildbreath-135052 | self.Castbar:SetStatusBarColor(r, g, b) |
|
126 | Wildbreath-135052 | self.Castbar.bg:SetVertexColor(r, g, b, .2) |
|
127 | Wildbreath-135052 | end |
|
128 | Wildbreath-135052 | ||
129 | Wildbreath-135052 | if settings.Portraits then |
|
130 | Wildbreath-135052 | self.Portrait:SetAlpha(.1) |
|
131 | Wildbreath-135052 | end |
|
132 | Wildbreath-135052 | end |
|
133 | Wildbreath-135052 | ||
134 | Wildbreath-135052 | local PostUpdatePower = function(self, event, unit, bar, min, max) |
|
135 | Wildbreath-135052 | if(not UnitIsConnected(unit) or min==0) then -- no unit - no mana! |
|
136 | Wildbreath-135052 | bar.value:SetText() |
|
137 | Wildbreath-135052 | elseif(UnitIsDead(unit) or UnitIsGhost(unit)) then -- dead unit - no mana! |
|
138 | Wildbreath-135052 | bar:SetValue(0) |
|
139 | Wildbreath-135052 | bar.value:SetText() |
|
140 | Wildbreath-135052 | elseif(unit=="player" or unit=="target" or unit=="pet") then |
|
141 | Wildbreath-135052 | bar.value:SetFormattedText("%s", siValue(min)) -- text for player, pet, target: "shortcurrentmana" |
|
142 | Wildbreath-135052 | else |
|
143 | Wildbreath-135052 | bar.value:SetText() -- no text for other units |
|
144 | Wildbreath-135052 | end |
|
145 | Wildbreath-135052 | ||
146 | Wildbreath-135052 | local r, g, b = 1, 1, 1 -- manabar coloring |
|
147 | Wildbreath-135052 | if(settings.PowerColorByType==true) then |
|
148 | Wildbreath-135052 | local _, ptype = UnitPowerType(unit) |
|
149 | Wildbreath-135052 | if(settings.powercolors[ptype]) then |
|
150 | Wildbreath-135052 | r, g, b = unpack(settings.powercolors[ptype]) |
|
151 | Wildbreath-135052 | end |
|
152 | Wildbreath-135052 | else |
|
153 | Wildbreath-135052 | r, g, b = unpack(settings.OwnPowerColor) |
|
154 | Wildbreath-135052 | end |
|
155 | Wildbreath-135052 | ||
156 | Wildbreath-135052 | bar:SetStatusBarColor(r, g, b) |
|
157 | Wildbreath-135052 | bar.value:SetTextColor(r, g, b) -- power text colored with same color as power bar |
|
158 | Wildbreath-135052 | bar.bg:SetVertexColor(r, g, b, .2) |
|
159 | Wildbreath-135052 | end |
|
160 | Wildbreath-135052 | ||
161 | Wildbreath-135052 | --[[ Druid power update. Credits to p3lim for code and idea ]] |
|
162 | Wildbreath-135052 | oUF.TagEvents["[druidpower]"] = "UNIT_MANA UPDATE_SHAPESHIFT_FORM" |
|
163 | Wildbreath-135052 | oUF.Tags["[druidpower]"] = function(unit) -- druid power text: "shortcurrentmana percentmana" |
|
164 | Wildbreath-135052 | local min, max = UnitPower(unit, 0), UnitPowerMax(unit, 0) |
|
165 | Wildbreath-135052 | local r, g, b = 0, 0, 1 |
|
166 | Wildbreath-135052 | if(max~=0) then |
|
167 | Wildbreath-135052 | r, g, b = ColorGradient(min/max, 1, 0, 0, 1, 1, 0, 0, 1, 0) -- gradient for percent mp |
|
168 | Wildbreath-135052 | end |
|
169 | Wildbreath-135052 | return UnitPowerType(unit)~=0 and format("|cff0090ff%d |cff%02x%02x%02x%.1f|r", min, r*255, g*255, b*255, (min/max)*100) |
|
170 | Wildbreath-135052 | end |
|
171 | Wildbreath-135052 | ||
172 | Wildbreath-135052 | --[[ Castbar time styling ]] |
|
173 | Wildbreath-135052 | local CustomTimeText = function(self, duration) |
|
174 | Wildbreath-135052 | self.Time:SetFormattedText("%.1f", duration) -- text for casts: "elapsed / casttime" |
|
175 | Wildbreath-135052 | --self.Time:SetFormattedText("%.1f / %.1f", duration, self.max) -- text for casts: "elapsed / casttime" |
|
176 | Wildbreath-135052 | end |
|
177 | Wildbreath-135052 | ||
178 | Wildbreath-135052 | --[[ Disabling default buff frames ]] |
|
179 | Wildbreath-135052 | local _G = getfenv(0) -- speed up getting globals |
|
180 | Wildbreath-135052 | --[[local buff = _G["BuffFrame"] |
|
181 | Wildbreath-135052 | buff:Hide() |
|
182 | Wildbreath-135052 | buff:UnregisterAllEvents() |
|
183 | Wildbreath-135052 | buff:SetScript("OnUpdate", nil)]] |
|
184 | Wildbreath-135052 | ||
185 | Wildbreath-135052 | --[[ Aura settings ]] |
|
186 | Wildbreath-135052 | local noHide = function(self) -- we don't want aura border to hide on buffs |
|
187 | Wildbreath-135052 | self:SetVertexColor(0, 0, 0) |
|
188 | Wildbreath-135052 | end |
|
189 | Wildbreath-135052 | ||
190 | Wildbreath-135052 | local CancelBuff = function(self, button) -- cancel buffs on right click |
|
191 | Wildbreath-135052 | if(button=="RightButton") then |
|
192 | Wildbreath-135052 | CancelUnitBuff("player", self:GetID()) |
|
193 | Wildbreath-135052 | end |
|
194 | Wildbreath-135052 | end |
|
195 | Wildbreath-135052 | ||
196 | Wildbreath-135052 | local PostCreateAuraIcon = function(self, button, icons, index, isDebuff) |
|
197 | Wildbreath-135052 | button.cd:SetReverse() |
|
198 | Wildbreath-135052 | ||
199 | Wildbreath-135052 | button.count:ClearAllPoints() |
|
200 | Wildbreath-135052 | button.count:SetPoint("TOPLEFT") -- Stacks text will be on top of icon |
|
201 | Wildbreath-135052 | button.count:SetFont(settings.font, settings.fsize, "THINOUTLINE") |
|
202 | Wildbreath-135052 | button.count:SetTextColor(.8, .8, .8) -- Color for stacks text |
|
203 | Wildbreath-135052 | ||
204 | Wildbreath-135052 | button.icon:SetTexCoord(0, 1, 0, 1) |
|
205 | Wildbreath-135052 | ||
206 | Wildbreath-135052 | button.overlay:SetTexture(settings.buffTex) |
|
207 | Wildbreath-135052 | button.overlay:SetTexCoord(0, 1, 0, 1) |
|
208 | Wildbreath-135052 | button.overlay.Hide = noHide |
|
209 | Wildbreath-135052 | ||
210 | Wildbreath-135052 | if(not isDebuff and self.unit=="player") then -- Cancel buffs on right click |
|
211 | Wildbreath-135052 | button:SetScript("OnMouseUp", CancelBuff) |
|
212 | Wildbreath-135052 | end |
|
213 | Wildbreath-135052 | end |
|
214 | Wildbreath-135052 | ||
215 | Wildbreath-135052 | local MyUnits = { -- true to show cooldown for debuffs from that units, false to hide |
|
216 | Wildbreath-135052 | player = true, |
|
217 | Wildbreath-135052 | pet = true, |
|
218 | Wildbreath-135052 | vehicle = true |
|
219 | Wildbreath-135052 | } |
|
220 | Wildbreath-135052 | ||
221 | Wildbreath-135052 | local PostUpdateAuraIcon = function(self, icons, unit, icon, index, offset, filter, isDebuff) |
|
222 | Wildbreath-135052 | if(icon.cd:IsShown() and self.unit=="target" and isDebuff and not MyUnits[icon.owner]) then |
|
223 | Wildbreath-135052 | icon.cd:Hide() |
|
224 | Wildbreath-135052 | end |
|
225 | Wildbreath-135052 | end |
|
226 | Wildbreath-135052 | ||
227 | Wildbreath-135052 | local _, class = UnitClass("player") |
|
228 | Wildbreath-135052 | ||
229 | Wildbreath-135052 | --[[ Let's start! ]] |
|
230 | Wildbreath-135052 | local func = function(self, unit) |
|
231 | Wildbreath-135052 | self.menu = menu |
|
232 | Wildbreath-135052 | self:SetScript("OnEnter", OnEnter) |
|
233 | Wildbreath-135052 | self:SetScript("OnLeave", OnLeave) |
|
234 | Wildbreath-135052 | self:RegisterForClicks("anyup") |
|
235 | Wildbreath-135052 | self:SetAttribute("*type2", "menu") |
|
236 | Wildbreath-135052 | self.disallowVehicleSwap = true |
|
237 | Wildbreath-135052 | ||
238 | Wildbreath-135052 | local s = settings.Frames[unit] -- Getting settings for every unit |
|
239 | Wildbreath-135052 | ||
240 | Wildbreath-135052 | --[[ Frame sizes ]] |
|
241 | Wildbreath-135052 | self:SetAttribute("initial-width", s.Width) |
|
242 | Wildbreath-135052 | self:SetAttribute("initial-height", s.Height) |
|
243 | Wildbreath-135052 | ||
244 | Wildbreath-135052 | self.FrameBackdrop = CreateFrame("Frame", nil, self) |
|
245 | Wildbreath-135052 | self.FrameBackdrop:SetPoint("TOPLEFT", self, "TOPLEFT", -4 , 4) |
|
246 | Wildbreath-135052 | self.FrameBackdrop:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 4 , -4) |
|
247 | Wildbreath-135052 | self.FrameBackdrop:SetFrameStrata("BACKGROUND") |
|
248 | Wildbreath-135052 | self.FrameBackdrop:SetBackdrop { |
|
249 | Wildbreath-135052 | edgeFile = glowTex, edgeSize = 4, |
|
250 | Wildbreath-135052 | tile = true, tileSize = 16, |
|
251 | Wildbreath-135052 | insets = {left = 6, right = 6, top = 6, bottom = 6} |
|
252 | Wildbreath-135052 | } |
|
253 | Wildbreath-135052 | self.FrameBackdrop:SetBackdropColor(0, 0, 0, 0) |
|
254 | Wildbreath-135052 | self.FrameBackdrop:SetBackdropBorderColor(0, 0, 0) |
|
255 | Wildbreath-135052 | ||
256 | Wildbreath-135052 | --[[ Healthbar ]] |
|
257 | Wildbreath-135052 | local hp = CreateFrame("StatusBar", nil, self) |
|
258 | Wildbreath-135052 | hp:SetStatusBarTexture(settings.texture) |
|
259 | Wildbreath-135052 | hp.frequentUpdates = true |
|
260 | Wildbreath-135052 | hp:SetPoint("TOPRIGHT") |
|
261 | Wildbreath-135052 | hp:SetPoint("TOPLEFT") |
|
262 | Wildbreath-135052 | hp:SetHeight(s.ManaBarHeight==0 and s.Height or (s.Height - s.ManaBarHeight - 1)) |
|
263 | Wildbreath-135052 | ||
264 | Wildbreath-135052 | local hpbg = hp:CreateTexture(nil, "BACKGROUND") |
|
265 | Wildbreath-135052 | hpbg:SetTexture(settings.texture) |
|
266 | Wildbreath-135052 | hpbg:SetAllPoints(hp) |
|
267 | Wildbreath-135052 | ||
268 | Wildbreath-135052 | local hpp = createFs(hp) |
|
269 | Wildbreath-135052 | hpp:SetPoint("RIGHT", hp, "RIGHT", -5, 0) -- health text for player - on right side |
|
270 | Wildbreath-135052 | ||
271 | Wildbreath-135052 | hp.bg = hpbg |
|
272 | Wildbreath-135052 | hp.value = hpp |
|
273 | Wildbreath-135052 | self.Health = hp |
|
274 | Wildbreath-135052 | self.OverrideUpdateHealth = OverrideUpdateHealth |
|
275 | Wildbreath-135052 | ||
276 | Wildbreath-135052 | --[[ Manabar ]] |
|
277 | Wildbreath-135052 | local pp = CreateFrame("StatusBar", nil, self) |
|
278 | Wildbreath-135052 | pp:SetStatusBarTexture(settings.texture) |
|
279 | Wildbreath-135052 | pp.frequentUpdates = true |
|
280 | Wildbreath-135052 | pp:SetPoint("BOTTOMLEFT") |
|
281 | Wildbreath-135052 | pp:SetPoint("BOTTOMRIGHT") |
|
282 | Wildbreath-135052 | pp:SetHeight(s.ManaBarHeight) |
|
283 | Wildbreath-135052 | ||
284 | Wildbreath-135052 | local ppbg = pp:CreateTexture(nil, "BACKGROUND") |
|
285 | Wildbreath-135052 | ppbg:SetTexture(settings.texture) |
|
286 | Wildbreath-135052 | ppbg:SetAllPoints(pp) |
|
287 | Wildbreath-135052 | ||
288 | Wildbreath-135052 | local ppp = createFs(pp) |
|
289 | Wildbreath-135052 | ppp:SetPoint("RIGHT", pp, "RIGHT", -2, 0) |
|
290 | Wildbreath-135052 | ||
291 | Wildbreath-135052 | pp.bg = ppbg |
|
292 | Wildbreath-135052 | pp.value = ppp |
|
293 | Wildbreath-135052 | self.Power = pp |
|
294 | Wildbreath-135052 | self.PostUpdatePower = PostUpdatePower |
|
295 | Wildbreath-135052 | self.PostUpdateAuraIcon = PostUpdateAuraIcon |
|
296 | Wildbreath-135052 | ||
297 | Wildbreath-135052 | --[[ Info text ]] |
|
298 | Wildbreath-135052 | local info = createFs(self) |
|
299 | Wildbreath-135052 | if(unit=="player") then |
|
300 | Wildbreath-135052 | info:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 3) |
|
301 | Wildbreath-135052 | self:Tag(info, "[name]") -- look into \Interface\AddOns\oUF\elements\tags.lua for more tags |
|
302 | Wildbreath-135052 | elseif(unit=="target") then |
|
303 | Wildbreath-135052 | info:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 3) |
|
304 | Wildbreath-135052 | self:Tag(info, "[difficulty][smartlevel]|r [name]") -- look into \Interface\AddOns\oUF\elements\tags.lua for more tags |
|
305 | Wildbreath-135052 | elseif(unit=="targettarget" or unit=="focus" or unit=="focustarget") then |
|
306 | Wildbreath-135052 | info:SetPoint("BOTTOM", self, "TOP", 0, 3) |
|
307 | Wildbreath-135052 | self:Tag(info, "[name]") |
|
308 | Wildbreath-135052 | elseif(not unit) then |
|
309 | Wildbreath-135052 | info:SetParent(self.Health) |
|
310 | Wildbreath-135052 | info:SetJustifyH("CENTER") |
|
311 | Wildbreath-135052 | self:Tag(info, "[name]") |
|
312 | Wildbreath-135052 | end |
|
313 | Wildbreath-135052 | ||
314 | Wildbreath-135052 | --[[ Global bg, 2 px border ]] |
|
315 | Wildbreath-135052 | local allbg = self:CreateTexture(nil, "BORDER") |
|
316 | Wildbreath-135052 | allbg:SetPoint("BOTTOMRIGHT", 1, -1) |
|
317 | Wildbreath-135052 | allbg:SetPoint("TOPLEFT", -1, 1) |
|
318 | Wildbreath-135052 | allbg:SetTexture(0, 0, 0) -- we want it black |
|
319 | Wildbreath-135052 | ||
320 | Wildbreath-135052 | --[[ Castbar ]] |
|
321 | Wildbreath-135052 | if(unit=="player" or unit=="target" or unit=="pet" or unit=="focus") then |
|
322 | Wildbreath-135052 | local _, class = UnitClass(unit) |
|
323 | Wildbreath-135052 | local space = 0 |
|
324 | Wildbreath-135052 | if class == "DEATHKNIGHT" or class=="SHAMAN" then |
|
325 | Wildbreath-135052 | space = 12 |
|
326 | Wildbreath-135052 | end |
|
327 | Wildbreath-135052 | ||
328 | Wildbreath-135052 | local cb = CreateFrame("StatusBar", nil, self) |
|
329 | Wildbreath-135052 | cb:SetStatusBarTexture(settings.texture) |
|
330 | Wildbreath-135052 | cb:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", 0, -30-space) |
|
331 | Wildbreath-135052 | cb:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, -30-space) |
|
332 | Wildbreath-135052 | cb:SetHeight(s.ManaBarHeight==0 and s.Height or (s.Height / 2)) -- Castbar will be as big as healthbar |
|
333 | Wildbreath-135052 | ||
334 | Wildbreath-135052 | local cbblackbg = cb:CreateTexture(nil, "BACKGROUND") -- that's the black thingie like global background |
|
335 | Wildbreath-135052 | cbblackbg:SetPoint("TOPLEFT", -1, 1) |
|
336 | Wildbreath-135052 | cbblackbg:SetPoint("BOTTOMRIGHT", 1, -1) |
|
337 | Wildbreath-135052 | cbblackbg:SetTexture(0, 0, 0) |
|
338 | Wildbreath-135052 | ||
339 | Wildbreath-135052 | local cbbg = cb:CreateTexture(nil, "BORDER") |
|
340 | Wildbreath-135052 | cbbg:SetTexture(settings.texture) |
|
341 | Wildbreath-135052 | cbbg:SetAllPoints(cb) |
|
342 | Wildbreath-135052 | ||
343 | Wildbreath-135052 | local time = createFs(cb, "RIGHT", 12) |
|
344 | Wildbreath-135052 | time:SetPoint("RIGHT", cb, "RIGHT", -4, 0) |
|
345 | Wildbreath-135052 | ||
346 | Wildbreath-135052 | local text = createFs(cb, "LEFT", 12) |
|
347 | Wildbreath-135052 | text:SetPoint("LEFT", cb, "LEFT", cb:GetHeight() + 4, 0) |
|
348 | Wildbreath-135052 | text:SetPoint("RIGHT", time, "LEFT") |
|
349 | Wildbreath-135052 | ||
350 | Wildbreath-135052 | local spark = cb:CreateTexture(nil, "OVERLAY") |
|
351 | Wildbreath-135052 | spark:SetVertexColor(1, 1, 1) |
|
352 | Wildbreath-135052 | spark:SetBlendMode("ADD") |
|
353 | Wildbreath-135052 | spark:SetHeight(cb:GetHeight()*2.5) |
|
354 | Wildbreath-135052 | spark:SetWidth(20) |
|
355 | Wildbreath-135052 | ||
356 | Wildbreath-135052 | cbicon = cb:CreateTexture(nil, "OVERLAY") |
|
357 | Wildbreath-135052 | cbicon:SetTexCoord(.1,.9,.1,.9) |
|
358 | Wildbreath-135052 | cbicon:SetWidth(cb:GetHeight()) |
|
359 | Wildbreath-135052 | cbicon:SetHeight(cb:GetHeight()) |
|
360 | Wildbreath-135052 | cbicon:SetPoint("LEFT") |
|
361 | Wildbreath-135052 | ||
362 | Wildbreath-135052 | cb.bg = cbbg |
|
363 | Wildbreath-135052 | cb.Time = time |
|
364 | Wildbreath-135052 | cb.Text = text |
|
365 | Wildbreath-135052 | cb.Spark = spark |
|
366 | Wildbreath-135052 | cb.CustomTimeText = CustomTimeText |
|
367 | Wildbreath-135052 | cb.Icon = cbicon |
|
368 | Wildbreath-135052 | self.Castbar = cb |
|
369 | Wildbreath-135052 | end |
|
370 | Wildbreath-135052 | ||
371 | Wildbreath-135052 | ||
372 | Wildbreath-135052 | if unit=="player" then |
|
373 | Wildbreath-135052 | local _, class = UnitClass(unit) |
|
374 | Wildbreath-135052 | ||
375 | Wildbreath-135052 | if class == "DEATHKNIGHT" then |
|
376 | Wildbreath-135052 | self.Runes = CreateFrame('Frame', nil, self) |
|
377 | Wildbreath-135052 | self.Runes:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -1) |
|
378 | Wildbreath-135052 | self.Runes:SetHeight(10) |
|
379 | Wildbreath-135052 | self.Runes:SetWidth(s.Width) |
|
380 | Wildbreath-135052 | self.Runes.anchor = "TOPLEFT" |
|
381 | Wildbreath-135052 | self.Runes.growth = "RIGHT" |
|
382 | Wildbreath-135052 | self.Runes.height = 10 |
|
383 | Wildbreath-135052 | self.Runes.width = s.Width / 6 - 0.85 |
|
384 | Wildbreath-135052 | self.Runes.spacing = 1 |
|
385 | Wildbreath-135052 | ||
386 | Wildbreath-135052 | ||
387 | Wildbreath-135052 | for i = 1, 6 do |
|
388 | Wildbreath-135052 | self.Runes[i] = CreateFrame("StatusBar", "oUFRune"..i, self.Runes) |
|
389 | Wildbreath-135052 | self.Runes[i]:SetStatusBarTexture(settings.texture) |
|
390 | Wildbreath-135052 | self.Runes[i]:SetStatusBarColor(unpack(settings.runecolors[i])) |
|
391 | Wildbreath-135052 | self.Runes[i].bg = self.Runes[i]:CreateTexture(nil, "BACKGROUND") -- that's the black thingie like global background |
|
392 | Wildbreath-135052 | self.Runes[i].bg:SetPoint("TOPLEFT", -1, 1) |
|
393 | Wildbreath-135052 | self.Runes[i].bg:SetPoint("BOTTOMRIGHT", 1, -1) |
|
394 | Wildbreath-135052 | self.Runes[i].bg:SetTexture(0, 0, 0) |
|
395 | Wildbreath-135052 | end |
|
396 | Wildbreath-135052 | end |
|
397 | Wildbreath-135052 | end |
|
398 | Wildbreath-135052 | ||
399 | Wildbreath-135052 | if settings.Portraits then |
|
400 | Wildbreath-135052 | self.Portrait = CreateFrame("PlayerModel", nil, self) |
|
401 | Wildbreath-135052 | self.Portrait:SetAllPoints(self.Health) |
|
402 | Wildbreath-135052 | self.Portrait:SetAlpha(.1) |
|
403 | Wildbreath-135052 | end |
|
404 | Wildbreath-135052 | ||
405 | Wildbreath-135052 | ||
406 | Wildbreath-135052 | if(unit=="player") then |
|
407 | Wildbreath-135052 | ||
408 | Wildbreath-135052 | -- [[ Temporary enchants icons ]] -- |
|
409 | Wildbreath-135052 | local ench = {} |
|
410 | Wildbreath-135052 | ||
411 | Wildbreath-135052 | for i = 1,2 do |
|
412 | Wildbreath-135052 | ench[i] = _G["TempEnchant"..i] |
|
413 | Wildbreath-135052 | _G["TempEnchant"..i.."Border"]:Hide() |
|
414 | Wildbreath-135052 | ||
415 | Wildbreath-135052 | ench[i]:ClearAllPoints() |
|
416 | Wildbreath-135052 | ||
417 | Wildbreath-135052 | if (i==1) then |
|
418 | Wildbreath-135052 | ench[i]:SetPoint("TOPRIGHT", self, "TOPLEFT", -3, 1) |
|
419 | Wildbreath-135052 | else |
|
420 | Wildbreath-135052 | ench[i]:SetPoint("RIGHT", ench[i-1], "LEFT", -2, 0) |
|
421 | Wildbreath-135052 | end |
|
422 | Wildbreath-135052 | ||
423 | Wildbreath-135052 | ench[i]:SetWidth(32) |
|
424 | Wildbreath-135052 | ench[i]:SetHeight(32) |
|
425 | Wildbreath-135052 | ench[i]:Show() |
|
426 | Wildbreath-135052 | ||
427 | Wildbreath-135052 | ench[i].t = ench[i]:CreateTexture(nil,"BORDER") |
|
428 | Wildbreath-135052 | ench[i].t:SetTexture(settings.buffTex) |
|
429 | Wildbreath-135052 | ench[i].t:SetVertexColor(0.7, 0, 0.7) |
|
430 | Wildbreath-135052 | ench[i].t:SetAllPoints(ench[i]) |
|
431 | Wildbreath-135052 | ||
432 | Wildbreath-135052 | ench[i].dur = _G["TempEnchant"..i.."Duration"] |
|
433 | Wildbreath-135052 | ench[i].dur:ClearAllPoints() |
|
434 | Wildbreath-135052 | ench[i].dur:SetAllPoints(ench[i]) |
|
435 | Wildbreath-135052 | ench[i].dur:SetFont(settings.font, 11, "THINOUTLINE") |
|
436 | Wildbreath-135052 | ench[i].dur:SetVertexColor(1, 1, 1) |
|
437 | Wildbreath-135052 | ench[i].dur.SetVertexColor = function() end |
|
438 | Wildbreath-135052 | end |
|
439 | Wildbreath-135052 | ||
440 | Wildbreath-135052 | -- Hide old buffs |
|
441 | Wildbreath-135052 | _G["BuffFrame"]:Hide() |
|
442 | Wildbreath-135052 | _G["BuffFrame"]:UnregisterAllEvents() |
|
443 | Wildbreath-135052 | _G["BuffFrame"]:SetScript("OnUpdate", nil) |
|
444 | Wildbreath-135052 | ||
445 | Wildbreath-135052 | local buffs = CreateFrame("Frame", nill, self) |
|
446 | Wildbreath-135052 | buffs:SetPoint("TOPRIGHT", Minimap, "TOPLEFT", -25, 0) |
|
447 | Wildbreath-135052 | buffs.initialAnchor = "TOPRIGHT" |
|
448 | Wildbreath-135052 | buffs["growth-y"] = "DOWN" |
|
449 | Wildbreath-135052 | buffs["growth-x"] = "LEFT" |
|
450 | Wildbreath-135052 | buffs:SetHeight(500) |
|
451 | Wildbreath-135052 | buffs:SetWidth(220) |
|
452 | Wildbreath-135052 | buffs.spacing = 4 |
|
453 | Wildbreath-135052 | buffs.size = 30 |
|
454 | Wildbreath-135052 | self.Buffs = buffs |
|
455 | Wildbreath-135052 | ||
456 | Wildbreath-135052 | local debuffs = CreateFrame("Frame", nill, self) |
|
457 | Wildbreath-135052 | debuffs:SetPoint("TOPRIGHT", Minimap, "BOTTOMRIGHT", 0, -35) |
|
458 | Wildbreath-135052 | debuffs.initialAnchor = "TOPRIGHT" |
|
459 | Wildbreath-135052 | debuffs["growth-x"] = "LEFT" |
|
460 | Wildbreath-135052 | debuffs["growth-y"] = "DOWN" |
|
461 | Wildbreath-135052 | debuffs:SetHeight(500) |
|
462 | Wildbreath-135052 | debuffs:SetWidth(220) |
|
463 | Wildbreath-135052 | debuffs.spacing = 4 |
|
464 | Wildbreath-135052 | debuffs.size = 45 |
|
465 | Wildbreath-135052 | self.Debuffs = debuffs |
|
466 | Wildbreath-135052 | end |
|
467 | Wildbreath-135052 | ||
468 | Wildbreath-135052 | if(unit=="target") then -- For target we make one frame. Buffs first, then debuffs |
|
469 | Wildbreath-135052 | local auras = CreateFrame("Frame", nill, self) |
|
470 | Wildbreath-135052 | auras:SetPoint("BOTTOMLEFT", self, "TOPLEFT", -2, 20) |
|
471 | Wildbreath-135052 | auras.initialAnchor = "BOTTOMLEFT" |
|
472 | Wildbreath-135052 | auras["growth-x"] = "RIGHT" |
|
473 | Wildbreath-135052 | auras["growth-y"] = "UP" |
|
474 | Wildbreath-135052 | auras.numDebuffs = 16 -- Max amount of debuffs to show |
|
475 | Wildbreath-135052 | auras:SetHeight(373) |
|
476 | Wildbreath-135052 | auras:SetWidth(s.Width) |
|
477 | Wildbreath-135052 | auras.spacing = 1 |
|
478 | Wildbreath-135052 | auras.size = 28 |
|
479 | Wildbreath-135052 | auras.gap = false -- A gap between buffs and debuffs |
|
480 | Wildbreath-135052 | ||
481 | Wildbreath-135052 | self.Auras = auras |
|
482 | Wildbreath-135052 | end |
|
483 | Wildbreath-135052 | ||
484 | Wildbreath-135052 | if(unit=="focus" or unit=="targettarget") then |
|
485 | Wildbreath-135052 | local debuffs = CreateFrame("Frame", nill, self) -- Debuffs for focus |
|
486 | Wildbreath-135052 | debuffs:SetPoint("TOPLEFT", self, "BOTTOMLEFT", -2, -3) |
|
487 | Wildbreath-135052 | debuffs.initialAnchor = "TOPLEFT" |
|
488 | Wildbreath-135052 | debuffs["growth-x"] = "RIGHT" |
|
489 | Wildbreath-135052 | debuffs["growth-y"] = "DOWN" |
|
490 | Wildbreath-135052 | debuffs:SetHeight(20) |
|
491 | Wildbreath-135052 | debuffs:SetWidth(104) |
|
492 | Wildbreath-135052 | debuffs.spacing = 1 |
|
493 | Wildbreath-135052 | debuffs.size = 20 |
|
494 | Wildbreath-135052 | ||
495 | Wildbreath-135052 | self.Debuffs = debuffs |
|
496 | Wildbreath-135052 | end |
|
497 | Wildbreath-135052 | ||
498 | Wildbreath-135052 | ||
499 | Wildbreath-135052 | local sentTime = 0 |
|
500 | Wildbreath-135052 | local lagTime = 0 |
|
501 | Wildbreath-135052 | ||
502 | Wildbreath-135052 | local UNIT_SPELLCAST_SENT = function (self, event, unit, spell, spellrank) |
|
503 | Wildbreath-135052 | if(self.unit~=unit) then return end |
|
504 | Wildbreath-135052 | sentTime = GetTime() |
|
505 | Wildbreath-135052 | end |
|
506 | Wildbreath-135052 | ||
507 | Wildbreath-135052 | local PostCastStart = function(self, event, unit, name, rank, text, castid) |
|
508 | Wildbreath-135052 | lagTime = GetTime() - sentTime |
|
509 | Wildbreath-135052 | end |
|
510 | Wildbreath-135052 | ||
511 | Wildbreath-135052 | local PostChannelStart = function(self, event, unit, name, rank, text) |
|
512 | Wildbreath-135052 | lagTime = GetTime() - sentTime |
|
513 | Wildbreath-135052 | end |
|
514 | Wildbreath-135052 | ||
515 | Wildbreath-135052 | local OnCastbarUpdate = function(self, elapsed) |
|
516 | Wildbreath-135052 | if(self.casting) then |
|
517 | Wildbreath-135052 | local duration = self.duration + elapsed |
|
518 | Wildbreath-135052 | if(duration>=self.max) then |
|
519 | Wildbreath-135052 | self.casting = nil |
|
520 | Wildbreath-135052 | self:Hide() |
|
521 | Wildbreath-135052 | return |
|
522 | Wildbreath-135052 | end |
|
523 | Wildbreath-135052 | ||
524 | Wildbreath-135052 | local width = self:GetWidth() |
|
525 | Wildbreath-135052 | local safeZonePercent = lagTime / self.max |
|
526 | Wildbreath-135052 | if(safeZonePercent>1) then safeZonePercent=1 end |
|
527 | Wildbreath-135052 | self.SafeZone:SetWidth(width * safeZonePercent) |
|
528 | Wildbreath-135052 | ||
529 | Wildbreath-135052 | if(self.delay~=0) then |
|
530 | Wildbreath-135052 | self.Time:SetFormattedText("%.1f|cffff0000-%.1f|r", duration, self.delay) |
|
531 | Wildbreath-135052 | else |
|
532 | Wildbreath-135052 | self.Time:SetFormattedText("%.1f / %.1f", duration, self.max) |
|
533 | Wildbreath-135052 | self.Lag:SetFormattedText("%d ms", lagTime * 1000) |
|
534 | Wildbreath-135052 | end |
|
535 | Wildbreath-135052 | ||
536 | Wildbreath-135052 | self.duration = duration |
|
537 | Wildbreath-135052 | self:SetValue(duration) |
|
538 | Wildbreath-135052 | ||
539 | Wildbreath-135052 | self.Spark:SetPoint("CENTER", self, "LEFT", (duration / self.max) * self:GetWidth(), 0) |
|
540 | Wildbreath-135052 | ||
541 | Wildbreath-135052 | elseif(self.channeling) then |
|
542 | Wildbreath-135052 | local duration = self.duration - elapsed |
|
543 | Wildbreath-135052 | ||
544 | Wildbreath-135052 | if(duration<=0) then |
|
545 | Wildbreath-135052 | self.channeling = nil |
|
546 | Wildbreath-135052 | self:Hide() |
|
547 | Wildbreath-135052 | return |
|
548 | Wildbreath-135052 | end |
|
549 | Wildbreath-135052 | ||
550 | Wildbreath-135052 | if(lagTime > 1e5) then |
|
551 | Wildbreath-135052 | lagTime = 0 |
|
552 | Wildbreath-135052 | self.SafeZone:SetWidth(0) |
|
553 | Wildbreath-135052 | else |
|
554 | Wildbreath-135052 | local width = self:GetWidth() |
|
555 | Wildbreath-135052 | local safeZonePercent = lagTime / self.max |
|
556 | Wildbreath-135052 | if(safeZonePercent > 1 or safeZonePercent<=0) then safeZonePercent = 1 end |
|
557 | Wildbreath-135052 | self.SafeZone:SetWidth(width * safeZonePercent) |
|
558 | Wildbreath-135052 | end |
|
559 | Wildbreath-135052 | ||
560 | Wildbreath-135052 | if(self.delay~=0) then |
|
561 | Wildbreath-135052 | self.Time:SetFormattedText("%.1f|cffff0000-%.1f|r", duration, self.delay) |
|
562 | Wildbreath-135052 | else |
|
563 | Wildbreath-135052 | self.Time:SetFormattedText("%.1f / %.1f", duration, self.max) |
|
564 | Wildbreath-135052 | self.Lag:SetFormattedText( "%d ms ", lagTime * 1000 ) |
|
565 | Wildbreath-135052 | end |
|
566 | Wildbreath-135052 | ||
567 | Wildbreath-135052 | self.duration = duration |
|
568 | Wildbreath-135052 | self:SetValue(duration) |
|
569 | Wildbreath-135052 | ||
570 | Wildbreath-135052 | self.Spark:SetPoint("CENTER", self, "LEFT", (duration / self.max) * self:GetWidth(), 0) |
|
571 | Wildbreath-135052 | else |
|
572 | Wildbreath-135052 | self.unitName = nil |
|
573 | Wildbreath-135052 | self.channeling = nil |
|
574 | Wildbreath-135052 | self:SetValue(1) |
|
575 | Wildbreath-135052 | self:Hide() |
|
576 | Wildbreath-135052 | end |
|
577 | Wildbreath-135052 | end |
|
578 | Wildbreath-135052 | ||
579 | Wildbreath-135052 | if(unit=="player") then |
|
580 | Wildbreath-135052 | local sz = self.Castbar:CreateTexture(nil, "ARTWORK") |
|
581 | Wildbreath-135052 | sz:SetTexture(settings.texture) |
|
582 | Wildbreath-135052 | sz:SetVertexColor(1, 0.3, 0.3) |
|
583 | Wildbreath-135052 | sz:SetPoint("BOTTOMRIGHT") |
|
584 | Wildbreath-135052 | sz:SetPoint("TOPRIGHT") |
|
585 | Wildbreath-135052 | self.Castbar.SafeZone = sz |
|
586 | Wildbreath-135052 | ||
587 | Wildbreath-135052 | local lag = createFs(self.Castbar) |
|
588 | Wildbreath-135052 | lag:SetFont(settings.font, 10, "THINOUTLINE") |
|
589 | Wildbreath-135052 | lag:SetPoint("LEFT", self.Castbar, "RIGHT", -2, 0) |
|
590 | Wildbreath-135052 | lag:SetJustifyH("RIGHT") |
|
591 | Wildbreath-135052 | self.Castbar.Lag = lag |
|
592 | Wildbreath-135052 | ||
593 | Wildbreath-135052 | self.PostCastStart = PostCastStart |
|
594 | Wildbreath-135052 | self.OnCastbarUpdate = OnCastbarUpdate |
|
595 | Wildbreath-135052 | self.PostChannelStart = PostChannelStart |
|
596 | Wildbreath-135052 | self:RegisterEvent("UNIT_SPELLCAST_SENT", UNIT_SPELLCAST_SENT) |
|
597 | Wildbreath-135052 | end |
|
598 | Wildbreath-135052 | ||
599 | Wildbreath-135052 | self.PostCreateAuraIcon = PostCreateAuraIcon |
|
600 | Wildbreath-135052 | ||
601 | Wildbreath-135052 | --[[ Druid mana ]] |
|
602 | Wildbreath-135052 | if(unit=="player" and class=="DRUID") then |
|
603 | Wildbreath-135052 | local druid = createFs(self) |
|
604 | Wildbreath-135052 | druid:SetPoint("BOTTOMRIGHT", self, "TOPRIGHT", -2, 3) |
|
605 | Wildbreath-135052 | ||
606 | Wildbreath-135052 | self:Tag(druid, "[druidpower]") |
|
607 | Wildbreath-135052 | self.DruidPower = druid |
|
608 | Wildbreath-135052 | end |
|
609 | Wildbreath-135052 | ||
610 | Wildbreath-135052 | --[[ Raid Target Icon ]] |
|
611 | Wildbreath-135052 | if(unit=="player" or unit=="target") then |
|
612 | Wildbreath-135052 | local ricon = self.Health:CreateTexture(nil, "OVERLAY") |
|
613 | Wildbreath-135052 | ricon:SetHeight(16) |
|
614 | Wildbreath-135052 | ricon:SetWidth(16) |
|
615 | Wildbreath-135052 | ricon:SetPoint("CENTER") |
|
616 | Wildbreath-135052 | ||
617 | Wildbreath-135052 | self.RaidIcon = ricon |
|
618 | Wildbreath-135052 | end |
|
619 | Wildbreath-135052 | ||
620 | Wildbreath-135052 | --[[ Resting icon ]] |
|
621 | Wildbreath-135052 | if(unit=="player") then |
|
622 | Wildbreath-135052 | local rest = self.Health:CreateTexture(nil, "OVERLAY") |
|
623 | Wildbreath-135052 | rest:SetHeight(20) |
|
624 | Wildbreath-135052 | rest:SetWidth(20) |
|
625 | Wildbreath-135052 | rest:SetPoint("LEFT") |
|
626 | Wildbreath-135052 | ||
627 | Wildbreath-135052 | self.Resting = rest |
|
628 | Wildbreath-135052 | end |
|
629 | Wildbreath-135052 | ||
630 | Wildbreath-135052 | --[[ Combat icon ]] |
|
631 | Wildbreath-135052 | if(unit=="player") then |
|
632 | Wildbreath-135052 | local combat = self.Health:CreateTexture(nil, "OVERLAY") |
|
633 | Wildbreath-135052 | combat:SetHeight(18) |
|
634 | Wildbreath-135052 | combat:SetWidth(18) |
|
635 | Wildbreath-135052 | combat:SetPoint("LEFT") |
|
636 | Wildbreath-135052 | ||
637 | Wildbreath-135052 | self.Combat = combat |
|
638 | Wildbreath-135052 | end |
|
639 | Wildbreath-135052 | ||
640 | Wildbreath-135052 | --[[ Leader icon ]] |
|
641 | Wildbreath-135052 | if(not unit) then -- only for party frames |
|
642 | Wildbreath-135052 | local leader = self:CreateTexture(nil, "OVERLAY") |
|
643 | Wildbreath-135052 | leader:SetHeight(16) |
|
644 | Wildbreath-135052 | leader:SetWidth(16) |
|
645 | Wildbreath-135052 | leader:SetPoint("RIGHT", hp, "LEFT", -2, 0) |
|
646 | Wildbreath-135052 | ||
647 | Wildbreath-135052 | self.Leader = leader |
|
648 | Wildbreath-135052 | end |
|
649 | Wildbreath-135052 | ||
650 | Wildbreath-135052 | --[[ Combo Points ]] |
|
651 | Wildbreath-135052 | if(unit=="target") then -- this is for Malygos. Text will be shown on right of target healthbar |
|
652 | Wildbreath-135052 | local UpdateCPoints = function(self, event, unit) |
|
653 | Wildbreath-135052 | if unit == PlayerFrame.unit and unit ~= self.CPoints.unit then |
|
654 | Wildbreath-135052 | self.CPoints.unit = unit |
|
655 | Wildbreath-135052 | end |
|
656 | Wildbreath-135052 | end |
|
657 | Wildbreath-135052 | ||
658 | Wildbreath-135052 | self.cpFrame = self.cpFrame or CreateFrame("Frame", nil, self) |
|
659 | Wildbreath-135052 | self.cpFrame:SetPoint("TOPLEFT",self,"BOTTOMLEFT",0,0) |
|
660 | Wildbreath-135052 | self.cpFrame:SetPoint("BOTTOMRIGHT",self,"BOTTOMRIGHT",0,-12) |
|
661 | Wildbreath-135052 | self.cpFrame:CreateTexture(nil):SetTexture(0,0,0) |
|
662 | Wildbreath-135052 | self.cpFrame:Show() |
|
663 | Wildbreath-135052 | self.CPoints = {} |
|
664 | Wildbreath-135052 | self.CPoints.unit = PlayerFrame.unit |
|
665 | Wildbreath-135052 | for i = 1, 5 do |
|
666 | Wildbreath-135052 | self.CPoints[i] = self.cpFrame:CreateTexture(nil, "OVERLAY") |
|
667 | Wildbreath-135052 | self.CPoints[i]:SetHeight(12) |
|
668 | Wildbreath-135052 | self.CPoints[i]:SetWidth(12) |
|
669 | Wildbreath-135052 | self.CPoints[i]:SetTexture(settings.indicator) |
|
670 | Wildbreath-135052 | if i == 1 then |
|
671 | Wildbreath-135052 | self.CPoints[i]:SetPoint("LEFT") |
|
672 | Wildbreath-135052 | self.CPoints[i]:SetVertexColor(0.69, 0.31, 0.31) |
|
673 | Wildbreath-135052 | else |
|
674 | Wildbreath-135052 | self.CPoints[i]:SetPoint("LEFT", self.CPoints[i-1], "RIGHT", 2, 0) |
|
675 | Wildbreath-135052 | end |
|
676 | Wildbreath-135052 | end |
|
677 | Wildbreath-135052 | self.CPoints[2]:SetVertexColor(0.69, 0.31, 0.31) |
|
678 | Wildbreath-135052 | self.CPoints[3]:SetVertexColor(0.65, 0.63, 0.35) |
|
679 | Wildbreath-135052 | self.CPoints[4]:SetVertexColor(0.65, 0.63, 0.35) |
|
680 | Wildbreath-135052 | self.CPoints[5]:SetVertexColor(0.33, 0.59, 0.33) |
|
681 | Wildbreath-135052 | self:RegisterEvent("UNIT_COMBO_POINTS", UpdateCPoints) |
|
682 | Wildbreath-135052 | end |
|
683 | Wildbreath-135052 | ||
684 | Wildbreath-135052 | --[[ Totems ]]-- |
|
685 | Wildbreath-135052 | local _, pClass = UnitClass("player") |
|
686 | Wildbreath-135052 | ||
687 | Wildbreath-135052 | if unit=="player" and pClass == "SHAMAN" then |
|
688 | Wildbreath-135052 | local GetTotemInfo, SetValue, GetTime = GetTotemInfo, SetValue, GetTime |
|
689 | Wildbreath-135052 | ||
690 | Wildbreath-135052 | local Abbrev = function(name) |
|
691 | Wildbreath-135052 | return (string.len(name) > 10) and string.gsub(name, "%s*(.)%S*%s*", "%1. ") or name |
|
692 | Wildbreath-135052 | end |
|
693 | Wildbreath-135052 | ||
694 | Wildbreath-135052 | self.TotemBar = {} |
|
695 | Wildbreath-135052 | self.TotemBar.colors = { |
|
696 | Wildbreath-135052 | [1] = {0.752,0.172,0.02}, |
|
697 | Wildbreath-135052 | [2] = {0.741,0.580,0.04}, |
|
698 | Wildbreath-135052 | [3] = {0,0.443,0.631}, |
|
699 | Wildbreath-135052 | [4] = {0.6,1,0.945}, |
|
700 | Wildbreath-135052 | } |
|
701 | Wildbreath-135052 | ||
702 | Wildbreath-135052 | local total = 0 |
|
703 | Wildbreath-135052 | local delay = 1 |
|
704 | Wildbreath-135052 | ||
705 | Wildbreath-135052 | self.TotemBarFrame = CreateFrame("frame", "oUF_TotemBarFrame",self) |
|
706 | Wildbreath-135052 | self.TotemBarFrame:SetPoint("TOPLEFT", self, "BOTTOMLEFT", -1, 0) |
|
707 | Wildbreath-135052 | self.TotemBarFrame:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 1, -settings.Frames.player.ManaBarHeight+1) |
|
708 | Wildbreath-135052 | local tfbg = self.TotemBarFrame:CreateTexture(nil, "BACKGROUND") |
|
709 | Wildbreath-135052 | tfbg:SetAllPoints(self.TotemBarFrame) |
|
710 | Wildbreath-135052 | tfbg:SetTexture(settings.texture) |
|
711 | Wildbreath-135052 | tfbg:SetVertexColor(0,0,0) |
|
712 | Wildbreath-135052 | self.TotemBarFrame:Show() |
|
713 | Wildbreath-135052 | ||
714 | Wildbreath-135052 | for i = 1, 4 do |
|
715 | Wildbreath-135052 | self.TotemBar[i] = CreateFrame("StatusBar", self:GetName().."_TotemBar"..i, self) |
|
716 | Wildbreath-135052 | self.TotemBar[i]:SetHeight(settings.Frames.player.ManaBarHeight-3) |
|
717 | Wildbreath-135052 | self.TotemBar[i]:SetWidth(s.Width/4-1) |
|
718 | Wildbreath-135052 | if (i==1) then |
|
719 | Wildbreath-135052 | self.TotemBar[i]:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 0, -1) |
|
720 | Wildbreath-135052 | else |
|
721 | Wildbreath-135052 | self.TotemBar[i]:SetPoint("LEFT", self.TotemBar[i-1], "RIGHT", 1, 0) |
|
722 | Wildbreath-135052 | end |
|
723 | Wildbreath-135052 | self.TotemBar[i]:SetStatusBarTexture(settings.texture) |
|
724 | Wildbreath-135052 | self.TotemBar[i]:SetMinMaxValues(0, 1) |
|
725 | Wildbreath-135052 | ||
726 | Wildbreath-135052 | self.TotemBar[i].bg = self.TotemBar[i]:CreateTexture(nil, "BORDER") |
|
727 | Wildbreath-135052 | self.TotemBar[i].bg:SetAllPoints(self.TotemBar[i]) |
|
728 | Wildbreath-135052 | self.TotemBar[i].bg:SetTexture(settings.texture) |
|
729 | Wildbreath-135052 | self.TotemBar[i].bg:SetVertexColor(.2,.2,.2) |
|
730 | Wildbreath-135052 | ||
731 | Wildbreath-135052 | self.TotemBar[i].fs = createFs(self.TotemBar[i], nil, 8) |
|
732 | Wildbreath-135052 | self.TotemBar[i].fs:SetAllPoints(self.TotemBar[i]) |
|
733 | Wildbreath-135052 | ||
734 | Wildbreath-135052 | self.TotemBar[i]:Hide() |
|
735 | Wildbreath-135052 | end |
|
736 | Wildbreath-135052 | ||
737 | Wildbreath-135052 | local function TotemOnClick(self,...) |
|
738 | Wildbreath-135052 | local id = self.ID |
|
739 | Wildbreath-135052 | local mouse = ... |
|
740 | Wildbreath-135052 | if IsShiftKeyDown() then |
|
741 | Wildbreath-135052 | for j = 1,4 do |
|
742 | Wildbreath-135052 | DestroyTotem(j) |
|
743 | Wildbreath-135052 | end |
|
744 | Wildbreath-135052 | else |
|
745 | Wildbreath-135052 | DestroyTotem(id) |
|
746 | Wildbreath-135052 | end |
|
747 | Wildbreath-135052 | end |
|
748 | Wildbreath-135052 | self.TotemBar.Destroy = true |
|
749 | Wildbreath-135052 | ||
750 | Wildbreath-135052 | local function InitDestroy(self) |
|
751 | Wildbreath-135052 | local totem = self.TotemBar |
|
752 | Wildbreath-135052 | for i = 1 , 4 do |
|
753 | Wildbreath-135052 | local Destroy = CreateFrame("Button",nil, totem[i]) |
|
754 | Wildbreath-135052 | Destroy:SetAllPoints(totem[i]) |
|
755 | Wildbreath-135052 | Destroy:RegisterForClicks("LeftButtonUp", "RightButtonUp") |
|
756 | Wildbreath-135052 | Destroy.ID = i |
|
757 | Wildbreath-135052 | Destroy:SetScript("OnClick", TotemOnClick) |
|
758 | Wildbreath-135052 | end |
|
759 | Wildbreath-135052 | end |
|
760 | Wildbreath-135052 | ||
761 | Wildbreath-135052 | local function UpdateSlot(self, slot) |
|
762 | Wildbreath-135052 | local totem = self.TotemBar |
|
763 | Wildbreath-135052 | self.TotemBar[slot]:Show() |
|
764 | Wildbreath-135052 | if(totem) then |
|
765 | Wildbreath-135052 | if totem.Destroy then |
|
766 | Wildbreath-135052 | InitDestroy(self) |
|
767 | Wildbreath-135052 | end |
|
768 | Wildbreath-135052 | end |
|
769 | Wildbreath-135052 | ||
770 | Wildbreath-135052 | haveTotem, name, startTime, duration, totemIcon = GetTotemInfo(slot) |
|
771 | Wildbreath-135052 | ||
772 | Wildbreath-135052 | totem[slot]:SetStatusBarColor(unpack(totem.colors[slot])) |
|
773 | Wildbreath-135052 | totem[slot]:SetValue(0) |
|
774 | Wildbreath-135052 | ||
775 | Wildbreath-135052 | totem[slot].ID = slot |
|
776 | Wildbreath-135052 | ||
777 | Wildbreath-135052 | -- If we have a totem then set his value |
|
778 | Wildbreath-135052 | if(haveTotem) then |
|
779 | Wildbreath-135052 | if totem[slot].Name then |
|
780 | Wildbreath-135052 | totem[slot].Name:SetText(Abbrev(name)) |
|
781 | Wildbreath-135052 | end |
|
782 | Wildbreath-135052 | if(duration >= 0) then |
|
783 | Wildbreath-135052 | totem[slot]:SetValue(1 - ((GetTime() - startTime) / duration)) |
|
784 | Wildbreath-135052 | -- Status bar update |
|
785 | Wildbreath-135052 | totem[slot]:SetScript("OnUpdate",function(self,elapsed) |
|
786 | Wildbreath-135052 | total = total + elapsed |
|
787 | Wildbreath-135052 | if total >= delay then |
|
788 | Wildbreath-135052 | total = 0 |
|
789 | Wildbreath-135052 | haveTotem, name, startTime, duration, totemIcon = GetTotemInfo(self.ID) |
|
790 | Wildbreath-135052 | if ((GetTime() - startTime) == 0) then |
|
791 | Wildbreath-135052 | self:SetValue(0) |
|
792 | Wildbreath-135052 | self.fs:SetText("") |
|
793 | Wildbreath-135052 | else |
|
794 | Wildbreath-135052 | self:SetValue(1 - ((GetTime() - startTime) / duration)) |
|
795 | Wildbreath-135052 | self.fs:SetText(SecondsToTimeAbbrev(floor(duration - (GetTime() - startTime)))) |
|
796 | Wildbreath-135052 | end |
|
797 | Wildbreath-135052 | end |
|
798 | Wildbreath-135052 | end) |
|
799 | Wildbreath-135052 | else |
|
800 | Wildbreath-135052 | -- There's no need to update because it doesn't have any duration |
|
801 | Wildbreath-135052 | totem[slot]:SetScript("OnUpdate",nil) |
|
802 | Wildbreath-135052 | totem[slot]:SetValue(0) |
|
803 | Wildbreath-135052 | totem[slot]:Hide() |
|
804 | Wildbreath-135052 | end |
|
805 | Wildbreath-135052 | else |
|
806 | Wildbreath-135052 | -- No totem = no time |
|
807 | Wildbreath-135052 | if totem[slot].Name then |
|
808 | Wildbreath-135052 | totem[slot].Name:SetText(" ") |
|
809 | Wildbreath-135052 | end |
|
810 | Wildbreath-135052 | totem[slot]:SetValue(0) |
|
811 | Wildbreath-135052 | totem[slot]:Hide() |
|
812 | Wildbreath-135052 | end |
|
813 | Wildbreath-135052 | ||
814 | Wildbreath-135052 | end |
|
815 | Wildbreath-135052 | ||
816 | Wildbreath-135052 | local function Event(self,event,...) |
|
817 | Wildbreath-135052 | if event == "PLAYER_TOTEM_UPDATE" then |
|
818 | Wildbreath-135052 | UpdateSlot(self, ...) |
|
819 | Wildbreath-135052 | end |
|
820 | Wildbreath-135052 | end |
|
821 | Wildbreath-135052 | ||
822 | Wildbreath-135052 | self:RegisterEvent("PLAYER_TOTEM_UPDATE", Event) |
|
823 | Wildbreath-135052 | end |
|
824 | Wildbreath-135052 | ||
825 | Wildbreath-135052 | ||
826 | Wildbreath-135052 | --[[ Fading for party ]] |
|
827 | Wildbreath-135052 | if(not unit) then |
|
828 | Wildbreath-135052 | self.Range = true |
|
829 | Wildbreath-135052 | self.inRangeAlpha = 1.0 |
|
830 | Wildbreath-135052 | self.outsideRangeAlpha = 0.5 |
|
831 | Wildbreath-135052 | end |
|
832 | Wildbreath-135052 | ||
833 | Wildbreath-135052 | return self |
|
834 | Wildbreath-135052 | end |
|
835 | Wildbreath-135052 | ||
836 | Wildbreath-135052 | oUF:RegisterStyle("style", func) |
|
837 | Wildbreath-135052 | oUF:SetActiveStyle("style") |
|
838 | Wildbreath-135052 | ||
839 | Wildbreath-135052 | --[[ Positions ]] |
|
840 | Wildbreath-135052 | oUF:Spawn("player", "oUF_player"):SetPoint(unpack(settings.Positions.player)) |
|
841 | Wildbreath-135052 | oUF:Spawn("target", "oUF_target"):SetPoint(unpack(settings.Positions.target)) |
|
842 | Wildbreath-135052 | oUF:Spawn("targettarget", "oUF_targettarget"):SetPoint(unpack(settings.Positions.targettarget)) |
|
843 | Wildbreath-135052 | oUF:Spawn("focus", "oUF_focus"):SetPoint(unpack(settings.Positions.focus)) |
|
844 | Wildbreath-135052 | oUF:Spawn("focustarget", "oUF_focustarget"):SetPoint(unpack(settings.Positions.focustarget)) |
|
845 | Wildbreath-135052 | oUF:Spawn("pet", "oUF_pet"):SetPoint("TOPRIGHT", oUF.units.player, "TOPLEFT", -5, 0) |