Add support for class mounts and flight form

When an equally capable item mount is found in the bags they take
priority over the class mounts and flight form.
This commit is contained in:
2026-07-04 01:01:18 +02:00
parent 2b2189df8d
commit 2ee110599c
+35 -2
View File
@@ -17,6 +17,23 @@ local NONFLYABLE_ZONES = {
local RIDING_SKILLS = { [75] = false, [150] = false, [225] = true, [300] = true } local RIDING_SKILLS = { [75] = false, [150] = false, [225] = true, [300] = true }
local MOUNT_SPELLS = {
DRUID = {
[40120] = 3, -- swift flight form
[33943] = 2, -- flight form
},
PALADIN = {
[34767] = 1, -- Summon Charger (horde)
[34769] = 0, -- Summon Warhorse (horde)
[13819] = 0, -- Summon Warhorse (alliance)
[23214] = 1, -- Summon Charger (alliance)
},
WARLOCK = {
[5784] = 0, -- Summon Felsteed
[23161] = 1, -- Summon Dreadsteed
},
}
local function IsFlyable() local function IsFlyable()
local mapId = select(8, GetInstanceInfo()) local mapId = select(8, GetInstanceInfo())
if not FLYABLE_MAPS[mapId] then if not FLYABLE_MAPS[mapId] then
@@ -80,6 +97,16 @@ local function FindBestMount(flyable)
end end
end end
end end
local mount_spells = MOUNT_SPELLS[(select(2, UnitClass("player")))]
if mount_spells then
for spellId, priority in pairs(mount_spells) do
if priority > bestPriority and priority <= maxPriority and C_SpellBook.IsSpellKnown(spellId) then
best = spellId
bestPriority = priority
end
end
end
return best return best
end end
@@ -93,13 +120,19 @@ local function MakeMountButton(name, forceGround)
end end
local flyable = not forceGround and IsFlyable() local flyable = not forceGround and IsFlyable()
local mount = FindBestMount(flyable) local mount = FindBestMount(flyable)
if mount then if mount and type(mount) == "table" then
self:SetAttribute("spell1", nil)
self:SetAttribute("type1", "item")
self:SetAttribute("item1", mount.bag .. " " .. mount.slot) self:SetAttribute("item1", mount.bag .. " " .. mount.slot)
elseif mount and type(mount) == "number" then
self:SetAttribute("type1", "spell")
self:SetAttribute("item1", nil)
self:SetAttribute("spell1", mount)
else else
self:SetAttribute("item1", nil) self:SetAttribute("item1", nil)
self:SetAttribute("spell1", nil)
end end
end) end)
button:SetAttribute("type1", "item")
return button return button
end end