vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --------------- |
2 | -- Variables -- |
||
3 | --------------- |
||
4 | Perl_Player_Config = {}; |
||
5 | |||
6 | -- Default Saved Variables (also set in Perl_Player_GetVars) |
||
7 | local locked = 0; -- unlocked by default |
||
8 | local xpbarstate = 1; -- show default xp bar by default |
||
9 | local compactmode = 0; -- compact mode is disabled by default |
||
10 | local showraidgroup = 1; -- show the raid group number by default when in raids |
||
11 | local scale = 1; -- default scale |
||
12 | local healermode = 0; -- nurfed unit frame style |
||
13 | local transparency = 1; -- transparency for frames |
||
14 | local showportrait = 0; -- portrait is hidden by default |
||
15 | local compactpercent = 0; -- percents are not shown in compact mode by default |
||
16 | local threedportrait = 0; -- 3d portraits are off by default |
||
17 | local portraitcombattext = 1; -- Combat text is enabled by default on the portrait frame |
||
18 | local showdruidbar = 1; -- Druid Bar support is enabled by default |
||
19 | |||
20 | -- Default Local Variables |
||
21 | local InCombat = 0; -- used to track if the player is in combat and if the icon should be displayed |
||
22 | local Initialized = nil; -- waiting to be initialized |
||
23 | local mouseoverhealthflag = 0; -- is the mouse over the health bar for healer mode? |
||
24 | local mouseovermanaflag = 0; -- is the mouse over the mana bar for healer mode? |
||
25 | |||
26 | -- Variables for position of the class icon texture. |
||
27 | local Perl_Player_ClassPosRight = {}; |
||
28 | local Perl_Player_ClassPosLeft = {}; |
||
29 | local Perl_Player_ClassPosTop = {}; |
||
30 | local Perl_Player_ClassPosBottom = {}; |
||
31 | |||
32 | |||
33 | ---------------------- |
||
34 | -- Loading Function -- |
||
35 | ---------------------- |
||
36 | function Perl_Player_OnLoad() |
||
37 | -- Combat Text |
||
38 | CombatFeedback_Initialize(Perl_Player_HitIndicator, 30); |
||
39 | |||
40 | -- Events |
||
41 | this:RegisterEvent("ADDON_LOADED"); |
||
42 | this:RegisterEvent("PARTY_LEADER_CHANGED"); |
||
43 | this:RegisterEvent("PARTY_LOOT_METHOD_CHANGED"); |
||
44 | this:RegisterEvent("PARTY_MEMBERS_CHANGED"); |
||
45 | this:RegisterEvent("PLAYER_ENTERING_WORLD"); |
||
46 | this:RegisterEvent("PLAYER_REGEN_DISABLED"); |
||
47 | this:RegisterEvent("PLAYER_REGEN_ENABLED"); |
||
48 | this:RegisterEvent("PLAYER_UPDATE_RESTING"); |
||
49 | this:RegisterEvent("PLAYER_XP_UPDATE"); |
||
50 | this:RegisterEvent("RAID_ROSTER_UPDATE"); |
||
51 | this:RegisterEvent("UNIT_COMBAT"); |
||
52 | this:RegisterEvent("UNIT_DISPLAYPOWER"); |
||
53 | this:RegisterEvent("UNIT_ENERGY"); |
||
54 | this:RegisterEvent("UNIT_HEALTH"); |
||
55 | this:RegisterEvent("UNIT_LEVEL"); |
||
56 | this:RegisterEvent("UNIT_MANA"); |
||
57 | this:RegisterEvent("UNIT_MAXENERGY"); |
||
58 | this:RegisterEvent("UNIT_MAXHEALTH"); |
||
59 | this:RegisterEvent("UNIT_MAXMANA"); |
||
60 | this:RegisterEvent("UNIT_MAXRAGE"); |
||
61 | this:RegisterEvent("UNIT_MODEL_CHANGED"); |
||
62 | this:RegisterEvent("UNIT_PORTRAIT_UPDATE"); |
||
63 | this:RegisterEvent("UNIT_PVP_UPDATE"); |
||
64 | this:RegisterEvent("UNIT_RAGE"); |
||
65 | this:RegisterEvent("UNIT_SPELLMISS"); |
||
66 | this:RegisterEvent("UPDATE_FACTION"); |
||
67 | this:RegisterEvent("VARIABLES_LOADED"); |
||
68 | |||
69 | -- Button Click Overlays (in order of occurrence in XML) |
||
70 | Perl_Player_Name_CastClickOverlay:SetFrameLevel(Perl_Player_Name:GetFrameLevel() + 2); |
||
71 | Perl_Player_RaidGroupNumberFrame_CastClickOverlay:SetFrameLevel(Perl_Player_RaidGroupNumberFrame:GetFrameLevel() + 1); |
||
72 | Perl_Player_LevelFrame_CastClickOverlay:SetFrameLevel(Perl_Player_LevelFrame:GetFrameLevel() + 1); |
||
73 | Perl_Player_PortraitFrame_CastClickOverlay:SetFrameLevel(Perl_Player_PortraitFrame:GetFrameLevel() + 2); |
||
74 | Perl_Player_StatsFrame_CastClickOverlay:SetFrameLevel(Perl_Player_StatsFrame:GetFrameLevel() + 1); |
||
75 | Perl_Player_HealthBar_CastClickOverlay:SetFrameLevel(Perl_Player_StatsFrame:GetFrameLevel() + 2); |
||
76 | Perl_Player_ManaBar_CastClickOverlay:SetFrameLevel(Perl_Player_StatsFrame:GetFrameLevel() + 2); |
||
77 | Perl_Player_DruidBar_CastClickOverlay:SetFrameLevel(Perl_Player_StatsFrame:GetFrameLevel() + 2); |
||
78 | Perl_Player_XPBar_CastClickOverlay:SetFrameLevel(Perl_Player_StatsFrame:GetFrameLevel() + 2); |
||
79 | |||
80 | if (DEFAULT_CHAT_FRAME) then |
||
81 | DEFAULT_CHAT_FRAME:AddMessage("|cffffff00Perl Classic: Player loaded successfully."); |
||
82 | end |
||
83 | end |
||
84 | |||
85 | |||
86 | ------------------- |
||
87 | -- Event Handler -- |
||
88 | ------------------- |
||
89 | function Perl_Player_OnEvent(event) |
||
90 | if (event == "UNIT_HEALTH" or event == "UNIT_MAXHEALTH") then |
||
91 | if (arg1 == "player") then |
||
92 | Perl_Player_Update_Health(); -- Update health values |
||
93 | end |
||
94 | return; |
||
95 | elseif ((event == "UNIT_ENERGY") or (event == "UNIT_MANA") or (event == "UNIT_RAGE") or (event == "UNIT_MAXMANA") or (event == "UNIT_MAXENERGY") or (event == "UNIT_MAXRAGE")) then |
||
96 | if (arg1 == "player") then |
||
97 | Perl_Player_Update_Mana(); -- Update energy/mana/rage values |
||
98 | end |
||
99 | return; |
||
100 | elseif (event == "UNIT_DISPLAYPOWER") then |
||
101 | if (arg1 == "player") then |
||
102 | Perl_Player_Update_Mana_Bar(); -- What type of energy are we using now? |
||
103 | Perl_Player_Update_Mana(); -- Update the energy info immediately |
||
104 | end |
||
105 | return; |
||
106 | elseif (event == "UNIT_COMBAT") then |
||
107 | if (arg1 == "player") then |
||
108 | CombatFeedback_OnCombatEvent(arg2, arg3, arg4, arg5); |
||
109 | end |
||
110 | return; |
||
111 | elseif (event == "UNIT_SPELLMISS") then |
||
112 | if (arg1 == "player") then |
||
113 | CombatFeedback_OnSpellMissEvent(arg2); |
||
114 | end |
||
115 | return; |
||
116 | elseif ((event == "PLAYER_REGEN_DISABLED") or (event == "PLAYER_REGEN_ENABLED") or (event == "PLAYER_UPDATE_RESTING")) then |
||
117 | Perl_Player_Update_Combat_Status(event); -- Are we fighting, resting, or none? |
||
118 | return; |
||
119 | elseif (event == "PLAYER_XP_UPDATE") then |
||
120 | if (xpbarstate == 1) then |
||
121 | Perl_Player_Update_Experience(); -- Set the experience bar info |
||
122 | end |
||
123 | return; |
||
124 | elseif (event == "UPDATE_FACTION") then |
||
125 | if (xpbarstate == 4) then |
||
126 | Perl_Player_Update_Reputation(); -- Set faction info |
||
127 | end |
||
128 | return; |
||
129 | elseif (event == "UNIT_PVP_UPDATE") then |
||
130 | Perl_Player_Update_PvP_Status(); -- Is the character PvP flagged? |
||
131 | return; |
||
132 | elseif (event == "UNIT_LEVEL") then |
||
133 | if (arg1 == "player") then |
||
134 | Perl_Player_LevelFrame_LevelBarText:SetText(UnitLevel("player")); -- Set the player's level |
||
135 | end |
||
136 | return; |
||
137 | elseif (event == "RAID_ROSTER_UPDATE") then |
||
138 | Perl_Player_Update_Raid_Group_Number(); -- What raid group number are we in? |
||
139 | return; |
||
140 | elseif (event == "PARTY_LEADER_CHANGED" or event == "PARTY_MEMBERS_CHANGED") then |
||
141 | Perl_Player_Update_Leader(); -- Are we the party leader? |
||
142 | return; |
||
143 | elseif (event == "PARTY_LOOT_METHOD_CHANGED") then |
||
144 | Perl_Player_Update_Loot_Method(); |
||
145 | return; |
||
146 | elseif (event == "UNIT_PORTRAIT_UPDATE" or event == "UNIT_MODEL_CHANGED") then |
||
147 | if (arg1 == "player") then |
||
148 | Perl_Player_Update_Portrait(); |
||
149 | end |
||
150 | return; |
||
151 | elseif (event == "VARIABLES_LOADED") or (event=="PLAYER_ENTERING_WORLD") then |
||
152 | Perl_Player_Initialize(); |
||
153 | InCombat = 0; -- You can't be fighting if you're zoning, and no event is sent, force it to no combat. |
||
154 | Perl_Player_Update_Once(); |
||
155 | return; |
||
156 | elseif (event == "ADDON_LOADED") then |
||
157 | if (arg1 == "Perl_Player") then |
||
158 | Perl_Player_myAddOns_Support(); |
||
159 | end |
||
160 | return; |
||
161 | else |
||
162 | return; |
||
163 | end |
||
164 | end |
||
165 | |||
166 | |||
167 | ------------------------------- |
||
168 | -- Loading Settings Function -- |
||
169 | ------------------------------- |
||
170 | function Perl_Player_Initialize() |
||
171 | -- Check if we loaded the mod already. |
||
172 | if (Initialized) then |
||
173 | Perl_Player_Set_Scale(); |
||
174 | return; |
||
175 | end |
||
176 | |||
177 | -- Check if a previous exists, if not, enable by default. |
||
178 | if (type(Perl_Player_Config[UnitName("player")]) == "table") then |
||
179 | Perl_Player_GetVars(); |
||
180 | else |
||
181 | Perl_Player_UpdateVars(); |
||
182 | end |
||
183 | |||
184 | -- Major config options. |
||
185 | Perl_Player_Initialize_Frame_Color(); |
||
186 | Perl_Player_Set_Localized_ClassIcons(); |
||
187 | |||
188 | -- Unregister the Blizzard frames via the 1.8 function |
||
189 | PlayerFrame:UnregisterAllEvents(); |
||
190 | PlayerFrameHealthBar:UnregisterAllEvents(); |
||
191 | PlayerFrameManaBar:UnregisterAllEvents(); |
||
192 | |||
193 | Perl_Player_Frame:Show(); |
||
194 | |||
195 | Initialized = 1; |
||
196 | end |
||
197 | |||
198 | function Perl_Player_Initialize_Frame_Color() |
||
199 | Perl_Player_StatsFrame:SetBackdropColor(0, 0, 0, 1); |
||
200 | Perl_Player_StatsFrame:SetBackdropBorderColor(0.5, 0.5, 0.5, 1); |
||
201 | Perl_Player_LevelFrame:SetBackdropColor(0, 0, 0, 1); |
||
202 | Perl_Player_LevelFrame:SetBackdropBorderColor(0.5, 0.5, 0.5, 1); |
||
203 | Perl_Player_NameFrame:SetBackdropColor(0, 0, 0, 1); |
||
204 | Perl_Player_NameFrame:SetBackdropBorderColor(0.5, 0.5, 0.5, 1); |
||
205 | Perl_Player_RaidGroupNumberFrame:SetBackdropColor(0, 0, 0, 1); |
||
206 | Perl_Player_RaidGroupNumberFrame:SetBackdropBorderColor(0.5, 0.5, 0.5, 1); |
||
207 | Perl_Player_PortraitFrame:SetBackdropColor(0, 0, 0, 1); |
||
208 | Perl_Player_PortraitFrame:SetBackdropBorderColor(0.5, 0.5, 0.5, 1); |
||
209 | |||
210 | Perl_Player_HealthBarText:SetTextColor(1, 1, 1, 1); |
||
211 | Perl_Player_ManaBarText:SetTextColor(1, 1, 1, 1); |
||
212 | Perl_Player_RaidGroupNumberBarText:SetTextColor(1, 1, 1); |
||
213 | end |
||
214 | |||
215 | |||
216 | ---------------------- |
||
217 | -- Update Functions -- |
||
218 | ---------------------- |
||
219 | function Perl_Player_Update_Once() |
||
220 | local PlayerClass = UnitClass("player"); |
||
221 | |||
222 | PlayerFrame:Hide(); -- Hide default frame |
||
223 | Perl_Player_Set_Scale(); -- Set the scale |
||
224 | Perl_Player_Set_Transparency(); -- Set the transparency |
||
225 | Perl_Player_NameBarText:SetText(UnitName("player")); -- Set the player's name |
||
226 | Perl_Player_Update_Portrait(); -- Set the player's portrait |
||
227 | Perl_Player_Update_PvP_Status(); -- Is the character PvP flagged? |
||
228 | Perl_Player_ClassTexture:SetTexCoord(Perl_Player_ClassPosRight[PlayerClass], Perl_Player_ClassPosLeft[PlayerClass], Perl_Player_ClassPosTop[PlayerClass], Perl_Player_ClassPosBottom[PlayerClass]); -- Set the player's class icon |
||
229 | Perl_Player_Set_Text_Positions(); -- Align the text according to compact and healer mode |
||
230 | Perl_Player_Update_Health(); -- Set the player's health on load or toggle |
||
231 | Perl_Player_Update_Mana(); -- Set the player's mana/energy on load or toggle |
||
232 | Perl_Player_Update_Mana_Bar(); -- Set the type of mana used |
||
233 | Perl_Player_LevelFrame_LevelBarText:SetText(UnitLevel("player")); -- Set the player's level |
||
234 | Perl_Player_XPBar_Display(xpbarstate); -- Set the xp bar mode and update the experience if needed |
||
235 | Perl_Player_Update_Raid_Group_Number(); -- Are we in a raid at login? |
||
236 | Perl_Player_Update_Leader(); -- Are we the party leader? |
||
237 | Perl_Player_Update_Loot_Method(); -- Are we the master looter? |
||
238 | Perl_Player_Update_Combat_Status(); -- Are we already fighting or resting? |
||
239 | Perl_Player_Set_CompactMode(); -- Are we using compact mode? |
||
240 | end |
||
241 | |||
242 | function Perl_Player_Update_Health() |
||
243 | local playerhealth = UnitHealth("player"); |
||
244 | local playerhealthmax = UnitHealthMax("player"); |
||
245 | local playerhealthpercent = floor(playerhealth/playerhealthmax*100+0.5); |
||
246 | |||
247 | if (UnitIsDead("player") or UnitIsGhost("player")) then -- This prevents negative health |
||
248 | playerhealth = 0; |
||
249 | playerhealthpercent = 0; |
||
250 | end |
||
251 | |||
252 | Perl_Player_HealthBar:SetMinMaxValues(0, playerhealthmax); |
||
253 | Perl_Player_HealthBar:SetValue(playerhealth); |
||
254 | |||
255 | if (PCUF_COLORHEALTH == 1) then |
||
256 | if ((playerhealthpercent <= 100) and (playerhealthpercent > 75)) then |
||
257 | Perl_Player_HealthBar:SetStatusBarColor(0, 0.8, 0); |
||
258 | Perl_Player_HealthBarBG:SetStatusBarColor(0, 0.8, 0, 0.25); |
||
259 | elseif ((playerhealthpercent <= 75) and (playerhealthpercent > 50)) then |
||
260 | Perl_Player_HealthBar:SetStatusBarColor(1, 1, 0); |
||
261 | Perl_Player_HealthBarBG:SetStatusBarColor(1, 1, 0, 0.25); |
||
262 | elseif ((playerhealthpercent <= 50) and (playerhealthpercent > 25)) then |
||
263 | Perl_Player_HealthBar:SetStatusBarColor(1, 0.5, 0); |
||
264 | Perl_Player_HealthBarBG:SetStatusBarColor(1, 0.5, 0, 0.25); |
||
265 | else |
||
266 | Perl_Player_HealthBar:SetStatusBarColor(1, 0, 0); |
||
267 | Perl_Player_HealthBarBG:SetStatusBarColor(1, 0, 0, 0.25); |
||
268 | end |
||
269 | else |
||
270 | Perl_Player_HealthBar:SetStatusBarColor(0, 0.8, 0); |
||
271 | Perl_Player_HealthBarBG:SetStatusBarColor(0, 0.8, 0, 0.25); |
||
272 | end |
||
273 | |||
274 | if (compactmode == 0) then |
||
275 | if (healermode == 1) then -- compact mode off and healer mode on |
||
276 | Perl_Player_HealthBarText:SetText("-"..playerhealthmax - playerhealth); |
||
277 | if (mouseoverhealthflag == 0) then |
||
278 | Perl_Player_HealthBarTextPercent:SetText(); |
||
279 | else |
||
280 | Perl_Player_HealthBarTextPercent:SetText(playerhealth.."/"..playerhealthmax); |
||
281 | end |
||
282 | else -- compact mode off and healer mode off |
||
283 | Perl_Player_HealthBarText:SetText(playerhealth.."/"..playerhealthmax); |
||
284 | Perl_Player_HealthBarTextPercent:SetText(playerhealthpercent .. "%"); |
||
285 | end |
||
286 | Perl_Player_HealthBarTextCompactPercent:SetText(); -- Hide the compact mode percent text in full mode |
||
287 | else |
||
288 | if (healermode == 1) then -- compact mode on and healer mode on |
||
289 | Perl_Player_HealthBarText:SetText("-"..playerhealthmax - playerhealth); |
||
290 | if (mouseoverhealthflag == 0) then |
||
291 | Perl_Player_HealthBarTextPercent:SetText(); |
||
292 | else |
||
293 | Perl_Player_HealthBarTextPercent:SetText(playerhealth.."/"..playerhealthmax); |
||
294 | end |
||
295 | else -- compact mode on and healer mode off |
||
296 | Perl_Player_HealthBarText:SetText(); |
||
297 | Perl_Player_HealthBarTextPercent:SetText(playerhealth.."/"..playerhealthmax); |
||
298 | end |
||
299 | |||
300 | if (compactpercent == 1) then |
||
301 | Perl_Player_HealthBarTextCompactPercent:SetText(playerhealthpercent.."%"); |
||
302 | else |
||
303 | Perl_Player_HealthBarTextCompactPercent:SetText(); |
||
304 | end |
||
305 | end |
||
306 | end |
||
307 | |||
308 | function Perl_Player_Update_Mana() |
||
309 | local playermana = UnitMana("player"); |
||
310 | local playermanamax = UnitManaMax("player"); |
||
311 | local playermanapercent = floor(playermana/playermanamax*100+0.5); |
||
312 | |||
313 | if (UnitIsDead("player") or UnitIsGhost("player")) then -- This prevents negative mana |
||
314 | playermana = 0; |
||
315 | playermanapercent = 0; |
||
316 | end |
||
317 | |||
318 | Perl_Player_ManaBar:SetMinMaxValues(0, playermanamax); |
||
319 | Perl_Player_ManaBar:SetValue(playermana); |
||
320 | |||
321 | if (compactmode == 0) then |
||
322 | if (healermode == 1) then |
||
323 | if (mouseovermanaflag == 0) then |
||
324 | Perl_Player_ManaBarText:SetText(); |
||
325 | Perl_Player_ManaBarTextPercent:SetText(); |
||
326 | else |
||
327 | if (UnitPowerType("player") == 1) then |
||
328 | Perl_Player_ManaBarTextPercent:SetText(playermana); |
||
329 | else |
||
330 | Perl_Player_ManaBarTextPercent:SetText(playermana.."/"..playermanamax); |
||
331 | end |
||
332 | end |
||
333 | else |
||
334 | Perl_Player_ManaBarText:SetText(playermana.."/"..playermanamax); |
||
335 | if (UnitPowerType("player") == 1) then |
||
336 | Perl_Player_ManaBarTextPercent:SetText(playermana); |
||
337 | else |
||
338 | Perl_Player_ManaBarTextPercent:SetText(playermanapercent.."%"); |
||
339 | end |
||
340 | end |
||
341 | Perl_Player_ManaBarTextCompactPercent:SetText(); -- Hide the compact mode percent text in full mode |
||
342 | else |
||
343 | if (healermode == 1) then |
||
344 | if (mouseovermanaflag == 0) then |
||
345 | Perl_Player_ManaBarText:SetText(); |
||
346 | Perl_Player_ManaBarTextPercent:SetText(); |
||
347 | else |
||
348 | if (UnitPowerType("player") == 1) then |
||
349 | Perl_Player_ManaBarTextPercent:SetText(playermana); |
||
350 | else |
||
351 | Perl_Player_ManaBarTextPercent:SetText(playermana.."/"..playermanamax); |
||
352 | end |
||
353 | end |
||
354 | else |
||
355 | Perl_Player_ManaBarText:SetText(); |
||
356 | if (UnitPowerType("player") == 1) then |
||
357 | Perl_Player_ManaBarTextPercent:SetText(playermana); |
||
358 | else |
||
359 | Perl_Player_ManaBarTextPercent:SetText(playermana.."/"..playermanamax); |
||
360 | end |
||
361 | end |
||
362 | |||
363 | if (compactpercent == 1) then |
||
364 | Perl_Player_ManaBarTextCompactPercent:SetText(playermanapercent.."%"); |
||
365 | else |
||
366 | Perl_Player_ManaBarTextCompactPercent:SetText(); |
||
367 | end |
||
368 | end |
||
369 | |||
370 | if (showdruidbar == 1) then |
||
371 | if (DruidBarKey and (UnitClass("player") == PERL_LOCALIZED_DRUID)) then |
||
372 | if (UnitPowerType("player") > 0) then |
||
373 | -- Show the bars and set the text and reposition the original mana bar below the druid bar |
||
374 | local playerdruidbarmana = floor(DruidBarKey.keepthemana); |
||
375 | local playerdruidbarmanamax = DruidBarKey.maxmana; |
||
376 | local playerdruidbarmanapercent = floor(playerdruidbarmana/playerdruidbarmanamax*100+0.5); |
||
377 | |||
378 | if (playerdruidbarmanapercent == 100) then -- This is to ensure the value isn't 1 or 2 mana under max when 100% |
||
379 | playerdruidbarmana = playerdruidbarmanamax; |
||
380 | end |
||
381 | |||
382 | Perl_Player_DruidBar:SetMinMaxValues(0, playerdruidbarmanamax); |
||
383 | Perl_Player_DruidBar:SetValue(playerdruidbarmana); |
||
384 | |||
385 | -- Show the bar and adjust the stats frame |
||
386 | Perl_Player_DruidBar:Show(); |
||
387 | Perl_Player_DruidBarBG:Show(); |
||
388 | Perl_Player_DruidBar_CastClickOverlay:Show(); |
||
389 | Perl_Player_ManaBar:SetPoint("TOP", "Perl_Player_DruidBar", "BOTTOM", 0, -2); |
||
390 | if (xpbarstate == 3) then |
||
391 | Perl_Player_StatsFrame:SetHeight(54); -- Experience Bar is hidden |
||
392 | Perl_Player_StatsFrame_CastClickOverlay:SetHeight(54); |
||
393 | else |
||
394 | Perl_Player_StatsFrame:SetHeight(66); -- Experience Bar is shown |
||
395 | Perl_Player_StatsFrame_CastClickOverlay:SetHeight(66); |
||
396 | end |
||
397 | |||
398 | -- Display the needed text |
||
399 | if (compactmode == 0) then |
||
400 | if (healermode == 1) then |
||
401 | if (mouseovermanaflag == 0) then |
||
402 | Perl_Player_DruidBarText:SetText(); |
||
403 | Perl_Player_DruidBarTextPercent:SetText(); |
||
404 | else |
||
405 | Perl_Player_DruidBarTextPercent:SetText(playerdruidbarmana.."/"..playerdruidbarmanamax); |
||
406 | end |
||
407 | else |
||
408 | Perl_Player_DruidBarText:SetText(playerdruidbarmana.."/"..playerdruidbarmanamax); |
||
409 | Perl_Player_DruidBarTextPercent:SetText(playerdruidbarmanapercent.."%"); |
||
410 | end |
||
411 | Perl_Player_DruidBarTextCompactPercent:SetText(); -- Hide the compact mode percent text in full mode |
||
412 | else |
||
413 | if (healermode == 1) then |
||
414 | if (mouseovermanaflag == 0) then |
||
415 | Perl_Player_DruidBarText:SetText(); |
||
416 | Perl_Player_DruidBarTextPercent:SetText(); |
||
417 | else |
||
418 | Perl_Player_DruidBarTextPercent:SetText(playerdruidbarmana.."/"..playerdruidbarmanamax); |
||
419 | end |
||
420 | else |
||
421 | Perl_Player_DruidBarText:SetText(); |
||
422 | Perl_Player_DruidBarTextPercent:SetText(playerdruidbarmana.."/"..playerdruidbarmanamax); |
||
423 | end |
||
424 | |||
425 | if (compactpercent == 1) then |
||
426 | Perl_Player_DruidBarTextCompactPercent:SetText(playerdruidbarmanapercent.."%"); |
||
427 | else |
||
428 | Perl_Player_DruidBarTextCompactPercent:SetText(); |
||
429 | end |
||
430 | end |
||
431 | else |
||
432 | -- Hide it all (bars and text) |
||
433 | Perl_Player_DruidBarText:SetText(); |
||
434 | Perl_Player_DruidBarTextPercent:SetText(); |
||
435 | Perl_Player_DruidBarTextCompactPercent:SetText(); |
||
436 | Perl_Player_DruidBar:Hide(); |
||
437 | Perl_Player_DruidBarBG:Hide(); |
||
438 | Perl_Player_DruidBar_CastClickOverlay:Hide(); |
||
439 | Perl_Player_ManaBar:SetPoint("TOP", "Perl_Player_HealthBar", "BOTTOM", 0, -2); |
||
440 | if (xpbarstate == 3) then |
||
441 | Perl_Player_StatsFrame:SetHeight(42); -- Experience Bar is hidden |
||
442 | Perl_Player_StatsFrame_CastClickOverlay:SetHeight(42); |
||
443 | else |
||
444 | Perl_Player_StatsFrame:SetHeight(54); -- Experience Bar is shown |
||
445 | Perl_Player_StatsFrame_CastClickOverlay:SetHeight(54); |
||
446 | end |
||
447 | end |
||
448 | else |
||
449 | -- Hide it all (bars and text) |
||
450 | Perl_Player_DruidBarText:SetText(); |
||
451 | Perl_Player_DruidBarTextPercent:SetText(); |
||
452 | Perl_Player_DruidBarTextCompactPercent:SetText(); |
||
453 | Perl_Player_DruidBar:Hide(); |
||
454 | Perl_Player_DruidBarBG:Hide(); |
||
455 | Perl_Player_DruidBar_CastClickOverlay:Hide(); |
||
456 | Perl_Player_ManaBar:SetPoint("TOP", "Perl_Player_HealthBar", "BOTTOM", 0, -2); |
||
457 | if (xpbarstate == 3) then |
||
458 | Perl_Player_StatsFrame:SetHeight(42); -- Experience Bar is hidden |
||
459 | Perl_Player_StatsFrame_CastClickOverlay:SetHeight(42); |
||
460 | else |
||
461 | Perl_Player_StatsFrame:SetHeight(54); -- Experience Bar is shown |
||
462 | Perl_Player_StatsFrame_CastClickOverlay:SetHeight(54); |
||
463 | end |
||
464 | end |
||
465 | else |
||
466 | -- Hide it all (bars and text) |
||
467 | Perl_Player_DruidBarText:SetText(); |
||
468 | Perl_Player_DruidBarTextPercent:SetText(); |
||
469 | Perl_Player_DruidBarTextCompactPercent:SetText(); |
||
470 | Perl_Player_DruidBar:Hide(); |
||
471 | Perl_Player_DruidBarBG:Hide(); |
||
472 | Perl_Player_DruidBar_CastClickOverlay:Hide(); |
||
473 | Perl_Player_ManaBar:SetPoint("TOP", "Perl_Player_HealthBar", "BOTTOM", 0, -2); |
||
474 | if (xpbarstate == 3) then |
||
475 | Perl_Player_StatsFrame:SetHeight(42); -- Experience Bar is hidden |
||
476 | Perl_Player_StatsFrame_CastClickOverlay:SetHeight(42); |
||
477 | else |
||
478 | Perl_Player_StatsFrame:SetHeight(54); -- Experience Bar is shown |
||
479 | Perl_Player_StatsFrame_CastClickOverlay:SetHeight(54); |
||
480 | end |
||
481 | end |
||
482 | end |
||
483 | |||
484 | function Perl_Player_Update_Mana_Bar() |
||
485 | local playerpower = UnitPowerType("player"); |
||
486 | |||
487 | -- Set mana bar color |
||
488 | if (playerpower == 0) then |
||
489 | Perl_Player_ManaBar:SetStatusBarColor(0, 0, 1, 1); |
||
490 | Perl_Player_ManaBarBG:SetStatusBarColor(0, 0, 1, 0.25); |
||
491 | elseif (playerpower == 1) then |
||
492 | Perl_Player_ManaBar:SetStatusBarColor(1, 0, 0, 1); |
||
493 | Perl_Player_ManaBarBG:SetStatusBarColor(1, 0, 0, 0.25); |
||
494 | elseif (playerpower == 3) then |
||
495 | Perl_Player_ManaBar:SetStatusBarColor(1, 1, 0, 1); |
||
496 | Perl_Player_ManaBarBG:SetStatusBarColor(1, 1, 0, 0.25); |
||
497 | end |
||
498 | end |
||
499 | |||
500 | function Perl_Player_Update_Experience() |
||
501 | if (UnitLevel("player") ~= 70) then |
||
502 | -- XP Bar stuff |
||
503 | local playerxp = UnitXP("player"); |
||
504 | local playerxpmax = UnitXPMax("player"); |
||
505 | local playerxprest = GetXPExhaustion(); |
||
506 | |||
507 | Perl_Player_XPBar:SetMinMaxValues(0, playerxpmax); |
||
508 | Perl_Player_XPRestBar:SetMinMaxValues(0, playerxpmax); |
||
509 | Perl_Player_XPBar:SetValue(playerxp); |
||
510 | |||
511 | -- Set xp text |
||
512 | local xptext = playerxp.."/"..playerxpmax; |
||
513 | local xptextpercent = floor(playerxp/playerxpmax*100+0.5); |
||
514 | |||
515 | if (playerxprest) then |
||
516 | xptext = xptext .."(+"..(playerxprest)..")"; |
||
517 | Perl_Player_XPBar:SetStatusBarColor(0, 0.6, 0.6, 1); |
||
518 | Perl_Player_XPRestBar:SetStatusBarColor(0, 0.6, 0.6, 0.5); |
||
519 | Perl_Player_XPBarBG:SetStatusBarColor(0, 0.6, 0.6, 0.25); |
||
520 | Perl_Player_XPRestBar:SetValue(playerxp + playerxprest); |
||
521 | else |
||
522 | Perl_Player_XPBar:SetStatusBarColor(0, 0.6, 0.6, 1); |
||
523 | Perl_Player_XPRestBar:SetStatusBarColor(0, 0.6, 0.6, 0.5); |
||
524 | Perl_Player_XPBarBG:SetStatusBarColor(0, 0.6, 0.6, 0.25); |
||
525 | Perl_Player_XPRestBar:SetValue(playerxp); |
||
526 | end |
||
527 | |||
528 | Perl_Player_XPBarText:SetText(xptextpercent.."%"); |
||
529 | else |
||
530 | Perl_Player_XPBar:SetMinMaxValues(0, 1); |
||
531 | Perl_Player_XPRestBar:SetMinMaxValues(0, 1); |
||
532 | Perl_Player_XPBar:SetValue(1); |
||
533 | Perl_Player_XPRestBar:SetValue(1); |
||
534 | |||
535 | Perl_Player_XPBar:SetStatusBarColor(0, 0.6, 0.6, 1); |
||
536 | Perl_Player_XPRestBar:SetStatusBarColor(0, 0.6, 0.6, 0.5); |
||
537 | Perl_Player_XPBarBG:SetStatusBarColor(0, 0.6, 0.6, 0.25); |
||
538 | |||
539 | Perl_Player_XPBarText:SetText("Level 70"); |
||
540 | end |
||
541 | |||
542 | end |
||
543 | |||
544 | function Perl_Player_Update_Reputation() |
||
545 | local name, reaction, min, max, value = GetWatchedFactionInfo(); |
||
546 | if (name) then |
||
547 | value = value - min; |
||
548 | max = max - min; |
||
549 | min = 0; |
||
550 | |||
551 | Perl_Player_XPBar:SetMinMaxValues(min, max); |
||
552 | Perl_Player_XPRestBar:SetMinMaxValues(min, max); |
||
553 | Perl_Player_XPBar:SetValue(value); |
||
554 | Perl_Player_XPRestBar:SetValue(value); |
||
555 | |||
556 | local color = FACTION_BAR_COLORS[reaction]; |
||
557 | Perl_Player_XPBar:SetStatusBarColor(color.r, color.g, color.b, 1); |
||
558 | Perl_Player_XPRestBar:SetStatusBarColor(color.r, color.g, color.b, 0.5); |
||
559 | Perl_Player_XPBarBG:SetStatusBarColor(color.r, color.g, color.b, 0.25); |
||
560 | |||
561 | Perl_Player_XPBarText:SetText(name); |
||
562 | else |
||
563 | Perl_Player_XPBar:SetMinMaxValues(0, 1); |
||
564 | Perl_Player_XPRestBar:SetMinMaxValues(0, 1); |
||
565 | Perl_Player_XPBar:SetValue(1); |
||
566 | Perl_Player_XPRestBar:SetValue(1); |
||
567 | |||
568 | Perl_Player_XPBar:SetStatusBarColor(0.9, 0.7, 0, 1); |
||
569 | Perl_Player_XPRestBar:SetStatusBarColor(0.9, 0.7, 0, 0.5); |
||
570 | Perl_Player_XPBarBG:SetStatusBarColor(0.9, 0.7, 0, 0.25); |
||
571 | |||
572 | Perl_Player_XPBarText:SetText("Select a Reputation"); |
||
573 | end |
||
574 | end |
||
575 | |||
576 | function Perl_Player_Update_Combat_Status(event) |
||
577 | -- Rest/Combat Status Icon |
||
578 | if (event == "PLAYER_REGEN_DISABLED") then |
||
579 | InCombat = 1; |
||
580 | Perl_Player_ActivityStatus:SetTexCoord(0.5, 1.0, 0.0, 0.5); |
||
581 | Perl_Player_ActivityStatus:Show(); |
||
582 | elseif (event == "PLAYER_REGEN_ENABLED") then |
||
583 | InCombat = 0; |
||
584 | Perl_Player_ActivityStatus:Hide(); |
||
585 | elseif (IsResting()) then |
||
586 | if (InCombat == 1) then |
||
587 | return; |
||
588 | else |
||
589 | Perl_Player_ActivityStatus:SetTexCoord(0, 0.5, 0.0, 0.5); |
||
590 | Perl_Player_ActivityStatus:Show(); |
||
591 | end |
||
592 | else |
||
593 | if (InCombat == 1) then |
||
594 | return; |
||
595 | else |
||
596 | Perl_Player_ActivityStatus:Hide(); |
||
597 | end |
||
598 | end |
||
599 | end |
||
600 | |||
601 | function Perl_Player_Update_Raid_Group_Number() -- taken from 1.8 |
||
602 | if (showraidgroup == 1) then |
||
603 | Perl_Player_RaidGroupNumberFrame:Hide(); |
||
604 | local name, rank, subgroup; |
||
605 | if (GetNumRaidMembers() == 0) then |
||
606 | Perl_Player_RaidGroupNumberFrame:Hide(); |
||
607 | Perl_Player_MasterIcon:Hide(); -- This was added to correctly hide the master loot icon after leaving a party/raid |
||
608 | return; |
||
609 | end |
||
610 | local numRaidMembers = GetNumRaidMembers(); |
||
611 | for i=1, MAX_RAID_MEMBERS do |
||
612 | if (i <= numRaidMembers) then |
||
613 | name, rank, subgroup = GetRaidRosterInfo(i); |
||
614 | -- Set the player's group number indicator |
||
615 | if (name == UnitName("player")) then |
||
616 | Perl_Player_RaidGroupNumberBarText:SetText("Group "..subgroup); |
||
617 | Perl_Player_RaidGroupNumberFrame:Show(); |
||
618 | return; |
||
619 | end |
||
620 | end |
||
621 | end |
||
622 | else |
||
623 | Perl_Player_RaidGroupNumberFrame:Hide(); |
||
624 | end |
||
625 | end |
||
626 | |||
627 | function Perl_Player_Update_Leader() |
||
628 | if (IsPartyLeader()) then |
||
629 | Perl_Player_LeaderIcon:Show(); |
||
630 | else |
||
631 | Perl_Player_LeaderIcon:Hide(); |
||
632 | end |
||
633 | end |
||
634 | |||
635 | function Perl_Player_Update_Loot_Method() |
||
636 | local lootMethod, lootMaster; |
||
637 | lootMethod, lootMaster = GetLootMethod(); |
||
638 | if (lootMaster == 0) then |
||
639 | Perl_Player_MasterIcon:Show(); |
||
640 | else |
||
641 | Perl_Player_MasterIcon:Hide(); |
||
642 | end |
||
643 | end |
||
644 | |||
645 | function Perl_Player_Update_PvP_Status() |
||
646 | if (UnitIsPVP("player")) then |
||
647 | local factionGroup = UnitFactionGroup("player"); |
||
648 | Perl_Player_NameBarText:SetTextColor(0,1,0); |
||
649 | Perl_Player_PVPStatus:SetTexture("Interface\\TargetingFrame\\UI-PVP-"..factionGroup); |
||
650 | Perl_Player_PVPStatus:Show(); |
||
651 | else |
||
652 | Perl_Player_NameBarText:SetTextColor(0.5,0.5,1); |
||
653 | Perl_Player_PVPStatus:Hide(); |
||
654 | end |
||
655 | end |
||
656 | |||
657 | function Perl_Player_Set_CompactMode() |
||
658 | if (compactmode == 0) then |
||
659 | Perl_Player_Update_Health(); |
||
660 | Perl_Player_Update_Mana(); |
||
661 | Perl_Player_XPBar:SetWidth(220); |
||
662 | Perl_Player_XPRestBar:SetWidth(220); |
||
663 | Perl_Player_XPBarBG:SetWidth(220); |
||
664 | Perl_Player_XPBar_CastClickOverlay:SetWidth(220); |
||
665 | Perl_Player_StatsFrame:SetWidth(240); |
||
666 | Perl_Player_StatsFrame_CastClickOverlay:SetWidth(240); |
||
667 | else |
||
668 | if (compactpercent == 0) then |
||
669 | Perl_Player_Update_Health(); |
||
670 | Perl_Player_Update_Mana(); |
||
671 | Perl_Player_XPBar:SetWidth(150); |
||
672 | Perl_Player_XPRestBar:SetWidth(150); |
||
673 | Perl_Player_XPBarBG:SetWidth(150); |
||
674 | Perl_Player_XPBar_CastClickOverlay:SetWidth(150); |
||
675 | Perl_Player_StatsFrame:SetWidth(170); |
||
676 | Perl_Player_StatsFrame_CastClickOverlay:SetWidth(170); |
||
677 | else |
||
678 | Perl_Player_Update_Health(); |
||
679 | Perl_Player_Update_Mana(); |
||
680 | Perl_Player_XPBar:SetWidth(185); |
||
681 | Perl_Player_XPRestBar:SetWidth(185); |
||
682 | Perl_Player_XPBarBG:SetWidth(185); |
||
683 | Perl_Player_XPBar_CastClickOverlay:SetWidth(185); |
||
684 | Perl_Player_StatsFrame:SetWidth(205); |
||
685 | Perl_Player_StatsFrame_CastClickOverlay:SetWidth(205); |
||
686 | end |
||
687 | |||
688 | end |
||
689 | end |
||
690 | |||
691 | function Perl_Player_Set_Text_Positions() |
||
692 | if (compactmode == 0) then |
||
693 | Perl_Player_HealthBarText:SetPoint("RIGHT", 70, 0); |
||
694 | Perl_Player_HealthBarTextPercent:SetPoint("TOP", 0, 1); |
||
695 | Perl_Player_ManaBarText:SetPoint("RIGHT", 70, 0); |
||
696 | Perl_Player_ManaBarTextPercent:SetPoint("TOP", 0, 1); |
||
697 | Perl_Player_DruidBarText:SetPoint("RIGHT", 70, 0); |
||
698 | Perl_Player_DruidBarTextPercent:SetPoint("TOP", 0, 1); |
||
699 | else |
||
700 | if (healermode == 1) then |
||
701 | Perl_Player_HealthBarText:SetPoint("RIGHT", -10, 0); |
||
702 | Perl_Player_HealthBarTextPercent:SetPoint("TOP", -40, 1); |
||
703 | Perl_Player_ManaBarText:SetPoint("RIGHT", -10, 0); |
||
704 | Perl_Player_ManaBarTextPercent:SetPoint("TOP", -40, 1); |
||
705 | Perl_Player_DruidBarText:SetPoint("RIGHT", -10, 0); |
||
706 | Perl_Player_DruidBarTextPercent:SetPoint("TOP", -40, 1); |
||
707 | else |
||
708 | Perl_Player_HealthBarText:SetPoint("RIGHT", 70, 0); |
||
709 | Perl_Player_HealthBarTextPercent:SetPoint("TOP", 0, 1); |
||
710 | Perl_Player_ManaBarText:SetPoint("RIGHT", 70, 0); |
||
711 | Perl_Player_ManaBarTextPercent:SetPoint("TOP", 0, 1); |
||
712 | Perl_Player_DruidBarText:SetPoint("RIGHT", 70, 0); |
||
713 | Perl_Player_DruidBarTextPercent:SetPoint("TOP", 0, 1); |
||
714 | end |
||
715 | end |
||
716 | end |
||
717 | |||
718 | function Perl_Player_HealthShow() |
||
719 | if (healermode == 1) then |
||
720 | local playerhealth = UnitHealth("player"); |
||
721 | local playerhealthmax = UnitHealthMax("player"); |
||
722 | |||
723 | if (UnitIsDead("player") or UnitIsGhost("player")) then -- This prevents negative health |
||
724 | playerhealth = 0; |
||
725 | end |
||
726 | |||
727 | Perl_Player_HealthBarTextPercent:SetText(playerhealth.."/"..playerhealthmax); |
||
728 | mouseoverhealthflag = 1; |
||
729 | end |
||
730 | end |
||
731 | |||
732 | function Perl_Player_HealthHide() |
||
733 | if (healermode == 1) then |
||
734 | Perl_Player_HealthBarTextPercent:SetText(); |
||
735 | mouseoverhealthflag = 0; |
||
736 | end |
||
737 | end |
||
738 | |||
739 | function Perl_Player_ManaShow() |
||
740 | if (healermode == 1) then |
||
741 | local playermana = UnitMana("player"); |
||
742 | local playermanamax = UnitManaMax("player"); |
||
743 | |||
744 | if (UnitIsDead("player") or UnitIsGhost("player")) then -- This prevents negative mana |
||
745 | playermana = 0; |
||
746 | end |
||
747 | |||
748 | if (UnitPowerType("player") == 1) then |
||
749 | Perl_Player_ManaBarTextPercent:SetText(playermana); |
||
750 | else |
||
751 | Perl_Player_ManaBarTextPercent:SetText(playermana.."/"..playermanamax); |
||
752 | end |
||
753 | mouseovermanaflag = 1; |
||
754 | end |
||
755 | end |
||
756 | |||
757 | function Perl_Player_ManaHide() |
||
758 | if (healermode == 1) then |
||
759 | Perl_Player_ManaBarTextPercent:SetText(); |
||
760 | mouseovermanaflag = 0; |
||
761 | end |
||
762 | end |
||
763 | |||
764 | function Perl_Player_DruidBarManaShow() |
||
765 | if (DruidBarKey and (UnitClass("player") == PERL_LOCALIZED_DRUID)) then |
||
766 | if (healermode == 1) then |
||
767 | local playerdruidbarmana = floor(DruidBarKey.keepthemana); |
||
768 | local playerdruidbarmanamax = DruidBarKey.maxmana; |
||
769 | local playerdruidbarmanapercent = floor(playerdruidbarmana/playerdruidbarmanamax*100+0.5); |
||
770 | |||
771 | if (playerdruidbarmanapercent == 100) then -- This is to ensure the value isn't 1 or 2 mana under max when 100% |
||
772 | playerdruidbarmana = playerdruidbarmanamax; |
||
773 | end |
||
774 | |||
775 | if (UnitIsDead("player") or UnitIsGhost("player")) then -- This prevents negative mana |
||
776 | playerdruidbarmana = 0; |
||
777 | end |
||
778 | |||
779 | Perl_Player_DruidBarTextPercent:SetText(playerdruidbarmana.."/"..playerdruidbarmanamax); |
||
780 | |||
781 | mouseovermanaflag = 1; |
||
782 | end |
||
783 | end |
||
784 | end |
||
785 | |||
786 | function Perl_Player_DruidBarManaHide() |
||
787 | if (healermode == 1) then |
||
788 | Perl_Player_DruidBarTextPercent:SetText(); |
||
789 | mouseovermanaflag = 0; |
||
790 | end |
||
791 | end |
||
792 | |||
793 | function Perl_Player_Update_Portrait() |
||
794 | if (showportrait == 1) then |
||
795 | Perl_Player_PortraitTextFrame:SetFrameLevel(Perl_Player_PortraitFrame:GetFrameLevel() + 1); -- Put the combat text above it so the portrait graphic doesn't go on top of it |
||
796 | Perl_Player_PortraitFrame:Show(); -- Show the main portrait frame |
||
797 | |||
798 | if (threedportrait == 0) then |
||
799 | SetPortraitTexture(Perl_Player_Portrait, "player"); -- Load the correct 2d graphic |
||
800 | Perl_Player_PortraitFrame_PlayerModel:Hide(); -- Hide the 3d graphic |
||
801 | Perl_Player_Portrait:Show(); -- Show the 2d graphic |
||
802 | else |
||
803 | Perl_Player_PortraitFrame_PlayerModel:SetUnit("player"); -- Load the correct 3d graphic |
||
804 | Perl_Player_Portrait:Hide(); -- Hide the 2d graphic |
||
805 | Perl_Player_PortraitFrame_PlayerModel:Show(); -- Show the 3d graphic |
||
806 | Perl_Player_PortraitFrame_PlayerModel:SetCamera(0); |
||
807 | end |
||
808 | |||
809 | Perl_Player_PortraitTextFrame:Show(); -- Show the combat text frame |
||
810 | else |
||
811 | Perl_Player_PortraitFrame:Hide(); -- Hide the frame and 2d/3d portion |
||
812 | Perl_Player_PortraitTextFrame:Hide(); -- Hide the combat text |
||
813 | end |
||
814 | end |
||
815 | |||
816 | function Perl_Player_Portrait_Combat_Text() |
||
817 | if (portraitcombattext == 1) then |
||
818 | CombatFeedback_OnUpdate(arg1); |
||
819 | end |
||
820 | end |
||
821 | |||
822 | function Perl_Player_Set_Localized_ClassIcons() |
||
823 | Perl_Player_ClassPosRight = { |
||
824 | [PERL_LOCALIZED_DRUID] = 0.75, |
||
825 | [PERL_LOCALIZED_HUNTER] = 0, |
||
826 | [PERL_LOCALIZED_MAGE] = 0.25, |
||
827 | [PERL_LOCALIZED_PALADIN] = 0, |
||
828 | [PERL_LOCALIZED_PRIEST] = 0.5, |
||
829 | [PERL_LOCALIZED_ROGUE] = 0.5, |
||
830 | [PERL_LOCALIZED_SHAMAN] = 0.25, |
||
831 | [PERL_LOCALIZED_WARLOCK] = 0.75, |
||
832 | [PERL_LOCALIZED_WARRIOR] = 0, |
||
833 | }; |
||
834 | Perl_Player_ClassPosLeft = { |
||
835 | [PERL_LOCALIZED_DRUID] = 1, |
||
836 | [PERL_LOCALIZED_HUNTER] = 0.25, |
||
837 | [PERL_LOCALIZED_MAGE] = 0.5, |
||
838 | [PERL_LOCALIZED_PALADIN] = 0.25, |
||
839 | [PERL_LOCALIZED_PRIEST] = 0.75, |
||
840 | [PERL_LOCALIZED_ROGUE] = 0.75, |
||
841 | [PERL_LOCALIZED_SHAMAN] = 0.5, |
||
842 | [PERL_LOCALIZED_WARLOCK] = 1, |
||
843 | [PERL_LOCALIZED_WARRIOR] = 0.25, |
||
844 | }; |
||
845 | Perl_Player_ClassPosTop = { |
||
846 | [PERL_LOCALIZED_DRUID] = 0, |
||
847 | [PERL_LOCALIZED_HUNTER] = 0.25, |
||
848 | [PERL_LOCALIZED_MAGE] = 0, |
||
849 | [PERL_LOCALIZED_PALADIN] = 0.5, |
||
850 | [PERL_LOCALIZED_PRIEST] = 0.25, |
||
851 | [PERL_LOCALIZED_ROGUE] = 0, |
||
852 | [PERL_LOCALIZED_SHAMAN] = 0.25, |
||
853 | [PERL_LOCALIZED_WARLOCK] = 0.25, |
||
854 | [PERL_LOCALIZED_WARRIOR] = 0, |
||
855 | |||
856 | }; |
||
857 | Perl_Player_ClassPosBottom = { |
||
858 | [PERL_LOCALIZED_DRUID] = 0.25, |
||
859 | [PERL_LOCALIZED_HUNTER] = 0.5, |
||
860 | [PERL_LOCALIZED_MAGE] = 0.25, |
||
861 | [PERL_LOCALIZED_PALADIN] = 0.75, |
||
862 | [PERL_LOCALIZED_PRIEST] = 0.5, |
||
863 | [PERL_LOCALIZED_ROGUE] = 0.25, |
||
864 | [PERL_LOCALIZED_SHAMAN] = 0.5, |
||
865 | [PERL_LOCALIZED_WARLOCK] = 0.5, |
||
866 | [PERL_LOCALIZED_WARRIOR] = 0.25, |
||
867 | }; |
||
868 | end |
||
869 | |||
870 | |||
871 | -------------------------- |
||
872 | -- GUI Config Functions -- |
||
873 | -------------------------- |
||
874 | function Perl_Player_XPBar_Display(state) |
||
875 | if (state == 1) then -- Experience |
||
876 | Perl_Player_StatsFrame:SetHeight(54); |
||
877 | Perl_Player_StatsFrame_CastClickOverlay:SetHeight(54); |
||
878 | Perl_Player_XPBar:Show(); |
||
879 | Perl_Player_XPBarBG:Show(); |
||
880 | Perl_Player_XPRestBar:Show(); |
||
881 | Perl_Player_XPBar_CastClickOverlay:Show(); |
||
882 | Perl_Player_Update_Experience(); |
||
883 | elseif (state == 2) then -- PvP |
||
884 | Perl_Player_StatsFrame:SetHeight(54); |
||
885 | Perl_Player_StatsFrame_CastClickOverlay:SetHeight(54); |
||
886 | Perl_Player_XPBar:Show(); |
||
887 | Perl_Player_XPBarBG:Show(); |
||
888 | Perl_Player_XPRestBar:Show(); |
||
889 | Perl_Player_XPBar_CastClickOverlay:Show(); |
||
890 | local rankNumber, rankName, rankProgress; |
||
891 | rankNumber = UnitPVPRank("player") |
||
892 | if (rankNumber < 1) then |
||
893 | rankName = "Unranked" |
||
894 | else |
||
895 | rankName = GetPVPRankInfo(rankNumber, "player"); |
||
896 | end |
||
897 | rankProgress = GetPVPRankProgress(); |
||
898 | Perl_Player_XPBar:SetMinMaxValues(0, 1); |
||
899 | Perl_Player_XPRestBar:SetMinMaxValues(0, 1); |
||
900 | Perl_Player_XPBar:SetValue(rankProgress); |
||
901 | Perl_Player_XPRestBar:SetValue(rankProgress); |
||
902 | Perl_Player_XPBarText:SetText(rankName); |
||
903 | elseif (state == 3) then -- Hidden |
||
904 | Perl_Player_XPBar:Hide(); |
||
905 | Perl_Player_XPBarBG:Hide(); |
||
906 | Perl_Player_XPRestBar:Hide(); |
||
907 | Perl_Player_XPBar_CastClickOverlay:Hide(); |
||
908 | Perl_Player_StatsFrame:SetHeight(42); |
||
909 | Perl_Player_StatsFrame_CastClickOverlay:SetHeight(42); |
||
910 | elseif (state == 4) then -- Reputation |
||
911 | Perl_Player_StatsFrame:SetHeight(54); |
||
912 | Perl_Player_StatsFrame_CastClickOverlay:SetHeight(54); |
||
913 | Perl_Player_XPBar:Show(); |
||
914 | Perl_Player_XPBarBG:Show(); |
||
915 | Perl_Player_XPRestBar:Show(); |
||
916 | Perl_Player_XPBar_CastClickOverlay:Show(); |
||
917 | Perl_Player_Update_Reputation(); |
||
918 | end |
||
919 | if (DruidBarKey and (UnitClass("player") == PERL_LOCALIZED_DRUID) and (UnitPowerType("player") > 0)) then -- Only change the size if the player has Druid Bar, is a Druid, and is morphed currently |
||
920 | if (state == 3) then |
||
921 | Perl_Player_StatsFrame:SetHeight(54); -- Experience Bar is hidden |
||
922 | Perl_Player_StatsFrame_CastClickOverlay:SetHeight(54); |
||
923 | else |
||
924 | Perl_Player_StatsFrame:SetHeight(66); -- Experience Bar is shown |
||
925 | Perl_Player_StatsFrame_CastClickOverlay:SetHeight(66); |
||
926 | end |
||
927 | end |
||
928 | xpbarstate = state; |
||
929 | Perl_Player_UpdateVars(); |
||
930 | end |
||
931 | |||
932 | function Perl_Player_Set_Compact(newvalue) |
||
933 | compactmode = newvalue; |
||
934 | Perl_Player_UpdateVars(); |
||
935 | Perl_Player_Set_Text_Positions(); |
||
936 | Perl_Player_Set_CompactMode(); |
||
937 | end |
||
938 | |||
939 | function Perl_Player_Set_Healer(newvalue) |
||
940 | healermode = newvalue; |
||
941 | Perl_Player_UpdateVars(); |
||
942 | Perl_Player_Set_Text_Positions(); |
||
943 | Perl_Player_Update_Health(); |
||
944 | Perl_Player_Update_Mana(); |
||
945 | end |
||
946 | |||
947 | function Perl_Player_Set_RaidGroupNumber(newvalue) |
||
948 | showraidgroup = newvalue; |
||
949 | Perl_Player_UpdateVars(); |
||
950 | Perl_Player_Update_Raid_Group_Number(); |
||
951 | end |
||
952 | |||
953 | function Perl_Player_Set_Lock(newvalue) |
||
954 | locked = newvalue; |
||
955 | Perl_Player_UpdateVars(); |
||
956 | end |
||
957 | |||
958 | function Perl_Player_Set_Portrait(newvalue) |
||
959 | showportrait = newvalue; |
||
960 | Perl_Player_UpdateVars(); |
||
961 | Perl_Player_Update_Portrait(); |
||
962 | end |
||
963 | |||
964 | function Perl_Player_Set_3D_Portrait(newvalue) |
||
965 | threedportrait = newvalue; |
||
966 | Perl_Player_UpdateVars(); |
||
967 | Perl_Player_Update_Portrait(); |
||
968 | end |
||
969 | |||
970 | function Perl_Player_Set_Portrait_Combat_Text(newvalue) |
||
971 | portraitcombattext = newvalue; |
||
972 | Perl_Player_UpdateVars(); |
||
973 | end |
||
974 | |||
975 | function Perl_Player_Set_Compact_Percent(newvalue) |
||
976 | compactpercent = newvalue; |
||
977 | Perl_Player_UpdateVars(); |
||
978 | Perl_Player_Set_Text_Positions(); |
||
979 | Perl_Player_Set_CompactMode(); |
||
980 | Perl_Player_Update_Health(); |
||
981 | Perl_Player_Update_Mana(); |
||
982 | end |
||
983 | |||
984 | function Perl_Player_Set_DruidBar(newvalue) |
||
985 | showdruidbar = newvalue; |
||
986 | Perl_Player_UpdateVars(); |
||
987 | Perl_Player_Set_Text_Positions(); |
||
988 | Perl_Player_Set_CompactMode(); -- Perl_Player_Update_Mana() called here |
||
989 | end |
||
990 | |||
991 | function Perl_Player_Set_Scale(number) |
||
992 | local unsavedscale; |
||
993 | if (number ~= nil) then |
||
994 | scale = (number / 100); -- convert the user input to a wow acceptable value |
||
995 | end |
||
996 | unsavedscale = 1 - UIParent:GetEffectiveScale() + scale; -- run it through the scaling formula introduced in 1.9 |
||
997 | Perl_Player_Frame:SetScale(unsavedscale); |
||
998 | Perl_Player_UpdateVars(); |
||
999 | end |
||
1000 | |||
1001 | function Perl_Player_Set_Transparency(number) |
||
1002 | if (number ~= nil) then |
||
1003 | transparency = (number / 100); -- convert the user input to a wow acceptable value |
||
1004 | end |
||
1005 | Perl_Player_Frame:SetAlpha(transparency); |
||
1006 | Perl_Player_UpdateVars(); |
||
1007 | end |
||
1008 | |||
1009 | |||
1010 | ------------------------------ |
||
1011 | -- Saved Variable Functions -- |
||
1012 | ------------------------------ |
||
1013 | function Perl_Player_GetVars() |
||
1014 | locked = Perl_Player_Config[UnitName("player")]["Locked"]; |
||
1015 | xpbarstate = Perl_Player_Config[UnitName("player")]["XPBarState"]; |
||
1016 | compactmode = Perl_Player_Config[UnitName("player")]["CompactMode"]; |
||
1017 | showraidgroup = Perl_Player_Config[UnitName("player")]["ShowRaidGroup"]; |
||
1018 | scale = Perl_Player_Config[UnitName("player")]["Scale"]; |
||
1019 | healermode = Perl_Player_Config[UnitName("player")]["HealerMode"]; |
||
1020 | transparency = Perl_Player_Config[UnitName("player")]["Transparency"]; |
||
1021 | showportrait = Perl_Player_Config[UnitName("player")]["ShowPortrait"]; |
||
1022 | compactpercent = Perl_Player_Config[UnitName("player")]["CompactPercent"]; |
||
1023 | threedportrait = Perl_Player_Config[UnitName("player")]["ThreeDPortrait"]; |
||
1024 | portraitcombattext = Perl_Player_Config[UnitName("player")]["PortraitCombatText"]; |
||
1025 | showdruidbar = Perl_Player_Config[UnitName("player")]["ShowDruidBar"]; |
||
1026 | |||
1027 | if (locked == nil) then |
||
1028 | locked = 0; |
||
1029 | end |
||
1030 | if (xpbarstate == nil) then |
||
1031 | xpbarstate = 1; |
||
1032 | end |
||
1033 | if (compactmode == nil) then |
||
1034 | compactmode = 0; |
||
1035 | end |
||
1036 | if (showraidgroup == nil) then |
||
1037 | showraidgroup = 1; |
||
1038 | end |
||
1039 | if (scale == nil) then |
||
1040 | scale = 1; |
||
1041 | end |
||
1042 | if (healermode == nil) then |
||
1043 | healermode = 0; |
||
1044 | end |
||
1045 | if (transparency == nil) then |
||
1046 | transparency = 1; |
||
1047 | end |
||
1048 | if (showportrait == nil) then |
||
1049 | showportrait = 0; |
||
1050 | end |
||
1051 | if (compactpercent == nil) then |
||
1052 | compactpercent = 0; |
||
1053 | end |
||
1054 | if (threedportrait == nil) then |
||
1055 | threedportrait = 0; |
||
1056 | end |
||
1057 | if (portraitcombattext == nil) then |
||
1058 | portraitcombattext = 1; |
||
1059 | end |
||
1060 | if (showdruidbar == nil) then |
||
1061 | showdruidbar = 1; |
||
1062 | end |
||
1063 | |||
1064 | local vars = { |
||
1065 | ["locked"] = locked, |
||
1066 | ["xpbarstate"] = xpbarstate, |
||
1067 | ["compactmode"] = compactmode, |
||
1068 | ["showraidgroup"] = showraidgroup, |
||
1069 | ["scale"] = scale, |
||
1070 | ["healermode"] = healermode, |
||
1071 | ["transparency"] = transparency, |
||
1072 | ["showportrait"] = showportrait, |
||
1073 | ["compactpercent"] = compactpercent, |
||
1074 | ["threedportrait"] = threedportrait, |
||
1075 | ["portraitcombattext"] = portraitcombattext, |
||
1076 | ["showdruidbar"] = showdruidbar, |
||
1077 | } |
||
1078 | return vars; |
||
1079 | end |
||
1080 | |||
1081 | function Perl_Player_UpdateVars(vartable) |
||
1082 | if (vartable ~= nil) then |
||
1083 | -- Sanity checks in case you use a load from an old version |
||
1084 | if (vartable["Global Settings"] ~= nil) then |
||
1085 | if (vartable["Global Settings"]["Locked"] ~= nil) then |
||
1086 | locked = vartable["Global Settings"]["Locked"]; |
||
1087 | else |
||
1088 | locked = nil; |
||
1089 | end |
||
1090 | if (vartable["Global Settings"]["XPBarState"] ~= nil) then |
||
1091 | xpbarstate = vartable["Global Settings"]["XPBarState"]; |
||
1092 | else |
||
1093 | xpbarstate = nil; |
||
1094 | end |
||
1095 | if (vartable["Global Settings"]["CompactMode"] ~= nil) then |
||
1096 | compactmode = vartable["Global Settings"]["CompactMode"]; |
||
1097 | else |
||
1098 | compactmode = nil; |
||
1099 | end |
||
1100 | if (vartable["Global Settings"]["ShowRaidGroup"] ~= nil) then |
||
1101 | showraidgroup = vartable["Global Settings"]["ShowRaidGroup"]; |
||
1102 | else |
||
1103 | showraidgroup = nil; |
||
1104 | end |
||
1105 | if (vartable["Global Settings"]["Scale"] ~= nil) then |
||
1106 | scale = vartable["Global Settings"]["Scale"]; |
||
1107 | else |
||
1108 | scale = nil; |
||
1109 | end |
||
1110 | if (vartable["Global Settings"]["HealerMode"] ~= nil) then |
||
1111 | healermode = vartable["Global Settings"]["HealerMode"]; |
||
1112 | else |
||
1113 | healermode = nil; |
||
1114 | end |
||
1115 | if (vartable["Global Settings"]["Transparency"] ~= nil) then |
||
1116 | transparency = vartable["Global Settings"]["Transparency"]; |
||
1117 | else |
||
1118 | transparency = nil; |
||
1119 | end |
||
1120 | if (vartable["Global Settings"]["ShowPortrait"] ~= nil) then |
||
1121 | showportrait = vartable["Global Settings"]["ShowPortrait"]; |
||
1122 | else |
||
1123 | showportrait = nil; |
||
1124 | end |
||
1125 | if (vartable["Global Settings"]["CompactPercent"] ~= nil) then |
||
1126 | compactpercent = vartable["Global Settings"]["CompactPercent"]; |
||
1127 | else |
||
1128 | compactpercent = nil; |
||
1129 | end |
||
1130 | if (vartable["Global Settings"]["ThreeDPortrait"] ~= nil) then |
||
1131 | threedportrait = vartable["Global Settings"]["ThreeDPortrait"]; |
||
1132 | else |
||
1133 | threedportrait = nil; |
||
1134 | end |
||
1135 | if (vartable["Global Settings"]["PortraitCombatText"] ~= nil) then |
||
1136 | portraitcombattext = vartable["Global Settings"]["PortraitCombatText"]; |
||
1137 | else |
||
1138 | portraitcombattext = nil; |
||
1139 | end |
||
1140 | if (vartable["Global Settings"]["ShowDruidBar"] ~= nil) then |
||
1141 | showdruidbar = vartable["Global Settings"]["ShowDruidBar"]; |
||
1142 | else |
||
1143 | showdruidbar = nil; |
||
1144 | end |
||
1145 | end |
||
1146 | |||
1147 | -- Set the new values if any new values were found, same defaults as above |
||
1148 | if (locked == nil) then |
||
1149 | locked = 0; |
||
1150 | end |
||
1151 | if (xpbarstate == nil) then |
||
1152 | xpbarstate = 1; |
||
1153 | end |
||
1154 | if (compactmode == nil) then |
||
1155 | compactmode = 0; |
||
1156 | end |
||
1157 | if (showraidgroup == nil) then |
||
1158 | showraidgroup = 1; |
||
1159 | end |
||
1160 | if (scale == nil) then |
||
1161 | scale = 1; |
||
1162 | end |
||
1163 | if (healermode == nil) then |
||
1164 | healermode = 0; |
||
1165 | end |
||
1166 | if (transparency == nil) then |
||
1167 | transparency = 1; |
||
1168 | end |
||
1169 | if (showportrait == nil) then |
||
1170 | showportrait = 0; |
||
1171 | end |
||
1172 | if (compactpercent == nil) then |
||
1173 | compactpercent = 0; |
||
1174 | end |
||
1175 | if (threedportrait == nil) then |
||
1176 | threedportrait = 0; |
||
1177 | end |
||
1178 | if (portraitcombattext == nil) then |
||
1179 | portraitcombattext = 1; |
||
1180 | end |
||
1181 | if (showdruidbar == nil) then |
||
1182 | showdruidbar = 1; |
||
1183 | end |
||
1184 | |||
1185 | -- Call any code we need to activate them |
||
1186 | Perl_Player_XPBar_Display(xpbarstate); |
||
1187 | Perl_Player_Set_Compact(compactmode); |
||
1188 | Perl_Player_Set_Healer(healermode); |
||
1189 | Perl_Player_Update_Raid_Group_Number(); |
||
1190 | Perl_Player_Update_Health(); |
||
1191 | Perl_Player_Update_Mana(); |
||
1192 | Perl_Player_Update_Portrait(); |
||
1193 | Perl_Player_Set_Scale(); |
||
1194 | Perl_Player_Set_Transparency(); |
||
1195 | end |
||
1196 | |||
1197 | Perl_Player_Config[UnitName("player")] = { |
||
1198 | ["Locked"] = locked, |
||
1199 | ["XPBarState"] = xpbarstate, |
||
1200 | ["CompactMode"] = compactmode, |
||
1201 | ["ShowRaidGroup"] = showraidgroup, |
||
1202 | ["Scale"] = scale, |
||
1203 | ["HealerMode"] = healermode, |
||
1204 | ["Transparency"] = transparency, |
||
1205 | ["ShowPortrait"] = showportrait, |
||
1206 | ["CompactPercent"] = compactpercent, |
||
1207 | ["ThreeDPortrait"] = threedportrait, |
||
1208 | ["PortraitCombatText"] = portraitcombattext, |
||
1209 | ["ShowDruidBar"] = showdruidbar, |
||
1210 | }; |
||
1211 | end |
||
1212 | |||
1213 | |||
1214 | -------------------- |
||
1215 | -- Click Handlers -- |
||
1216 | -------------------- |
||
1217 | function Perl_PlayerDropDown_OnLoad() |
||
1218 | UIDropDownMenu_Initialize(this, Perl_PlayerDropDown_Initialize, "MENU"); |
||
1219 | end |
||
1220 | |||
1221 | function Perl_PlayerDropDown_Initialize() |
||
1222 | UnitPopup_ShowMenu(Perl_Player_DropDown, "SELF", "player"); |
||
1223 | end |
||
1224 | |||
1225 | function Perl_Player_MouseClick(button) |
||
1226 | if (CastPartyConfig and PCUF_CASTPARTYSUPPORT == 1) then |
||
1227 | if (not string.find(GetMouseFocus():GetName(), "Name")) then |
||
1228 | CastParty_OnClickByUnit(button, "player"); |
||
1229 | end |
||
1230 | elseif (Genesis_data and PCUF_CASTPARTYSUPPORT == 1) then |
||
1231 | if (not string.find(GetMouseFocus():GetName(), "Name")) then |
||
1232 | Genesis_MouseHeal("player", button); |
||
1233 | end |
||
1234 | else |
||
1235 | if (SpellIsTargeting() and button == "RightButton") then |
||
1236 | SpellStopTargeting(); |
||
1237 | return; |
||
1238 | end |
||
1239 | |||
1240 | if (button == "LeftButton") then |
||
1241 | if (SpellIsTargeting()) then |
||
1242 | SpellTargetUnit("player"); |
||
1243 | elseif (CursorHasItem()) then |
||
1244 | DropItemOnUnit("player"); |
||
1245 | else |
||
1246 | TargetUnit("player"); |
||
1247 | end |
||
1248 | end |
||
1249 | end |
||
1250 | end |
||
1251 | |||
1252 | function Perl_Player_MouseDown(button) |
||
1253 | if (button == "LeftButton" and locked == 0) then |
||
1254 | Perl_Player_Frame:StartMoving(); |
||
1255 | end |
||
1256 | end |
||
1257 | |||
1258 | function Perl_Player_MouseUp(button) |
||
1259 | if (button == "RightButton") then |
||
1260 | if ((CastPartyConfig or Genesis_data) and PCUF_CASTPARTYSUPPORT == 1) then |
||
1261 | if (not (IsAltKeyDown() or IsControlKeyDown() or IsShiftKeyDown()) and string.find(GetMouseFocus():GetName(), "Name")) then -- if alt, ctrl, or shift ARE NOT held AND we are clicking the name frame, show the menu |
||
1262 | ToggleDropDownMenu(1, nil, Perl_Player_DropDown, "Perl_Player_NameFrame", 40, 0); |
||
1263 | end |
||
1264 | else |
||
1265 | if (not (IsAltKeyDown() or IsControlKeyDown() or IsShiftKeyDown())) then -- if alt, ctrl, or shift ARE NOT held, show the menu |
||
1266 | ToggleDropDownMenu(1, nil, Perl_Player_DropDown, "Perl_Player_NameFrame", 40, 0); |
||
1267 | end |
||
1268 | end |
||
1269 | end |
||
1270 | |||
1271 | Perl_Player_Frame:StopMovingOrSizing(); |
||
1272 | end |
||
1273 | |||
1274 | |||
1275 | ------------------------ |
||
1276 | -- Experience Tooltip -- |
||
1277 | ------------------------ |
||
1278 | function Perl_Player_XPTooltip() |
||
1279 | local playerxp, playerxpmax, xptext |
||
1280 | GameTooltip_SetDefaultAnchor(GameTooltip, this); |
||
1281 | if (xpbarstate == 1) then |
||
1282 | local playerlevel = UnitLevel("player"); -- Player's next level |
||
1283 | if (playerlevel < 70) then |
||
1284 | playerxp = UnitXP("player"); -- Player's current XP |
||
1285 | playerxpmax = UnitXPMax("player"); -- Experience for the current level |
||
1286 | local playerxprest = GetXPExhaustion(); -- Amount of bonus xp we have |
||
1287 | local xptolevel = playerxpmax - playerxp -- XP till level |
||
1288 | |||
1289 | if (playerxprest) then |
||
1290 | xptext = playerxp.."/"..playerxpmax .." (+"..(playerxprest)..")"; -- Create the experience string w/ rest xp |
||
1291 | else |
||
1292 | xptext = playerxp.."/"..playerxpmax; -- Create the experience string w/ no rest xp |
||
1293 | end |
||
1294 | |||
1295 | GameTooltip:SetText(xptext, 255/255, 209/255, 0/255); |
||
1296 | GameTooltip:AddLine(xptolevel.." until level "..(playerlevel + 1), 255/255, 209/255, 0/255); |
||
1297 | else |
||
1298 | GameTooltip:SetText("You can't gain anymore experience!", 255/255, 209/255, 0/255); |
||
1299 | end |
||
1300 | |||
1301 | elseif (xpbarstate == 2) then |
||
1302 | local rankNumber, rankName, rankProgress; -- Some variables |
||
1303 | rankNumber = UnitPVPRank("player") |
||
1304 | if (rankNumber < 1) then |
||
1305 | rankName = "Unranked" |
||
1306 | GameTooltip:SetText("You are Unranked.", 255/255, 209/255, 0/255); |
||
1307 | else |
||
1308 | rankName = GetPVPRankInfo(rankNumber, "player"); |
||
1309 | rankProgress = floor(GetPVPRankProgress() * 100); |
||
1310 | GameTooltip:SetText(rankProgress.."% into Rank "..(rankNumber - 4).." ("..rankName..")", 255/255, 209/255, 0/255); |
||
1311 | if (rankNumber < 18) then |
||
1312 | rankNumber = rankNumber + 1; |
||
1313 | rankName = GetPVPRankInfo(rankNumber, "player"); |
||
1314 | GameTooltip:AddLine((100 - rankProgress).."% until Rank "..(rankNumber - 4).." ("..rankName..")", 255/255, 209/255, 0/255); |
||
1315 | end |
||
1316 | end |
||
1317 | elseif (xpbarstate == 4) then |
||
1318 | local name, reaction, min, max, value = GetWatchedFactionInfo(); |
||
1319 | if (name) then |
||
1320 | value = value - min; |
||
1321 | max = max - min; |
||
1322 | min = 0; |
||
1323 | GameTooltip:SetText(floor(value/max*100+0.5).."% into "..Perl_Player_Get_Reaction_Name(reaction), 255/255, 209/255, 0/255); |
||
1324 | GameTooltip:AddLine(value.."/"..max, 255/255, 209/255, 0/255); |
||
1325 | if (reaction ~= 8) then |
||
1326 | GameTooltip:AddLine((max - value).." until "..Perl_Player_Get_Reaction_Name(reaction + 1), 255/255, 209/255, 0/255); |
||
1327 | end |
||
1328 | else |
||
1329 | GameTooltip:SetText("There is no reputation being tracked.", 255/255, 209/255, 0/255); |
||
1330 | end |
||
1331 | end |
||
1332 | GameTooltip:Show(); |
||
1333 | end |
||
1334 | |||
1335 | function Perl_Player_Get_Reaction_Name(reaction) |
||
1336 | local reactionname; |
||
1337 | if (reaction == 1) then |
||
1338 | reactionname = "Hated"; |
||
1339 | elseif (reaction == 2) then |
||
1340 | reactionname = "Hostile"; |
||
1341 | elseif (reaction == 3) then |
||
1342 | reactionname = "Unfriendly"; |
||
1343 | elseif (reaction == 4) then |
||
1344 | reactionname = "Neutral"; |
||
1345 | elseif (reaction == 5) then |
||
1346 | reactionname = "Friendly"; |
||
1347 | elseif (reaction == 6) then |
||
1348 | reactionname = "Honored"; |
||
1349 | elseif (reaction == 7) then |
||
1350 | reactionname = "Revered"; |
||
1351 | elseif (reaction == 8) then |
||
1352 | reactionname = "Exalted"; |
||
1353 | end |
||
1354 | return reactionname; |
||
1355 | end |
||
1356 | |||
1357 | |||
1358 | ----------------------- |
||
1359 | -- Scripting Support -- |
||
1360 | ----------------------- |
||
1361 | function Perl_Player_InCombat() |
||
1362 | if (InCombat == 1) then |
||
1363 | return 1; |
||
1364 | else |
||
1365 | return nil; |
||
1366 | end |
||
1367 | end |
||
1368 | |||
1369 | |||
1370 | ---------------------- |
||
1371 | -- myAddOns Support -- |
||
1372 | ---------------------- |
||
1373 | function Perl_Player_myAddOns_Support() |
||
1374 | -- Register the addon in myAddOns |
||
1375 | if (myAddOnsFrame_Register) then |
||
1376 | local Perl_Player_myAddOns_Details = { |
||
1377 | name = "Perl_Player", |
||
1378 | version = "Version 0.58", |
||
1379 | releaseDate = "April 15, 2006", |
||
1380 | author = "Perl; Maintained by Global", |
||
1381 | email = "global@g-ball.com", |
||
1382 | website = "http://www.curse-gaming.com/mod.php?addid=2257", |
||
1383 | category = MYADDONS_CATEGORY_OTHERS |
||
1384 | }; |
||
1385 | Perl_Player_myAddOns_Help = {}; |
||
1386 | Perl_Player_myAddOns_Help[1] = "/perl"; |
||
1387 | myAddOnsFrame_Register(Perl_Player_myAddOns_Details, Perl_Player_myAddOns_Help); |
||
1388 | end |
||
1389 | end |