-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMounts.lua
82 lines (66 loc) · 2.23 KB
/
Mounts.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
local addonName, ATOM = ...
local Module = ATOM:NewModule('Mounts')
-- LuaFormatter off
local uiMapIDs = {
AhnQiraji = {
-- [203] = 'Vashjir',
},
Vashjir = {
[203] = 'Vashjir',
[201] = 'Kelpthar Forest',
[204] = 'Abyssal Depths',
[205] = 'Shimmering Expanse',
},
} -- LuaFormatter on
local function getMountID(name)
if not name then
return
end
for index, mountID in ipairs(C_MountJournal.GetMountIDs()) do
local mountName = C_MountJournal.GetMountInfoByID(mountID)
if string.find(mountName:lower(), name:lower()) then
return mountID
end
end
end
local GROUND_MOUNT = getMountID('Mechacycle Model W')
local RED_QIRAJI_BATTLE_TANK = getMountID('Red Qiraji Battle Tank')
local SEA_TURTLE = getMountID('Sea Turtle')
local VASHJIR_SEAHORSE = getMountID('Vashj\'ir Seahorse')
function Module:Mount(mountName)
if IsMounted() then
return Dismount()
end
local mountID = getMountID(mountName)
-- Mount for Temple of Ahn'Qiraji
if uiMapIDs.AhnQiraji[playerUiMapID] then
return C_MountJournal.SummonByID(RED_QIRAJI_BATTLE_TANK)
end
-- Mount for Nagrand in Draenor
-- if currentMapAreaID == 950 then
-- return CastSpellByName('Garrison Ability')
-- end
-- Mount for Vashj'ir (increases swim speed by 450%)
if IsSwimming() and uiMapIDs.Vashjir[playerUiMapID] then
return C_MountJournal.SummonByID(VASHJIR_SEAHORSE)
end
-- Mount for Swimming (increases swim speed by ~325%)
if IsSwimming() and IsControlKeyDown() then
return C_MountJournal.SummonByID(SEA_TURTLE)
end
-- If no mount was specified load on of the
-- favourite mounts from the mount journal
if not mountID then
return C_MountJournal.SummonByID(0)
end
local mountTypeID = select(5, C_MountJournal.GetMountInfoExtraByID(mountID))
local flyingMountTypeIDs = {
[247] = '[Disc of the Red Flying Cloud]',
[248] = 'Most flying mounts',
[424] = 'Dragonriding mounts',
}
if not IsFlyableArea() and flyingMountTypeIDs[mountTypeID] then
return C_MountJournal.SummonByID(GROUND_MOUNT)
end
return C_MountJournal.SummonByID(mountID)
end