-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMount.lua
148 lines (135 loc) · 4.49 KB
/
Mount.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
setfenv(1, _G.SlackUI)
function handleDragonriding()
-- log("Aura handling dragonriding...")
if isTester() then
if isDragonriding() then
-- log("BINDING dragonriding")
bindDragonriding()
else
-- log("UNBINDING dragonriding")
unbindDragonriding()
end
end
end
isDragonridingBound = false
function bindDragonriding()
if not InCombatLockdown() and not isDragonridingBound then
SetOverrideBindingSpell(Self.frame, true, "BUTTON3", "Skyward Ascent") -- Fly up
SetOverrideBindingSpell(Self.frame, true, "SHIFT-BUTTON3", "Surge Forward") -- Fly forward
SetOverrideBindingSpell(Self.frame, true, "CTRL-BUTTON3", "Whirling Surge") -- Fly forward x3
SetOverrideBindingSpell(Self.frame, true, "BUTTON5", "Aerial Halt") -- Brake
SetOverrideBindingSpell(Self.frame, true, "SHIFT-X", "Second Wind") -- Regen Vigor
SetOverrideBindingSpell(Self.frame, true, "CTRL-X", "Bronze Timelock") -- Rewind Time
if getClassName() == "DRUID" then
SetOverrideBindingMacro(Self.frame, true, "X", "X") -- Moonkin or Brake
else
SetOverrideBindingSpell(Self.frame, true, "X", "Aerial Halt") -- Brake
end
isDragonridingBound = true
-- log("Dragonriding keys BOUND")
end
end
function unbindDragonriding()
if not InCombatLockdown() and isDragonridingBound then
ClearOverrideBindings(Self.frame)
isDragonridingBound = false
-- log("Dragonriding keys CLEARED")
end
end
SKYRIDING_SPELLID = 404464
function isDragonriding()
-- log("Checking if dragonriding...")
local dragonridingSpellIds = C_MountJournal.GetCollectedDragonridingMounts()
if C_UnitAuras.GetPlayerAuraBySpellID(SKYRIDING_SPELLID) and isActuallyFlyableArea() then
if GetShapeshiftForm() == 3 then
return true
elseif IsMounted() then
for _, mountId in ipairs(dragonridingSpellIds) do
local spellId = select(2, C_MountJournal.GetMountInfoByID(mountId))
if C_UnitAuras.GetPlayerAuraBySpellID(spellId) then
return true
end
end
end
end
return false
end
MOUNTS_BY_USAGE = { }
function setupEkil()
if isEkil() then
MOUNTS_BY_USAGE = {
DEFAULT = {
['GROUND'] = MOUNT_IDS["Ironbound Proto-Drake"],
['FLYING'] = MOUNT_IDS["Ironbound Proto-Drake"],
['WATER'] = MOUNT_IDS["Ironbound Proto-Drake"],
['GROUND_PASSENGER'] = MOUNT_IDS["Renewed Proto-Drake"],
['FLYING_PASSENGER'] = MOUNT_IDS["Renewed Proto-Drake"],
['GROUND_SHOWOFF'] = MOUNT_IDS["Ironbound Proto-Drake"],
['FLYING_SHOWOFF'] = MOUNT_IDS["Ironbound Proto-Drake"],
}
}
end
end
function mountByUsage(usage)
if isDebugging() then
printDebugMapInfo()
end
local classMounts = MOUNTS_BY_USAGE[getClassName()] or MOUNTS_BY_USAGE["DEFAULT"]
C_MountJournal.SummonByID(classMounts[usage])
end
function mountByName(mountName)
C_MountJournal.SummonByID(MOUNT_IDS[mountName])
end
function isAlternativeMountRequested()
return IsControlKeyDown()
end
function mount()
if IsMounted() then
Dismount()
return
end
if UnitUsingVehicle("player") then
VehicleExit()
return
end
if IsOutdoors() then
if isActuallyFlyableArea() and not IsSubmerged() then -- Summon flying mount
log("FLYING AREA")
if isAlternativeMountRequested() then -- But we may want to show off our ground mount
mountByUsage("FLYING_SHOWOFF")
return
end
if IsInGroup() then
mountByUsage("FLYING_PASSENGER")
return
else
mountByUsage("FLYING")
return
end
return
elseif IsSubmerged() then -- Summon water mount
if isAlternativeMountRequested() then -- But we may want to fly out of the water
mountByUsage("FLYING")
return
end
mountByUsage("WATER")
return
else -- Summon ground mount
if IsInGroup() then
if isAlternativeMountRequested() then -- But we may want to show off
mountByUsage("GROUND_SHOWOFF")
return
end
mountByUsage("GROUND_PASSENGER")
return
else
if isAlternativeMountRequested() then -- But we may want to show off
mountByUsage("GROUND_SHOWOFF")
return
end
mountByUsage("GROUND")
return
end
end
end
end