Skip to content

Commit

Permalink
fix: error on linking mount [gh#141](#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
exochron committed Dec 21, 2024
1 parent 33b34e1 commit 21bb1f7
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions Api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,17 @@ end

function ADDON.Api:GetMountInfoByID(mountId)
local creatureName, spellId, icon, active, isUsable, sourceType, isFavorite, isFaction, faction, hideOnChar, isCollected, mountID, isSteadyFlight, a, b, c, d, e, f, g, h = C_MountJournal.GetMountInfoByID(mountId)
-- moved api functions in 11.0
local IsUsableSpell = C_Spell.IsSpellUsable or IsUsableSpell
isUsable = isUsable and IsUsableSpell(spellId)
isSteadyFlight = isSteadyFlight and WOW_PROJECT_ID ~= WOW_PROJECT_CATACLYSM_CLASSIC
isUsable = isUsable and C_Spell.IsSpellUsable(spellId)
isSteadyFlight = isSteadyFlight and WOW_PROJECT_ID == WOW_PROJECT_MAINLINE

return creatureName, spellId, icon, active, isUsable, sourceType, isFavorite, isFaction, faction, hideOnChar, isCollected, mountID, isSteadyFlight, a, b, c, d, e, f, g, h
end

function ADDON.Api:GetMountLink(spellId)
-- moved api functions in 11.0
local GetSpellLink = C_Spell.GetSpellLink or GetSpellLink

if WOW_PROJECT_ID == WOW_PROJECT_CATACLYSM_CLASSIC then
-- classic doesn't supports mount links yet. so use spell link instead. (preview might not work though)
return GetSpellLink(spellId)
end
local link = C_MountJournal.GetMountLink(spellId)
if strlen(link) > 400 then
if not link or strlen(link) > 400 then
-- broken link
return GetSpellLink(spellId)
return C_Spell.GetSpellLink(spellId)
end

return link
Expand Down

0 comments on commit 21bb1f7

Please sign in to comment.