vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | local Moog_HudClass = { |
2 | [MOOGHUD_CLASS_MAGE] = "00FFFF", |
||
3 | [MOOGHUD_CLASS_WARLOCK] = "8D54FB", |
||
4 | [MOOGHUD_CLASS_PRIEST] = "FFFFFF", |
||
5 | [MOOGHUD_CLASS_DRUID] = "FF8A00", |
||
6 | [MOOGHUD_CLASS_SHAMAN] = "FF71A8", |
||
7 | [MOOGHUD_CLASS_PALADIN] = "FF71A8", |
||
8 | [MOOGHUD_CLASS_ROGUE] = "FFFF00", |
||
9 | [MOOGHUD_CLASS_HUNTER] = "00FF00", |
||
10 | [MOOGHUD_CLASS_WARRIOR] = "B39442", |
||
11 | }; |
||
12 | |||
13 | local Moog_HudRep = { "FF4444", "DD4444", "DD7744", "BB9944", "44DD44", "55EE44", "66FF44"}; |
||
14 | |||
15 | function GetArgs(message, separator) |
||
16 | |||
17 | local args = {}; |
||
18 | |||
19 | local i = 0; |
||
20 | |||
21 | for value in string.gfind(message, "[^"..separator.."]+") do |
||
22 | i = i + 1; |
||
23 | args[i] = value; |
||
24 | end |
||
25 | |||
26 | return args; |
||
27 | end |
||
28 | |||
29 | function sr_pr(msg) |
||
30 | DEFAULT_CHAT_FRAME:AddMessage(msg); |
||
31 | end |
||
32 | |||
33 | -- Seal: Added |
||
34 | local function Moog_UpdateCurrentState(unit) |
||
35 | local stateicon = getglobal("Moog_Hud_"..unit.."_StatusTexture"); |
||
36 | local inCombat = this.inCombat; |
||
37 | if (not stateicon) then return; end |
||
38 | if(unit == "target") then |
||
39 | inCombat = UnitAffectingCombat(unit); |
||
40 | end |
||
41 | if(inCombat == 1) then |
||
42 | stateicon:Show(); |
||
43 | stateicon:SetTexCoord(.5625, .9375, .0625, .4375); |
||
44 | elseif(unit == "player" and IsResting()) then |
||
45 | stateicon:Show(); |
||
46 | stateicon:SetTexCoord(.0625, .4375, .0625, .4375); |
||
47 | else |
||
48 | stateicon:Hide(); |
||
49 | end |
||
50 | end |
||
51 | |||
52 | local function Moog_UpdatePvP(unit) |
||
53 | local pvpicon = getglobal("Moog_Hud_"..unit.."_PvPTexture"); |
||
54 | if (not pvpicon) then return; end |
||
55 | local factionGroup = UnitFactionGroup(unit); |
||
56 | if ( UnitIsPVPFreeForAll(unit) ) then |
||
57 | pvpicon:SetTexture("Interface\\TargetingFrame\\UI-PVP-FFA"); |
||
58 | pvpicon:Show(); |
||
59 | elseif ( factionGroup and UnitIsPVP(unit) ) then |
||
60 | pvpicon:SetTexture("Interface\\TargetingFrame\\UI-PVP-"..factionGroup); |
||
61 | pvpicon:Show(); |
||
62 | else |
||
63 | pvpicon:Hide(); |
||
64 | end |
||
65 | end |
||
66 | |||
67 | local function Moog_UpdatePartyLeader() |
||
68 | if ( IsPartyLeader() and (GetNumPartyMembers() > 0) ) then |
||
69 | Moog_Hud_player_LeaderTexture:Show(); |
||
70 | else |
||
71 | Moog_Hud_player_LeaderTexture:Hide(); |
||
72 | end |
||
73 | end |
||
74 | |||
75 | local function Moog_UpdatePartyLoot() |
||
76 | local lootMethod, lootMaster = GetLootMethod(); |
||
77 | if ((lootMaster == 0)and (GetNumPartyMembers() > 0)) then |
||
78 | Moog_Hud_player_LootTexture:Show(); |
||
79 | else |
||
80 | Moog_Hud_player_LootTexture:Hide(); |
||
81 | end |
||
82 | end |
||
83 | |||
84 | -- Seal: End Add |
||
85 | |||
86 | function Moog_Hud_OnLoad() |
||
87 | SlashCmdList["MOOGHUD"] = Moog_Hud_SlashHandler; |
||
88 | SLASH_MOOGHUD1 = "/moog"; |
||
89 | |||
90 | -- Shen: Events which are needed globally |
||
91 | this:RegisterEvent("PLAYER_ENTERING_WORLD"); |
||
92 | this:RegisterEvent("PLAYER_LEAVING_WORLD"); |
||
93 | this:RegisterEvent("VARIABLES_LOADED"); |
||
94 | |||
95 | Moog_UseMobHealth = false; |
||
96 | |||
97 | Moog_SpellBlinkTime = GetTime(); |
||
98 | |||
99 | table.insert(UnitPopupFrames,"Moog_Player_DropDown"); |
||
100 | table.insert(UnitPopupFrames,"Moog_Target_DropDown"); |
||
101 | |||
102 | --RegisterForSave("MoogHUDInfo"); |
||
103 | |||
104 | sr_pr("Moog HUD v"..MOOGHUD_VERSION.." loaded. Type /moog to bring up options"); |
||
105 | end |
||
106 | |||
107 | function Moog_Hud_SlashHandler(msg) |
||
108 | -- if (msg == nil) then |
||
109 | -- msg = ""; end |
||
110 | |||
111 | local parsedmsg = GetArgs(msg," "); |
||
112 | |||
113 | if (parsedmsg[1] == nil) then |
||
114 | Moogmenu:Show(); |
||
115 | else |
||
116 | parsedmsg[1] = strlower(parsedmsg[1]) |
||
117 | |||
118 | if strfind(parsedmsg[1], "menu") and Moogmenu then |
||
119 | Moogmenu:Show(); |
||
120 | elseif Moogmenu then |
||
121 | Moogmenu:Show(); |
||
122 | end |
||
123 | end |
||
124 | end |
||
125 | |||
126 | function Moog_HudTargetUpdate() |
||
127 | -- Update Combo Points here just to be sure it catches target deaths, etc |
||
128 | local points = GetComboPoints(); |
||
129 | if (points > 0) then |
||
130 | Moog_HudCombo:SetText(points); |
||
131 | else |
||
132 | Moog_HudCombo:SetText(""); |
||
133 | end |
||
134 | |||
135 | if (UnitIsDeadOrGhost("target")) then |
||
136 | Moog_TargetHudHPText:SetTextColor(0.7, 0.7, 0.7); |
||
137 | else |
||
138 | Moog_TargetHudHPText:SetTextColor(1, 0, 0); |
||
139 | end |
||
140 | |||
141 | if (MoogHUDInfo.TargetOn and UnitExists("target")) then |
||
142 | Moog_TargetHud:Show(); |
||
143 | -- Moog_TargetHudHPPerc:SetText(ceil((UnitHealth("target") / UnitHealthMax("target")) * 100).."%"); |
||
144 | |||
145 | if UnitIsDeadOrGhost("target") then |
||
146 | Moog_TargetHudHPText:SetText("Dead"); |
||
147 | elseif ((UnitInParty("target") or UnitIsUnit("target","pet")) and (MoogHUDInfo.PlayerTargetPC == false)) then |
||
148 | Moog_TargetHudHPText:SetText(UnitHealth("target").."/"..UnitHealthMax("target")); |
||
149 | else |
||
150 | if (Moog_UseMobHealth and (MoogHUDInfo.MobTargetPC == false)) then |
||
151 | Moog_TargetHudHPText:SetText(Moog_MobHealth_GetTargetCurHP().."/"..Moog_MobHealth_GetTargetMaxHP()); |
||
152 | else |
||
153 | Moog_TargetHudHPText:SetText(ceil((UnitHealth("target") / UnitHealthMax("target")) * 100).."%"); |
||
154 | end |
||
155 | end |
||
156 | |||
157 | if (UnitManaMax("target") > 0) then |
||
158 | if ((UnitIsPlayer("target") and (MoogHUDInfo.PlayerTargetPC == false)) or ((not UnitIsPlayer("target")) and (MoogHUDInfo.MobTargetPC == false))) then |
||
159 | Moog_TargetHudMPText:SetText(UnitMana("target").."/"..UnitManaMax("target")); |
||
160 | else |
||
161 | Moog_TargetHudMPText:SetText(ceil((UnitMana("target") / UnitManaMax("target")) * 100).."%"); |
||
162 | end |
||
163 | else |
||
164 | Moog_TargetHudMPText:SetText(" "); |
||
165 | end |
||
166 | |||
167 | if (UnitLevel("target") < 0) then |
||
168 | if ( UnitClassification("target") == "worldboss" ) then |
||
169 | Moog_TargetHudLevel:SetText("Boss"); |
||
170 | else |
||
171 | Moog_TargetHudLevel:SetText("L??"); |
||
172 | end |
||
173 | else |
||
174 | if ( string.find(UnitClassification("target"), "elite") == nil ) then |
||
175 | Moog_TargetHudLevel:SetText("L" .. UnitLevel("target")); |
||
176 | else |
||
177 | Moog_TargetHudLevel:SetText("L" .. UnitLevel("target") .. "+"); |
||
178 | end |
||
179 | end |
||
180 | |||
181 | local targetfriend = 1; |
||
182 | |||
183 | if (UnitIsFriend("player","target") == nil) then |
||
184 | targetfriend = 0; end |
||
185 | |||
186 | if (targetfriend == 1) then |
||
187 | Moog_TargetHudLevel:SetTextColor(1, 0.9, 0); |
||
188 | elseif (UnitIsTrivial("target")) then |
||
189 | Moog_TargetHudLevel:SetTextColor(0.7, 0.7, 0.7); |
||
190 | elseif (UnitLevel("target") == -1) then |
||
191 | Moog_TargetHudLevel:SetTextColor(1, 0, 0); |
||
192 | elseif (UnitLevel("target") <= (UnitLevel("player")-3)) then |
||
193 | Moog_TargetHudLevel:SetTextColor(0, 0.9, 0); |
||
194 | elseif (UnitLevel("target") >= (UnitLevel("player")+5)) then |
||
195 | Moog_TargetHudLevel:SetTextColor(1, 0, 0); |
||
196 | elseif (UnitLevel("target") >= (UnitLevel("player")+3)) then |
||
197 | Moog_TargetHudLevel:SetTextColor(1, 0.5, 0); |
||
198 | else |
||
199 | Moog_TargetHudLevel:SetTextColor(1, 0.9, 0); |
||
200 | end |
||
201 | |||
202 | local info = {}; |
||
203 | if (UnitPowerType("target") == 0) then |
||
204 | info = { r = 0.00, g = 0.7, b = 1.00 }; |
||
205 | else |
||
206 | info = ManaBarColor[UnitPowerType("target")]; |
||
207 | end |
||
208 | |||
209 | local class = UnitClass("target"); |
||
210 | local color = Moog_HudClass[class]; |
||
211 | if (UnitIsPlayer("target")) then |
||
212 | if (color) then |
||
213 | Moog_TargetHudName:SetText("|cff"..color..UnitName("target").."|r"); |
||
214 | else |
||
215 | Moog_TargetHudName:SetText("|cffb39442"..UnitName("target").."|r"); |
||
216 | end |
||
217 | else |
||
218 | local reaction = UnitReaction("target","player"); |
||
219 | local reactioncolour = Moog_HudRep[4]; |
||
220 | if (reaction) then |
||
221 | reactioncolour = Moog_HudRep[reaction]; |
||
222 | end |
||
223 | Moog_TargetHudName:SetText("|cff"..reactioncolour..UnitName("target").."|r"); |
||
224 | end |
||
225 | |||
226 | if ((UnitIsPlayer("target") or (MoogHUDInfo.MobClass == true)) and MoogHUDInfo.ShowIcons) then |
||
227 | Moog_Target_ClassTexture:SetTexCoord(Moog_ClassPosRight(class), Moog_ClassPosLeft(class), Moog_ClassPosTop(class), Moog_ClassPosBottom(class)); |
||
228 | Moog_Target_Icon:Show(); |
||
229 | else |
||
230 | Moog_Target_Icon:Hide(); |
||
231 | end |
||
232 | |||
233 | if (UnitIsTapped("target") and not UnitIsTappedByPlayer("target")) then |
||
234 | Moog_TargetHudName:SetTextColor(0.5, 0.5, 0.5); |
||
235 | end |
||
236 | |||
237 | Moog_TargetHudMPText:SetTextColor(info.r, info.g, info.b); |
||
238 | |||
239 | Moog_HudTargetAuras(); |
||
240 | --Seal: Added Update status and pvp |
||
241 | --Moog_UpdatePvP("target"); |
||
242 | --Moog_UpdateCurrentState("target"); |
||
243 | --Seal: End Add |
||
244 | else |
||
245 | Moog_TargetHud:Hide(); |
||
246 | end |
||
247 | end |
||
248 | |||
249 | function Moog_HudTargetAuras() |
||
250 | local i, icon, buff, debuff, debuffborder, debuffcount; |
||
251 | for i = 1, 16 do |
||
252 | buff = UnitBuff("target", i); |
||
253 | button = getglobal("Moog_TargetHudBuff"..i); |
||
254 | if (buff) then |
||
255 | icon = getglobal(button:GetName().."Icon"); |
||
256 | icon:SetTexture(buff); |
||
257 | button:Show(); |
||
258 | button.unit = "target"; |
||
259 | else |
||
260 | button:Hide(); |
||
261 | end |
||
262 | end |
||
263 | |||
264 | for i = 1, 16 do |
||
265 | debuff, debuffApplications = UnitDebuff("target", i); |
||
266 | button = getglobal("Moog_TargetHudDeBuff"..i); |
||
267 | if (debuff) then |
||
268 | icon = getglobal(button:GetName().."Icon"); |
||
269 | debuffborder = getglobal(button:GetName().."Border"); |
||
270 | debuffcount = getglobal(button:GetName().."Count"); |
||
271 | icon:SetTexture(debuff); |
||
272 | button:Show(); |
||
273 | debuffborder:Show(); |
||
274 | button.isdebuff = 1; |
||
275 | button.unit = "target"; |
||
276 | if (debuffApplications > 1) then |
||
277 | debuffcount:SetText(debuffApplications); |
||
278 | debuffcount:Show(); |
||
279 | else |
||
280 | debuffcount:Hide(); |
||
281 | end |
||
282 | else |
||
283 | button:Hide(); |
||
284 | end |
||
285 | end |
||
286 | end |
||
287 | |||
288 | function Moog_HudSetAuraTooltip() |
||
289 | if (not this:IsVisible()) then return; end |
||
290 | GameTooltip:SetOwner(this, "ANCHOR_BOTTOMRIGHT"); |
||
291 | local unit = this.unit; |
||
292 | if (this.isdebuff == 1) then |
||
293 | GameTooltip:SetUnitDebuff(unit, this:GetID()); |
||
294 | else |
||
295 | GameTooltip:SetUnitBuff(unit, this:GetID()); |
||
296 | end |
||
297 | end |
||
298 | |||
299 | function Moog_HudUpdateOptions() |
||
300 | if (MoogHUDInfo.SelfOn) then |
||
301 | Moog_SelfHud:Show(); |
||
302 | else |
||
303 | Moog_SelfHud:Hide(); |
||
304 | end |
||
305 | |||
306 | if (MoogHUDInfo.ShowIcons) then |
||
307 | Moog_Player_Icon:Show(); |
||
308 | else |
||
309 | Moog_Player_Icon:Hide(); |
||
310 | end |
||
311 | |||
312 | if (MoogHUDInfo.Seperation == nil) then |
||
313 | MoogHUDInfo.Seperation = 0; end |
||
314 | |||
315 | Moog_HudLeft:SetPoint("CENTER","Moog_Hud","CENTER", -MoogHUDInfo.Seperation, 0); |
||
316 | Moog_HudRight:SetPoint("CENTER","Moog_Hud","CENTER", MoogHUDInfo.Seperation, 0); |
||
317 | |||
318 | if (MoogHUDInfo.SeperateNumbers == nil) then |
||
319 | MoogHUDInfo.SeperateNumbers = 0; end |
||
320 | |||
321 | local TextOffset = 0; |
||
322 | |||
323 | if (MoogHUDInfo.SeperateNumbers) then |
||
324 | TextOffset=MoogHUDInfo.Seperation; end |
||
325 | |||
326 | Moog_HudHealthText:SetPoint("BOTTOMRIGHT","Moog_HudCombo","TOPLEFT", -TextOffset, 0); |
||
327 | Moog_HudManaText:SetPoint("BOTTOMLEFT","Moog_HudCombo","TOPRIGHT", TextOffset, 0); |
||
328 | |||
329 | --Moog_TargetHudHPText:SetPoint("TOPLEFT","Moog_TargetHudName","BOTTOMLEFT", -TextOffset, -2); |
||
330 | --Moog_TargetHudMPText:SetPoint("TOPRIGHT","Moog_TargetHudName","BOTTOMRIGHT", TextOffset, -2); |
||
331 | |||
332 | if (MoogHUDInfo.VertPos == nil) then |
||
333 | MoogHUDInfo.VertPos = 50; end |
||
334 | |||
335 | Moog_Hud:SetPoint("CENTER","UIParent","CENTER", 0, MoogHUDInfo.VertPos); |
||
336 | |||
337 | Moog_HudTargetUpdate(); |
||
338 | end |
||
339 | |||
340 | function Moog_HudOnEvent(event) |
||
341 | if (event == "VARIABLES_LOADED" ) then |
||
342 | if ( not MoogHUDInfo ) then |
||
343 | MoogHUDInfo = { |
||
344 | ["SelfOn"] = true, |
||
345 | ["Seperation"] = 0, |
||
346 | ["VertPos"] = 50, |
||
347 | ["TargetOn"] = true, |
||
348 | ["MobTargetPC"] = false, |
||
349 | ["PlayerTargetPC"] = false, |
||
350 | ["MobClass"] = false, |
||
351 | ["ShowIcons"] = false, |
||
352 | ["BlinkLongCast"] = true, |
||
353 | ["BlinkInstaCast"] = false, |
||
354 | ["SeperateNumbers"] = false |
||
355 | }; |
||
356 | end |
||
357 | if MoogHUDInfo.SelfOn == nil then |
||
358 | MoogHUDInfo.SelfOn = true; end |
||
359 | if MoogHUDInfo.TargetOn == nil then |
||
360 | MoogHUDInfo.TargetOn = true; end |
||
361 | if MoogHUDInfo.MobTargetPC == nil then |
||
362 | MoogHUDInfo.MobTargetPC = false; end |
||
363 | if MoogHUDInfo.PlayerTargetPC == nil then |
||
364 | MoogHUDInfo.PlayerTargetPC = false; end |
||
365 | if MoogHUDInfo.MobClass == nil then |
||
366 | MoogHUDInfo.MobClass = false; end |
||
367 | if MoogHUDInfo.ShowIcons == nil then |
||
368 | MoogHUDInfo.ShowIcons = false; end |
||
369 | if MoogHUDInfo.BlinkLongCast == nil then |
||
370 | MoogHUDInfo.BlinkLongCast = true; end |
||
371 | if MoogHUDInfo.BlinkInstaCast == nil then |
||
372 | MoogHUDInfo.BlinkInstaCast = false; end |
||
373 | if MoogHUDInfo.SeperateNumbers == nil then |
||
374 | MoogHUDInfo.SeperateNumbers = false; end |
||
375 | if MobHealthFrame then |
||
376 | sr_pr("Moog HUD detected MobHealth/MobInfo"); |
||
377 | Moog_UseMobHealth = true; end |
||
378 | Moog_HudUpdateOptions(); |
||
379 | elseif (event == "PLAYER_ENTERING_WORLD") then |
||
380 | -- Shen: Event hooks moved from OnLoad |
||
381 | --Seal: Added |
||
382 | this:RegisterEvent("PLAYER_ENTER_COMBAT"); |
||
383 | this:RegisterEvent("PLAYER_LEAVE_COMBAT"); |
||
384 | this:RegisterEvent("PLAYER_UPDATE_RESTING"); |
||
385 | this:RegisterEvent("PLAYER_REGEN_DISABLED"); |
||
386 | this:RegisterEvent("PLAYER_REGEN_ENABLED"); |
||
387 | this:RegisterEvent("PARTY_LEADER_CHANGED"); |
||
388 | this:RegisterEvent("PARTY_LOOT_METHOD_CHANGED"); |
||
389 | --Seal: End Add |
||
390 | this:RegisterEvent("PLAYER_COMBO_POINTS"); |
||
391 | this:RegisterEvent("UNIT_AURA"); |
||
392 | this:RegisterEvent("UNIT_HEALTH"); |
||
393 | this:RegisterEvent("UNIT_MAXHEALTH"); |
||
394 | this:RegisterEvent("UNIT_MANA"); |
||
395 | this:RegisterEvent("UNIT_RAGE"); |
||
396 | this:RegisterEvent("UNIT_FOCUS"); |
||
397 | this:RegisterEvent("UNIT_ENERGY"); |
||
398 | this:RegisterEvent("UNIT_MAXMANA"); |
||
399 | this:RegisterEvent("UNIT_MAXRAGE"); |
||
400 | this:RegisterEvent("UNIT_MAXFOCUS"); |
||
401 | this:RegisterEvent("UNIT_MAXENERGY"); |
||
402 | this:RegisterEvent("UNIT_NAME_UPDATE"); |
||
403 | this:RegisterEvent("UNIT_DISPLAYPOWER"); |
||
404 | this:RegisterEvent("PARTY_MEMBERS_CHANGED"); |
||
405 | --Seal: Added |
||
406 | this:RegisterEvent("UNIT_PVP_UPDATE"); |
||
407 | --Seal: End Add |
||
408 | |||
409 | Moog_HealthHud:SetVertexColor(0, 1, 0); |
||
410 | Moog_HealthHud:SetAlpha(0); |
||
411 | Moog_ManaHud:SetAlpha(0); |
||
412 | Moog_ManaHudBG:SetAlpha(0); |
||
413 | Moog_ManaHudBG:SetTexCoord(0, 1, 0, 1); |
||
414 | |||
415 | Moog_HealthHudBG:SetAlpha(0); |
||
416 | Moog_HealthHudBG:SetVertexColor(0, 1, 0); |
||
417 | Moog_HealthHudBG:SetTexCoord(0, 1, 0, 1); |
||
418 | |||
419 | |||
420 | if (UnitPowerType("player") == 0) then |
||
421 | info = { r = 0.00, g = 0.7, b = 1.00 }; |
||
422 | else |
||
423 | info = ManaBarColor[UnitPowerType("player")]; |
||
424 | end |
||
425 | Moog_ManaHud:SetVertexColor(info.r, info.g, info.b); |
||
426 | Moog_ManaHudBG:SetVertexColor(info.r, info.g, info.b); |
||
427 | |||
428 | local p=UnitMana("player")/UnitManaMax("player"); |
||
429 | local h = 256 * p; |
||
430 | Moog_ManaHud:SetHeight(h); |
||
431 | Moog_ManaHud:SetTexCoord(0, 1, 1-p, 1); |
||
432 | Moog_HudManaText:SetText(UnitMana("player").."/"..UnitManaMax("player")); |
||
433 | Moog_HudManaText:SetVertexColor(info.r, info.g, info.b); |
||
434 | |||
435 | if (GetNumPartyMembers() > 0) then |
||
436 | Moog_Player_ClassTexture:SetAlpha(1); |
||
437 | Moog_Player_Icon:EnableMouse(true); |
||
438 | else |
||
439 | Moog_Player_ClassTexture:SetAlpha(0.5); |
||
440 | Moog_Player_Icon:EnableMouse(false); |
||
441 | end |
||
442 | |||
443 | p=UnitHealth("player")/UnitHealthMax("player"); |
||
444 | h = 256 * p; |
||
445 | Moog_HealthHud:SetHeight(h); |
||
446 | Moog_HealthHud:SetTexCoord(0, 1, 1-p, 1); |
||
447 | Moog_HudHealthText:SetText(UnitHealth("player").."/"..UnitHealthMax("player")); |
||
448 | Moog_HudHealthText:SetVertexColor(0, 1, 0); |
||
449 | |||
450 | local PlayerClass = UnitClass("player"); |
||
451 | Moog_Player_ClassTexture:SetTexCoord(Moog_ClassPosRight(PlayerClass), Moog_ClassPosLeft(PlayerClass), Moog_ClassPosTop(PlayerClass), Moog_ClassPosBottom(PlayerClass)); |
||
452 | --Seal: Added |
||
453 | Moog_UpdateCurrentState("player"); |
||
454 | Moog_UpdatePvP("player"); |
||
455 | Moog_UpdatePartyLeader(); |
||
456 | Moog_UpdatePartyLoot(); |
||
457 | --Seal: End Add |
||
458 | -- Shen: Hook added for leaving, unregistering hooks |
||
459 | elseif (event == "PLAYER_LEAVING_WORLD") then |
||
460 | this:UnregisterEvent("PLAYER_ENTER_COMBAT"); |
||
461 | this:UnregisterEvent("PLAYER_LEAVE_COMBAT"); |
||
462 | this:UnregisterEvent("PLAYER_UPDATE_RESTING"); |
||
463 | this:UnregisterEvent("PLAYER_REGEN_DISABLED"); |
||
464 | this:UnregisterEvent("PLAYER_REGEN_ENABLED"); |
||
465 | this:UnregisterEvent("PARTY_LEADER_CHANGED"); |
||
466 | this:UnregisterEvent("PARTY_LOOT_METHOD_CHANGED"); |
||
467 | this:UnregisterEvent("PLAYER_COMBO_POINTS"); |
||
468 | this:UnregisterEvent("UNIT_AURA"); |
||
469 | this:UnregisterEvent("UNIT_HEALTH"); |
||
470 | this:UnregisterEvent("UNIT_MAXHEALTH"); |
||
471 | this:UnregisterEvent("UNIT_MANA"); |
||
472 | this:UnregisterEvent("UNIT_RAGE"); |
||
473 | this:UnregisterEvent("UNIT_FOCUS"); |
||
474 | this:UnregisterEvent("UNIT_ENERGY"); |
||
475 | this:UnregisterEvent("UNIT_MAXMANA"); |
||
476 | this:UnregisterEvent("UNIT_MAXRAGE"); |
||
477 | this:UnregisterEvent("UNIT_MAXFOCUS"); |
||
478 | this:UnregisterEvent("UNIT_MAXENERGY"); |
||
479 | this:UnregisterEvent("UNIT_NAME_UPDATE"); |
||
480 | this:UnregisterEvent("UNIT_DISPLAYPOWER"); |
||
481 | this:UnregisterEvent("PARTY_MEMBERS_CHANGED"); |
||
482 | this:UnregisterEvent("UNIT_PVP_UPDATE"); |
||
483 | elseif (event == "UNIT_DISPLAYPOWER") then |
||
484 | local info = {}; |
||
485 | if (arg1 == "player" or arg1 == "target") then |
||
486 | if (UnitPowerType(arg1) == 0) then |
||
487 | info = { r = 0.00, g = 0.7, b = 1.00 }; |
||
488 | else |
||
489 | info = ManaBarColor[UnitPowerType(arg1)]; |
||
490 | end |
||
491 | if (arg1 == "player") then |
||
492 | Moog_ManaHud:SetVertexColor(info.r, info.g, info.b); |
||
493 | Moog_ManaHudBG:SetVertexColor(info.r, info.g, info.b); |
||
494 | else |
||
495 | Moog_TargetHudMPText:SetTextColor(info.r, info.g, info.b); |
||
496 | end |
||
497 | end |
||
498 | elseif (event == "PLAYER_COMBO_POINTS") then |
||
499 | local points = GetComboPoints(); |
||
500 | if (points > 0) then |
||
501 | Moog_HudCombo:SetText(points); |
||
502 | else |
||
503 | Moog_HudCombo:SetText(""); |
||
504 | end |
||
505 | elseif (event == "UNIT_AURA" and arg1 == "target") then |
||
506 | Moog_HudTargetAuras(); |
||
507 | elseif (event == "UNIT_HEALTH" or event == "UNIT_MAXHEALTH") then |
||
508 | if (arg1=="player") then |
||
509 | if UnitHealthMax("player")==0 then return; end |
||
510 | local p=UnitHealth("player")/UnitHealthMax("player"); |
||
511 | local h = 256 * p; |
||
512 | Moog_HealthHud:SetHeight(h); |
||
513 | Moog_HealthHud:SetTexCoord(0, 1, 1-p, 1); |
||
514 | |||
515 | if (UnitIsDeadOrGhost("player")) then |
||
516 | Moog_HudHealthText:SetTextColor(0.7, 0.7, 0.7); |
||
517 | Moog_HudHealthText:SetText("Dead"); |
||
518 | else |
||
519 | Moog_HudHealthText:SetTextColor(0, 1, 0); |
||
520 | Moog_HudHealthText:SetText(UnitHealth("player").."/"..UnitHealthMax("player")); |
||
521 | end |
||
522 | elseif (arg1 == "target") then |
||
523 | if (UnitIsDeadOrGhost("target")) then |
||
524 | Moog_TargetHudHPText:SetTextColor(0.7, 0.7, 0.7); |
||
525 | else |
||
526 | Moog_TargetHudHPText:SetTextColor(1, 0, 0); |
||
527 | end |
||
528 | if (UnitIsTapped("target") and not UnitIsTappedByPlayer("target")) then |
||
529 | Moog_TargetHudName:SetTextColor(0.5, 0.5, 0.5); |
||
530 | end |
||
531 | -- Moog_TargetHudHPPerc:SetText(ceil((UnitHealth("target") / UnitHealthMax("target")) * 100).."%"); |
||
532 | if UnitIsDeadOrGhost("target") then |
||
533 | Moog_TargetHudHPText:SetText("Dead"); |
||
534 | elseif ((UnitInParty("target") or UnitIsUnit("target","pet")) and (MoogHUDInfo.PlayerTargetPC == false)) then |
||
535 | Moog_TargetHudHPText:SetText(UnitHealth("target").."/"..UnitHealthMax("target")); |
||
536 | else |
||
537 | if (Moog_UseMobHealth and (MoogHUDInfo.MobTargetPC == false)) then |
||
538 | Moog_TargetHudHPText:SetText(Moog_MobHealth_GetTargetCurHP().."/"..Moog_MobHealth_GetTargetMaxHP()); |
||
539 | else |
||
540 | Moog_TargetHudHPText:SetText(ceil((UnitHealth("target") / UnitHealthMax("target")) * 100).."%"); |
||
541 | end |
||
542 | end |
||
543 | end |
||
544 | elseif (event == "PARTY_MEMBERS_CHANGED") then |
||
545 | --sr_pr(GetNumPartyMembers()); |
||
546 | if (GetNumPartyMembers() > 0) then |
||
547 | Moog_Player_ClassTexture:SetAlpha(1); |
||
548 | Moog_Player_Icon:EnableMouse(true); |
||
549 | else |
||
550 | Moog_Player_ClassTexture:SetAlpha(0.5); |
||
551 | Moog_Player_Icon:EnableMouse(false); |
||
552 | end |
||
553 | Moog_UpdatePartyLeader(); |
||
554 | Moog_UpdatePartyLoot(); |
||
555 | elseif (event == "UNIT_NAME_UPDATE") then |
||
556 | if (arg1=="target") then |
||
557 | Moog_HudTargetUpdate(); |
||
558 | end |
||
559 | else |
||
560 | if (arg1=="player") then |
||
561 | if UnitManaMax("player")==0 then return; end |
||
562 | local p=UnitMana("player")/UnitManaMax("player"); |
||
563 | local h = 256 * p; |
||
564 | Moog_ManaHud:SetHeight(h); |
||
565 | Moog_ManaHud:SetTexCoord(0, 1, 1-p, 1); |
||
566 | Moog_HudManaText:SetText(UnitMana("player").."/"..UnitManaMax("player")); |
||
567 | elseif (arg1 == "target") then |
||
568 | if ((UnitIsPlayer("target") and (MoogHUDInfo.PlayerTargetPC == false)) or ((not UnitIsPlayer("target")) and (MoogHUDInfo.MobTargetPC == false))) then |
||
569 | Moog_TargetHudMPText:SetText(UnitMana("target").."/"..UnitManaMax("target")); |
||
570 | else |
||
571 | Moog_TargetHudMPText:SetText(ceil((UnitMana("target") / UnitManaMax("target")) * 100).."%"); |
||
572 | end |
||
573 | end |
||
574 | end |
||
575 | --Seal: Added |
||
576 | if ( event == "PLAYER_ENTER_COMBAT" or event == "PLAYER_REGEN_DISABLED") then |
||
577 | this.inCombat = 1; |
||
578 | Moog_UpdateCurrentState("player"); |
||
579 | return; |
||
580 | end |
||
581 | |||
582 | if ( event == "PLAYER_UPDATE_RESTING" ) then |
||
583 | Moog_UpdateCurrentState("player"); |
||
584 | return; |
||
585 | end |
||
586 | |||
587 | if ( event == "PLAYER_LEAVE_COMBAT" or event == "PLAYER_REGEN_ENABLED") then |
||
588 | this.inCombat = 0; |
||
589 | Moog_UpdateCurrentState("player"); |
||
590 | return; |
||
591 | end |
||
592 | |||
593 | if (event == "UNIT_PVP_UPDATE") then |
||
594 | if ((arg1 == "target") or (arg1 == "player")) then |
||
595 | Moog_UpdatePvP(arg1); end |
||
596 | end |
||
597 | |||
598 | if (event == "PARTY_LEADER_CHANGED") then |
||
599 | Moog_UpdatePartyLeader(); |
||
600 | return; |
||
601 | end |
||
602 | if (event == "PARTY_LOOT_METHOD_CHANGED") then |
||
603 | Moog_UpdatePartyLoot(); |
||
604 | end |
||
605 | --Seal: End Add |
||
606 | end |
||
607 | |||
608 | |||
609 | function Moog_PlayerDropDown_OnLoad() |
||
610 | UIDropDownMenu_Initialize(this, Moog_PlayerDropDown_Initialize, "MENU"); |
||
611 | end |
||
612 | |||
613 | function Moog_PlayerDropDown_Initialize() |
||
614 | UnitPopup_ShowMenu(Moog_Player_DropDown, "SELF", "player"); |
||
615 | end |
||
616 | |||
617 | function Moog_Player_MouseUp(button) |
||
618 | if (button == "RightButton") then |
||
619 | ToggleDropDownMenu(1, nil, Moog_Player_DropDown, "Moog_Player_ClassTexture", 0, 0); end |
||
620 | end |
||
621 | |||
622 | function Moog_Player_MouseDown(button) |
||
623 | end |
||
624 | |||
625 | function Moog_TargetDropDown_OnLoad() |
||
626 | UIDropDownMenu_Initialize(this, Moog_TargetDropDown_Initialize, "MENU"); |
||
627 | end |
||
628 | |||
629 | function Moog_TargetDropDown_Initialize() |
||
630 | local menu = nil; |
||
631 | if (UnitIsEnemy("target", "player")) then |
||
632 | return; |
||
633 | end |
||
634 | if (UnitIsUnit("target", "player")) then |
||
635 | menu = "SELF"; |
||
636 | elseif (UnitIsUnit("target", "pet")) then |
||
637 | menu = "PET"; |
||
638 | elseif (UnitIsPlayer("target")) then |
||
639 | if (UnitInParty("target")) then |
||
640 | menu = "PARTY"; |
||
641 | else |
||
642 | menu = "PLAYER"; |
||
643 | end |
||
644 | end |
||
645 | if (menu) then |
||
646 | UnitPopup_ShowMenu(Moog_Target_DropDown, menu, "target"); |
||
647 | end |
||
648 | end |
||
649 | |||
650 | function Moog_Target_MouseUp(button) |
||
651 | if (button == "RightButton") then |
||
652 | ToggleDropDownMenu(1, nil, Moog_Target_DropDown, "Moog_Target_ClassTexture", 0, 0); end |
||
653 | end |
||
654 | |||
655 | function Moog_Target_MouseDown(button) |
||
656 | end |
||
657 | |||
658 | --------------------------------- |
||
659 | --Class Icon Location Functions-- |
||
660 | --------------------------------- |
||
661 | |||
662 | function Moog_ClassPosRight (class) |
||
663 | |||
664 | if(class==MOOGHUD_CLASS_WARRIOR) then return 0; end |
||
665 | if(class==MOOGHUD_CLASS_MAGE) then return 0.25; end |
||
666 | if(class==MOOGHUD_CLASS_ROGUE) then return 0.5; end |
||
667 | if(class==MOOGHUD_CLASS_DRUID) then return 0.75; end |
||
668 | if(class==MOOGHUD_CLASS_HUNTER) then return 0; end |
||
669 | if(class==MOOGHUD_CLASS_SHAMAN) then return 0.25; end |
||
670 | if(class==MOOGHUD_CLASS_PRIEST) then return 0.5; end |
||
671 | if(class==MOOGHUD_CLASS_WARLOCK) then return 0.75; end |
||
672 | if(class==MOOGHUD_CLASS_PALADIN) then return 0; end |
||
673 | return nil; |
||
674 | end |
||
675 | function Moog_ClassPosLeft (class) |
||
676 | |||
677 | if(class==MOOGHUD_CLASS_WARRIOR) then return 0.25; end |
||
678 | if(class==MOOGHUD_CLASS_MAGE) then return 0.5; end |
||
679 | if(class==MOOGHUD_CLASS_ROGUE) then return 0.75; end |
||
680 | if(class==MOOGHUD_CLASS_DRUID) then return 1; end |
||
681 | if(class==MOOGHUD_CLASS_HUNTER) then return 0.25; end |
||
682 | if(class==MOOGHUD_CLASS_SHAMAN) then return 0.5; end |
||
683 | if(class==MOOGHUD_CLASS_PRIEST) then return 0.75; end |
||
684 | if(class==MOOGHUD_CLASS_WARLOCK) then return 1; end |
||
685 | if(class==MOOGHUD_CLASS_PALADIN) then return 0.25; end |
||
686 | return nil; |
||
687 | end |
||
688 | function Moog_ClassPosTop (class) |
||
689 | if(class==MOOGHUD_CLASS_WARRIOR) then return 0; end |
||
690 | if(class==MOOGHUD_CLASS_MAGE) then return 0; end |
||
691 | if(class==MOOGHUD_CLASS_ROGUE) then return 0; end |
||
692 | if(class==MOOGHUD_CLASS_DRUID) then return 0; end |
||
693 | if(class==MOOGHUD_CLASS_HUNTER) then return 0.25; end |
||
694 | if(class==MOOGHUD_CLASS_SHAMAN) then return 0.25; end |
||
695 | if(class==MOOGHUD_CLASS_PRIEST) then return 0.25; end |
||
696 | if(class==MOOGHUD_CLASS_WARLOCK) then return 0.25; end |
||
697 | if(class==MOOGHUD_CLASS_PALADIN) then return 0.5; end |
||
698 | return nil; |
||
699 | end |
||
700 | function Moog_ClassPosBottom (class) |
||
701 | |||
702 | if(class==MOOGHUD_CLASS_WARRIOR) then return 0.25; end |
||
703 | if(class==MOOGHUD_CLASS_MAGE) then return 0.25; end |
||
704 | if(class==MOOGHUD_CLASS_ROGUE) then return 0.25; end |
||
705 | if(class==MOOGHUD_CLASS_DRUID) then return 0.25; end |
||
706 | if(class==MOOGHUD_CLASS_HUNTER) then return 0.5; end |
||
707 | if(class==MOOGHUD_CLASS_SHAMAN) then return 0.5; end |
||
708 | if(class==MOOGHUD_CLASS_PRIEST) then return 0.5; end |
||
709 | if(class==MOOGHUD_CLASS_WARLOCK) then return 0.5; end |
||
710 | if(class==MOOGHUD_CLASS_PALADIN) then return 0.75; end |
||
711 | return nil; |
||
712 | end |
||
713 |