vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | |
2 | local aquaformid, travelformid; |
||
3 | |||
4 | function DruidBar_OnLoad() |
||
5 | this:RegisterEvent("PLAYER_ENTERING_WORLD"); |
||
6 | this:RegisterEvent("PLAYER_LEAVING_WORLD"); |
||
7 | this:RegisterEvent("UNIT_MANA"); |
||
8 | this:RegisterEvent("UNIT_MAXMANA"); |
||
9 | this:RegisterEvent("SPELLCAST_STOP"); |
||
10 | this:RegisterEvent("VARIABLES_LOADED"); |
||
11 | this:RegisterEvent("UNIT_INVENTORY_CHANGED"); |
||
12 | this:RegisterEvent("PLAYER_AURAS_CHANGED"); |
||
13 | this:RegisterEvent("UPDATE_SHAPESHIFT_FORMS"); |
||
14 | this:RegisterEvent("CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE"); |
||
15 | this:RegisterEvent("INSTANCE_BOOT_START"); |
||
16 | this:RegisterEvent("INSTANCE_BOOT_STOP"); |
||
17 | SlashCmdList["DRUIDBARSLASH"] = DruidBar_Enable_ChatCommandHandler; |
||
18 | SLASH_DRUIDBARSLASH1 = "/dbar"; |
||
19 | SLASH_DRUIDBARSLASH2 = "/druidbar"; |
||
20 | DBarSpellCatch:SetOwner(DruidBarUpdateFrame, "ANCHOR_NONE"); |
||
21 | end |
||
22 | |||
23 | local inform, lowregentimer, fullmanatimer, lastshift, inCombat, firstEZ, pre_UseAction, shiftload, isMoving, waitonce, firstshift; |
||
24 | lowregentimer = 0; |
||
25 | fullmanatimer = 0; |
||
26 | function DruidBar_OnEvent(event, arg1, arg2, arg3) |
||
27 | if event == "PLAYER_ENTERING_WORLD" then |
||
28 | --Thanks to Tigerheart from Argent Dawn for this little piece of work, as well as fireball and prudence for bringing it up! |
||
29 | this:RegisterEvent("UNIT_MANA"); |
||
30 | this:RegisterEvent("UNIT_MAXMANA"); |
||
31 | this:RegisterEvent("PLAYER_REGEN_ENABLED"); |
||
32 | this:RegisterEvent("PLAYER_REGEN_DISABLED"); |
||
33 | this:RegisterEvent("UNIT_INVENTORY_CHANGED"); |
||
34 | this:RegisterEvent("PLAYER_AURAS_CHANGED"); |
||
35 | this:RegisterEvent("UPDATE_SHAPESHIFT_FORMS"); |
||
36 | return; |
||
37 | elseif event == "PLAYER_LEAVING_WORLD" then |
||
38 | this:UnregisterEvent("UNIT_MANA"); |
||
39 | this:UnregisterEvent("UNIT_MAXMANA"); |
||
40 | this:UnregisterEvent("PLAYER_REGEN_ENABLED"); |
||
41 | this:UnregisterEvent("PLAYER_REGEN_DISABLED"); |
||
42 | this:UnregisterEvent("UNIT_INVENTORY_CHANGED"); |
||
43 | this:UnregisterEvent("PLAYER_AURAS_CHANGED"); |
||
44 | this:RegisterEvent("UPDATE_SHAPESHIFT_FORMS"); |
||
45 | return; |
||
46 | end |
||
47 | if event == "VARIABLES_LOADED" then |
||
48 | if not DruidBarKey then DruidBarKey = {}; |
||
49 | DruidBarKey.keepthemana = 0; |
||
50 | DruidBarKey.maxmana = 10; |
||
51 | DruidBarKey.int = 0; |
||
52 | DruidBarKey.subtractmana = 0; |
||
53 | DruidBarKey.extra = 0; |
||
54 | DruidBarKey.Enabled = true; |
||
55 | DruidBarKey.EZShift = true; |
||
56 | DruidBarKey.Graphics = true; |
||
57 | end |
||
58 | _, init = UnitClass("player"); |
||
59 | if UnitPowerType("player") ~= 0 then firstshift = true; end |
||
60 | if not shiftload and init == "DRUID" then |
||
61 | pre_ShapeshiftBar_ChangeForm = ShapeshiftBar_ChangeForm; |
||
62 | ShapeshiftBar_ChangeForm = DruidBar_ChangeForm; |
||
63 | shiftload = true; |
||
64 | end |
||
65 | DBarSpellCatch:SetOwner(DruidBarUpdateFrame, "ANCHOR_NONE"); |
||
66 | elseif init and init == "DRUID" and DruidBarKey.Enabled then |
||
67 | if event == "UNIT_MAXMANA" and arg1 == "player" then |
||
68 | DruidBar_MaxManaScript(); |
||
69 | elseif event == "UNIT_INVENTORY_CHANGED" and arg1 == "player" then |
||
70 | DruidBar_MaxManaScript(); |
||
71 | elseif event == "UNIT_MANA" and arg1 == "player" then |
||
72 | if UnitPowerType(arg1) == 0 then |
||
73 | DruidBarKey.keepthemana = UnitMana(arg1); |
||
74 | elseif DruidBarKey.keepthemana < DruidBarKey.maxmana then |
||
75 | local add = DruidBar_ReflectionCheck(); |
||
76 | DruidBarKey.keepthemana = DruidBarKey.keepthemana + add + DruidBarKey.extra; |
||
77 | if DruidBarKey.keepthemana > DruidBarKey.maxmana then DruidBarKey.keepthemana = DruidBarKey.maxmana; end |
||
78 | end |
||
79 | fullmanatimer = 0; |
||
80 | elseif event == "PLAYER_AURAS_CHANGED" or event == "UPDATE_SHAPESHIFT_FORMS" then |
||
81 | if UnitPowerType("player") == 1 and not inform then |
||
82 | inform = true; |
||
83 | --Bear |
||
84 | DruidBar_Subtract(); |
||
85 | elseif UnitPowerType("player") == 3 and not inform then |
||
86 | inform = true; |
||
87 | --Cat |
||
88 | DruidBar_Subtract(); |
||
89 | elseif UnitPowerType("player") == 0 and inform then |
||
90 | inform = nil; |
||
91 | DruidBarKey.keepthemana = UnitMana("player"); |
||
92 | if DruidBarKey.maxmana ~= UnitManaMax("player") then |
||
93 | DruidBarKey.maxmana = UnitManaMax("player"); |
||
94 | end |
||
95 | --player/aqua/travel |
||
96 | end |
||
97 | elseif (event == "SPELLCAST_STOP") then |
||
98 | if (not firstEZ) then |
||
99 | if (DruidBarKey.EZShift) then |
||
100 | pre_UseAction = UseAction; |
||
101 | UseAction = DruidBar_UseAction; |
||
102 | end |
||
103 | firstEZ = true; |
||
104 | end |
||
105 | if UnitPowerType("player") == 0 then lowregentimer = 5; |
||
106 | waitonce = nil; end |
||
107 | end |
||
108 | elseif init and init == "DRUID" and not DruidBarKey.Enabled then |
||
109 | if event == "UNIT_MAXMANA" and arg1 == "player" then |
||
110 | DruidBar_MaxManaScript(); |
||
111 | end |
||
112 | end |
||
113 | end |
||
114 | |||
115 | local notyet; |
||
116 | function DruidBar_OnUpdate(elapsed) |
||
117 | if init and init == "DRUID" and DruidBarKey.Enabled then |
||
118 | if not notyet then |
||
119 | DruidBar_MaxManaScript(); |
||
120 | for i = 1, GetNumShapeshiftForms() do |
||
121 | local icon = GetShapeshiftFormInfo(i); |
||
122 | if icon == "Interface\\Icons\\Ability_Druid_AquaticForm" then aquaformid = i; end |
||
123 | if icon == "Interface\\Icons\\Ability_Druid_TravelForm" then travelformid = i; end |
||
124 | end |
||
125 | notyet = true; |
||
126 | end |
||
127 | DruidBarMana:SetMinMaxValues(0, DruidBarKey.maxmana); |
||
128 | DruidBarMana:SetValue(DruidBarKey.keepthemana); |
||
129 | if lowregentimer > 0 then |
||
130 | lowregentimer = lowregentimer - elapsed; |
||
131 | if lowregentimer <= 0 then lowregentimer = 0; end |
||
132 | end |
||
133 | if UnitPowerType("player") ~= 0 then |
||
134 | fullmanatimer = fullmanatimer + elapsed; |
||
135 | if fullmanatimer > 6 and floor((DruidBarKey.keepthemana*100) / DruidBarKey.maxmana) > 90 then |
||
136 | DruidBarKey.keepthemana = DruidBarKey.maxmana; |
||
137 | end |
||
138 | end |
||
139 | if DruidBarKey.Graphics then |
||
140 | if DruidBarKey.kmg then |
||
141 | dbarhide(DruidBarFrame); |
||
142 | dbarhide(DruidBarReplaceText); |
||
143 | DruidBar_KMGraphics(); |
||
144 | else |
||
145 | dbarhide(DruidBarKMG); |
||
146 | if DruidBarKey.Replace then DruidBar_ReplaceGraphics(); else DruidBar_MainGraphics(); end |
||
147 | end |
||
148 | else |
||
149 | dbarhide(DruidBarFrame); |
||
150 | dbarhide(DruidBarReplaceText); |
||
151 | dbarhide(DruidBarKMG); |
||
152 | if PlayerFrameManaBar:GetWidth() < 100 then PlayerFrameManaBar:SetWidth(120); end |
||
153 | end |
||
154 | else |
||
155 | dbarhide(DruidBarFrame); |
||
156 | dbarhide(DruidBarKMG); |
||
157 | end |
||
158 | end |
||
159 | |||
160 | function DruidBar_ReflectionCheck() |
||
161 | local managain = 0; |
||
162 | local j = 1; |
||
163 | while (UnitBuff("player",j)) do |
||
164 | DBarSpellCatch:SetUnitBuff("player", j); |
||
165 | local msg = DBarSpellCatchTextLeft1:GetText(); |
||
166 | if msg and (strfind(msg,DRUIDBAR_INNERVATE)) then |
||
167 | return ((ceil(UnitStat(arg1,5) / 5)+15) * 5); |
||
168 | end |
||
169 | j = j + 1; |
||
170 | end |
||
171 | if lowregentimer > 0 then |
||
172 | if waitonce then |
||
173 | local name, iconTexture, tier, column, rank, maxRank, isExceptional, meetsPrereq = GetTalentInfo(3, 6); |
||
174 | if rank == 0 then return 0; else |
||
175 | managain = ((ceil(UnitStat("player",5) / 5)+15) * (0.05 * rank)); |
||
176 | end |
||
177 | else |
||
178 | waitonce = true; |
||
179 | end |
||
180 | elseif lowregentimer <= 0 then |
||
181 | managain = (ceil(UnitStat("player",5) / 5)+15); |
||
182 | end |
||
183 | return managain; |
||
184 | end |
||
185 | |||
186 | --Gets the mana cost of your shapeshifting spells. |
||
187 | function DruidBar_GetShapeshiftCost() |
||
188 | if not DBarSpellCatch:IsOwned(DruidBarUpdateFrame) then DBarSpellCatch:SetOwner(DruidBarUpdateFrame, "ANCHOR_NONE"); end |
||
189 | DruidBarKey.subtractmana = 0; |
||
190 | local a, b, c, d = GetSpellTabInfo(4); |
||
191 | for i = 1, c+d, 1 do |
||
192 | local spellname = GetSpellName(i, BOOKTYPE_SPELL); |
||
193 | spellname = strlower(spellname); |
||
194 | if spellname and (strfind(spellname, DRUIDBAR_CAT_FORM) or strfind(spellname, DRUIDBAR_BEAR_FORM)) then |
||
195 | DBarSpellCatch:SetSpell(i, 1); |
||
196 | local msg = DBarSpellCatchTextLeft2:GetText(); |
||
197 | if DruidBarKey.Debug then DEFAULT_CHAT_FRAME:AddMessage(msg); end |
||
198 | local params; |
||
199 | if msg then |
||
200 | local index = strfind(msg, DRUIDBAR_MANA_DELIM); |
||
201 | if index then |
||
202 | if GetLocale() == "frFR" then params = strsub(msg, index+1); else params = strsub(msg, 1, index-1); end |
||
203 | if DruidBarKey.Debug then DEFAULT_CHAT_FRAME:AddMessage(params); end |
||
204 | DruidBarKey.subtractmana = tonumber(params); |
||
205 | if DruidBarKey.subtractmana and DruidBarKey.subtractmana > 0 then return; end |
||
206 | end |
||
207 | end |
||
208 | end |
||
209 | end |
||
210 | end |
||
211 | |||
212 | function DruidBar_Subtract() |
||
213 | if not firstshift then |
||
214 | local j = 1; |
||
215 | while (UnitBuff("player",j)) do |
||
216 | DBarSpellCatch:SetUnitBuff("player", j); |
||
217 | local msg = DBarSpellCatchTextLeft1:GetText(); |
||
218 | if msg and (strfind(msg,DRUIDBAR_META)) then |
||
219 | if DruidBarKey.Debug then DEFAULT_CHAT_FRAME:AddMessage("Rune detected, no mana cost!"); end |
||
220 | return; |
||
221 | end |
||
222 | j = j + 1; |
||
223 | end |
||
224 | DruidBarKey.keepthemana = DruidBarKey.keepthemana - DruidBarKey.subtractmana; |
||
225 | if DruidBarKey.Debug then DEFAULT_CHAT_FRAME:AddMessage("Mana Deduction: "..DruidBarKey.subtractmana); end |
||
226 | else |
||
227 | firstshift = nil; |
||
228 | end |
||
229 | end |
||
230 | |||
231 | --Change form! whatever you cast, if you're shifted, you'll shift back to caster. |
||
232 | function DruidBar_ChangeForm(id) |
||
233 | local a, b, c, d; |
||
234 | a = "Interface\\Icons\\Ability_Druid_AquaticForm"; |
||
235 | b = "Interface\\Icons\\Ability_Racial_BearForm"; |
||
236 | c = "Interface\\Icons\\Ability_Druid_CatForm"; |
||
237 | d = "Interface\\Icons\\Ability_Druid_TravelForm"; |
||
238 | local changingback = nil; |
||
239 | for i = 1, GetNumShapeshiftForms() do |
||
240 | local icon, name, active = GetShapeshiftFormInfo(i); |
||
241 | if active then id = i; changingback = true; end |
||
242 | end |
||
243 | if (id) then |
||
244 | local tex = GetShapeshiftFormInfo(id); |
||
245 | if DruidBarKey.message and not changingback then |
||
246 | if not DruidBarKey.BearMessage or not strfind(tostring(DruidBarKey.BearMessage), "table:") then |
||
247 | DruidBarKey.BearMessage = {}; |
||
248 | DruidBarKey.BearMessage[1] = "ROAR! ROAR I SAY! I guess there's no denyin'..."; |
||
249 | DruidBarKey.BearMessage[2] = "SAY"; |
||
250 | end |
||
251 | if not DruidBarKey.CatMessage or not strfind(tostring(DruidBarKey.CatMessage), "table:") then |
||
252 | DruidBarKey.CatMessage = {}; |
||
253 | DruidBarKey.CatMessage[1] = "Nyao."; |
||
254 | DruidBarKey.CatMessage[2] = "SAY"; |
||
255 | end |
||
256 | if not DruidBarKey.AquaMessage or not strfind(tostring(DruidBarKey.AquaMessage), "table:") then |
||
257 | DruidBarKey.AquaMessage = {}; |
||
258 | DruidBarKey.AquaMessage[1] = "Thrust vectoring owns the seas!"; |
||
259 | DruidBarKey.AquaMessage[2] = "SAY"; |
||
260 | end |
||
261 | if not DruidBarKey.TravMessage or not strfind(tostring(DruidBarKey.TravMessage), "table:") then |
||
262 | DruidBarKey.TravMessage = {}; |
||
263 | DruidBarKey.TravMessage[1] = "Multi-cat drifting!"; |
||
264 | DruidBarKey.TravMessage[2] = "SAY"; |
||
265 | end |
||
266 | if tex == b and DruidBarKey.BearMessage then |
||
267 | SendChatMessage(DruidBarKey.BearMessage[1], DruidBarKey.BearMessage[2]); |
||
268 | elseif tex == a and DruidBarKey.AquaMessage then |
||
269 | SendChatMessage(DruidBarKey.AquaMessage[1], DruidBarKey.AquaMessage[2]); |
||
270 | elseif tex == c and DruidBarKey.CatMessage then |
||
271 | SendChatMessage(DruidBarKey.CatMessage[1], DruidBarKey.CatMessage[2]); |
||
272 | elseif tex == d and DruidBarKey.TravMessage then |
||
273 | SendChatMessage(DruidBarKey.TravMessage[1], DruidBarKey.TravMessage[2]); |
||
274 | end |
||
275 | end |
||
276 | pre_ShapeshiftBar_ChangeForm(id); |
||
277 | return nil; |
||
278 | else |
||
279 | return true; |
||
280 | end |
||
281 | end |
||
282 | |||
283 | --Hooks into the original UseAction. Passes ChangeForm to shift out of caster. |
||
284 | function DruidBar_UseAction(id, ex, theSelf) |
||
285 | local texture = GetActionTexture(id); |
||
286 | local a, b, c, d; |
||
287 | a = "Interface\\Icons\\Ability_Druid_AquaticForm"; |
||
288 | b = "Interface\\Icons\\Ability_Racial_BearForm"; |
||
289 | c = "Interface\\Icons\\Ability_Druid_CatForm"; |
||
290 | d = "Interface\\Icons\\Ability_Druid_TravelForm"; |
||
291 | e = ".blp"; |
||
292 | if (texture == a or texture == b or texture == c or texture == d or texture == a..e or texture == b..e or texture == c..e or texture == d..e) then |
||
293 | local fix = DruidBar_ChangeForm(nil); |
||
294 | if (GetActionText(id) or fix) then |
||
295 | pre_UseAction(id, ex, theSelf); |
||
296 | end |
||
297 | else |
||
298 | pre_UseAction(id, ex, theSelf); |
||
299 | end |
||
300 | end |
||
301 | |||
302 | function dbarhide(frame) |
||
303 | if frame:IsVisible() then |
||
304 | frame:Hide(); |
||
305 | end |
||
306 | end |
||
307 | function dbarshow(frame) |
||
308 | if not frame:IsVisible() then |
||
309 | frame:Show(); |
||
310 | end |
||
311 | end |
||
312 | |||
313 | function dbarlen() |
||
314 | if not DruidBarKey.xvar then DruidBarKey.xvar = 160; end |
||
315 | if DruidBarFrame:GetWidth() ~= DruidBarKey.xvar then |
||
316 | DruidBarFrame:SetWidth(DruidBarKey.xvar); |
||
317 | DruidBarKey.xvar = DruidBarFrame:GetWidth(); |
||
318 | end |
||
319 | DruidBarMana:SetWidth(DruidBarKey.xvar*0.9375); |
||
320 | end |
||
321 | |||
322 | function dbarhei() |
||
323 | if not DruidBarKey.yvar then DruidBarKey.yvar = 18; end |
||
324 | if DruidBarFrame:GetHeight() ~= DruidBarKey.yvar then |
||
325 | DruidBarFrame:SetHeight(DruidBarKey.yvar); |
||
326 | DruidBarKey.yvar = DruidBarFrame:GetHeight(); |
||
327 | end |
||
328 | DruidBarMana:SetHeight(DruidBarKey.yvar*(2/3)); |
||
329 | end |
||
330 | local DruidBar_Anchored = nil |
||
331 | |||
332 | function DruidBar_MainGraphics() |
||
333 | local str; |
||
334 | if DruidBarKey.Percent and DruidBarKey.Percent == 1 then |
||
335 | str = "|CFFFFFFFF"..floor(DruidBarKey.keepthemana / DruidBarKey.maxmana * 100).."%|r"; |
||
336 | elseif DruidBarKey.Percent then |
||
337 | str = "|CFFFFFFFF"..floor(DruidBarKey.keepthemana).."/"..floor(DruidBarKey.maxmana).."|r"; |
||
338 | else |
||
339 | str = "|CFFFFFFFF"..floor(DruidBarKey.keepthemana).."/"..floor(DruidBarKey.maxmana).." "..floor(DruidBarKey.keepthemana / DruidBarKey.maxmana * 100).."%|r"; |
||
340 | end |
||
341 | dbarhide(DruidBarReplaceText); |
||
342 | if PlayerFrameManaBar:GetWidth() < 100 then PlayerFrameManaBar:SetWidth(120); end |
||
343 | |||
344 | if (DruidBarKey.Hide and UnitPowerType("player") ~= 0 and DruidBar_Full()) or not DruidBarKey.Hide then |
||
345 | dbarshow(DruidBarFrame); |
||
346 | dbarshow(DruidBarBorder); |
||
347 | if (DruidBarKey.Text and DruidBarKey.Text == 1) or (not DruidBarKey.Text and MouseIsOver(DruidBarFrame)) then |
||
348 | dbarshow(DruidBarText1); |
||
349 | dbarhide(DruidBarText); |
||
350 | DruidBarText1:SetText(str); |
||
351 | elseif DruidBarKey.Text then |
||
352 | dbarshow(DruidBarText); |
||
353 | dbarhide(DruidBarText1); |
||
354 | DruidBarText:SetText(str); |
||
355 | else |
||
356 | dbarhide(DruidBarText); |
||
357 | dbarhide(DruidBarText1); |
||
358 | end |
||
359 | dbarlen(); |
||
360 | dbarhei(); |
||
361 | if DruidBarKey.XPBar then |
||
362 | DruidBarFrame:ClearAllPoints(); |
||
363 | DruidBarFrame:SetPoint("TOPLEFT","PlayerFrame","TOPLEFT", 80, -63); |
||
364 | PlayerFrame:SetFrameLevel("1"); |
||
365 | DruidBarFrame:SetFrameLevel("1"); |
||
366 | DruidBarMana:SetFrameLevel("1"); |
||
367 | DruidBar_Anchored = true; |
||
368 | elseif DruidBar_Anchored then |
||
369 | DruidBarFrame:ClearAllPoints(); |
||
370 | DruidBarFrame:SetPoint("CENTER","UIParent","CENTER", 0, 0); |
||
371 | PlayerFrame:SetFrameLevel("1") |
||
372 | DruidBarFrame:SetFrameLevel("1"); |
||
373 | DruidBarFrame:SetFrameLevel("1"); |
||
374 | DruidBar_Anchored = nil; |
||
375 | end |
||
376 | if DruidBarKey.Lock then |
||
377 | dbarshow(DruidBarDontMove); |
||
378 | else |
||
379 | dbarhide(DruidBarDontMove); |
||
380 | end |
||
381 | else |
||
382 | dbarhide(DruidBarFrame); |
||
383 | dbarhide(DruidBarDontMove); |
||
384 | end |
||
385 | end |
||
386 | |||
387 | function DruidBar_ReplaceGraphics() |
||
388 | if UnitPowerType("player") ~= 0 then |
||
389 | dbarshow(DruidBarFrame); |
||
390 | dbarhide(DruidBarDontMove); |
||
391 | dbarhide(DruidBarBorder); |
||
392 | dbarhide(DruidBarText); |
||
393 | dbarhide(DruidBarText1); |
||
394 | dbarhide(PlayerFrameManaBarText); |
||
395 | dbarshow(DruidBarReplaceText); |
||
396 | PlayerFrameManaBar:SetWidth(60); |
||
397 | DruidBarFrame:ClearAllPoints(); |
||
398 | DruidBarFrame:SetPoint("TOPLEFT","PlayerFrame","TOPLEFT", 116, -50); |
||
399 | DruidBarMana:SetWidth(60); |
||
400 | DruidBarMana:SetHeight(10); |
||
401 | DruidBarMana:SetFrameLevel("1"); |
||
402 | local str, str1; |
||
403 | str = "|CFFFFFFFF"..UnitMana("player").."|r"; |
||
404 | if DruidBarKey.Percent and DruidBarKey.Percent == 1 then |
||
405 | str1 = "|CFFFFFFFF"..floor(DruidBarKey.keepthemana / DruidBarKey.maxmana * 100).."%|r"; |
||
406 | elseif DruidBarKey.Percent then |
||
407 | str1 = "|CFFFFFFFF"..floor(DruidBarKey.keepthemana).."|r"; |
||
408 | else |
||
409 | str1 = "|CFFFFFFFF"..(floor(DruidBarKey.keepthemana / 100)/10).."k,"..floor(DruidBarKey.keepthemana / DruidBarKey.maxmana * 100).."%|r"; |
||
410 | end |
||
411 | DruidBarReplaceText:SetFrameLevel("2"); |
||
412 | if (DruidBarKey.Text and DruidBarKey.Text == 1) or (not DruidBarKey.Text and (MouseIsOver(DruidBarFrame) or MouseIsOver(PlayerFrameManaBar)))then |
||
413 | dbarshow(DEnergyText1); |
||
414 | dbarshow(DManaText1); |
||
415 | dbarhide(DManaText); |
||
416 | dbarhide(DEnergyText); |
||
417 | DEnergyText1:SetText(str); |
||
418 | DManaText1:SetText(str1); |
||
419 | elseif DruidBarKey.Text then |
||
420 | dbarshow(DEnergyText); |
||
421 | dbarhide(DEnergyText1); |
||
422 | dbarshow(DManaText); |
||
423 | dbarhide(DManaText1); |
||
424 | DEnergyText:SetText(str); |
||
425 | DManaText:SetText(str1); |
||
426 | else |
||
427 | dbarhide(DEnergyText); |
||
428 | dbarhide(DEnergyText1); |
||
429 | dbarhide(DManaText); |
||
430 | dbarhide(DManaText1); |
||
431 | end |
||
432 | else |
||
433 | dbarhide(DruidBarFrame); |
||
434 | dbarhide(DEnergyText); |
||
435 | dbarhide(DEnergyText1); |
||
436 | dbarhide(DManaText); |
||
437 | dbarhide(DManaText1); |
||
438 | dbarhide(DruidBarReplaceText); |
||
439 | PlayerFrameManaBar:SetWidth(120); |
||
440 | end |
||
441 | end |
||
442 | |||
443 | function DruidBar_KMGraphics() |
||
444 | if (MGplayer_ManaBar) then |
||
445 | if UnitPowerType("player") == 0 then |
||
446 | MGplayer_ManaBar:SetWidth(MGplayer_HealthBar:GetWidth()); |
||
447 | MGplayer_ManaBar:ClearAllPoints(); |
||
448 | MGplayer_ManaBar:SetPoint("TOP","MGplayer_HealthBar","BOTTOM",0,-2); |
||
449 | DruidBarKMG:Hide(); |
||
450 | else |
||
451 | local sub = 0; |
||
452 | if MG_Get("ShowEndcaps") == 1 then sub = 1; else sub = -1; end |
||
453 | KMGDruidBar:SetWidth(MGplayer_HealthBar:GetWidth() / 2 - sub); |
||
454 | KMGDruidBar:SetHeight(MGplayer_ManaBar:GetHeight()); |
||
455 | MGplayer_ManaBar:SetWidth(MGplayer_HealthBar:GetWidth() / 2); |
||
456 | DruidBarKMG:Show(); |
||
457 | DruidBarKMG:ClearAllPoints(); |
||
458 | MGplayer_ManaBar:ClearAllPoints(); |
||
459 | MGplayer_ManaBar:SetPoint("TOPLEFT","MGplayer_HealthBar","BOTTOMLEFT",0,-2); |
||
460 | local points = MGplayer_HealthBar:GetWidth() / 4 * 3; |
||
461 | if MG_Get("ShowEndcaps") == 1 then |
||
462 | dbarshow(KMGDruidBar_ManaEndcapRight); |
||
463 | else |
||
464 | dbarhide(KMGDruidBar_ManaEndcapRight); |
||
465 | if MGplayer_ManaBar:GetWidth() <= 92 then points = points - 1; else points = points - 1; end |
||
466 | end |
||
467 | DruidBarKMG:SetScale(MGplayer_HealthBar:GetScale()); |
||
468 | DruidBarKMG:SetPoint("LEFT","MGplayer_ManaBar","LEFT", points, 0); |
||
469 | DruidBarKMG:SetFrameLevel("1"); |
||
470 | KMGDruidBar:SetFrameLevel(MGplayer_ManaBar:GetFrameLevel()); |
||
471 | KMGDruidBar:SetMinMaxValues(0, DruidBarKey.maxmana); |
||
472 | KMGDruidBar:SetValue(DruidBarKey.keepthemana); |
||
473 | if (DruidBarKey.Percent and MGplayer_HealthBar:GetWidth() <= 92) then |
||
474 | local curstat = (UnitMana("player") / UnitManaMax("player") * 100); |
||
475 | local manstat = (floor(DruidBarKey.keepthemana / DruidBarKey.maxmana * 100)).."%"; |
||
476 | MGplayer_ManaText:SetText(curstat.."/"..manstat); |
||
477 | elseif (MGplayer_HealthBar:GetWidth() <= 92) then |
||
478 | local curstat = UnitMana("player"); |
||
479 | MGplayer_ManaText:SetText(curstat.."/"..floor(DruidBarKey.keepthemana)); |
||
480 | end |
||
481 | end |
||
482 | else |
||
483 | DruidBarKMG:Hide(); |
||
484 | DruidBarKey.kmg = nil; |
||
485 | end |
||
486 | end |
||
487 | |||
488 | --Text Parsing. Yay! |
||
489 | function TextParse(InputString) |
||
490 | --[[ By FERNANDO! |
||
491 | This function should take a string and return a table with each word from the string in |
||
492 | each entry. IE, "Linoleum is teh awesome" returns {"Linoleum", "is", "teh", "awesome"} |
||
493 | Some good should come of this, I've been avoiding writing a text parser for a while, and |
||
494 | I need one I understand completely. ^_^ |
||
495 | |||
496 | If you want to gank this function and use it for whatever, feel free. Just give me props |
||
497 | somewhere. This function, as far as I can tell, is fairly foolproof. It's hard to get it |
||
498 | to screw up. It's also completely self-contained. Just cut and paste.]] |
||
499 | local Text = InputString; |
||
500 | local TextLength = 1; |
||
501 | local OutputTable = {}; |
||
502 | local OTIndex = 1; |
||
503 | local StartAt = 1; |
||
504 | local StopAt = 1; |
||
505 | local TextStart = 1; |
||
506 | local TextStop = 1; |
||
507 | local TextRemaining = 1; |
||
508 | local NextSpace = 1; |
||
509 | local Chunk = ""; |
||
510 | local Iterations = 1; |
||
511 | local EarlyError = false; |
||
512 | |||
513 | if ((Text ~= nil) and (Text ~= "")) then |
||
514 | -- ... Yeah. I'm not even going to begin without checking to make sure Im not getting |
||
515 | -- invalid data. The big ol crashes I got with my color functions taught me that. ^_^ |
||
516 | |||
517 | -- First, it's time to strip out any extra spaces, ie any more than ONE space at a time. |
||
518 | while (string.find(Text, " ") ~= nil) do |
||
519 | Text = string.gsub(Text, " ", " "); |
||
520 | end |
||
521 | |||
522 | -- Now, what if text consisted of only spaces, for some ungodly reason? Well... |
||
523 | if (string.len(Text) <= 1) then |
||
524 | EarlyError = true; |
||
525 | end |
||
526 | |||
527 | -- Now, if there is a leading or trailing space, we nix them. |
||
528 | if EarlyError ~= true then |
||
529 | TextStart = 1; |
||
530 | TextStop = string.len(Text); |
||
531 | |||
532 | if (string.sub(Text, TextStart, TextStart) == " ") then |
||
533 | TextStart = TextStart+1; |
||
534 | end |
||
535 | |||
536 | if (string.sub(Text, TextStop, TextStop) == " ") then |
||
537 | TextStop = TextStop-1; |
||
538 | end |
||
539 | |||
540 | Text = string.sub(Text, TextStart, TextStop); |
||
541 | end |
||
542 | |||
543 | -- Finally, on to breaking up the goddamn string. |
||
544 | |||
545 | OTIndex = 1; |
||
546 | TextRemaining = string.len(Text); |
||
547 | |||
548 | while (StartAt <= TextRemaining) and (EarlyError ~= true) do |
||
549 | |||
550 | -- NextSpace is the index of the next space in the string... |
||
551 | NextSpace = string.find(Text, " ",StartAt); |
||
552 | -- if there isn't another space, then StopAt is the length of the rest of the |
||
553 | -- string, otherwise it's just before the next space... |
||
554 | if (NextSpace ~= nil) then |
||
555 | StopAt = (NextSpace - 1); |
||
556 | else |
||
557 | StopAt = string.len(Text); |
||
558 | LetsEnd = true; |
||
559 | end |
||
560 | |||
561 | Chunk = string.sub(Text, StartAt, StopAt); |
||
562 | OutputTable[OTIndex] = Chunk; |
||
563 | OTIndex = OTIndex + 1; |
||
564 | |||
565 | StartAt = StopAt + 2; |
||
566 | |||
567 | end |
||
568 | else |
||
569 | OutputTable[1] = "Error: Bad value passed to TextParse!"; |
||
570 | end |
||
571 | |||
572 | if (EarlyError ~= true) then |
||
573 | return OutputTable; |
||
574 | else |
||
575 | return {"Error: Bad value passed to TextParse!"}; |
||
576 | end |
||
577 | end |
||
578 | |||
579 | --Normal print job. |
||
580 | function DruidBar_Print(msg,r,g,b,frame,id,unknown4th) |
||
581 | if(unknown4th) then |
||
582 | local temp = id; |
||
583 | id = unknown4th; |
||
584 | unknown4th = id; |
||
585 | end |
||
586 | |||
587 | if (not r) then r = 1.0; end |
||
588 | if (not g) then g = 1.0; end |
||
589 | if (not b) then b = 1.0; end |
||
590 | if ( frame ) then |
||
591 | frame:AddMessage(msg,r,g,b,id,unknown4th); |
||
592 | else |
||
593 | if ( DEFAULT_CHAT_FRAME ) then |
||
594 | DEFAULT_CHAT_FRAME:AddMessage(msg, r, g, b,id,unknown4th); |
||
595 | end |
||
596 | end |
||
597 | end |
||
598 | |||
599 | function DruidBar_Toggle(tog, str) if tog then DruidBar_Print(str.." off"); return nil; else DruidBar_Print(str.." on"); return true; end end |
||
600 | |||
601 | function DruidBar_Enable_ChatCommandHandler(text) |
||
602 | local msg = TextParse(text); |
||
603 | msg[1] = strlower(msg[1]); |
||
604 | if msg[1] == "on" then |
||
605 | DruidBarKey.Enabled = true; |
||
606 | DruidBar_Print("DruidBar is Enabled!",1,1,0); |
||
607 | elseif msg[1] == "off" then |
||
608 | DruidBarKey.Enabled = nil; |
||
609 | DruidBar_Print("DruidBar is Disabled!",1,1,0); |
||
610 | elseif msg[1] == "toggle" then |
||
611 | DruidBarKey.Enabled = DruidBar_Toggle(DruidBarKey.Enabled, "DruidBar is"); |
||
612 | elseif msg[1] == "vis" then |
||
613 | DruidBarKey.Graphics = DruidBar_Toggle(DruidBarKey.Graphics, "DruidBar's visual data is"); |
||
614 | elseif msg[1] == "message" then |
||
615 | if msg[2] and msg[2] == "toggle" then |
||
616 | DruidBarKey.message = DruidBar_Toggle(DruidBarKey.message, "Shapeshifting messages are"); |
||
617 | elseif msg[2] then |
||
618 | msg[2] = strlower(msg[2]); |
||
619 | if msg[3] then msg[3] = strlower(msg[3]); end |
||
620 | if msg[3] and (msg[3] == "say" or msg[3] == "party" or msg[3] == "raid" or msg[3] == "emote") then |
||
621 | --ookay... |
||
622 | else |
||
623 | DruidBar_Print("Invalid chat type. message format is: /dbar message [toggle/bear/cat/aqua/travel] [say/party/raid/emote] [message]"); |
||
624 | return; |
||
625 | end |
||
626 | if msg[2] == "bear" then |
||
627 | DruidBarKey.BearMessage = {}; |
||
628 | local x = string.gsub(text, msg[1].." "..msg[2].." "..msg[3].." ", ""); |
||
629 | DruidBarKey.BearMessage[1] = x; |
||
630 | DruidBarKey.BearMessage[2] = msg[3]; |
||
631 | DruidBar_Print("Current Bear message is now:"..x); |
||
632 | elseif msg[2] == "cat" then |
||
633 | DruidBarKey.CatMessage = {}; |
||
634 | local x = string.gsub(text, msg[1].." "..msg[2].." "..msg[3].." ", ""); |
||
635 | DruidBarKey.CatMessage[1] = x; |
||
636 | DruidBarKey.CatMessage[2] = msg[3]; |
||
637 | DruidBar_Print("Current Cat message is now:"..x); |
||
638 | elseif msg[2] == "aqua" then |
||
639 | DruidBarKey.AquaMessage = {}; |
||
640 | local x = string.gsub(text, msg[1].." "..msg[2].." "..msg[3].." ", ""); |
||
641 | DruidBarKey.AquaMessage[1] = x; |
||
642 | DruidBarKey.AquaMessage[2] = msg[3]; |
||
643 | DruidBar_Print("Current Aquatic message is now:"..x); |
||
644 | elseif msg[2] == "travel" then |
||
645 | DruidBarKey.TravMessage = {}; |
||
646 | local x = string.gsub(text, msg[1].." "..msg[2].." "..msg[3].." ", ""); |
||
647 | DruidBarKey.TravMessage[1] = x; |
||
648 | DruidBarKey.TravMessage[2] = msg[3]; |
||
649 | DruidBar_Print("Current Travel message is now:"..x); |
||
650 | else |
||
651 | DruidBar_Print("Invalid message type. message takes 5 parameters: Toggle, Bear, Cat, Aqua, or Travel."); |
||
652 | end |
||
653 | else |
||
654 | DruidBar_Print("Invalid chat type. message format is: /dbar message [toggle/bear/cat/aqua/travel] [say/party/raid/emote] [message]"); |
||
655 | end |
||
656 | elseif msg[1] == "width" and msg[2] and tonumber(msg[2]) then |
||
657 | DruidBarKey.xvar = tonumber(msg[2]); |
||
658 | DruidBar_Print("Width is now set to "..msg[2]); |
||
659 | elseif msg[1] == "height" and msg[2] and tonumber(msg[2]) then |
||
660 | DruidBarKey.yvar = tonumber(msg[2]); |
||
661 | DruidBar_Print("Height is now set to "..msg[2]); |
||
662 | elseif msg[1] == "hide" then |
||
663 | DruidBarKey.Hide = DruidBar_Toggle(DruidBarKey.Hide, "Hiding bar when in caster form is"); |
||
664 | elseif msg[1] == "full" then |
||
665 | DruidBarKey.Full = DruidBar_Toggle(DruidBarKey.Full, "Hiding bar when mana is full is"); |
||
666 | elseif msg[1] == "lock" then |
||
667 | DruidBarKey.Lock = DruidBar_Toggle(DruidBarKey.Lock, "Lock feature is"); |
||
668 | elseif msg[1] == "replace" then |
||
669 | DruidBarKey.Replace = DruidBar_Toggle(DruidBarKey.Replace, "Replacing the player frame's mana bar is"); |
||
670 | elseif msg[1] == "player" then |
||
671 | DruidBarKey.XPBar = DruidBar_Toggle(DruidBarKey.XPBar, "Showing the bar below the Player Frame is"); |
||
672 | if DruidBarKey.XPBar then DruidBarKey.xvar = 150; DruidBarKey.yvar = 18; else DruidBarKey.xvar = 160; DruidBarKey.yvar = 18; end |
||
673 | elseif msg[1] == "text" then |
||
674 | if not DruidBarKey.Text then DruidBarKey.Text = 0; DruidBar_Print("Original-Style text on!"); elseif DruidBarKey.Text == 0 then DruidBarKey.Text = 1; DruidBar_Print("New-Style text on!"); elseif DruidBarKey.Text == 1 then DruidBarKey.Text = nil; DruidBar_Print("Text removed."); end |
||
675 | elseif msg[1] == "percent" then |
||
676 | if not DruidBarKey.Percent then DruidBarKey.Percent = 0; DruidBar_Print("DruidBar will show Raw numbers"); elseif DruidBarKey.Percent == 0 then DruidBarKey.Percent = 1; DruidBar_Print("DruidBar will now show Percentages"); elseif DruidBarKey.Percent == 1 then DruidBarKey.Percent = nil; DruidBar_Print("DruidBar will show both Percentages and Raw numbers"); end |
||
677 | elseif msg[1] == "status" then |
||
678 | DruidBar_Status(); |
||
679 | elseif msg[1] == "best" then |
||
680 | DruidBar_ChangeBestForm(); |
||
681 | elseif msg[1] == "ez" then |
||
682 | DruidBarKey.EZShift = DruidBar_Toggle(DruidBarKey.EZShift, "Easy Shifting is now"); |
||
683 | elseif msg[1] == "kmg" then |
||
684 | if (MGplayer_ManaBar) then |
||
685 | DruidBarKey.kmg = DruidBar_Toggle(DruidBarKey.kmg, "Replacing the MiniGroup mana bar is"); |
||
686 | else |
||
687 | DruidBarKey.kmg = nil; |
||
688 | DruidBar_Print("Can't replace MiniGroup if it don't exist, YO!"); |
||
689 | end |
||
690 | elseif msg[1] == "debug" then |
||
691 | DruidBarKey.Debug = DruidBar_Toggle(DruidBarKey.Debug, "Debug options"); |
||
692 | else |
||
693 | DruidBar_Print("Invalid option. Options are: [on/off/toggle/vis/message/width/height/percent/hide/full/lock/replace/kmg/best/player/text/status]"); |
||
694 | end |
||
695 | end |
||
696 | |||
697 | function DruidBar_Status() |
||
698 | DruidBar_Print("DruidBar Toggle Status:"); |
||
699 | DruidBar_Print("DruidBar's enabled status is "..DruidBar_On(DruidBarKey.Enabled)); |
||
700 | DruidBar_Print("Graphics are "..DruidBar_On(DruidBarKey.Graphics)); |
||
701 | DruidBar_Print("Shapeshift messages are "..DruidBar_On(DruidBarKey.message)); |
||
702 | DruidBar_Print("Hiding when in caster is "..DruidBar_On(DruidBarKey.Hide)); |
||
703 | DruidBar_Print("Hiding when mana is full is "..DruidBar_On(DruidBarKey.Full)); |
||
704 | DruidBar_Print("Replacing the Player Frame's mana bar is "..DruidBar_On(DruidBarKey.Replace)); |
||
705 | DruidBar_Print("Showing under the Player Frame is "..DruidBar_On(DruidBarKey.XPBar)); |
||
706 | local str; |
||
707 | if not DruidBarKey.Text then str = "|CFF888888Off|r"; elseif DruidBarKey.Text == 1 then str = "|CFFFFFFFFModern|r"; else str = "|CFF00FF00Classic|r"; end |
||
708 | DruidBar_Print("The current style of text is "..str); |
||
709 | if not DruidBarKey.Percent then str = "|CFF00FF00Percent and Raw|r"; elseif DruidBarKey.Percent == 1 then str = "|CFFFF00FFRaw|r"; else str = "|CFF0000FFPercent|r"; end |
||
710 | DruidBar_Print("The current display of text is "..str); |
||
711 | DruidBar_Print("Debugging is "..DruidBar_On(DruidBarKey.Debug)); |
||
712 | end |
||
713 | |||
714 | function DruidBar_On(tog) |
||
715 | if tog then |
||
716 | return "|CFF00FF00On.|r"; |
||
717 | else |
||
718 | return "|CFFFF0000Off.|r"; |
||
719 | end |
||
720 | end |
||
721 | |||
722 | function DruidBar_MaxManaScript() |
||
723 | local _, int = UnitStat("player", 4); |
||
724 | DruidBar_GetShapeshiftCost(); |
||
725 | if UnitPowerType("player") == 0 then |
||
726 | if UnitManaMax("player") > 0 then |
||
727 | DruidBarKey.maxmana = UnitManaMax("player"); |
||
728 | DruidBarKey.keepthemana = UnitMana("player"); |
||
729 | DruidBarKey.int = int; |
||
730 | end |
||
731 | elseif UnitPowerType("player") ~= 0 then |
||
732 | if DruidBarKey.int ~= int then |
||
733 | if int > DruidBarKey.int then |
||
734 | local dif = int - DruidBarKey.int; |
||
735 | DruidBarKey.maxmana = DruidBarKey.maxmana + (dif * 15); |
||
736 | DruidBarKey.int = int; |
||
737 | elseif int < DruidBarKey.int then |
||
738 | local dif = DruidBarKey.int - int; |
||
739 | DruidBarKey.maxmana = DruidBarKey.maxmana - (dif * 15); |
||
740 | DruidBarKey.int = int; |
||
741 | end |
||
742 | end |
||
743 | if DruidBarKey.keepthemana > DruidBarKey.maxmana then |
||
744 | DruidBarKey.keepthemana = DruidBarKey.maxmana; |
||
745 | end |
||
746 | end |
||
747 | DruidBarKey.extra = 0; |
||
748 | for i = 1, 18 do |
||
749 | DBarSpellCatch:ClearLines(); |
||
750 | DBarSpellCatch:SetInventoryItem("player", i); |
||
751 | for j = 1, DBarSpellCatch:NumLines() do |
||
752 | local strchek = getglobal("DBarSpellCatchTextLeft"..j):GetText(); |
||
753 | if strchek then |
||
754 | |||
755 | if strfind(strchek, DRUIDBAR_REGEN1) then |
||
756 | DruidBarKey.extra = DruidBarKey.extra + string.gsub(strchek, DRUIDBAR_REGEN3, "%1") |
||
757 | end |
||
758 | if strfind(strchek, DRUIDBAR_REGEN2) then |
||
759 | DruidBarKey.extra = DruidBarKey.extra + string.gsub(strchek, DRUIDBAR_REGEN4, "%1"); |
||
760 | end |
||
761 | end |
||
762 | end |
||
763 | end |
||
764 | DruidBarKey.extra = (DruidBarKey.extra * 2) / 5; |
||
765 | end |
||
766 | |||
767 | function DruidBar_Full() |
||
768 | if DruidBarKey.Full then |
||
769 | if DruidBarKey.keepthemana < DruidBarKey.maxmana then |
||
770 | return true; |
||
771 | else |
||
772 | return nil; |
||
773 | end |
||
774 | else |
||
775 | return true; |
||
776 | end |
||
777 | end |
||
778 | |||
779 | |||
780 | function UIErrorsFrame:realEcho() |
||
781 | |||
782 | end |
||
783 | |||
784 | |||
785 | |||
786 | function UIErrorsFrame:fakeEcho(str, a1, a2, a3, a4, a5, a6) |
||
787 | --DruidBar_Print(str, a1, a2, a3) |
||
788 | --The outdoors message is normally delayed by lag so that it doesn't actually come until after the function is re-enabled. However, on occasion when the latency is very low and the interface lags, it will come while the function is still disabled. Allow the message through if this is the case. |
||
789 | if(str == "Can only use outside") then |
||
790 | UIErrorsFrame:realEcho(str, a1, a2, a3, a4, a5, a6) |
||
791 | end |
||
792 | |||
793 | end |
||
794 | |||
795 | |||
796 | --[[ Shapeshifting Code ]]-- |
||
797 | --Thanks to mib for this code! it's awesome! |
||
798 | --also thanks to Zevzabich for a bit of help since the pure rapeage of both my character and my lua that is know as 0.10 |
||
799 | function DruidBar_ChangeBestForm() |
||
800 | local m_bag = -1; |
||
801 | local m_pos = -1; |
||
802 | local aq_bag = -1; |
||
803 | local aq_pos = -1; |
||
804 | -- search position of mount |
||
805 | for bag = 0,4 do |
||
806 | for i = 1,16 do |
||
807 | local t = GetContainerItemInfo(bag, i) |
||
808 | if (t) then |
||
809 | if (strfind(t,"\Ability_Mount_")) then |
||
810 | m_bag = bag; |
||
811 | m_pos = i; |
||
812 | end |
||
813 | if strfind(t, "\INV_Misc_Horn_01") and strfind(strlower(GetContainerItemLink(bag,i)), "frostwolf") then |
||
814 | m_bag = bag; |
||
815 | m_pos = i; |
||
816 | end |
||
817 | if (strfind(t, "INV_Misc_QirajiCrystal")) then |
||
818 | aq_bag = bag; |
||
819 | aq_pos = i; |
||
820 | end |
||
821 | end |
||
822 | end |
||
823 | end |
||
824 | local _, pqrs = UnitClass("player"); |
||
825 | if pqrs == "DRUID" then |
||
826 | --first hide the error messages |
||
827 | --we try to do all 3 at once! |
||
828 | |||
829 | UIErrorsFrame.realEcho = UIErrorsFrame.AddMessage; |
||
830 | UIErrorsFrame.AddMessage = UIErrorsFrame.fakeEcho; |
||
831 | if strfind(GetRealZoneText(), "Ahn'Qiraj") and not strfind(GetRealZoneText(), "Gates of Ahn'Qiraj") and not strfind(GetRealZoneText(), "Ruins of Ahn'Qiraj") then |
||
832 | UseContainerItem(aq_bag, aq_pos); |
||
833 | else |
||
834 | UseContainerItem(m_bag, m_pos); |
||
835 | end |
||
836 | ShapeshiftBar_ChangeForm(travelformid); |
||
837 | ShapeshiftBar_ChangeForm(aquaformid); |
||
838 | --then we allow error messages again |
||
839 | UIErrorsFrame.AddMessage = UIErrorsFrame.realEcho; |
||
840 | else |
||
841 | local i = 1; |
||
842 | --check for high-speed castable mounts. |
||
843 | while true do |
||
844 | local spellName = GetSpellName(i, BOOKTYPE_SPELL); |
||
845 | if not spellName then |
||
846 | do break end |
||
847 | end |
||
848 | if spellName == "Summon Charger" or spellName == "Summon Dreadsteed" then |
||
849 | CastSpell(i, BOOKTYPE_SPELL); |
||
850 | return; |
||
851 | end |
||
852 | i = i + 1; |
||
853 | end |
||
854 | i = 1; |
||
855 | --check for lv40 castable mounts, or ghost wolf. |
||
856 | while true do |
||
857 | local spellName = GetSpellName(i, BOOKTYPE_SPELL); |
||
858 | if not spellName then |
||
859 | do break end |
||
860 | end |
||
861 | if spellName == "Summon Felsteed" or spellName == "Ghost Wolf" or spellName == "Summon Warhorse" then |
||
862 | CastSpell(i, BOOKTYPE_SPELL); |
||
863 | return; |
||
864 | end |
||
865 | i = i + 1; |
||
866 | end |
||
867 | --nothing yet? let's try to mount normally. |
||
868 | UIErrorsFrame.realEcho = UIErrorsFrame.AddMessage; |
||
869 | UIErrorsFrame.AddMessage = UIErrorsFrame.fakeEcho; |
||
870 | --and trying... |
||
871 | if strfind(GetRealZoneText(), "Ahn'Qiraj") and not strfind(GetRealZoneText(), "Gates of Ahn'Qiraj") and not strfind(GetRealZoneText(), "Ruins of Ahn'Qiraj") then |
||
872 | UseContainerItem(aq_bag, aq_pos); |
||
873 | else |
||
874 | UseContainerItem(m_bag, m_pos); |
||
875 | end |
||
876 | --then we allow error messages again |
||
877 | UIErrorsFrame.AddMessage = UIErrorsFrame.realEcho; |
||
878 | end |
||
879 | end |