Skip to content

Commit 4af6489

Browse files
author
Ruben Zantingh
committed
Add macro support
1 parent 8cd68c1 commit 4af6489

2 files changed

Lines changed: 36 additions & 3 deletions

File tree

MultiLanguage.lua

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
local lastQuestFrameEvent = nil
2+
local macroSpellID = nil
23
local translationFrame = CreateFrame("Frame")
34
local activeItemSpellOrUnitLines = {}
45
local activeItemSpellOrUnitId = nil
@@ -495,6 +496,32 @@ local function OnTooltipSetData(self)
495496
local npcTranslationsEnabled = MultiLanguageOptions["NPC_TRANSLATIONS"]
496497
local questTranslationsEnabled = MultiLanguageOptions["QUEST_TRANSLATIONS"]
497498

499+
if TooltipDataProcessor and TooltipDataProcessor.AddTooltipPostCall then
500+
TooltipDataProcessor.AddTooltipPostCall(TooltipDataProcessor.AllTypes, function(tooltip, data)
501+
macroSpellID = nil
502+
503+
if tooltip ~= GameTooltip then return end
504+
if not data or not data.type then return end
505+
506+
local spellTranslationsEnabled = MultiLanguageOptions["SPELL_TRANSLATIONS"]
507+
if not spellTranslationsEnabled then return end
508+
509+
if data.type == Enum.TooltipDataType.Spell then
510+
macroSpellID = data.id
511+
elseif data.type == Enum.TooltipDataType.Macro then
512+
if tooltip.GetPrimaryTooltipData then
513+
local primaryData = tooltip:GetPrimaryTooltipData()
514+
515+
if primaryData and primaryData.lines then
516+
if primaryData.lines[1] then
517+
macroSpellID = primaryData.lines[1].tooltipID
518+
end
519+
end
520+
end
521+
end
522+
end)
523+
end
524+
498525
if itemLink and itemTranslationsEnabled then
499526
local itemID = GetItemIDFromLink(itemLink)
500527

@@ -509,8 +536,14 @@ local function OnTooltipSetData(self)
509536
else
510537
TranslationTooltipFrame:Hide()
511538
end
512-
elseif spellID and spellTranslationsEnabled then
513-
local spell = GetDataByID(MultiLanguageSpellData, spellID)
539+
elseif (spellID and spellTranslationsEnabled) or (macroSpellID and spellTranslationsEnabled) then
540+
local spell = nil
541+
542+
if spellID then
543+
spell = GetDataByID(MultiLanguageSpellData, spellID)
544+
elseif macroSpellID then
545+
spell = GetDataByID(MultiLanguageSpellData, macroSpellID)
546+
end
514547

515548
if spell then
516549
UpdateTranslationTooltipFrame(spell.name, spell.additional_info, spellID, "spell")

MultiLanguage.toc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## Title: MultiLanguage
33
## Notes: Tooltip displaying data in another language
44
## Author: Ruben Zantingh
5-
## Version: 1.1.16
5+
## Version: 1.2.0
66
## SavedVariables: MultiLanguageOptions
77

88
Database/Quests/quests.lua

0 commit comments

Comments
 (0)