1
0
Bifurcation 0

Fixes tooltip for mount macro buttons.

Cette révision appartient à :
dvipid 2019-01-10 22:38:48 -05:00
Parent e41406b008
révision 9ece55c266
2 fichiers modifiés avec 18 ajouts et 18 suppressions

Voir le fichier

@ -1268,19 +1268,15 @@ function Button:TranslateMacro()
self.MacroTargetDead = TargetDead; self.MacroTargetDead = TargetDead;
local SpellName, SpellRank, SpellId = GetMacroSpell(self.MacroIndex); local SpellName, SpellRank, SpellId = GetMacroSpell(self.MacroIndex);
if (SpellName) then if (SpellName) then
--[[local CompanionType, CompanionIndex = Util.LookupCompanion(SpellName); local CompanionType, CompanionID = Util.LookupCompanion(SpellName);
if (CompanionType) then if (CompanionType) then
self.CompanionType = CompanionType; self.CompanionType = CompanionType;
self.CompanionIndex = CompanionIndex; self.CompanionIndex = CompanionID;
local SpellId = select(3, GetCompanionInfo(CompanionType, CompanionIndex)); end
self.CompanionSpellName = GetSpellInfo(SpellId);
self.MacroMode = "companion";
else]]
self.SpellName = SpellName; self.SpellName = SpellName;
self.SpellNameRank = GetSpellInfo(SpellName); --BFA fix: Cache is indexed by name and the old function returned the ID self.SpellNameRank = GetSpellInfo(SpellName); --BFA fix: Cache is indexed by name and the old function returned the ID
self.SpellId = SpellId; self.SpellId = SpellId;
self.MacroMode = "spell"; self.MacroMode = "spell";
--end
else else
local ItemName, ItemLink = GetMacroItem(self.MacroIndex); local ItemName, ItemLink = GetMacroItem(self.MacroIndex);
if (ItemName) then if (ItemName) then
@ -1730,6 +1726,9 @@ function Button:UpdateTooltipMacro()
local Index, BookType = Util.LookupSpellIndex(self.SpellNameRank); local Index, BookType = Util.LookupSpellIndex(self.SpellNameRank);
if (Index) then if (Index) then
GameTooltip:SetSpellBookItem(Index, BookType); GameTooltip:SetSpellBookItem(Index, BookType);
elseif (self.CompanionType == "MOUNT") then
GameTooltip_SetDefaultAnchor(GameTooltip, self.Widget); --It appears that the sethyperlink (specifically this one) requires that the anchor be constantly refreshed!?
GameTooltip:SetHyperlink("spell:"..self.SpellName);
end end
elseif (self.MacroMode == "item") then elseif (self.MacroMode == "item") then
local EquippedSlot = Util.LookupItemNameEquippedSlot(self.ItemId); local EquippedSlot = Util.LookupItemNameEquippedSlot(self.ItemId);

Voir le fichier

@ -1875,7 +1875,8 @@ end
Companion Functions Companion Functions
-------------------------------------------]] -------------------------------------------]]
function Util.CacheCompanions() function Util.CacheCompanions()
--[[Util.Critters = {}; Util.Critters = {};
--[[
for i = 1, GetNumCompanions("CRITTER") do for i = 1, GetNumCompanions("CRITTER") do
local Id, Name = GetCompanionInfo("CRITTER", i); local Id, Name = GetCompanionInfo("CRITTER", i);
if (not Name) then if (not Name) then
@ -1884,14 +1885,14 @@ function Util.CacheCompanions()
Util.Critters[Name] = i; Util.Critters[Name] = i;
end]] end]]
--[[Util.Mounts = {}; Util.Mounts = {};
for i = 1, C_MountJournal.GetNumMounts() do for i, mountID in pairs(C_MountJournal.GetMountIDs()) do
local Name, Id = C_MountJournal.GetDisplayedMountInfo(i); local creatureName, spellID = C_MountJournal.GetMountInfoByID(mountID);
if (not Name) then if (not creatureName) then
return; return;
end end
Util.Mounts[Name] = i; Util.Mounts[spellID] = mountID;
end]] end
Util.CompanionsCached = true; Util.CompanionsCached = true;
end end