3 Commits
Author SHA1 Message Date
omicron abad82caad Correct cancelaura button to be by name instead of by id 2026-07-12 02:05:11 +02:00
omicron ca0295887d Fix recasting of class mounts instead of dismount 2026-07-04 11:11:50 +02:00
omicron 2ee110599c 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.
2026-07-04 01:01:18 +02:00
+42 -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,26 @@ 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
local aura = C_UnitAuras.GetPlayerAuraBySpellID(mount)
if aura ~= nil then
self:SetAttribute("type1", "cancelaura")
self:SetAttribute("item1", nil)
self:SetAttribute("spell1", aura["name"])
else
self:SetAttribute("type1", "spell")
self:SetAttribute("item1", nil)
self:SetAttribute("spell1", mount)
end
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