Compare commits
3
Commits
main
..
class_mounts
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
abad82caad | ||
|
|
ca0295887d | ||
|
|
2ee110599c |
+42
-2
@@ -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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user