addon/Addon/Addon.lua

73 lines
3.3 KiB
Lua
Raw Normal View History

local function SetHoverScripts(frame)
frame:SetScript("OnEnter", function()
CzechQuestsAddon:ShowQuestTranslation()
end)
2024-08-25 11:50:46 +02:00
frame:SetScript("OnLeave", function()
CzechQuestsAddon.translationQuestFrame:Hide()
end)
end
2024-08-25 11:50:46 +02:00
function CzechQuestsAddon:InitializeTranslations()
-- Activate Quest translations
if CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_ENABLED then
CzechQuestsAddon.translationQuestFrame = CzechQuestsAddon:CreateTranslationQuestFrame()
CzechQuestsAddon.translationQuestFrame:RegisterEvent("PLAYER_LOGIN")
CzechQuestsAddon.translationQuestFrame:RegisterEvent("QUEST_PROGRESS")
CzechQuestsAddon.translationQuestFrame:RegisterEvent("QUEST_COMPLETE")
CzechQuestsAddon.translationQuestFrame:RegisterEvent("QUEST_FINISHED")
CzechQuestsAddon.translationQuestFrame:RegisterEvent("QUEST_DETAIL")
CzechQuestsAddon.translationQuestFrame:RegisterEvent("ITEM_TEXT_READY")
CzechQuestsAddon.translationQuestFrame:RegisterEvent("PLAYER_STARTED_MOVING")
CzechQuestsAddon.translationQuestFrame:RegisterEvent("PLAYER_STOPPED_MOVING")
CzechQuestsAddon.translationQuestFrame:SetScript("OnEvent", function(self, event)
if event == "PLAYER_LOGIN" then
-- classic
if QuestLogFrame then
SetHoverScripts(QuestLogFrame)
end
-- retail
if QuestMapDetailsScrollFrame then
SetHoverScripts(QuestMapDetailsScrollFrame)
end
2024-08-25 11:50:46 +02:00
end
if event == "QUEST_PROGRESS" or event == "QUEST_COMPLETE" or event == "QUEST_DETAIL" or event == "QUEST_FINISHED" then
CzechQuestsAddon:ShowQuestTranslation(event)
2024-08-25 11:50:46 +02:00
end
2024-07-07 12:29:29 +02:00
if (event == "ITEM_TEXT_READY") then
CzechQuestsAddon:ShowQuestItemTranslation()
end
2024-08-19 13:08:40 +02:00
if CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA_ONLY_MOVING then
if event == "PLAYER_STARTED_MOVING" then
CzechQuestsAddon.translationQuestFrame.texture:SetAlpha(
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXTURE_ALPHA / 100
)
elseif event == "PLAYER_STOPPED_MOVING" then
CzechQuestsAddon.translationQuestFrame.texture:SetAlpha(1)
end
end
end)
end
-- Activate Speech translations
if CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_ENABLED then
CzechQuestsAddon.translationSpeechFrame = CzechQuestsAddon:CreateTranslationSpeechFrame()
CzechQuestsAddon.translationSpeechFrame:RegisterEvent("CHAT_MSG_MONSTER_SAY")
CzechQuestsAddon.translationSpeechFrame:RegisterEvent("CHAT_MSG_MONSTER_YELL")
CzechQuestsAddon.translationSpeechFrame:RegisterEvent("CHAT_MSG_MONSTER_EMOTE")
CzechQuestsAddon.translationSpeechFrame:RegisterEvent("CHAT_MSG_MONSTER_PARTY")
CzechQuestsAddon.translationSpeechFrame:RegisterEvent("CHAT_MSG_MONSTER_WHISPER")
CzechQuestsAddon.translationSpeechFrame:SetScript("OnEvent", function(self, event, message, sender)
CzechQuestsAddon:ShowSpeechTranslation(sender, message)
end)
end
end