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;
local SpellName, SpellRank, SpellId = GetMacroSpell(self.MacroIndex);
if (SpellName) then
--[[local CompanionType, CompanionIndex = Util.LookupCompanion(SpellName);
local CompanionType, CompanionID = Util.LookupCompanion(SpellName);
if (CompanionType) then
self.CompanionType = CompanionType;
self.CompanionIndex = CompanionIndex;
local SpellId = select(3, GetCompanionInfo(CompanionType, CompanionIndex));
self.CompanionSpellName = GetSpellInfo(SpellId);
self.MacroMode = "companion";
else]]
self.SpellName = SpellName;
self.SpellNameRank = GetSpellInfo(SpellName); --BFA fix: Cache is indexed by name and the old function returned the ID
self.SpellId = SpellId;
self.MacroMode = "spell";
--end
self.CompanionIndex = CompanionID;
end
self.SpellName = SpellName;
self.SpellNameRank = GetSpellInfo(SpellName); --BFA fix: Cache is indexed by name and the old function returned the ID
self.SpellId = SpellId;
self.MacroMode = "spell";
else
local ItemName, ItemLink = GetMacroItem(self.MacroIndex);
if (ItemName) then
@ -1730,6 +1726,9 @@ function Button:UpdateTooltipMacro()
local Index, BookType = Util.LookupSpellIndex(self.SpellNameRank);
if (Index) then
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
elseif (self.MacroMode == "item") then
local EquippedSlot = Util.LookupItemNameEquippedSlot(self.ItemId);

Voir le fichier

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