Compare commits
3
Commits
v0.1.0
...
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 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 mapId = select(8, GetInstanceInfo())
|
||||
if not FLYABLE_MAPS[mapId] then
|
||||
@@ -80,6 +97,16 @@ local function FindBestMount(flyable)
|
||||
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
|
||||
end
|
||||
|
||||
@@ -93,13 +120,26 @@ local function MakeMountButton(name, forceGround)
|
||||
end
|
||||
local flyable = not forceGround and IsFlyable()
|
||||
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)
|
||||
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
|
||||
self:SetAttribute("item1", nil)
|
||||
self:SetAttribute("spell1", nil)
|
||||
end
|
||||
end)
|
||||
button:SetAttribute("type1", "item")
|
||||
return button
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user