vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | local XPerl_Target_Events = {} |
2 | |||
3 | ---------------------- |
||
4 | -- Loading Function -- |
||
5 | ---------------------- |
||
6 | |||
7 | function XPerl_Target_OnLoad() |
||
8 | CombatFeedback_Initialize(XPerl_TargetHitIndicator, 30) |
||
9 | |||
10 | this:RegisterEvent("PLAYER_ENTERING_WORLD") |
||
11 | this:RegisterEvent("PLAYER_LEAVING_WORLD") |
||
12 | this:RegisterEvent("VARIABLES_LOADED") |
||
13 | |||
14 | --this.PlayerFlash = 0 |
||
15 | this.lastTarget = "" |
||
16 | this.lastDeathMsg = "" |
||
17 | this.unitid = "target" |
||
18 | this.perlBuffs = 0 |
||
19 | this.perlDebuffs = 0 |
||
20 | |||
21 | XPerl_InitFadeFrame(this) |
||
22 | |||
23 | if (XPerl_Target_AssistFrame) then |
||
24 | -- Since target module is loaded after raid helper, we have to attach this manually |
||
25 | -- because the target frame did not exist when this frame was created |
||
26 | XPerl_Target_AssistFrame:SetParent(XPerl_Target_CastClickOverlay) |
||
27 | XPerl_Target_AssistFrame:ClearAllPoints() |
||
28 | XPerl_Target_AssistFrame:SetPoint("TOPLEFT", XPerl_Target_PortraitFrame, "TOPRIGHT", -2, -20) |
||
29 | end |
||
30 | |||
31 | -- Set here to reduce amount of function calls made |
||
32 | this:SetScript("OnEvent", XPerl_Target_OnEvent) |
||
33 | this:SetScript("OnUpdate", XPerl_Target_OnUpdate) |
||
34 | this:SetScript("OnShow", XPerl_Target_UpdatePortrait) |
||
35 | |||
36 | XPerl_RegisterHighlight(XPerl_Target_CastClickOverlay, 3) |
||
37 | XPerl_RegisterPerlFrames(XPerl_Target, {"NameFrame", "StatsFrame", "LevelFrame", "PortraitFrame", "TypeFramePlayer", "CreatureType", "BossFrame", "CPFrame"}) |
||
38 | |||
39 | this.FlashFrames = {XPerl_Target_PortraitFrame, XPerl_Target_NameFrame, |
||
40 | XPerl_Target_LevelFrame, XPerl_Target_StatsFrame, |
||
41 | XPerl_Target_BossFrame, XPerl_Target_TypeFramePlayer, |
||
42 | XPerl_Target_CreatureType } |
||
43 | end |
||
44 | |||
45 | local events = {"UNIT_SPELLMISS", "UNIT_FACTION", "UNIT_DYNAMIC_FLAGS", "UNIT_FLAGS", "UNIT_CLASSIFICATION_CHANGED", |
||
46 | "PLAYER_TARGET_CHANGED", "PLAYER_FLAGS_CHANGED", "PLAYER_COMBO_POINTS", "UNIT_MODEL_CHANGED", |
||
47 | "PARTY_MEMBER_DISABLE", "PARTY_MEMBER_ENABLE", "UNIT_AURA", "RAID_TARGET_UPDATE", "PARTY_MEMBERS_CHANGED", |
||
48 | "PARTY_LEADER_CHANGED", "PARTY_LOOT_METHOD_CHANGED", "CHAT_MSG_COMBAT_HOSTILE_DEATH"} |
||
49 | |||
50 | local function XPerl_Target_RegisterSome() |
||
51 | for i,event in pairs(events) do |
||
52 | this:RegisterEvent(event) |
||
53 | end |
||
54 | XPerl_RegisterBasics() |
||
55 | end |
||
56 | local function XPerl_Target_UnregisterSome() |
||
57 | for i,event in pairs(events) do |
||
58 | this:UnregisterEvent(event) |
||
59 | end |
||
60 | XPerl_UnregisterBasics() |
||
61 | end |
||
62 | |||
63 | -------------------- |
||
64 | -- Buff Functions -- |
||
65 | -------------------- |
||
66 | local function GetBuffButton(thisFrame, buffnum, debuff, createIfAbsent) |
||
67 | |||
68 | local buffType |
||
69 | if (debuff == 1) then |
||
70 | buffType = "DeBuff" |
||
71 | else |
||
72 | buffType = "Buff" |
||
73 | end |
||
74 | local name |
||
75 | if (thisFrame == XPerl_Target) then |
||
76 | name = "XPerl_Target_BuffFrame_"..buffType..buffnum |
||
77 | else |
||
78 | name = thisFrame:GetName().."_BuffFrame_"..buffType..buffnum |
||
79 | end |
||
80 | local button = getglobal(name) |
||
81 | |||
82 | if (not button and createIfAbsent) then |
||
83 | local parent |
||
84 | if (thisFrame == XPerl_Target) then |
||
85 | parent = XPerl_Target_BuffFrame |
||
86 | else |
||
87 | parent = getglobal(thisFrame:GetName().."_BuffFrame") |
||
88 | end |
||
89 | |||
90 | button = CreateFrame("Button", name, parent, "XPerl_"..buffType.."Template") |
||
91 | button:SetID(buffnum) |
||
92 | |||
93 | local size = XPerlConfig.TargetBuffSize * (1 + (0.2 * debuff)) |
||
94 | button:SetHeight(size) |
||
95 | button:SetWidth(size) |
||
96 | |||
97 | if (debuff == 1) then |
||
98 | if (thisFrame == XPerl_Target) then |
||
99 | button:SetScript("OnEnter", function() XPerl_Target_SetDeBuffTooltip("target") end) |
||
100 | else |
||
101 | button:SetScript("OnEnter", function() XPerl_Target_SetDeBuffTooltip("targettarget") end) |
||
102 | end |
||
103 | else |
||
104 | if (thisFrame == XPerl_Target) then |
||
105 | button:SetScript("OnEnter", function() XPerl_Target_SetBuffTooltip("target") end) |
||
106 | else |
||
107 | button:SetScript("OnEnter", function() XPerl_Target_SetBuffTooltip("targettarget") end) |
||
108 | end |
||
109 | end |
||
110 | button:SetScript("OnLeave", XPerl_PlayerTipHide) |
||
111 | |||
112 | button:ClearAllPoints() |
||
113 | if (buffnum == 1) then |
||
114 | button:SetPoint("TOPLEFT", 0, 0) |
||
115 | else |
||
116 | local prevButton = getglobal(thisFrame:GetName().."_BuffFrame_"..buffType..(buffnum - 1)) |
||
117 | button:SetPoint("TOPLEFT", prevButton, "TOPRIGHT", 1 + debuff, 0) |
||
118 | end |
||
119 | end |
||
120 | |||
121 | return button |
||
122 | end |
||
123 | |||
124 | -- This gets complicated. When we're the target frame, we have to wrap to next line of buffs if there's no mana on the target, or if the mob type frame is shown |
||
125 | -- And if the mob type frame is shown, AND there's no mana, then we may have to use small width on 2 rows, depending on buff size. |
||
126 | -- displayWidth is our current row max |
||
127 | -- displayWidthExtra is the max size after any short rows |
||
128 | -- displayWidthStart remembers the short row size for 2nd pass |
||
129 | function XPerl_Targets_BuffPositions(unitTarget, argFramePrefix, ttFrame) |
||
130 | local above = 0 |
||
131 | if (ttFrame == XPerl_Target) then |
||
132 | above = XPerlConfig.TargetBuffsAbove == 1 |
||
133 | else |
||
134 | above = XPerlConfig.TargetTargetBuffsAbove == 1 |
||
135 | end |
||
136 | |||
137 | local buffFrame = getglobal(argFramePrefix.."BuffFrame") |
||
138 | local nameFrame = getglobal(argFramePrefix.."NameFrame") |
||
139 | local statsFrame = getglobal(argFramePrefix.."StatsFrame") |
||
140 | if (above) then |
||
141 | buffFrame:ClearAllPoints() |
||
142 | buffFrame:SetPoint("BOTTOMLEFT", nameFrame, "TOPLEFT", 2, 0) |
||
143 | else |
||
144 | buffFrame:ClearAllPoints() |
||
145 | buffFrame:SetPoint("TOPLEFT", statsFrame, "BOTTOMLEFT", 2, 0) |
||
146 | end |
||
147 | |||
148 | local unitBuff = XPerl_UnitBuff(unitTarget, 1, XPerlConfig.TargetCastableBuffs) |
||
149 | local buff1 = GetBuffButton(ttFrame, 1, 0, true) |
||
150 | unitBuff = XPerl_UnitDebuff(unitTarget, 1, XPerlConfig.TargetCastableBuffs) |
||
151 | local debuff1 = GetBuffButton(ttFrame, 1, 1, true) |
||
152 | |||
153 | local buffHeight, debuffHeight |
||
154 | if (buff1) then |
||
155 | buffHeight = math.floor(buff1:GetHeight() + 1.5) |
||
156 | else |
||
157 | buffHeight = 21 |
||
158 | end |
||
159 | if (debuff1) then |
||
160 | debuffHeight = math.floor(debuff1:GetHeight() + 2.5) |
||
161 | else |
||
162 | debuffHeight = 23 |
||
163 | end |
||
164 | local displayWidth = math.floor(getglobal(argFramePrefix.."StatsFrame"):GetWidth() - 3.5) |
||
165 | local displayWidthStart = displayWidth |
||
166 | local displayWidthExtra = displayWidth |
||
167 | local mana = UnitManaMax(unitTarget) |
||
168 | local buffRows = 1 |
||
169 | local debuffRows = 1 |
||
170 | |||
171 | local pframe = getglobal(argFramePrefix.."PortraitFrame") |
||
172 | if (pframe) then |
||
173 | displayWidthExtra = displayWidthExtra + math.floor(pframe:GetWidth() - 3.5) |
||
174 | end |
||
175 | |||
176 | if (unitTarget == "target") then |
||
177 | if (XPerlConfig.ShowTargetLevel == 1 or XPerlConfig.ShowTargetClassIcon == 1) then |
||
178 | pframe = getglobal(argFramePrefix.."LevelFrame") |
||
179 | if (pframe) then |
||
180 | displayWidthExtra = displayWidthExtra + math.floor(pframe:GetWidth() - 3.5) |
||
181 | end |
||
182 | end |
||
183 | |||
184 | if (above or not XPerl_Target_CreatureType:IsShown() or UnitFactionGroup("player") ~= UnitFactionGroup(unitTarget)) then |
||
185 | displayWidth = displayWidthExtra |
||
186 | end |
||
187 | else |
||
188 | displayWidthExtra = displayWidth |
||
189 | displayWidthStart = displayWidth |
||
190 | end |
||
191 | |||
192 | local unitBuff = XPerl_UnitBuff(unitTarget, 1, XPerlConfig.TargetCastableBuffs) |
||
193 | local buffPrev = buff1 |
||
194 | local buffRowStart = buffPrev |
||
195 | local buffsWidth = buffHeight |
||
196 | ttFrame.buffData = {{row = 1, buff = buffRowStart}} |
||
197 | for i = 2,20 do |
||
198 | unitBuff = XPerl_UnitBuff(unitTarget, i, XPerlConfig.TargetCastableBuffs) |
||
199 | local buff = GetBuffButton(ttFrame, i, 0, unitBuff and (buffRows <= XPerlConfig.TargetBuffRows)) |
||
200 | |||
201 | if (buff) then |
||
202 | buff:ClearAllPoints() |
||
203 | if (buffsWidth + buffHeight > displayWidth) then |
||
204 | if (above) then |
||
205 | buff:SetPoint("BOTTOMLEFT", buffRowStart, "TOPLEFT", 0, -1) |
||
206 | else |
||
207 | buff:SetPoint("TOPLEFT", buffRowStart, "BOTTOMLEFT", 0, -1) |
||
208 | end |
||
209 | buffRowStart = buff |
||
210 | |||
211 | if (buffRows > 1 or mana > 0 or buffHeight > 26 or not XPerl_Target_CreatureType:IsShown()) then |
||
212 | displayWidth = displayWidthExtra |
||
213 | end |
||
214 | |||
215 | buffsWidth = 0 |
||
216 | buffRows = buffRows + 1 |
||
217 | else |
||
218 | buff:SetPoint("TOPLEFT", buffPrev, "TOPRIGHT", 1, 0) |
||
219 | end |
||
220 | |||
221 | buffsWidth = buffsWidth + buffHeight |
||
222 | buffPrev = buff |
||
223 | end |
||
224 | tinsert(ttFrame.buffData, {row = buffRows, buff = buffRowStart}) |
||
225 | end |
||
226 | |||
227 | if (not above) then |
||
228 | if ((UnitFactionGroup("player") == UnitFactionGroup(unitTarget))) then |
||
229 | if (mana == 0) then |
||
230 | if (buffRows > 1 or buffHeight > 25) then |
||
231 | displayWidth = displayWidthExtra |
||
232 | else |
||
233 | displayWidth = displayWidthStart |
||
234 | end |
||
235 | else |
||
236 | displayWidth = displayWidthExtra |
||
237 | end |
||
238 | else |
||
239 | if (unitTarget == "target" and (mana == 0 or XPerl_Target_CreatureType:IsShown())) then |
||
240 | displayWidth = displayWidthStart |
||
241 | else |
||
242 | displayWidth = displayWidthExtra |
||
243 | end |
||
244 | end |
||
245 | end |
||
246 | |||
247 | local unitDebuff = XPerl_UnitDebuff(unitTarget, 1, XPerlConfig.TargetCastableBuffs) |
||
248 | buffPrev = debuff1 |
||
249 | buffRowStart = buffPrev |
||
250 | buffsWidth = debuffHeight |
||
251 | ttFrame.debuffData = {{row = 1, buff = buffRowStart}} |
||
252 | for i = 2,16 do |
||
253 | unitDebuff = XPerl_UnitDebuff(unitTarget, i, XPerlConfig.TargetCastableBuffs) |
||
254 | local buff = GetBuffButton(ttFrame, i, 1, unitDebuff and (debuffRows <= XPerlConfig.TargetBuffRows)) |
||
255 | |||
256 | if (buff) then |
||
257 | buff:ClearAllPoints() |
||
258 | if (buffsWidth + debuffHeight > displayWidth) then |
||
259 | if (above) then |
||
260 | buff:SetPoint("BOTTOMLEFT", buffRowStart, "TOPLEFT", 0, 2) |
||
261 | else |
||
262 | buff:SetPoint("TOPLEFT", buffRowStart, "BOTTOMLEFT", 0, -2) |
||
263 | end |
||
264 | buffRowStart = buff |
||
265 | |||
266 | if (debuffRows > 1 or mana > 0 or debuffHeight > 26 or not XPerl_Target_CreatureType:IsShown()) then |
||
267 | displayWidth = displayWidthExtra |
||
268 | end |
||
269 | |||
270 | buffsWidth = 0 |
||
271 | debuffRows = debuffRows + 1 |
||
272 | else |
||
273 | buff:SetPoint("TOPLEFT", buffPrev, "TOPRIGHT", 2, 0) |
||
274 | end |
||
275 | |||
276 | buffsWidth = buffsWidth + debuffHeight |
||
277 | buffPrev = buff |
||
278 | end |
||
279 | tinsert(ttFrame.debuffData, {row = debuffRows, buff = buffRowStart}) |
||
280 | end |
||
281 | end |
||
282 | |||
283 | -- XPerl_Targets_BuffUpdate |
||
284 | function XPerl_Targets_BuffUpdate(unitTarget, argFramePrefix, ttFrame) |
||
285 | if (this.Fading == 1) then |
||
286 | return |
||
287 | end |
||
288 | |||
289 | if (ttFrame == XPerl_Target) then |
||
290 | above = XPerlConfig.TargetBuffsAbove == 1 |
||
291 | else |
||
292 | above = XPerlConfig.TargetTargetBuffsAbove == 1 |
||
293 | end |
||
294 | |||
295 | if (UnitExists(unitTarget)) then |
||
296 | this.perlBuffs = 0 |
||
297 | this.perlDebuffs = 0 |
||
298 | |||
299 | for buffnum=1,20 do |
||
300 | local hide = false |
||
301 | if (ttFrame.buffData and ttFrame.buffData[buffnum] and ttFrame.buffData[buffnum].row > XPerlConfig.TargetBuffRows) then |
||
302 | hide = true |
||
303 | else |
||
304 | local buff, count = XPerl_UnitBuff(unitTarget, buffnum, XPerlConfig.TargetCastableBuffs) |
||
305 | |||
306 | if (buff) then |
||
307 | local button = GetBuffButton(ttFrame, buffnum, 0, true) |
||
308 | local icon = getglobal(button:GetName().."Icon") |
||
309 | |||
310 | this.perlBuffs = this.perlBuffs + 1 |
||
311 | local buffCount = getglobal(button:GetName().."Count") |
||
312 | |||
313 | icon:SetTexture(buff) |
||
314 | if (count > 1) then |
||
315 | buffCount:SetText(count) |
||
316 | buffCount:Show() |
||
317 | else |
||
318 | buffCount:Hide() |
||
319 | end |
||
320 | button:Show() |
||
321 | else |
||
322 | hide = true |
||
323 | end |
||
324 | end |
||
325 | |||
326 | if (hide) then |
||
327 | local button = getglobal(argFramePrefix.."BuffFrame_Buff"..buffnum) |
||
328 | if (button) then |
||
329 | button:Hide() |
||
330 | end |
||
331 | end |
||
332 | end |
||
333 | |||
334 | for buffnum=1,16 do |
||
335 | local hide = false |
||
336 | if (ttFrame.debuffData and ttFrame.debuffData[buffnum] and ttFrame.debuffData[buffnum].row > XPerlConfig.TargetBuffRows) then |
||
337 | hide = true |
||
338 | else |
||
339 | local debuff, debuffApplications, debuffType = XPerl_UnitDebuff(unitTarget, buffnum, XPerlConfig.TargetCurableDebuffs) |
||
340 | |||
341 | if (debuff) then |
||
342 | local button = GetBuffButton(ttFrame, buffnum, 1, true) |
||
343 | local icon = getglobal(button:GetName().."Icon") |
||
344 | |||
345 | this.perlDebuffs = this.perlDebuffs + 1 |
||
346 | local debuffCount = getglobal(button:GetName().."Count") |
||
347 | |||
348 | icon:SetTexture(debuff) |
||
349 | if ( debuffApplications > 1 ) then |
||
350 | debuffCount:SetText(debuffApplications) |
||
351 | debuffCount:Show() |
||
352 | else |
||
353 | debuffCount:Hide() |
||
354 | end |
||
355 | |||
356 | local borderColor = DebuffTypeColor[(debuffType or "none")] |
||
357 | local buffBorder = getglobal(button:GetName().."Border") |
||
358 | buffBorder:SetVertexColor(borderColor.r, borderColor.g, borderColor.b) |
||
359 | |||
360 | button:Show() |
||
361 | else |
||
362 | hide = true |
||
363 | end |
||
364 | end |
||
365 | |||
366 | if (hide) then |
||
367 | local button = getglobal(argFramePrefix.."BuffFrame_DeBuff"..buffnum) |
||
368 | if (button) then |
||
369 | button:Hide() |
||
370 | end |
||
371 | end |
||
372 | end |
||
373 | |||
374 | local buff1 = getglobal(argFramePrefix.."BuffFrame_Buff1") |
||
375 | local debuff1 = getglobal(argFramePrefix.."BuffFrame_DeBuff1") |
||
376 | if (buff1 or debuff1) then |
||
377 | if (buff1) then buff1:ClearAllPoints() end |
||
378 | if (debuff1) then debuff1:ClearAllPoints() end |
||
379 | |||
380 | if ((UnitFactionGroup("player") == UnitFactionGroup(unitTarget))) then |
||
381 | if (buff1) then |
||
382 | if (above) then |
||
383 | buff1:SetPoint("BOTTOMLEFT", 0, 0) |
||
384 | else |
||
385 | buff1:SetPoint("TOPLEFT", 0, 0) |
||
386 | end |
||
387 | end |
||
388 | if (debuff1) then |
||
389 | local mark = this.perlBuffs |
||
390 | if (mark < 1) then |
||
391 | mark = 1 |
||
392 | end |
||
393 | if (above) then |
||
394 | debuff1:SetPoint("BOTTOMLEFT", ttFrame.buffData[mark].buff, "TOPLEFT", 0, 2) |
||
395 | else |
||
396 | debuff1:SetPoint("TOPLEFT", ttFrame.buffData[mark].buff, "BOTTOMLEFT", 0, -2) |
||
397 | end |
||
398 | end |
||
399 | else |
||
400 | if (debuff1) then |
||
401 | if (above) then |
||
402 | debuff1:SetPoint("BOTTOMLEFT", 0, 0) |
||
403 | else |
||
404 | debuff1:SetPoint("TOPLEFT", 0, 0) |
||
405 | end |
||
406 | end |
||
407 | if (buff1) then |
||
408 | local mark = this.perlDebuffs |
||
409 | if (mark < 1) then |
||
410 | mark = 1 |
||
411 | end |
||
412 | if (this.perlDebuffs > 0) then |
||
413 | if (above) then |
||
414 | buff1:SetPoint("BOTTOMLEFT", ttFrame.debuffData[mark].buff, "TOPLEFT", 0, 2) |
||
415 | else |
||
416 | buff1:SetPoint("TOPLEFT", ttFrame.debuffData[mark].buff, "BOTTOMLEFT", 0, -2) |
||
417 | end |
||
418 | end |
||
419 | end |
||
420 | end |
||
421 | end |
||
422 | end |
||
423 | end |
||
424 | |||
425 | -- XPerl_Target_SetBuffTooltip |
||
426 | function XPerl_Target_SetBuffTooltip (target) |
||
427 | GameTooltip:SetOwner(this, "ANCHOR_BOTTOMRIGHT") |
||
428 | |||
429 | if (target == "targettarget") then |
||
430 | if (strfind(this:GetName(), "TargetTargetTarget")) then |
||
431 | target = "targettargettarget" |
||
432 | end |
||
433 | end |
||
434 | |||
435 | XPerl_TooltipSetUnitBuff(GameTooltip, target, this:GetID(), XPerlConfig.TargetCastableBuffs) |
||
436 | XPerl_ToolTip_AddBuffDuration(target) |
||
437 | end |
||
438 | |||
439 | -- XPerl_Target_SetDeBuffTooltip |
||
440 | function XPerl_Target_SetDeBuffTooltip (target) |
||
441 | GameTooltip:SetOwner(this, "ANCHOR_BOTTOMRIGHT") |
||
442 | |||
443 | if (target == "targettarget") then |
||
444 | if (strfind(this:GetName(), "TargetTargetTarget")) then |
||
445 | target = "targettargettarget" |
||
446 | end |
||
447 | end |
||
448 | |||
449 | XPerl_TooltipSetUnitDebuff(GameTooltip, target, this:GetID(), XPerlConfig.TargetCurableDebuffs) |
||
450 | end |
||
451 | |||
452 | --------------- |
||
453 | -- Combo Points |
||
454 | --------------- |
||
455 | local function XPerl_Target_UpdateCombo() |
||
456 | local combopoints = GetComboPoints() |
||
457 | if (XPerlConfig.UseCPMeter == 1) then |
||
458 | XPerl_Target_CPFrame:Hide() |
||
459 | XPerl_Target_CPMeter:SetMinMaxValues(0, 5) |
||
460 | XPerl_Target_CPMeter:SetValue(combopoints) |
||
461 | XPerl_Target_CPMeter:Show() |
||
462 | if (combopoints == 5) then |
||
463 | XPerl_Target_CPMeter:SetStatusBarColor(1, 0, 0, 0.7) |
||
464 | elseif (combopoints == 4) then |
||
465 | XPerl_Target_CPMeter:SetStatusBarColor(1, 0.5, 0, 0.7) |
||
466 | elseif (combopoints == 3) then |
||
467 | XPerl_Target_CPMeter:SetStatusBarColor(1, 1, 0, 0.6) |
||
468 | elseif (combopoints == 2) then |
||
469 | XPerl_Target_CPMeter:SetStatusBarColor(0.5, 1, 0, 0.4) |
||
470 | elseif (combopoints == 1) then |
||
471 | XPerl_Target_CPMeter:SetStatusBarColor(0, 1, 0, 0.4) |
||
472 | else |
||
473 | XPerl_Target_CPMeter:Hide() |
||
474 | end |
||
475 | elseif (XPerlConfig.BlizzardCPMeter == 0) then |
||
476 | XPerl_Target_CPMeter:Hide() |
||
477 | XPerl_Target_CPFrame:Show() |
||
478 | XPerl_Target_CPFrameText:SetText(combopoints) |
||
479 | if (combopoints == 5) then |
||
480 | XPerl_Target_CPFrameText:SetTextColor(1, 0, 0) |
||
481 | elseif (combopoints == 4) then |
||
482 | XPerl_Target_CPFrameText:SetTextColor(1, 0.5, 0) |
||
483 | elseif (combopoints == 3) then |
||
484 | XPerl_Target_CPFrameText:SetTextColor(1, 1, 0) |
||
485 | elseif (combopoints == 2) then |
||
486 | XPerl_Target_CPFrameText:SetTextColor(0.5, 1, 0) |
||
487 | elseif (combopoints == 1) then |
||
488 | XPerl_Target_CPFrameText:SetTextColor(0, 1, 0) |
||
489 | else |
||
490 | XPerl_Target_CPFrame:Hide() |
||
491 | end |
||
492 | end |
||
493 | end |
||
494 | |||
495 | -- XPerl_UnitDebuffInformation |
||
496 | local function XPerl_UnitDebuffInformation(debuff) |
||
497 | local i = 1 |
||
498 | |||
499 | while UnitDebuff("target", i) do |
||
500 | XPerlBuffStatusTooltip:SetUnitDebuff("target", i ) |
||
501 | if (XPerlBuffStatusTooltipTextLeft1:GetText() == debuff) then |
||
502 | _, debuffApplications = UnitDebuff("target", i) |
||
503 | return debuffApplications |
||
504 | end |
||
505 | |||
506 | i = i + 1 |
||
507 | end |
||
508 | |||
509 | return 0 |
||
510 | end |
||
511 | |||
512 | --------------------- |
||
513 | --Debuffs -- |
||
514 | --------------------- |
||
515 | local function XPerl_Target_DebuffUpdate() |
||
516 | if (this.Fading == 1) then |
||
517 | return |
||
518 | end |
||
519 | |||
520 | if (GetComboPoints()==0) then |
||
521 | local numDebuffs = 0 |
||
522 | local _, class = UnitClass("player") |
||
523 | |||
524 | if (class == "WARRIOR") then |
||
525 | numDebuffs = XPerl_UnitDebuffInformation(XPERL_SPELL_SUNDER) |
||
526 | elseif (class == "PRIEST") then |
||
527 | numDebuffs = XPerl_UnitDebuffInformation(XPERL_SPELL_SHADOWV) |
||
528 | elseif (class == "MAGE") then |
||
529 | numDebuffs = XPerl_UnitDebuffInformation(XPERL_SPELL_FIREV) |
||
530 | |||
531 | if (numDebuffs == 0) then |
||
532 | numDebuffs = XPerl_UnitDebuffInformation(XPERL_SPELL_WINTERCH) |
||
533 | end |
||
534 | end |
||
535 | |||
536 | if (XPerlConfig.UseCPMeter == 1) then |
||
537 | XPerl_Target_CPFrame:Hide() |
||
538 | XPerl_Target_CPMeter:SetMinMaxValues(0, 5) |
||
539 | XPerl_Target_CPMeter:SetValue(numDebuffs) |
||
540 | XPerl_Target_CPMeter:Show() |
||
541 | if (numDebuffs == 5) then |
||
542 | XPerl_Target_CPMeter:SetStatusBarColor(1, 0, 0, 0.4) |
||
543 | elseif (numDebuffs == 4) then |
||
544 | XPerl_Target_CPMeter:SetStatusBarColor(1, 0.5, 0, 0.4) |
||
545 | elseif (numDebuffs == 3) then |
||
546 | XPerl_Target_CPMeter:SetStatusBarColor(1, 1, 0, 0.4) |
||
547 | elseif (numDebuffs == 2) then |
||
548 | XPerl_Target_CPMeter:SetStatusBarColor(0.5, 1, 0, 0.4) |
||
549 | elseif (numDebuffs == 1) then |
||
550 | XPerl_Target_CPMeter:SetStatusBarColor(0, 1, 0, 0.4) |
||
551 | else |
||
552 | XPerl_Target_CPMeter:Hide() |
||
553 | end |
||
554 | else |
||
555 | XPerl_Target_CPMeter:Hide() |
||
556 | XPerl_Target_CPFrame:Show() |
||
557 | XPerl_Target_CPFrameText:SetText(numDebuffs) |
||
558 | if (cnumDebuffs == 5) then |
||
559 | XPerl_Target_CPFrameText:SetTextColor(1, 0, 0) |
||
560 | elseif (numDebuffs == 4) then |
||
561 | XPerl_Target_CPFrameText:SetTextColor(1, 0.5, 0) |
||
562 | elseif (numDebuffs == 3) then |
||
563 | XPerl_Target_CPFrameText:SetTextColor(1, 1, 0) |
||
564 | elseif (numDebuffs == 2) then |
||
565 | XPerl_Target_CPFrameText:SetTextColor(0.5, 1, 0) |
||
566 | elseif (numDebuffs == 1) then |
||
567 | XPerl_Target_CPFrameText:SetTextColor(0, 1, 0) |
||
568 | else |
||
569 | XPerl_Target_CPFrame:Hide() |
||
570 | end |
||
571 | end |
||
572 | else |
||
573 | XPerl_Target_UpdateCombo() |
||
574 | end |
||
575 | end |
||
576 | |||
577 | ------------------------- |
||
578 | -- The Update Functions-- |
||
579 | ------------------------- |
||
580 | local function XPerl_Target_UpdatePVP() |
||
581 | local targetrankname, targetrank=GetPVPRankInfo(UnitPVPRank("target"), "target") |
||
582 | if (targetrank and XPerlConfig.ShowTargetPVPRank==1 and UnitIsPlayer("target")) then |
||
583 | XPerl_Target_NameFrame_PVPRankIcon:Show() |
||
584 | if (targetrank==0) then |
||
585 | XPerl_Target_NameFrame_PVPRankIcon:Hide() |
||
586 | else |
||
587 | XPerl_Target_NameFrame_PVPRankIcon:SetTexture(string.format("Interface\\PVPRankBadges\\PVPRank%02d", targetrank)) |
||
588 | end |
||
589 | else |
||
590 | XPerl_Target_NameFrame_PVPRankIcon:Hide() |
||
591 | end |
||
592 | if (XPerlConfig.ShowTargetPVP == 1 and UnitIsPVP("target")) then |
||
593 | XPerl_Target_NameFrame_PVPStatus:SetTexture("Interface\\TargetingFrame\\UI-PVP-"..(UnitFactionGroup("target") or "FFA")) |
||
594 | XPerl_Target_NameFrame_PVPStatus:Show() |
||
595 | else |
||
596 | XPerl_Target_NameFrame_PVPStatus:Hide() |
||
597 | end |
||
598 | XPerl_SetUnitNameColor("target", XPerl_Target_NameFrame_NameBarText) |
||
599 | |||
600 | if (XPerlConfig.TargetReactionHighlight == 1) then |
||
601 | local c = XPerl_ReactionColour("target") |
||
602 | XPerl_Target_NameFrame:SetBackdropColor(c.r, c.g, c.b) |
||
603 | end |
||
604 | end |
||
605 | |||
606 | -- XPerl_Target_UpdateName |
||
607 | local function XPerl_Target_UpdateName() |
||
608 | local targetname = UnitName("target") |
||
609 | |||
610 | --if (strlen(targetname) > 20) then |
||
611 | -- targetname = strsub(targetname, 1, 19).."..." |
||
612 | --end |
||
613 | |||
614 | XPerl_Target_NameFrame_NameBarText:SetText(targetname) |
||
615 | |||
616 | local remCount = 1 |
||
617 | while ((XPerl_Target_NameFrame_NameBarText:GetStringWidth() >= (XPerl_Target_NameFrame:GetWidth() - 8)) and (string.len(targetname) > remCount)) do |
||
618 | targetname = string.sub(targetname, 1, string.len(targetname) - remCount)..".." |
||
619 | remCount = 3 |
||
620 | XPerl_Target_NameFrame_NameBarText:SetText(targetname) |
||
621 | end |
||
622 | |||
623 | XPerl_Target_UpdatePVP() |
||
624 | |||
625 | --guildname, guildtitle, guildrank = GetGuildInfo("target") |
||
626 | end |
||
627 | |||
628 | -- XPerl_Target_UpdatePortrait |
||
629 | function XPerl_Target_UpdatePortrait() |
||
630 | if (XPerlConfig.ShowTargetPortrait == 1) then |
||
631 | if (UnitExists("target")) then |
||
632 | if (UnitIsVisible("target") and XPerlConfig.ShowTargetPortrait3D == 1) then |
||
633 | XPerl_Target_PortraitFrame_Portrait:Hide() |
||
634 | XPerl_Target_PortraitFrame_Portrait3D:Show() |
||
635 | XPerlSetPortrait3D(XPerl_Target_PortraitFrame_Portrait3D, "target") |
||
636 | else |
||
637 | XPerl_Target_PortraitFrame_Portrait3D.last3DTime = nil |
||
638 | XPerl_Target_PortraitFrame_Portrait:Show() |
||
639 | XPerl_Target_PortraitFrame_Portrait3D:Hide() |
||
640 | SetPortraitTexture(XPerl_Target_PortraitFrame_Portrait, "target") |
||
641 | end |
||
642 | end |
||
643 | end |
||
644 | end |
||
645 | |||
646 | -- XPerl_Target_UpdateLevel |
||
647 | local function XPerl_Target_UpdateLevel() |
||
648 | local targetlevel = UnitLevel("target") |
||
649 | XPerl_Target_LevelFrameText:SetText(targetlevel) |
||
650 | -- Set Level |
||
651 | if (XPerlConfig.ShowTargetLevel==1) then |
||
652 | XPerl_Target_LevelFrame:Show() |
||
653 | XPerl_Target_LevelFrame:SetWidth(27) |
||
654 | if (targetlevel < 0) then |
||
655 | XPerl_Target_LevelFrameText:SetTextColor(1, 0, 0) |
||
656 | XPerl_Target_LevelFrame:Hide() |
||
657 | else |
||
658 | local color = GetDifficultyColor(targetlevel) |
||
659 | XPerl_Target_LevelFrameText:SetTextColor(color.r, color.g, color.b) |
||
660 | end |
||
661 | if (XPerlConfig.ShowTargetElite==0 and (UnitClassification("target") == "elite" or UnitClassification("target") == "worldboss")) then --(UnitIsPlusMob("target"))) then |
||
662 | XPerl_Target_LevelFrameText:SetText(targetlevel.."+") |
||
663 | XPerl_Target_LevelFrame:SetWidth(33) |
||
664 | end |
||
665 | end |
||
666 | end |
||
667 | |||
668 | -- XPerl_Target_UpdateClassification |
||
669 | local function XPerl_Target_UpdateClassification() |
||
670 | local targetclassification = UnitClassification("target") |
||
671 | |||
672 | if (UnitIsCivilian("target")) then |
||
673 | XPerl_Target_BossFrameText:SetText(XPERL_TYPE_CIVILIAN) |
||
674 | XPerl_Target_BossFrameText:SetTextColor(1, 0, 0) |
||
675 | XPerl_Target_BossFrame:Show() |
||
676 | |||
677 | elseif (targetclassification == "normal" and UnitPlayerControlled("target")) then |
||
678 | if (not UnitIsPlayer("target")) then |
||
679 | XPerl_Target_BossFrameText:SetText(XPERL_TYPE_PET) |
||
680 | XPerl_Target_BossFrameText:SetTextColor(1, 1, 1) |
||
681 | XPerl_Target_BossFrame:Show() |
||
682 | else |
||
683 | XPerl_Target_BossFrame:Hide() |
||
684 | end |
||
685 | |||
686 | elseif ((XPerlConfig.ShowTargetLevel==1 and XPerlConfig.ShowTargetElite==1) or targetclassification=="Rare+" or targetclassification=="Rare") then |
||
687 | XPerl_Target_BossFrame:Show() |
||
688 | if (targetclassification == "worldboss") then |
||
689 | XPerl_Target_BossFrameText:SetText(XPERL_TYPE_BOSS) |
||
690 | XPerl_Target_BossFrameText:SetTextColor(1, 0.5, 0.5) |
||
691 | |||
692 | elseif (targetclassification == "rareelite") then |
||
693 | XPerl_Target_BossFrameText:SetText(XPERL_TYPE_RAREPLUS) |
||
694 | XPerl_Target_BossFrameText:SetTextColor(0.8, 0.8, 0.8) |
||
695 | |||
696 | elseif (targetclassification == "elite") then |
||
697 | XPerl_Target_BossFrameText:SetText(XPERL_TYPE_ELITE) |
||
698 | XPerl_Target_BossFrameText:SetTextColor(1, 1, 0.5) |
||
699 | |||
700 | elseif (targetclassification == "rare") then |
||
701 | XPerl_Target_BossFrameText:SetText(XPERL_TYPE_RARE) |
||
702 | XPerl_Target_BossFrameText:SetTextColor(0.8, 0.8, 0.8) |
||
703 | |||
704 | else |
||
705 | XPerl_Target_BossFrame:Hide() |
||
706 | end |
||
707 | else |
||
708 | XPerl_Target_BossFrame:Hide() |
||
709 | end |
||
710 | |||
711 | XPerl_Target_BossFrame:SetWidth(XPerl_Target_BossFrameText:GetStringWidth() + 10) |
||
712 | end |
||
713 | |||
714 | -- XPerl_Target_UpdateType |
||
715 | local function XPerl_Target_UpdateType() |
||
716 | local targettype = UnitCreatureType("target") |
||
717 | |||
718 | if (targettype == XPERL_TYPE_NOT_SPECIFIED) then |
||
719 | targettype = nil |
||
720 | end |
||
721 | |||
722 | if (XPerlConfig.ShowTargetMobType == 1) then |
||
723 | XPerl_Target_CreatureType:Show() |
||
724 | else |
||
725 | XPerl_Target_CreatureType:Hide() |
||
726 | end |
||
727 | |||
728 | XPerl_Target_TypeFramePlayer:Hide() |
||
729 | XPerl_Target_CreatureTypeText:SetText(targettype) |
||
730 | |||
731 | if (UnitIsPlayer("target")) then |
||
732 | local _, PlayerClass = UnitClass("target") |
||
733 | if (XPerlConfig.ShowTargetClassIcon==1) then |
||
734 | local r, l, t, b = XPerl_ClassPos(PlayerClass) |
||
735 | XPerl_Target_TypeFramePlayer_ClassTexture:SetTexCoord(r, l, t, b) |
||
736 | XPerl_Target_TypeFramePlayer:Show() |
||
737 | end |
||
738 | XPerl_Target_CreatureType:Hide() |
||
739 | else |
||
740 | if (targettype and targettype ~= "") then |
||
741 | XPerl_Target_CreatureTypeText:SetTextColor(1, 1, 1) |
||
742 | XPerl_Target_CreatureType:SetWidth(XPerl_Target_CreatureTypeText:GetStringWidth() + 10) |
||
743 | else |
||
744 | XPerl_Target_CreatureType:Hide() |
||
745 | end |
||
746 | end |
||
747 | |||
748 | -- If it's too long, we anchor it to left side of portrait instead of right, to avoid it overlapping some buffs |
||
749 | XPerl_Target_CreatureType:ClearAllPoints() |
||
750 | if (XPerl_Target_CreatureType:GetWidth() > XPerl_Target_PortraitFrame:GetWidth()) then |
||
751 | XPerl_Target_CreatureType:SetPoint("TOPLEFT", XPerl_Target_PortraitFrame, "BOTTOMLEFT", 0, 2) |
||
752 | else |
||
753 | XPerl_Target_CreatureType:SetPoint("TOPRIGHT", XPerl_Target_PortraitFrame, "BOTTOMRIGHT", 0, 2) |
||
754 | end |
||
755 | end |
||
756 | |||
757 | -- XPerl_Target_UpdateManaType |
||
758 | local function XPerl_Target_UpdateManaType() |
||
759 | if (this.Fading == 1) then |
||
760 | return |
||
761 | end |
||
762 | |||
763 | XPerl_Target_SetManaType("target", XPerl_Target_StatsFrame_ManaBar, XPerl_Target_StatsFrame_ManaBarText, XPerl_Target_StatsFrame_ManaBarBG, XPerl_Target_StatsFrame, XPerl_Target) |
||
764 | end |
||
765 | |||
766 | -- XPerl_Target_SetManaType |
||
767 | function XPerl_Target_SetManaType(unit, frameManaBar, frameManaBarText, frameManaBarBG, frameStatsFrame, frameFrame) |
||
768 | local targetmanamax = UnitManaMax(unit) |
||
769 | |||
770 | if ((targetmanamax == 0) or (unit == "target" and XPerlConfig.ShowTargetMana==0) or (unit ~= "target" and XPerlConfig.ShowTargetTargetMana == 0)) then |
||
771 | if (frameManaBar:IsShown()) then |
||
772 | frameManaBar:Hide() |
||
773 | frameStatsFrame:SetHeight(28) |
||
774 | XPerl_StatsFrameSetup(frameStatsFrame) |
||
775 | end |
||
776 | return |
||
777 | end |
||
778 | |||
779 | XPerl_SetManaBarType(unit, frameManaBar, frameManaBarBG) |
||
780 | |||
781 | local targetmana = UnitMana(unit) |
||
782 | |||
783 | if (not frameManaBar:IsShown()) then |
||
784 | frameManaBarText:Show() |
||
785 | frameManaBar:Show() |
||
786 | frameStatsFrame:SetHeight(40) |
||
787 | XPerl_StatsFrameSetup(frameStatsFrame) |
||
788 | end |
||
789 | end |
||
790 | |||
791 | -- XPerl_Target_UpdateMana |
||
792 | local function XPerl_Target_UpdateMana() |
||
793 | if (this.Fading == 1) then |
||
794 | return |
||
795 | end |
||
796 | |||
797 | XPerl_Target_SetMana("target", XPerl_Target_StatsFrame_ManaBar, XPerl_Target_StatsFrame_HealthBarPercent, XPerl_Target_StatsFrame_ManaBarPercent, XPerl_Target_StatsFrame_ManaBarText) |
||
798 | end |
||
799 | |||
800 | -- XPerl_Target_SetMana |
||
801 | function XPerl_Target_SetMana(unit, frameManabar, frameHealthBarPercent, frameManaBarPercent, frameManaBarText) |
||
802 | local targetmana = UnitMana(unit) |
||
803 | local targetmanamax = UnitManaMax(unit) |
||
804 | if (frameHealthBarPercent:IsVisible()) then |
||
805 | frameManaBarPercent:Show() |
||
806 | end |
||
807 | |||
808 | if (targetmanamax == 1 and targetmana > targetmanamax) then |
||
809 | targetmanamax = targetmana |
||
810 | end |
||
811 | |||
812 | frameManabar:SetMinMaxValues(0, targetmanamax) |
||
813 | frameManabar:SetValue(targetmana) |
||
814 | |||
815 | frameManaBarPercent:SetText(string.format("%d",(100*(targetmana / targetmanamax))+0.5).."%") |
||
816 | frameManaBarText:SetText(targetmana.."/"..targetmanamax) |
||
817 | end |
||
818 | |||
819 | -- XPerl_Target_UpdateHealth |
||
820 | local function XPerl_Target_UpdateHealth() |
||
821 | if (this.Fading == 1) then |
||
822 | return |
||
823 | end |
||
824 | |||
825 | XPerl_Target_SetHealth("target", XPerl_Target_StatsFrame_HealthBar, XPerl_Target_StatsFrame_HealthBarBG, XPerl_Target_StatsFrame_HealthBarPercent, XPerl_Target_StatsFrame_HealthBarText, XPerl_Target_StatsFrame_ManaBarPercent, XPerlConfig.ShowTargetPercent) |
||
826 | |||
827 | if (XPerlConfig.ShowTargetValues == 1) then |
||
828 | XPerl_Target_StatsFrame_HealthBarText:Show() |
||
829 | XPerl_Target_StatsFrame_ManaBarText:Show() |
||
830 | else |
||
831 | XPerl_Target_StatsFrame_HealthBarText:Hide() |
||
832 | XPerl_Target_StatsFrame_ManaBarText:Hide() |
||
833 | end |
||
834 | |||
835 | if (not UnitIsConnected("target")) then |
||
836 | XPerl_Target_StatsFrame_HealthBarText:SetText(XPERL_LOC_OFFLINE) |
||
837 | XPerl_Target:SetAlpha(XPerlConfig.Transparency / 2) |
||
838 | else |
||
839 | XPerl_Target:SetAlpha(XPerlConfig.Transparency) |
||
840 | end |
||
841 | end |
||
842 | |||
843 | -- XPerl_Target_SetHealth |
||
844 | function XPerl_Target_SetHealth(unit, frameHealthBar, frameHealthBarBG, frameHealthBarPercent, frameHealthBarText, frameManaBarPercent, bPercent) |
||
845 | local targethealth, targethealthmax = UnitHealth(unit), UnitHealthMax(unit) |
||
846 | local healthPct = targethealth / targethealthmax |
||
847 | |||
848 | frameHealthBar:SetMinMaxValues(0, targethealthmax) |
||
849 | if (XPerlConfig.InverseBars == 1) then |
||
850 | frameHealthBar:SetValue(targethealthmax - targethealth) |
||
851 | else |
||
852 | frameHealthBar:SetValue(targethealth) |
||
853 | end |
||
854 | |||
855 | XPerl_SetSmoothBarColor(frameHealthBar, healthPct) |
||
856 | if (targethealthmax == 100) then |
||
857 | frameHealthBarPercent:SetText(targethealth.."%") |
||
858 | else |
||
859 | frameHealthBarPercent:SetText(string.format("%d",(100*healthPct)+0.5).."%") |
||
860 | end |
||
861 | if (targethealthmax ~= 100) then |
||
862 | if (XPerlConfig.HealerMode == 1) then |
||
863 | if (XPerlConfig.HealerModeType == 1) then |
||
864 | frameHealthBarText:SetText(string.format("%d/%d", targethealth - targethealthmax, targethealthmax)) |
||
865 | else |
||
866 | frameHealthBarText:SetText(targethealth - targethealthmax) |
||
867 | end |
||
868 | else |
||
869 | frameHealthBarText:SetText(targethealth.."/"..targethealthmax) |
||
870 | end |
||
871 | else |
||
872 | -- Hide MobInfo-2 frame |
||
873 | if MobHealthFrame then |
||
874 | MobHealthFrame:Hide() |
||
875 | end |
||
876 | |||
877 | local current, max |
||
878 | if (MobHealth3) then |
||
879 | local found |
||
880 | current, max, found = MobHealth3:GetUnitHealth(unit, targethealth, targethealthmax, UnitName(unit), UnitLevel(unit)) |
||
881 | |||
882 | if (not found) then |
||
883 | current = nil |
||
884 | end |
||
885 | |||
886 | elseif (MobHealthDB) then |
||
887 | local index |
||
888 | if UnitIsPlayer(unit) then |
||
889 | index = UnitName(unit) |
||
890 | else |
||
891 | index = UnitName(unit)..":"..UnitLevel(unit) |
||
892 | end |
||
893 | |||
894 | local table = MobHealthDB |
||
895 | if (not (table and table[index])) then |
||
896 | table = MobHealthPlayerDB |
||
897 | end |
||
898 | if (table and table[index]) then |
||
899 | local s, e |
||
900 | local pts |
||
901 | local pct |
||
902 | |||
903 | if ( type(table[index]) ~= "string" ) then |
||
904 | frameHealthBarText:SetText(targethealth.."%") |
||
905 | end |
||
906 | s, e, pts, pct = strfind(table[index], "^(%d+)/(%d+)$") |
||
907 | |||
908 | if ( pts and pct ) then |
||
909 | pts = pts + 0 |
||
910 | pct = pct + 0 |
||
911 | if( pct ~= 0 ) then |
||
912 | pointsPerPct = pts / pct |
||
913 | else |
||
914 | pointsPerPct = 0 |
||
915 | end |
||
916 | end |
||
917 | local currentPct = UnitHealth(unit) |
||
918 | if ( pointsPerPct > 0 ) then |
||
919 | current = (currentPct * pointsPerPct) + 0.5 |
||
920 | max = (100 * pointsPerPct) + 0.5 |
||
921 | end |
||
922 | end |
||
923 | end |
||
924 | |||
925 | if (current) then |
||
926 | if (XPerlConfig.HealerMode == 1) then |
||
927 | if (XPerlConfig.HealerModeType == 1) then |
||
928 | if (max > 100000) then |
||
929 | frameHealthBarText:SetText(string.format("%d%s/%d%s", (current - max) / XPERL_LOC_LARGENUMDIV, XPERL_LOC_LARGENUMTAG, max / XPERL_LOC_LARGENUMDIV, XPERL_LOC_LARGENUMTAG)) |
||
930 | else |
||
931 | frameHealthBarText:SetText(string.format("%d/%d", current - max, max)) |
||
932 | end |
||
933 | else |
||
934 | if (max > 100000) then |
||
935 | frameHealthBarText:SetText(string.format("%d%s", (current - max) / XPERL_LOC_LARGENUMDIV, XPERL_LOC_LARGENUMTAG)) |
||
936 | else |
||
937 | frameHealthBarText:SetText(string.format("%d", current - max)) |
||
938 | end |
||
939 | end |
||
940 | else |
||
941 | if (max > 100000) then |
||
942 | frameHealthBarText:SetText(string.format("%.1f%s/%.1f%s", current / XPERL_LOC_LARGENUMDIV, XPERL_LOC_LARGENUMTAG, max / XPERL_LOC_LARGENUMDIV, XPERL_LOC_LARGENUMTAG)) |
||
943 | else |
||
944 | frameHealthBarText:SetText(string.format("%d/%d", current, max)) |
||
945 | end |
||
946 | end |
||
947 | else |
||
948 | frameHealthBarText:SetText(targethealth.."%") |
||
949 | end |
||
950 | end |
||
951 | |||
952 | if (bPercent == 1) then |
||
953 | if (UnitIsGhost(unit)) then |
||
954 | frameManaBarPercent:Hide() |
||
955 | frameHealthBarPercent:SetText(XPERL_LOC_GHOST) |
||
956 | elseif (UnitIsDead(unit)) then |
||
957 | frameManaBarPercent:Hide() |
||
958 | frameHealthBarPercent:SetText(XPERL_LOC_DEAD) |
||
959 | elseif (UnitExists(unit) and not UnitIsConnected(unit)) then |
||
960 | frameManaBarPercent:Hide() |
||
961 | frameHealthBarPercent:SetText(XPERL_LOC_OFFLINE) |
||
962 | end |
||
963 | else |
||
964 | if (UnitIsGhost(unit)) then |
||
965 | frameHealthBarText:SetText(XPERL_LOC_GHOST) |
||
966 | elseif (UnitIsDead(unit)) then |
||
967 | frameHealthBarText:SetText(XPERL_LOC_DEAD) |
||
968 | elseif (UnitExists(unit) and not UnitIsConnected(unit)) then |
||
969 | frameHealthBarText:SetText(XPERL_LOC_OFFLINE) |
||
970 | end |
||
971 | end |
||
972 | end |
||
973 | |||
974 | -- XPerl_Target_Update_Control |
||
975 | local function XPerl_Target_Update_Control() |
||
976 | if (UnitIsVisible("target") and UnitIsCharmed("target")) then |
||
977 | XPerl_Target_NameFrame_Warning:Show() |
||
978 | else |
||
979 | XPerl_Target_NameFrame_Warning:Hide() |
||
980 | end |
||
981 | end |
||
982 | |||
983 | -- XPerl_Target_Update_Combat |
||
984 | function XPerl_Target_Update_Combat() |
||
985 | if (UnitAffectingCombat("target")) then |
||
986 | XPerl_Target_NameFrame_ActivityStatus:Show() |
||
987 | else |
||
988 | XPerl_Target_NameFrame_ActivityStatus:Hide() |
||
989 | end |
||
990 | end |
||
991 | |||
992 | -- XPerl_Target_CombatFlash |
||
993 | local function XPerl_Target_CombatFlash(elapsed, argNew, argGreen) |
||
994 | if (XPerl_CombatFlashSet (elapsed, XPerl_Target, argNew, argGreen)) then |
||
995 | XPerl_CombatFlashSetFrames(XPerl_Target) |
||
996 | end |
||
997 | end |
||
998 | |||
999 | -- XPerl_Target_Udpate_Range |
||
1000 | function XPerl_Target_Udpate_Range() |
||
1001 | if (XPerlConfig.Show30YardSymbol == 0 or CheckInteractDistance("target", 4) or not UnitIsConnected("target")) then |
||
1002 | XPerl_Target_NameFrame_RangeStatus:Hide() |
||
1003 | else |
||
1004 | XPerl_Target_NameFrame_RangeStatus:Show() |
||
1005 | XPerl_Target_NameFrame_RangeStatus:SetAlpha(1) |
||
1006 | end |
||
1007 | end |
||
1008 | |||
1009 | -- XPerl_Target_UpdateLeader |
||
1010 | local function XPerl_Target_UpdateLeader() |
||
1011 | local leader |
||
1012 | if (UnitIsUnit("target", "player")) then |
||
1013 | leader = IsPartyLeader() |
||
1014 | |||
1015 | elseif (UnitInRaid("target")) then |
||
1016 | local find = UnitName("target") |
||
1017 | for i = 1,GetNumRaidMembers() do |
||
1018 | local name, rank = GetRaidRosterInfo(i) |
||
1019 | if (name == find) then |
||
1020 | leader = (rank == 2) |
||
1021 | break |
||
1022 | end |
||
1023 | end |
||
1024 | |||
1025 | elseif (UnitInParty("target")) then |
||
1026 | local index = GetPartyLeaderIndex() |
||
1027 | if (index > 0) then |
||
1028 | leader = UnitIsUnit("target", "party"..index) |
||
1029 | end |
||
1030 | end |
||
1031 | |||
1032 | if (leader) then |
||
1033 | XPerl_Target_NameFrame_LeaderIcon:Show() |
||
1034 | else |
||
1035 | XPerl_Target_NameFrame_LeaderIcon:Hide() |
||
1036 | end |
||
1037 | end |
||
1038 | |||
1039 | -- XPerl_Target_UpdateMasterLooter |
||
1040 | -- We can't determine who is master looter in raid if not in current party... :( |
||
1041 | local function XPerl_Target_UpdateMasterLooter() |
||
1042 | local ml |
||
1043 | local method, index = GetLootMethod() |
||
1044 | |||
1045 | if (method == "master" and index) then |
||
1046 | if (index == 0 and UnitIsUnit("player", "target")) then |
||
1047 | ml = true |
||
1048 | elseif (index >= 1 and index <= 4) then |
||
1049 | ml = UnitIsUnit("target", "party"..index) |
||
1050 | end |
||
1051 | end |
||
1052 | |||
1053 | if (ml) then |
||
1054 | XPerl_Target_NameFrame_MasterIcon:Show() |
||
1055 | else |
||
1056 | XPerl_Target_NameFrame_MasterIcon:Hide() |
||
1057 | end |
||
1058 | end |
||
1059 | |||
1060 | -- XPerl_Target_UpdateDisplay |
||
1061 | function XPerl_Target_UpdateDisplay() |
||
1062 | if (UnitExists("target")) then |
||
1063 | this.lastTarget = UnitName("target") |
||
1064 | this.lastDeathMsg = "" |
||
1065 | XPerl_CancelFade(XPerl_Target) |
||
1066 | |||
1067 | XPerl_Target:Show() |
||
1068 | XPerl_Target_UpdateName() |
||
1069 | XPerl_Target_UpdateLeader() |
||
1070 | XPerl_Target_UpdateMasterLooter() |
||
1071 | XPerl_Target_UpdateLevel() |
||
1072 | XPerl_Target_UpdateClassification() |
||
1073 | XPerl_Target_UpdateType() |
||
1074 | XPerl_Target_UpdatePVP() |
||
1075 | XPerl_Target_UpdateCombo() |
||
1076 | XPerl_Target_UpdateManaType() |
||
1077 | XPerl_Target_UpdateMana() |
||
1078 | XPerl_Target_UpdateHealth() |
||
1079 | XPerl_Target_Update_Control() |
||
1080 | XPerl_Target_Update_Combat() |
||
1081 | |||
1082 | -- Work out where all our buffs can fit, we only do this for a fresh target |
||
1083 | XPerl_Targets_BuffPositions("target", "XPerl_Target_", XPerl_Target) |
||
1084 | XPerl_Targets_BuffUpdate("target", "XPerl_Target_", XPerl_Target) |
||
1085 | |||
1086 | XPerl_Target_DebuffUpdate() |
||
1087 | XPerl_Target_Events:RAID_TARGET_UPDATE() |
||
1088 | |||
1089 | if (not UnitIsConnected("target")) then |
||
1090 | XPerl_Target:SetAlpha(XPerlConfig.Transparency / 2) |
||
1091 | else |
||
1092 | XPerl_Target:SetAlpha(XPerlConfig.Transparency) |
||
1093 | end |
||
1094 | |||
1095 | if (TargetFrame) then |
||
1096 | TargetFrame:Hide(); -- Hide default frame |
||
1097 | end |
||
1098 | |||
1099 | if (XPerlConfig.BlizzardCPMeter~=1) then |
||
1100 | ComboFrame:Hide(); -- Hide Combo Points |
||
1101 | end |
||
1102 | else |
||
1103 | if (this.lastDeathMsg ~= nil and this.lastTarget ~= nil) then |
||
1104 | if (strfind (this.lastDeathMsg, this.lastTarget)) then |
||
1105 | XPerl_Target_UpdateCombo() |
||
1106 | this.lastDeathMsg = "" |
||
1107 | XPerl_Target_StatsFrame_HealthBar:SetMinMaxValues(0, 1) |
||
1108 | XPerl_Target_StatsFrame_HealthBar:SetValue(0) |
||
1109 | XPerl_Target_StatsFrame_ManaBar:SetMinMaxValues(0, 1) |
||
1110 | XPerl_Target_StatsFrame_ManaBar:SetValue(0) |
||
1111 | XPerl_SetSmoothBarColor (XPerl_Target_StatsFrame_HealthBar, 0) |
||
1112 | |||
1113 | local oldhp = XPerl_Target_StatsFrame_HealthBarText:GetText() |
||
1114 | if (strfind(oldhp, "/")) then |
||
1115 | oldhp = string.gsub(oldhp, "%d+/(%d+)", "0/%1") |
||
1116 | XPerl_Target_StatsFrame_HealthBarText:SetText(oldhp) |
||
1117 | else |
||
1118 | XPerl_Target_StatsFrame_HealthBarText:SetText("0%") |
||
1119 | end |
||
1120 | |||
1121 | local oldmana = XPerl_Target_StatsFrame_ManaBarText:GetText() |
||
1122 | if (strfind(oldmana, "/")) then |
||
1123 | oldmana = string.gsub(oldmana, "%d+/(%d+)", "0/%1") |
||
1124 | XPerl_Target_StatsFrame_ManaBarText:SetText(oldmana) |
||
1125 | else |
||
1126 | XPerl_Target_StatsFrame_ManaBarText:SetText("0%") |
||
1127 | end |
||
1128 | |||
1129 | XPerl_Target_StatsFrame_HealthBarPercent:SetText(XPERL_LOC_DEAD) |
||
1130 | end |
||
1131 | end |
||
1132 | |||
1133 | XPerl_StartFade(XPerl_Target) |
||
1134 | if (XPerl_Target_StatsFrame_HealthBarPercent:GetText() == XPERL_LOC_OFFLINE) then |
||
1135 | XPerl_Target.FadeTime = 0.5 |
||
1136 | end |
||
1137 | end |
||
1138 | end |
||
1139 | |||
1140 | -------------------- |
||
1141 | -- Click Handlers -- |
||
1142 | -------------------- |
||
1143 | function XPerl_Target_OnClick(button) |
||
1144 | -- If player clicks the target frame while it's fading away. no actual target, but we can get that back: |
||
1145 | if (not UnitName("target")) then |
||
1146 | TargetLastTarget() |
||
1147 | end |
||
1148 | |||
1149 | if (XPerl_OnClick_Handler(button, "target")) then |
||
1150 | return |
||
1151 | end |
||
1152 | |||
1153 | if (button == "RightButton") then |
||
1154 | HideDropDownMenu(1) |
||
1155 | ToggleDropDownMenu(1, nil, TargetFrameDropDown, "XPerl_Target_StatsFrame", 0, 0) |
||
1156 | end |
||
1157 | end |
||
1158 | |||
1159 | -- XPerl_Target_OnUpdate |
||
1160 | function XPerl_Target_OnUpdate() |
||
1161 | CombatFeedback_OnUpdate(arg1) |
||
1162 | |||
1163 | if (this.Fading == 0) then |
||
1164 | XPerl_Target_Udpate_Range() |
||
1165 | if (this.PlayerFlash) then |
||
1166 | XPerl_Target_CombatFlash(arg1, false) |
||
1167 | end |
||
1168 | else |
||
1169 | XPerl_ProcessFade(XPerl_Target) |
||
1170 | end |
||
1171 | end |
||
1172 | |||
1173 | ------------------- |
||
1174 | -- Event Handler -- |
||
1175 | ------------------- |
||
1176 | function XPerl_Target_OnEvent() |
||
1177 | local func = XPerl_Target_Events[event] |
||
1178 | if (func) then |
||
1179 | func() |
||
1180 | else |
||
1181 | XPerl_ShowMessage("EXTRA EVENT") |
||
1182 | end |
||
1183 | end |
||
1184 | |||
1185 | -- PLAYER_ENTERING_WORLD |
||
1186 | function XPerl_Target_Events:PLAYER_ENTERING_WORLD() |
||
1187 | XPerl_Target_RegisterSome() |
||
1188 | end |
||
1189 | |||
1190 | -- VARIABLES_LOADED |
||
1191 | function XPerl_Target_Events:VARIABLES_LOADED() |
||
1192 | XPerl_Target_RegisterSome() |
||
1193 | end |
||
1194 | |||
1195 | -- PLAYER_LEAVING_WORLD |
||
1196 | function XPerl_Target_Events:PLAYER_LEAVING_WORLD() |
||
1197 | XPerl_Target.Fading = 0 |
||
1198 | XPerl_Target.lastTarget = 0 |
||
1199 | XPerl_Target:Hide() |
||
1200 | XPerl_Target_UnregisterSome() |
||
1201 | end |
||
1202 | |||
1203 | -- UNIT_COMBAT |
||
1204 | function XPerl_Target_Events:UNIT_COMBAT() |
||
1205 | if (arg1 == "target") then |
||
1206 | XPerl_Target_Update_Combat() |
||
1207 | |||
1208 | if (XPerlConfig.CombatHitIndicator == 1 and XPerlConfig.ShowTargetPortrait == 1) then |
||
1209 | CombatFeedback_OnCombatEvent(arg2, arg3, arg4, arg5) |
||
1210 | end |
||
1211 | |||
1212 | if (arg2 == "HEAL") then |
||
1213 | XPerl_Target_CombatFlash(0, true, true) |
||
1214 | elseif (arg4 and arg4 > 0) then |
||
1215 | XPerl_Target_CombatFlash(0, true) |
||
1216 | end |
||
1217 | end |
||
1218 | end |
||
1219 | |||
1220 | -- UNIT_SPELLMISS |
||
1221 | function XPerl_Target_Events:UNIT_SPELLMISS() |
||
1222 | if (arg1 == "target") then |
||
1223 | if (XPerlConfig.CombatHitIndicator == 1 and XPerlConfig.ShowTargetPortrait == 1) then |
||
1224 | CombatFeedback_OnSpellMissEvent(arg2) |
||
1225 | end |
||
1226 | end |
||
1227 | end |
||
1228 | |||
1229 | -- PLAYER_TARGET_CHANGED |
||
1230 | function XPerl_Target_Events:PLAYER_TARGET_CHANGED() |
||
1231 | XPerl_Target.PlayerFlash = 0 |
||
1232 | XPerl_Target_CombatFlash(0, false) |
||
1233 | XPerl_Target_UpdateDisplay() |
||
1234 | XPerl_Target_UpdatePortrait() |
||
1235 | return |
||
1236 | end |
||
1237 | |||
1238 | -- UNIT_HEALTH, UNIT_MAXHEALTH |
||
1239 | function XPerl_Target_Events:UNIT_HEALTH() |
||
1240 | if (arg1 == "target") then |
||
1241 | XPerl_Target_UpdateHealth() |
||
1242 | end |
||
1243 | end |
||
1244 | XPerl_Target_Events.UNIT_MAXHEALTH = XPerl_Target_Events.UNIT_HEALTH |
||
1245 | |||
1246 | -- UNIT_DYNAMIC_FLAGS |
||
1247 | function XPerl_Target_Events:UNIT_DYNAMIC_FLAGS() |
||
1248 | if (arg1 == "target") then |
||
1249 | XPerl_Target_UpdateName() |
||
1250 | XPerl_Target_Update_Control() |
||
1251 | XPerl_Target_Update_Combat() |
||
1252 | end |
||
1253 | end |
||
1254 | |||
1255 | XPerl_Target_Events.UNIT_FLAGS = XPerl_Target_Events.UNIT_DYNAMIC_FLAGS |
||
1256 | |||
1257 | function XPerl_Target_Events:RAID_TARGET_UPDATE() |
||
1258 | XPerl_Update_RaidIcon("target", XPerl_Target_NameFrame_RaidIcon) |
||
1259 | |||
1260 | XPerl_Target_NameFrame_RaidIcon:ClearAllPoints() |
||
1261 | if (XPerlConfig.AlternateRaidIcon == 1) then |
||
1262 | XPerl_Target_NameFrame_RaidIcon:SetHeight(16) |
||
1263 | XPerl_Target_NameFrame_RaidIcon:SetWidth(16) |
||
1264 | XPerl_Target_NameFrame_RaidIcon:SetPoint("CENTER", XPerl_Target_NameFrame, "TOPRIGHT", -5, -4) |
||
1265 | else |
||
1266 | XPerl_Target_NameFrame_RaidIcon:SetHeight(32) |
||
1267 | XPerl_Target_NameFrame_RaidIcon:SetWidth(32) |
||
1268 | XPerl_Target_NameFrame_RaidIcon:SetPoint("CENTER", XPerl_Target_NameFrame, "CENTER", 0, 0) |
||
1269 | end |
||
1270 | end |
||
1271 | |||
1272 | -- UNIT_MANA, UNIT_MAXMANA, UNIT_RAGE, UNIT_MAXRAGE, UNIT_ENERGY |
||
1273 | -- UNIT_MAXENERGY, UNIT_FOCUS, UNIT_MAXFOCUS |
||
1274 | function XPerl_Target_Events:UNIT_MANA() |
||
1275 | if (arg1 == "target") then |
||
1276 | XPerl_Target_UpdateMana() |
||
1277 | end |
||
1278 | end |
||
1279 | XPerl_Target_Events.UNIT_MAXMANA = XPerl_Target_Events.UNIT_MANA |
||
1280 | XPerl_Target_Events.UNIT_RAGE = XPerl_Target_Events.UNIT_MANA |
||
1281 | XPerl_Target_Events.UNIT_MAXRAGE = XPerl_Target_Events.UNIT_MANA |
||
1282 | XPerl_Target_Events.UNIT_ENERGY = XPerl_Target_Events.UNIT_MANA |
||
1283 | XPerl_Target_Events.UNIT_MAXENERGY = XPerl_Target_Events.UNIT_MANA |
||
1284 | XPerl_Target_Events.UNIT_FOCUS = XPerl_Target_Events.UNIT_MANA |
||
1285 | XPerl_Target_Events.UNIT_MAXFOCUS = XPerl_Target_Events.UNIT_MANA |
||
1286 | |||
1287 | -- UNIT_DISPLAYPOWER |
||
1288 | function XPerl_Target_Events:UNIT_DISPLAYPOWER() |
||
1289 | if (arg1 == "target") then |
||
1290 | XPerl_Target_UpdateManaType() |
||
1291 | XPerl_Target_UpdateMana() |
||
1292 | end |
||
1293 | end |
||
1294 | |||
1295 | -- UNIT_MODEL_CHANGED |
||
1296 | function XPerl_Target_Events:UNIT_MODEL_CHANGED() |
||
1297 | if (arg1 == "target") then |
||
1298 | XPerl_Target_UpdatePortrait() |
||
1299 | end |
||
1300 | end |
||
1301 | --XPerl_Target_Events.UNIT_PORTRAIT_UPDATE = XPerl_Target_Events.UNIT_MODEL_CHANGED |
||
1302 | |||
1303 | -- UNIT_NAME_UPDATE |
||
1304 | function XPerl_Target_Events:UNIT_NAME_UPDATE() |
||
1305 | if (arg1 == "target") then |
||
1306 | XPerl_Target_UpdateName() |
||
1307 | end |
||
1308 | end |
||
1309 | |||
1310 | -- UNIT_LEVEL |
||
1311 | function XPerl_Target_Events:UNIT_LEVEL() |
||
1312 | if (arg1 == "target") then |
||
1313 | XPerl_Target_UpdateLevel() |
||
1314 | end |
||
1315 | end |
||
1316 | |||
1317 | -- UNIT_CLASSIFICATION_CHANGED |
||
1318 | function XPerl_Target_Events:UNIT_CLASSIFICATION_CHANGED() |
||
1319 | if (arg1 == "target") then |
||
1320 | XPerl_Target_UpdateClassification() |
||
1321 | end |
||
1322 | end |
||
1323 | |||
1324 | -- PLAYER_COMBO_POINTS |
||
1325 | function XPerl_Target_Events:PLAYER_COMBO_POINTS() |
||
1326 | XPerl_Target_UpdateCombo() |
||
1327 | end |
||
1328 | |||
1329 | -- UNIT_AURA |
||
1330 | function XPerl_Target_Events:UNIT_AURA() |
||
1331 | if (arg1 == "target") then |
||
1332 | if (not XPerl_Target.perlBuffs or XPerl_UnitBuff("target", XPerl_Target.perlBuffs + 1, XPerlConfig.TargetCastableBuffs)) then |
||
1333 | XPerl_Targets_BuffPositions("target", "XPerl_Target_", XPerl_Target) |
||
1334 | elseif (XPerl_UnitDebuff("target", XPerl_Target.perlDebuffs + 1, XPerlConfig.TargetCastableBuffs)) then |
||
1335 | XPerl_Targets_BuffPositions("target", "XPerl_Target_", XPerl_Target) |
||
1336 | end |
||
1337 | |||
1338 | XPerl_Targets_BuffUpdate("target", "XPerl_Target_", XPerl_Target) |
||
1339 | XPerl_Target_DebuffUpdate() |
||
1340 | end |
||
1341 | end |
||
1342 | |||
1343 | -- UNIT_FACTION |
||
1344 | function XPerl_Target_Events:UNIT_FACTION() |
||
1345 | if (arg1 == "target") then |
||
1346 | XPerl_Target_UpdatePVP() |
||
1347 | XPerl_Target_Update_Control() |
||
1348 | XPerl_Targets_BuffPositions("target", "XPerl_Target_", XPerl_Target) |
||
1349 | end |
||
1350 | end |
||
1351 | |||
1352 | -- PLAYER_FLAGS_CHANGED |
||
1353 | function XPerl_Target_Events:PLAYER_FLAGS_CHANGED() |
||
1354 | XPerl_Target_Update_Combat() |
||
1355 | XPerl_Target_UpdatePVP() |
||
1356 | XPerl_Target_UpdateHealth() |
||
1357 | |||
1358 | end |
||
1359 | |||
1360 | -- CHAT_MSG_COMBAT_HOSTILE_DEATH |
||
1361 | function XPerl_Target_Events:CHAT_MSG_COMBAT_HOSTILE_DEATH() |
||
1362 | if (strfind(arg1, this.lastTarget)) then |
||
1363 | this.lastDeathMsg = arg1 |
||
1364 | end |
||
1365 | end |
||
1366 | |||
1367 | -- PARTY_MEMBER_ENABLE |
||
1368 | function XPerl_Target_Events:PARTY_MEMBER_ENABLE() |
||
1369 | if (UnitInParty("target") or UnitInRaid("target")) then |
||
1370 | XPerl_Target_Update_Combat() |
||
1371 | XPerl_Target_UpdatePVP() |
||
1372 | XPerl_Target_UpdateHealth() |
||
1373 | end |
||
1374 | end |
||
1375 | |||
1376 | XPerl_Target_Events.PARTY_MEMBER_DISABLE = XPerl_Target_Events.PARTY_MEMBER_ENABLE |
||
1377 | |||
1378 | -- PARTY_LOOT_METHOD_CHANGED |
||
1379 | function XPerl_Target_Events:PARTY_LOOT_METHOD_CHANGED() |
||
1380 | XPerl_Target_UpdateLeader() |
||
1381 | XPerl_Target_UpdateMasterLooter() |
||
1382 | end |
||
1383 | XPerl_Target_Events.PARTY_MEMBERS_CHANGED = XPerl_Target_Events.PARTY_LOOT_METHOD_CHANGED |
||
1384 | XPerl_Target_Events.PARTY_LEADER_CHANGED = XPerl_Target_Events.PARTY_LOOT_METHOD_CHANGED |
||
1385 | |||
1386 | -- XPerl_Target_Set_Bits |
||
1387 | function XPerl_Target_Set_Bits() |
||
1388 | if (XPerlConfig.ShowTargetPortrait==0) then |
||
1389 | XPerl_Target_PortraitFrame:Hide() |
||
1390 | XPerl_Target_PortraitFrame:SetWidth(2) |
||
1391 | XPerl_Target:SetWidth(160) |
||
1392 | else |
||
1393 | XPerl_Target_PortraitFrame:Show() |
||
1394 | XPerl_Target_PortraitFrame:SetWidth(60) |
||
1395 | XPerl_Target:SetWidth(220) |
||
1396 | |||
1397 | XPerl_Target_UpdatePortrait() |
||
1398 | end |
||
1399 | |||
1400 | if (XPerlConfig.ShowTargetPercent==0) then |
||
1401 | XPerl_Target_NameFrame:SetWidth(128) |
||
1402 | XPerl_Target_StatsFrame:SetWidth(128) |
||
1403 | XPerl_Target_StatsFrame_HealthBarPercent:Hide() |
||
1404 | XPerl_Target_StatsFrame_ManaBarPercent:Hide() |
||
1405 | else |
||
1406 | XPerl_Target_NameFrame:SetWidth(160) |
||
1407 | XPerl_Target_StatsFrame:SetWidth(160) |
||
1408 | XPerl_Target_StatsFrame_HealthBarPercent:Show() |
||
1409 | XPerl_Target_StatsFrame_ManaBarPercent:Show() |
||
1410 | end |
||
1411 | |||
1412 | if (XPerlConfig.ShowTargetLevel==0) then |
||
1413 | XPerl_Target_LevelFrame:Hide() |
||
1414 | else |
||
1415 | XPerl_Target_LevelFrame:Show() |
||
1416 | end |
||
1417 | |||
1418 | if (XPerlConfig.ShowTargetClassIcon==0) then |
||
1419 | XPerl_Target_TypeFramePlayer_ClassTexture:Hide() |
||
1420 | else |
||
1421 | XPerl_Target_TypeFramePlayer_ClassTexture:Show() |
||
1422 | end |
||
1423 | |||
1424 | if (XPerlConfig.ShowTargetPVPRank == 0) then |
||
1425 | XPerl_Target_NameFrame_PVPRankIcon:Hide() |
||
1426 | else |
||
1427 | XPerl_Target_NameFrame_PVPRankIcon:Show() |
||
1428 | end |
||
1429 | |||
1430 | XPerlConfig.TargetBuffSize = tonumber(XPerlConfig.TargetBuffSize) or 20 |
||
1431 | XPerl_SetBuffSize("XPerl_Target_", XPerlConfig.TargetBuffSize, XPerlConfig.TargetBuffSize * 1.2) |
||
1432 | end |
||
1433 | |||
1434 | -- Using the Blizzard Combo Point frame, but we move the buttons around a little |
||
1435 | function XPerl_Target_Set_BlizzCPFrame() |
||
1436 | ComboFrame:ClearAllPoints() |
||
1437 | ComboPoint1:ClearAllPoints() |
||
1438 | ComboPoint2:ClearAllPoints() |
||
1439 | ComboPoint3:ClearAllPoints() |
||
1440 | ComboPoint4:ClearAllPoints() |
||
1441 | ComboPoint5:ClearAllPoints() |
||
1442 | |||
1443 | if (XPerlConfig.BlizzardCPMeter == 1) then |
||
1444 | -- This setup will put the buttons along the top of the portrait frame |
||
1445 | |||
1446 | ComboFrame:SetScale(XPerlConfig.Scale_TargetFrame) |
||
1447 | |||
1448 | if (XPerlConfig.BlizzardCPPosition == "top") then |
||
1449 | ComboFrame:SetPoint("TOPLEFT", XPerl_Target_PortraitFrame, "TOPLEFT", -1, 4) |
||
1450 | ComboPoint1:SetPoint("TOPLEFT", 0, 0) |
||
1451 | ComboPoint2:SetPoint("LEFT", ComboPoint1, "RIGHT", 0, 1) |
||
1452 | ComboPoint3:SetPoint("LEFT", ComboPoint2, "RIGHT", 0, 1) |
||
1453 | ComboPoint4:SetPoint("LEFT", ComboPoint3, "RIGHT", 0, -1) |
||
1454 | ComboPoint5:SetPoint("LEFT", ComboPoint4, "RIGHT", 0, -4) |
||
1455 | |||
1456 | elseif (XPerlConfig.BlizzardCPPosition == "bottom") then |
||
1457 | ComboFrame:SetPoint("BOTTOMLEFT", XPerl_Target_PortraitFrame, "BOTTOMLEFT", -1, -4) |
||
1458 | ComboPoint1:SetPoint("BOTTOMLEFT", 0, 0) |
||
1459 | ComboPoint2:SetPoint("LEFT", ComboPoint1, "RIGHT", 0, -1) |
||
1460 | ComboPoint3:SetPoint("LEFT", ComboPoint2, "RIGHT", 0, -1) |
||
1461 | ComboPoint4:SetPoint("LEFT", ComboPoint3, "RIGHT", 0, 1) |
||
1462 | ComboPoint5:SetPoint("LEFT", ComboPoint4, "RIGHT", 0, -1) |
||
1463 | |||
1464 | elseif (XPerlConfig.BlizzardCPPosition == "left") then |
||
1465 | ComboFrame:SetPoint("BOTTOMLEFT", XPerl_Target_PortraitFrame, "BOTTOMLEFT", -1, 0) |
||
1466 | ComboPoint1:SetPoint("BOTTOMLEFT", 0, 0) |
||
1467 | ComboPoint2:SetPoint("BOTTOM", ComboPoint1, "TOP", -1, 0) |
||
1468 | ComboPoint3:SetPoint("BOTTOM", ComboPoint2, "TOP", -1, 0) |
||
1469 | ComboPoint4:SetPoint("BOTTOM", ComboPoint3, "TOP", 1, 0) |
||
1470 | ComboPoint5:SetPoint("BOTTOM", ComboPoint4, "TOP", 3, -5) |
||
1471 | |||
1472 | elseif (XPerlConfig.BlizzardCPPosition == "right") then |
||
1473 | ComboFrame:SetPoint("BOTTOMRIGHT", XPerl_Target_PortraitFrame, "BOTTOMRIGHT", 2, 0) |
||
1474 | ComboPoint1:SetPoint("BOTTOMRIGHT", 0, 0) |
||
1475 | ComboPoint2:SetPoint("BOTTOM", ComboPoint1, "TOP", 1, 0) |
||
1476 | ComboPoint3:SetPoint("BOTTOM", ComboPoint2, "TOP", 1, 0) |
||
1477 | ComboPoint4:SetPoint("BOTTOM", ComboPoint3, "TOP", -1, 0) |
||
1478 | ComboPoint5:SetPoint("BOTTOM", ComboPoint4, "TOP", 0, -5) |
||
1479 | |||
1480 | end |
||
1481 | |||
1482 | ComboFrame:RegisterEvent("PLAYER_TARGET_CHANGED") |
||
1483 | ComboFrame:RegisterEvent("PLAYER_COMBO_POINTS") |
||
1484 | else |
||
1485 | -- Not using blizzard's, and we'll put the buttons back where they were |
||
1486 | --[[ No reason to do this, so commented |
||
1487 | |||
1488 | ComboFrame:SetPoint("TOPRIGHT", TargetFrame, "TOPRIGHT", -44, -9) |
||
1489 | |||
1490 | ComboPoint1:SetPoint("TOPRIGHT", 0, 0) |
||
1491 | ComboPoint2:SetPoint("TOP", ComboPoint1, "BOTTOM", 7, 4) |
||
1492 | ComboPoint3:SetPoint("TOP", ComboPoint2, "BOTTOM", 5, 2) |
||
1493 | ComboPoint4:SetPoint("TOP", ComboPoint3, "BOTTOM", 2, 1) |
||
1494 | ComboPoint5:SetPoint("TOP", ComboPoint4, "BOTTOM", 0, 1) |
||
1495 | |||
1496 | ComboFrame:SetScale(1) |
||
1497 | ]] |
||
1498 | ComboFrame:Hide() |
||
1499 | |||
1500 | ComboFrame:UnregisterEvent("PLAYER_TARGET_CHANGED") |
||
1501 | ComboFrame:UnregisterEvent("PLAYER_COMBO_POINTS") |
||
1502 | end |
||
1503 | end |