73 lines
No EOL
3.3 KiB
Lua
73 lines
No EOL
3.3 KiB
Lua
local function SetHoverScripts(frame)
|
|
frame:SetScript("OnEnter", function()
|
|
CzechQuestsAddon:ShowQuestTranslation()
|
|
end)
|
|
|
|
frame:SetScript("OnLeave", function()
|
|
CzechQuestsAddon.translationQuestFrame:Hide()
|
|
end)
|
|
end
|
|
|
|
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
|
|
end
|
|
|
|
if event == "QUEST_PROGRESS" or event == "QUEST_COMPLETE" or event == "QUEST_DETAIL" or event == "QUEST_FINISHED" then
|
|
CzechQuestsAddon:ShowQuestTranslation(event)
|
|
end
|
|
|
|
if (event == "ITEM_TEXT_READY") then
|
|
CzechQuestsAddon:ShowQuestItemTranslation()
|
|
end
|
|
|
|
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_QUEST_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 |