-
Notifications
You must be signed in to change notification settings - Fork 8
/
GoGoMount.lua
3223 lines (2975 loc) · 139 KB
/
GoGoMount.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
local _
---------
function GoGo_OnLoad()
---------
SLASH_GOGOMOUNT1 = "/gogo"
SlashCmdList["GOGOMOUNT"] = function(msg) GoGo_OnSlash(msg) end
SLASH_GOGOID1 = "/id"
SlashCmdList["GOGOID"] = function(msg) GoGo_Msg(GoGo_Id(msg)) end
GoGoFrame:RegisterEvent("ADDON_LOADED")
GoGoFrame:RegisterEvent("UPDATE_BINDINGS")
GoGoFrame:RegisterEvent("TAXIMAP_OPENED")
GoGoFrame:RegisterEvent("CHAT_MSG_ADDON")
GoGoFrame:RegisterEvent("COMPANION_LEARNED")
GoGoFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
GoGoFrame:RegisterEvent("ZONE_CHANGED_NEW_AREA")
GoGoFrame:RegisterEvent("ZONE_CHANGED_INDOORS")
GoGoFrame:RegisterEvent("ZONE_CHANGED")
end --function
---------
function GoGo_OnEvent(self, event, ...)
---------
local arg1, arg2, arg3, arg4 = ...
if event == "ADDON_LOADED" and arg1 == "GoGoMount" then
GoGo_DebugLog = {}
if not GoGo_Prefs then
GoGo_Settings_Default()
end --if
GoGo_Prefs.UnknownMounts = {}
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_OnEvent(ADDON_LOADED): Addon Loaded event fired.")
end --if
GoGoFrame:UnregisterEvent("ADDON_LOADED")
if not GoGo_Prefs_Template then
GoGo_Prefs_Template = {}
end --if
if not GoGo_Prefs.version then
GoGo_Settings_Default()
elseif GoGo_Prefs.version ~= GetAddOnMetadata("GoGoMount", "Version") then
GoGo_Settings_SetUpdates()
end --if
GoGo_Variables.VerMajor, GoGo_Variables.VerMinor, GoGo_Variables.VerBuild = strsplit(".", GetAddOnMetadata("GoGoMount", "Version"))
GoGo_Variables.VerMajor, GoGo_Variables.VerMinor, GoGo_Variables.VerBuild = tonumber(GoGo_Variables.VerMajor), tonumber(GoGo_Variables.VerMinor), tonumber(GoGo_Variables.VerBuild)
_, GoGo_Variables.Player.Class = UnitClass("player")
_, GoGo_Variables.Player.Race = UnitRace("player")
GoGo_Variables.Player.Faction, _ = UnitFactionGroup("player")
GoGoFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
GoGo_UpdateZonePrefs() -- Migrate zone settings before attempting to draw options
if (GoGo_Variables.Player.Class == "DRUID") then
GoGo_Variables.Druid = {}
-- GoGoFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
GoGo_Druid_Panel()
elseif (GoGo_Variables.Player.Class == "SHAMAN") then
GoGo_Variables.Shaman = {}
-- GoGoFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
GoGo_Shaman_Panel()
elseif (GoGo_Variables.Player.Class == "HUNTER") then
GoGo_Hunter_Panel()
end --if
GoGo_Panel_Options()
GoGo_ZoneFavorites_Panel()
GoGo_GlobalFavorites_Panel()
GoGo_ExtraPassengerMounts_Panel()
GoGo_ZoneExclusions_Panel()
GoGo_GlobalExclusions_Panel()
GoGo_CheckBindings() -- reset key bindings when issuing /console reloadui
if GoGo_Prefs.autodismount then
GoGo_SetOptionAutoDismount(1)
end --if
elseif event == "PLAYER_REGEN_DISABLED" then
GoGo_Variables.Player.MapID = C_Map.GetBestMapForUnit("player")
GoGo_Variables.Player.ZoneID = GoGo_Variables.ZoneMapID[GoGo_Variables.Player.MapID]
for i, button in ipairs({GoGoButton, GoGoButton2, GoGoButton3}) do
if GoGo_Variables.Player.Class == "SHAMAN" then
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_OnEvent: Shaman entering combat. Setting macro.")
end --if
GoGo_FillButton(button, GoGo_InBook(GOGO_SPELLS["SHAMAN"]))
elseif GoGo_Variables.Player.Class == "DRUID" then
if not GoGo_Prefs.DruidDisableInCombat then
GoGo_ZoneCheck() -- Checking to see what we can and can not do in zones
GoGo_FillButton(button, GoGo_InBook(GOGO_SPELLS["DRUID"]))
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_OnEvent: Druid entering combat. Setting macro.")
end --if
else
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_OnEvent: Druid entering combat. Clearing macro because of set option.")
end --if
GoGo_FillButton(button)
end --if
elseif GoGo_Variables.Player.ZoneID == 950 then -- everyone else if in nagrand
local name = GetSpellInfo(161691)
_, _, _, _, _, _, spellID = GetSpellInfo(name)
if spellID == 165803 or spellID == 164222 then
if GoGo_Variables.Player.Faction == "Alliance" then
GoGo_FillButton(button, GoGo_GetIDName(165803))
elseif GoGo_Variables.Player.Faction == "Horde" then
GoGo_FillButton(button, GoGo_GetIDName(164222))
end --if
end --if
end --if
end --for
elseif event == "ZONE_CHANGED_NEW_AREA" or event == "ZONE_CHANGED_INDOORS" or event == "ZONE_CHANGED" then
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_OnEvent(ZONE_CHANGED_NEW_AREA): Event fired.")
end --if
-- SetMapToCurrentZone()
GoGo_Variables.Player.Zone = GetRealZoneText()
GoGo_Variables.Player.MapID = C_Map.GetBestMapForUnit("player")
GoGo_Variables.Player.ZoneID = GoGo_Variables.ZoneMapID[GoGo_Variables.Player.MapID]
-- GoGo_Variables.Player.ZoneID = GetCurrentMapAreaID()
if GoGo_Variables.Debug >= 5 then GoGo_ZoneCheck() end --if
GoGo_UpdateZonePrefs()
if _G["GoGo_ZoneFavorites_ContentFrame"] and _G["GoGo_ZoneFavorites_ContentFrame"]:IsShown() then
GoGo_AddOptionCheckboxes("GoGo_ZoneFavorites_ContentFrame")
end --if
if _G["GoGo_ZoneExclusions_ContentFrame"] and _G["GoGo_ZoneExclusions_ContentFrame"]:IsShown() then
GoGo_AddOptionCheckboxes("GoGo_ZoneExclusions_ContentFrame")
end --if
elseif event == "TAXIMAP_OPENED" then
GoGo_Dismount()
elseif event == "UPDATE_BINDINGS" then
if not InCombatLockdown() then -- ticket 213
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_OnEvent(UPDATE_BINDINGS): Updating key bindings.")
end --if
GoGo_CheckBindings()
end --if
elseif event == "UI_ERROR_MESSAGE" then
if GOGO_ERRORS[arg1] and not IsFlying() then
GoGo_Dismount()
end --if
elseif (event == "PLAYER_ENTERING_WORLD") then
GoGo_StartStopDebug(0)
GoGo_Variables.Player.Zone = GetRealZoneText()
GoGo_Variables.Player.MapID = C_Map.GetBestMapForUnit("player")
GoGo_Variables.Player.ZoneID = GoGo_Variables.ZoneMapID[GoGo_Variables.Player.MapID]
-- GoGo_Variables.Player.SubZoneID = GetCurrentMapDungeonLevel()
GoGo_UpdateZonePrefs()
GoGo_Variables.ExpansionAccount = GetAccountExpansionLevel()
GoGo_Variables.ExpansionGame = GetExpansionLevel()
-- local _ = RegisterAddonMessagePrefix("GoGoMountVER")
elseif (event == "UNIT_TARGET" and arg1 == "player") then -- find out what mount player is using - only enabled if debug level >= 6
local GoGo_PlayerName = UnitName("target")
local i = 1
GoGo_GetMountDB() -- get the mount list
local buff, _, _, _, _, _, _, _, _, _, spellid = UnitAura("target", i)
while buff do
if GoGo_Variables.MountDB[spellid] then
GoGo_DebugAddLine("EVENT UNIT_TARGET: " .. GoGo_PlayerName .. " buffs = " .. buff .. " - " .. spellid)
end --if
i = i + 1
buff, _, _, _, _, _, _, _, _, _, spellid = UnitAura("target", i)
end --while
elseif (event == "CHAT_MSG_ADDON") and (arg1 == "GoGoMountVER") and not GoGo_Prefs.DisableUpdateNotice then
local major, minor, build = strsplit(".", arg2)
local major, minor, build = tonumber(major), tonumber(minor), tonumber(build)
if not GoGo_Variables.UpdateShown then
local GoGo_ShowUpdate = false
if major > GoGo_Variables.VerMajor then
GoGo_ShowUpdate = true
elseif (major == GoGo_Variables.VerMajor) and (minor > GoGo_Variables.VerMinor) then
GoGo_ShowUpdate = true
elseif (major == GoGo_Variables.VerMajor) and (minor == GoGo_Variables.VerMinor) and (build > GoGo_Variables.VerBuild) then
GoGo_ShowUpdate = true
end --if
if GoGo_ShowUpdate then
GoGo_Variables.UpdateShown = true
GoGo_Msg(GoGo_Variables.Localize.String.NewVersionFound)
end --if
end --if
end --if
end --function
---------
function GoGo_OnSlash(msg)
---------
if GOGO_COMMANDS[string.lower(msg)] then
GOGO_COMMANDS[string.lower(msg)]()
elseif string.find(msg, "spell:%d+") or string.find(msg, "item:%d+") then
GoGo_CmdLineLinkProcessing(msg)
else
GoGo_Msg("optiongui")
GoGo_Msg("auto")
GoGo_Msg("updatenotice")
GoGo_Msg("mountnotice")
if GoGo_Variables.Player.Class == "DRUID" then GoGo_Msg("druidclickform") end --if
if GoGo_Variables.Player.Class == "DRUID" then GoGo_Msg("druidflightform") end --if
GoGo_Msg("pref")
GoGo_Msg("globalexclude")
end --if
end --function
---------
function GoGo_PreClick(button)
---------
if GoGo_Variables.Debug >= 10 then
_ = GoGo_DebugCollectInformation()
GoGo_DebugAddLine("GoGo_PreClick: Starts")
end --if
if not InCombatLockdown() then
GoGo_FillButton(button)
end --if
if IsMounted() or CanExitVehicle() then
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_PreClick: Player is mounted and is being dismounted.")
end --if
GoGo_Dismount()
elseif GoGo_Variables.Player.Class == "DRUID" and GoGo_IsShifted() and not InCombatLockdown() then
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_PreClick: Player is a druid, is shifted and not in combat.")
end --if
GoGo_Dismount(button)
-- elseif GoGo_Variables.Player.Class == "SHAMAN" and UnitBuff("player", GetSpellInfo(GoGo_Variables.Localize.GhostWolf)) then
elseif GoGo_Variables.Player.Class == "SHAMAN" and AuraUtil.FindAuraByName(GetSpellInfo(GoGo_Variables.Localize.GhostWolf), "player") then
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_PreClick: Player is a shaman and is in wolf form. Standing up.")
end --if
GoGo_Dismount(button)
elseif not InCombatLockdown() then
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_PreClick: Player not in combat, button pressed, looking for a mount.")
end --if
GoGo_FillButton(button, GoGo_GetMount())
end --if
--[[ --Disabled for now since Blizzard keeps changing group & raid layouts
if not GoGo_Variables.TestVersion then
if ( IsInGuild() ) then
if GoGo_Variables.Debug >= 5 then
GoGo_DebugAddLine("GoGo_PreClick: Is in guild - sending GoGoMount version information to guild addon channel.")
end --if
SendAddonMessage("GoGoMountVER", GetAddOnMetadata("GoGoMount", "Version"), "GUILD")
else
if GoGo_Variables.Debug >= 5 then
GoGo_DebugAddLine("GoGo_PreClick: Is not in guild - not sending GoGoMount version information to guild addon channel.")
end --if
end --if
if UnitInRaid("player") and not UnitInBattleground("player") then
if GoGo_Variables.Debug >= 5 then
GoGo_DebugAddLine("GoGo_PreClick: Is in raid - sending GoGoMount version information to raid addon channel.")
end --if
SendAddonMessage("GoGoMountVER", GetAddOnMetadata("GoGoMount", "Version"), "RAID")
end --if
-- if UnitInParty("player") and not UnitInBattleground("player") then
-- if GoGo_Variables.Debug >= 5 then
-- GoGo_DebugAddLine("GoGo_PreClick: Is in party - sending GoGoMount version information to party addon channel.")
-- end --if
-- SendAddonMessage("GoGoMountVER", GetAddOnMetadata("GoGoMount", "Version"), "PARTY")
-- end --if
if UnitInBattleground("player") then
if GoGo_Variables.Debug >= 5 then
GoGo_DebugAddLine("GoGo_PreClick: Is in battle ground - sending GoGoMount version information to battle ground addon channel.")
end --if
SendAddonMessage("GoGoMountVER", GetAddOnMetadata("GoGoMount", "Version"), "RAID")
end --if
end --if ]]
if GoGo_Variables.Debug >= 10 and not GoGo_Variables.TestVersion then
GoGo_Variables.Debug = 0
end --if
end --function
---------
function GoGo_GetMount()
---------
local GoGo_Mount = GoGo_ChooseMount() -- find a mount to use
local GoGo_Macro = ""
if GoGo_Variables.Player.Class == "DRUID" and GoGo_Mount == GoGo_GetIDName(GoGo_Variables.Localize.RunningWild) .. "()" then
GoGo_Macro = GoGo_Macro .. GoGo_RemoveBuffs(24858) -- remove moonkin form - can't use running wild in moonkin form
end --if
if GoGo_Mount then -- we have a mount to use so we are mounting
GoGo_Macro = GoGo_Macro .. GoGo_RemoveBuffs() -- remove buffs that could prevent us from mounting
-- GoGo_Macro = GoGo_Macro .. GoGo_CrusaderAura() -- start Crusader Aura if needed -- no longer available
-- if GoGo_Macro ~= "" then ...
end --if
if GoGo_Macro ~= "" then
GoGo_Mount = GoGo_Macro .. "/use " .. GoGo_Mount
end --if
return GoGo_Mount -- returning the mount
end --function
---------
function GoGo_ChooseMount()
---------
-- SetMapToCurrentZone() -- ticket 488
GoGo_Variables.CanRide = true -- resetting canride flag
GoGo_Variables.NoFlying = false -- resetting flag to prevent flying
local mounts = {}
GoGo_Variables.FilteredMounts = {}
GoGo_GetMountDB()
GoGo_Variables.Player.Zone = GetRealZoneText()
GoGo_Variables.Player.SubZone = GetSubZoneText()
GoGo_Variables.Player.MiniSubZone = GetMinimapZoneText()
GoGo_Variables.EngineeringLevel = GoGo_GetProfSkillLevel(GoGo_Variables.Localize.Skill.Engineering)
GoGo_Variables.TailoringLevel = GoGo_GetProfSkillLevel(GoGo_Variables.Localize.Skill.Tailoring)
GoGo_Variables.RidingLevel = GoGo_GetRidingSkillLevel() or 0
GoGo_Variables.Player.Level = UnitLevel("player")
GoGo_UpdateZonePrefs() -- check & build zone preference table for this zone
if (GoGo_Variables.Player.Class == "DRUID") then
GoGo_TableAddUnique(GoGo_Variables.WaterSpeed, 101) -- Aqua Form
GoGo_TableAddUnique(GoGo_Variables.WaterSurfaceSpeed, 101) -- Aqua Form
GoGo_TableAddUnique(GoGo_Variables.GroundSpeed, 125) -- Cat Form
GoGo_TableAddUnique(GoGo_Variables.GroundSpeed, 140) -- Travel Form
elseif (GoGo_Variables.Player.Class == "SHAMAN") then
GoGo_TableAddUnique(GoGo_Variables.GroundSpeed, 130) -- Ghost Wolf
elseif (GoGo_Variables.Player.Class == "HUNTER") then
GoGo_TableAddUnique(GoGo_Variables.GroundSpeed, 138) -- Aspects
elseif (GoGo_Variables.Player.Class == "MONK") then
GoGo_TableAddUnique(GoGo_Variables.AirSpeed, 160) -- Zen Flight
end --if
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: " .. GoGo_Variables.Localize.Skill.Engineering .. " = "..GoGo_Variables.EngineeringLevel)
GoGo_DebugAddLine("GoGo_ChooseMount: " .. GoGo_Variables.Localize.Skill.Tailoring .. " = "..GoGo_Variables.TailoringLevel)
GoGo_DebugAddLine("GoGo_ChooseMount: " .. GoGo_Variables.Localize.Skill.Riding .. " = "..GoGo_Variables.RidingLevel)
end --if
if (table.getn(mounts) == 0) then
if table.getn(GoGo_Prefs.MapIDs[GoGo_Variables.Player.MapID]["Preferred"]) > 0 then
GoGo_Variables.FilteredMounts = GoGo_Prefs.MapIDs[GoGo_Variables.Player.MapID]["Preferred"] or {}
GoGo_CheckForUnknownMounts(GoGo_Variables.FilteredMounts)
GoGo_Variables.FilteredMounts = GoGo_RemoveUnusableMounts(GoGo_Variables.FilteredMounts) -- remove mounts blizzard says we can't use
-- GoGo_Variables.UnknownMountMsgShown = true
end --if
end --if
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Checked for zone favorites.")
end --if
if (table.getn(mounts) == 0) and (table.getn(GoGo_Variables.FilteredMounts) == 0) then
if GoGo_Prefs.GlobalPrefMounts then
GoGo_Variables.FilteredMounts = GoGo_Prefs.GlobalPrefMounts or {}
GoGo_CheckForUnknownMounts(GoGo_Variables.FilteredMounts)
GoGo_Variables.FilteredMounts = GoGo_RemoveUnusableMounts(GoGo_Variables.FilteredMounts) -- remove mounts blizzard says we can't use
-- GoGo_Variables.UnknownMountMsgShown = true
end --if
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Checked for global favorites.")
end --if
end --if
if (table.getn(mounts) == 0) and (table.getn(GoGo_Variables.FilteredMounts) == 0) then
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Checking for spell and item mounts.")
end --if
GoGo_Variables.FilteredMounts = GoGo_BuildMountList() or {}
GoGo_CheckForUnknownMounts(GoGo_Variables.FilteredMounts)
GoGo_Variables.FilteredMounts = GoGo_RemoveUnusableMounts(GoGo_Variables.FilteredMounts) -- remove mounts blizzard says we can't use
end --if
if ((GoGo_Variables.SelectPassengerMount) and table.getn(GoGo_Prefs.ExtraPassengerMounts) > 0) then
for GoGo_TempLoopCounter=1, table.getn(GoGo_Prefs.ExtraPassengerMounts) do
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Passenger mount selected, extras to include. Including them now.")
end --if
GoGo_TableAddUnique(GoGo_Variables.FilteredMounts, GoGo_Prefs.ExtraPassengerMounts[GoGo_TempLoopCounter])
GoGo_Variables.FilteredMounts = GoGo_RemoveUnusableMounts(GoGo_Variables.FilteredMounts) -- remove mounts blizzard says we can't use
end --for
end --if
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: ** Searched all areas for mounts and found " .. (table.getn(GoGo_Variables.FilteredMounts) or 0) .. " mounts.")
end --if
GoGo_ZoneCheck() -- Checking to see what we can and can not do in zones
if GoGo_Prefs.AutoExcludeFlyingMounts and not GoGo_Variables.ZoneExclude.CanFly then
GoGo_Variables.SkipFlyingMount = true
end --if
GoGo_UpdateMountData() -- update mount information with changes from talents, glyphs, etc.
--[[
if GoGo_Variables.EngineeringLevel <= 299 then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 45)
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 46)
elseif GoGo_Variables.EngineeringLevel >= 300 and GoGo_Variables.EngineeringLevel <= 374 then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 46)
elseif GoGo_Variables.EngineeringLevel >= 375 then
-- filter nothing
else
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 45)
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 46)
end --if
if GoGo_Variables.TailoringLevel <= 299 then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 49)
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 48)
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 47)
elseif GoGo_Variables.TailoringLevel >= 300 and GoGo_Variables.TailoringLevel <= 424 then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 49)
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 47)
elseif GoGo_Variables.TailoringLevel >= 425 and GoGo_Variables.TailoringLevel <= 449 then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 47)
elseif GoGo_Variables.TailoringLevel >= 450 then
-- filter nothing
else
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 49)
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 48)
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 47)
end --if
]]
if GoGo_Variables.RidingLevel <= 224 then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 36)
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 35)
elseif GoGo_Variables.RidingLevel >= 225 and GoGo_Variables.RidingLevel <= 299 then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 35)
elseif GoGo_Variables.RidingLevel >= 300 then
-- filter nothing
else
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 36)
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 35)
end --if
if GoGo_Variables.RidingLevel <= 74 then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 37)
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 38)
elseif GoGo_Variables.RidingLevel >= 75 and GoGo_Variables.RidingLevel <= 149 then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 37)
end --if
if IsSubmerged() then
GoGo_CheckSwimSurface()
else
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 53)
end --if
if (GoGo_Variables.Player.Level < 60) then
if (GoGo_Variables.Player.Level >= 58 and GoGo_Variables.Player.Class == "DRUID") then
-- do nothing.. druids can fly at 58
else
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Disabling flying - under level 60")
end --if
GoGo_Variables.NoFlying = true
end --if
end --if
-- if GoGo_Variables.ExpansionAccount == 3 then -- only exists for 4.x with Cataclysm expansion
-- if UnitBuff("player", GetSpellInfo(GoGo_Variables.Localize.SeaLegs)) then
if AuraUtil.FindAuraByName(GetSpellInfo(GoGo_Variables.Localize.SeaLegs), "player") then
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Sea Legs buff found - not removing Vashj'ir mount.")
end --if
-- do nothing, we can use the abyssal seahorse
if IsSubmerged() then
GoGo_Variables.NoFlying = true -- block flying since we're swimming in vashir and most likely have water breathing buff
end --if
else
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Sea Legs buff not found - removing Vashj'ir mount.")
end --if
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 401)
end --if
-- end --if
if (GoGo_Variables.Player.Class == "DRUID" and GoGo_Prefs.DruidFormNotRandomize and not GoGo_IsMoving() and not IsFalling()) then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 9998)
end --if
if GoGo_Variables.SelectPassengerMount then
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Filtering out all mounts except passenger mounts since passenger mount only was requested.")
end --if
GoGo_Variables.FilteredMounts = GoGo_FilterMountsIn(GoGo_Variables.FilteredMounts, 2) or {}
end --if
if GoGo_Variables.SkipFlyingMount then
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Filtering out all mounts that can fly (button 2 pressed or no flying mounts preference set).")
end --if
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 10003) or {}
end --if
if GoGo_Variables.ZoneExclude.NorthrendLoanedMounts then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 52) or {}
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Eliminated loaned mounts - " .. (table.getn(GoGo_Variables.FilteredMounts) or 0) .. " mounts left.")
end --if
end --if
if GoGo_Variables.ZoneExclude.TheOculus then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 54)
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Eliminated Oculus mounts - " .. (table.getn(GoGo_Variables.FilteredMounts) or 0) .. " mounts left.")
end --if
end --if
if GoGo_Variables.ZoneExclude.Draenor_Nagrand then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 202) or {}
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Eliminated Draenor's Nagrand ability mounts - " .. (table.getn(GoGo_Variables.FilteredMounts) or 0) .. " mounts left.")
end --if
end --if
if GoGo_Variables.ZoneExclude.AQ40 then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 201) or {}
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Eliminated AQ40 mounts - " .. (table.getn(GoGo_Variables.FilteredMounts) or 0) .. " mounts left.")
end --if
end --if
if GoGo_Variables.ZoneExclude.ThousandNeedles then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 200) or {}
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Eliminated Thousand Needles boat - " .. (table.getn(GoGo_Variables.FilteredMounts) or 0) .. " mounts left.")
end --if
end --if
if GoGo_Variables.ZoneExclude.LegionZones then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 203) or {}
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Eliminated mounts requiring Legion zones - " .. (table.getn(GoGo_Variables.FilteredMounts) or 0) .. " mounts left.")
end --if
end --if
if not GoGo_Variables.SwimSurface then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 55) or {}
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Eliminated mounts requiring water surface - " .. (table.getn(GoGo_Variables.FilteredMounts) or 0) .. " mounts left.")
end --if
end --if
--[[
if not GoGo_InBook(GoGo_Variables.Localize.CloudSerpentRiding) then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 100) or {}
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Eliminated mounts requiring Cloud Serpent Riding - " .. (table.getn(GoGo_Variables.FilteredMounts) or 0) .. " mounts left.")
end --if
end --if
]]
if IsFalling() or GoGo_IsMoving() then -- we're falling.. save us (only grab instant cast spells)
local GoGo_TempMounts = {}
GoGo_TempMounts = GoGo_GetInstantMounts(GoGo_Variables.FilteredMounts) or {}
if table.getn(GoGo_TempMounts) == 0 then
GoGo_TempMounts = GoGo_GetMountsWhileMoving(GoGo_Variables.FilteredMounts) or {}
end --if
GoGo_Variables.FilteredMounts = GoGo_TempMounts or {}
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Eliminated all mounts except mounts that can be summoned while moving or falling - " .. (table.getn(GoGo_Variables.FilteredMounts) or 0) .. " mounts left.")
end --if
end --if
if GoGo_Variables.ZoneExclude.RestrictedIndoorMounts then -- only select what we can use in here..
GoGo_Variables.FilteredMounts = GoGo_GetIndoorMounts(GoGo_Variables.FilteredMounts) or {}
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Eliminated all mounts except indoor mounts - " .. (table.getn(GoGo_Variables.FilteredMounts) or 0) .. " mounts left.")
end --if
end --if
GoGo_RemoveExcluded()
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Eliminated excluded mounts - " .. (table.getn(GoGo_Variables.FilteredMounts) or 0) .. " mounts left.")
end --if
if GoGo_Variables.ZoneExclude.UseMountGroup then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsIn(GoGo_Variables.FilteredMounts, GoGo_Variables.ZoneExclude.UseMountGroup) or {}
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Selected specific group of mounts - " .. GoGo_Variables.ZoneExclude.UseMountGroup .. " - " .. (table.getn(GoGo_Variables.FilteredMounts) or 0) .. " mounts left.")
end --if
end --if
if GoGo_Variables.ZoneExclude.CanFly and not GoGo_Variables.SkipFlyingMount and not GoGo_Variables.NoFlying then
GoGo_Variables.CanFly = true
else
GoGo_Variables.CanFly = false
end --if
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: ZoneExclude.Canfly = " .. tostring(GoGo_Variables.ZoneExclude.CanFly))
GoGo_DebugAddLine("GoGo_ChooseMount: SkipFlyingMount = " .. tostring(GoGo_Variables.SkipFlyingMount))
GoGo_DebugAddLine("GoGo_ChooseMount: NoFlying = " .. tostring(GoGo_Variables.NoFlying))
end --if
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Eliminated mounts we can't use; " .. (table.getn(GoGo_Variables.FilteredMounts) or 0) .. " mounts left.")
end --if
if IsSubmerged() and not GoGo_Variables.CanFly then -- find a mount to use in water
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Swimming and can't fly.")
end --if
-- indoors shouldn't matter now since we've filtered out anything that can't be used indoors above
--if not IsIndoors() then
mounts = GoGo_GetBestWaterMounts(GoGo_Variables.FilteredMounts) or {}
--else -- we are indoors
-- if (table.getn(mounts) == 0) and (GoGo_Variables.Player.Class == "DRUID") and GoGo_InBook(GoGo_Variables.Localize.AquaForm) then
-- return GoGo_InBook(GoGo_Variables.Localize.AquaForm)
-- end --if
--end --if
elseif IsSubmerged() and GoGo_Variables.CanFly then
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Swimming but can fly.")
end --if
mounts = GoGo_GetBestAirMounts(GoGo_Variables.FilteredMounts) or {}
if table.getn(mounts) == 0 then
mounts = GoGo_GetBestWaterMounts(GoGo_Variables.FilteredMounts) or {}
end --if
end --if
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 53)
if (table.getn(mounts) == 0) and GoGo_Variables.CanFly then
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Looking for flying mounts since we past flight checks.")
end --if
mounts = GoGo_GetBestAirMounts(GoGo_Variables.FilteredMounts)
-- elseif (table.getn(mounts) == 0) and UnitBuff("player", GetSpellInfo(168796)) then
elseif (table.getn(mounts) == 0) and AuraUtil.FindAuraByName(GetSpellInfo(168796), "player") then
-- Druids in Ashran with "Book of Flight Form" buff can fly in Ashran zones
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Didn't pass flight checks but we're a Druid with buff 168796 so we're attempting to select flight form to fly.")
end --if
mounts = GoGo_FilterMountsIn(GoGo_Variables.FilteredMounts, 501) or {}
else
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Not looking for flying mounts since we didn't past flight checks (or found a better mount to use).")
end --if
end --if
-- Set the oculus mounts as the only mounts available if we're in the oculus, not skiping flying and have them in inventory
if (table.getn(mounts) == 0) and (table.getn(GoGo_Variables.FilteredMounts) > 0) and not GoGo_Variables.ZoneExclude.TheOculus and not GoGo_Variables.SkipFlyingMount then -- skip flying is here because we already know we can't normally fly here
mounts = GoGo_FilterMountsIn(GoGo_Variables.FilteredMounts, 54) or {}
if (table.getn(mounts) > 0) then
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: In the Oculus, Oculus only mount found, using.")
end --if
else
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: In the Oculus, no oculus mount found in inventory.")
end --if
end --if
end --if
if (table.getn(GoGo_Variables.FilteredMounts) >= 1) then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, "FlightOnly")
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Eliminated mounts that require skill 225 or 300 to use; " .. (table.getn(GoGo_Variables.FilteredMounts) or 0) .. " mounts left.")
end --if
end --if
-- Select ground mounts
if (table.getn(mounts) == 0) and GoGo_Variables.CanRide then
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Looking for ground mounts since we can't fly.")
end --if
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Ground mount count = " .. table.getn(GoGo_Variables.FilteredMounts) .. ".")
end --if
if (table.getn(mounts) == 0) then
mounts = GoGo_GetBestGroundMounts(GoGo_Variables.FilteredMounts) or {}
end --if
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Mount count of 100% = " .. table.getn(mounts) .. ".")
end --if
end --if
if table.getn(GoGo_Variables.FilteredMounts) >= 1 then
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 37)
GoGo_Variables.FilteredMounts = GoGo_FilterMountsOut(GoGo_Variables.FilteredMounts, 38)
end --if
if (table.getn(mounts) >= 1) then
if GoGo_Variables.Debug >= 10 then
for a = 1, table.getn(mounts) do
GoGo_DebugAddLine("GoGo_ChooseMount: Found mount " .. mounts[a] .. " - included in random pick.")
end --for
end --if
local selected = mounts[math.random(table.getn(mounts))]
if GoGo_Variables.Debug >= 5 then
if GoGo_Variables.MountDB[selected][10001] then
GoGo_DebugAddLine("GoGo_ChooseMount: Under water mount speed should be " .. GoGo_Variables.MountDB[selected][10001])
end --if
if GoGo_Variables.MountDB[selected][10002] then
GoGo_DebugAddLine("GoGo_ChooseMount: Ground mount speed should be " .. GoGo_Variables.MountDB[selected][10002])
end --if
if GoGo_Variables.MountDB[selected][10003] then
GoGo_DebugAddLine("GoGo_ChooseMount: Air mount speed should be " .. GoGo_Variables.MountDB[selected][10003])
end --if
if GoGo_Variables.MountDB[selected][10004] then
GoGo_DebugAddLine("GoGo_ChooseMount: Water surface mount speed should be " .. GoGo_Variables.MountDB[selected][10004])
end --if
end --if
if type(selected) == "string" then
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_ChooseMount: Selected string " .. selected)
end --if
return selected
else
local GoGo_SpellTemp = {}
table.insert(GoGo_SpellTemp, selected)
GoGo_SpellTemp = GoGo_FilterMountsIn(GoGo_SpellTemp, 50000)
selected = GoGo_GetIDName(selected)
if table.getn(GoGo_SpellTemp) == 0 then
selected = selected .. "()"
end --if
return selected
end --if
end --if
end --function
---------
function GoGo_FilterMountsOut(PlayerMounts, FilterID)
---------
local GoGo_FilteringMounts = {}
if not PlayerMounts then PlayerMounts = {} end --if
if table.getn(PlayerMounts) == 0 then
return GoGo_FilteringMounts
end --if
if not GoGo_Variables.MountDB then
GoGo_GetMountDB()
end --if
for a = 1, table.getn(PlayerMounts) do
local MountID = PlayerMounts[a]
if not GoGo_Variables.MountDB[MountID][FilterID] then
table.insert(GoGo_FilteringMounts, MountID)
end --if
end --for
return GoGo_FilteringMounts
end --function
---------
function GoGo_FilterMountsIn(PlayerMounts, FilterID, Value)
---------
local GoGo_FilteringMounts = {}
if not PlayerMounts then PlayerMounts = {} end --if
if table.getn(PlayerMounts) == 0 then
return GoGo_FilteringMounts
end --if
if Value == nil then
local Value = true
end --if
if not GoGo_Variables.MountDB then
GoGo_GetMountDB()
end --if
for a = 1, table.getn(PlayerMounts) do
local MountID = PlayerMounts[a]
if GoGo_Variables.MountDB[MountID] then
if GoGo_Variables.MountDB[MountID][FilterID] then
if Value and GoGo_Variables.MountDB[MountID][FilterID] == Value then
table.insert(GoGo_FilteringMounts, MountID)
elseif Value == nil then
table.insert(GoGo_FilteringMounts, MountID)
end --if
end --if
else
if GoGo_Variables.Debug >= 5 then
GoGo_DebugAddLine("GoGo_FilterMountsIn: Function called looking for unknown mount: " .. MountID)
end --if
end --if
end --for
return GoGo_FilteringMounts
end --function
---------
function GoGo_UpdateMountSpeedDB(PlayerMounts, FilterID, SpeedID, Value) -- eg. mount list, select filter, speed id to set, value to set
---------
local GoGo_TempMountDB = {}
local GoGo_TempLoopCounter
GoGo_TempMountDB = GoGo_FilterMountsIn(PlayerMounts, FilterID)
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_UpdateMountSpeedDB: FilterID = " .. FilterID .. ", SpeedID = " .. SpeedID .. ", Value = " .. Value)
GoGo_DebugAddLine("GoGo_UpdateMountSpeedDB: Number of mounts to be modified: " .. (table.getn(GoGo_TempMountDB) or 0))
end --if
for GoGo_TempLoopCounter=1, table.getn(GoGo_TempMountDB) do
GoGo_Variables.MountDB[GoGo_TempMountDB[GoGo_TempLoopCounter]][SpeedID] = Value
end --for
end --function
---------
function GoGo_Dismount(button)
---------
if IsMounted() then
Dismount()
elseif CanExitVehicle() then
VehicleExit()
elseif GoGo_Variables.Player.Class == "DRUID" then
if GoGo_IsShifted() and button then
if GoGo_Prefs.DruidClickForm and not IsFlying() then
GoGo_FillButton(button, GoGo_GetMount())
else
-- CancelUnitBuff("player", GoGo_IsShifted()) -- protected by blizzard now
GoGo_FillButton(button, GoGo_IsShifted())
end --if
end --if
elseif GoGo_Variables.Player.Class == "SHAMAN" then
-- if UnitBuff("player", GetSpellInfo(GoGo_Variables.Localize.GhostWolf)) and button then
if AuraUtil.FindAuraByName(GetSpellInfo(GoGo_Variables.Localize.GhostWolf), "player") and button then
if GoGo_Prefs.ShamanClickForm then
GoGo_FillButton(button, GoGo_GetMount())
else
-- CancelUnitBuff("player", GoGo_InBook(GoGo_Variables.Localize.GhostWolf))
GoGo_FillButton(button, GoGo_InBook(GoGo_Variables.Localize.GhostWolf))
end --if
end --if
else
return nil
end --if
return true
end --function
---------
function GoGo_BuildMountList()
---------
local GoGo_MountList = {}
if (GetNumCompanions("MOUNT") >= 1) then
local mountIDs = C_MountJournal.GetMountIDs()
for i, id in pairs(mountIDs) do
local _, SpellID, _, _, isUsable, _, _, isFactionSpecific, faction, _, isCollected, _ = C_MountJournal.GetMountInfoByID(id)
if GoGo_Variables.Debug >= 10 then
-- show a line for each mount and indicate if it's usable, etc. in debug log?
--GoGo_DebugAddLine("GoGo_BuildMountList: Found mount spell ID " .. SpellID .. " and added to known mount list.")
GoGo_DebugAddLine("GoGo_BuildMountList: SpellID: " .. SpellID .. " isUsable: " .. tostring(isUsable) .. " isFactionSpecific: " .. tostring(isFactionSpecific) .. " faction: " .. tostring(faction) .. " isCollected: " .. tostring(isCollected) .. " IsUsableSpell(): " .. tostring(IsUsableSpell(SpellID)) .. " IsSpellKnown(): " .. tostring(IsSpellKnown(SpellID)))
end --if
if isCollected and isUsable then
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_BuildMountList: " .. SpellID .. " has been added to the list of mounts available.")
end --if
table.insert(GoGo_MountList, SpellID) -- copy this line to the 'else' statement below to find new mounts on the ptr
else
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_BuildMountList: " .. SpellID .. " has not been added to the list of mounts available.")
end --if
end --if
end --for
end --if
if GoGo_Variables.Player.Class == "DRUID" then
if GoGo_InBook(GoGo_Variables.Localize.AquaForm) then
table.insert(GoGo_MountList, GoGo_Variables.Localize.AquaForm)
end --if
if GoGo_InBook(GoGo_Variables.Localize.CatForm) then
table.insert(GoGo_MountList, GoGo_Variables.Localize.CatForm)
end --if
if GoGo_InBook(GoGo_Variables.Localize.FlightForm) then -- may not be used any more since Warcraft 6.0
table.insert(GoGo_MountList, GoGo_Variables.Localize.FlightForm)
end --if
if GoGo_InBook(GoGo_Variables.Localize.FastFlightForm) then -- may not be used any more since Warcraft 6.0
table.insert(GoGo_MountList, GoGo_Variables.Localize.FastFlightForm)
end --if
if GoGo_InBook(165962) then -- Flight Form that appears with "Glyph of the Stag" in Warcraft 6.0
table.insert(GoGo_MountList, 165962)
end --if
if GoGo_InBook(GoGo_Variables.Localize.TravelForm) then
table.insert(GoGo_MountList, GoGo_Variables.Localize.TravelForm)
end --if
elseif GoGo_Variables.Player.Class == "SHAMAN" then
if GoGo_InBook(GoGo_Variables.Localize.GhostWolf) then
table.insert(GoGo_MountList, GoGo_Variables.Localize.GhostWolf)
end --if
elseif GoGo_Variables.Player.Class == "HUNTER" then
if GoGo_InBook(GoGo_Variables.Localize.AspectPack) and GoGo_Prefs.AspectPack then
table.insert(GoGo_MountList, GoGo_Variables.Localize.AspectPack)
GoGo_TableAddUnique(GoGo_Variables.GroundSpeed, 138)
elseif GoGo_InBook(GoGo_Variables.Localize.AspectCheetah) then
table.insert(GoGo_MountList, GoGo_Variables.Localize.AspectCheetah)
GoGo_TableAddUnique(GoGo_Variables.GroundSpeed, 138)
end --if
elseif GoGo_Variables.Player.Class == "MONK" then
if GoGo_InBook(GoGo_Variables.Localize.ZenFlight) then
table.insert(GoGo_MountList, GoGo_Variables.Localize.ZenFlight)
GoGo_TableAddUnique(GoGo_Variables.AirSpeed, 160)
end --if
end --if
if GoGo_Variables.Player.Race == "Worgen" then
if (GoGo_InBook(GoGo_Variables.Localize.RunningWild)) then
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_BuildMountList: We are a Worgen and have Running Wild - added to known mount list.")
end --if
table.insert(GoGo_MountList, GoGo_Variables.Localize.RunningWild)
end --if
end --if
for MountItemID, MountItemData in pairs(GoGo_Variables.MountItemIDs) do
local GoGo_SpellId = GoGo_Variables.MountItemIDs[MountItemID][50000]
if GoGo_Variables.MountItemIDs[MountItemID][51000] then -- in bag items
if GoGo_InBags(MountItemID) then
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_BuildMountList: Found mount item ID " .. MountItemID .. " in a bag and added to known mount list.")
end --if
table.insert(GoGo_MountList, GoGo_SpellId)
end --if
elseif GoGo_Variables.MountItemIDs[MountItemID][51001] then -- equipable items
if IsEquippedItem(MountItemID) then
table.insert(GoGo_MountList, GoGo_SpellId)
elseif GoGo_InBags(MountItemID) then
table.insert(GoGo_MountList, GoGo_SpellId)
end --if
end --if
end --for
-- WoD Nagrand's Garrison mounts
GoGo_Variables.Player.MapID = C_Map.GetBestMapForUnit("player")
if GoGo_Variables.Player.MapID == 550 then
-- or 551, 552, 553 TODO
local name = GetSpellInfo(161691)
_, _, _, _, _, _, spellID = GetSpellInfo(name)
if spellID == 165803 or spellID == 164222 then
table.insert(GoGo_MountList, spellID)
end --if
end --if
return GoGo_MountList
end --function
---------
function GoGo_RemoveUnusableMounts(MountList) -- Remove mounts Blizzard says we can't use due to location, timers, etc.
---------
if not MountList or table.getn(MountList) == 0 then
return {}
end --if
local GoGo_NewTable = {}
for a=1, table.getn(MountList) do
local GoGo_SpellID = MountList[a]
if not GoGo_SearchTable(GoGo_Prefs.UnknownMounts, GoGo_SpellID) then -- if mount spell is unknown then don't search the database - it's not in it
if GoGo_Variables.MountDB[GoGo_SpellID][50000] then
-- item mount, check item status
local GoGo_ItemID = GoGo_Variables.MountDB[GoGo_SpellID][50000] -- get item id
if GoGo_Variables.MountItemIDs[GoGo_ItemID][51000] then -- if item should be in bags
if GoGo_InBags(GoGo_ItemID) then -- if item is in bag
if GetItemCooldown(GoGo_ItemID) == 0 then -- if item doens't have a cooldown timer
if IsUsableItem(GoGo_ItemID) then -- if item can be used
table.insert(GoGo_NewTable, GoGo_SpellID)
end --if
end --if
end --if
elseif GoGo_Variables.MountItemIDs[GoGo_ItemID][51001] then -- if item should be equiped
if IsEquippedItem(GoGo_ItemID) then -- if item is equipped
if GetItemCooldown(GoGo_ItemID) == 0 then -- if item doens't have a cooldown timer
if IsUsableItem(GoGo_ItemID) then -- if item can be used
table.insert(GoGo_NewTable, GoGo_SpellID)
end --if
end --if
end --if
end --if
else -- it's a mount spell or class shape form
if IsUsableSpell(GoGo_SpellID) then -- don't use IsSpellKnown() - mounts in collection are not known... morons....
table.insert(GoGo_NewTable, GoGo_SpellID)
end --if
end --if
end --if
end --for
return GoGo_NewTable
end --function
---------
function GoGo_InBags(item)
---------
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_InBags: Searching for " .. item)
end --if
for bag = 0, NUM_BAG_FRAMES do
for slot = 1, GetContainerNumSlots(bag) do
local link = GetContainerItemLink(bag, slot)
if link then
local _, itemid, _ = strsplit(":",link,3)
if tonumber(itemid) == item then
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_InBags: Found item ID " .. item .. " in bag " .. (bag+1) .. ", at slot " .. slot .. " and added to known mount list.")
end --if
return GetItemInfo(link)
end --if
end --if
end --for
end --for
end --function
---------
function GoGo_InBook(spell)
---------
if GoGo_Variables.Debug >= 10 then
GoGo_DebugAddLine("GoGo_InBook: Searching for type " .. type(spell))
end --if
if type(spell) == "function" then
return spell()
else
if type(spell) == "string" then
if GoGo_Variables.Debug >= 10 then