Refactor addon structure and introduce new speech frame.

This commit is contained in:
Roman Jaroš 2025-02-26 02:05:52 +01:00
parent f00edc16fc
commit 4660216504
27 changed files with 698 additions and 441 deletions

View file

@ -1,71 +1,6 @@
function CzechQuestsAddon:ShowTranslationFrame(primaryHeader, primaryText, secondaryHeader, secondaryText, parentFrame, yOffset, xOffset)
-- replace placeholders with current values
primaryText = CzechQuestsAddon:replacePlaceholders(primaryText);
secondaryText = CzechQuestsAddon:replacePlaceholders(secondaryText);
-- when user change own setting, does not require reload, just apply it
CzechQuestsAddon:SetTextureFromSettings(CzechQuestsAddon.translationFrame)
-- reset all texts
CzechQuestsAddon:ResetTranslationText(CzechQuestsAddon.translationFrame)
-- set text to labels
CzechQuestsAddon.translationFrame.primaryHeader:SetText(primaryHeader)
CzechQuestsAddon.translationFrame.primaryText:SetText(primaryText)
CzechQuestsAddon.translationFrame.secondaryHeader:SetText(secondaryHeader)
CzechQuestsAddon.translationFrame.secondaryText:SetText(secondaryText)
local primaryTextTopMargin = -CzechQuestsAddon.translationFrame.primaryHeader:GetHeight() - 15
local secondaryHeaderTopMargin = primaryTextTopMargin - CzechQuestsAddon.translationFrame.primaryText:GetHeight() - 20
local secondaryTextTopMargin = secondaryHeaderTopMargin - CzechQuestsAddon.translationFrame.secondaryHeader:GetHeight() - 5
-- apply gap between headers and texts
local gap = 10
local function addPadding(text, value)
if text ~= "" then
gap = gap + value
end
end
addPadding(primaryHeader, 10)
addPadding(primaryText, 5)
addPadding(secondaryHeader, 25)
addPadding(secondaryText, 5)
-- apply positions
CzechQuestsAddon.translationFrame.primaryHeader:SetPoint("TOPLEFT", 10, -10)
CzechQuestsAddon.translationFrame.primaryText:SetPoint("TOPLEFT", 10, primaryTextTopMargin)
CzechQuestsAddon.translationFrame.secondaryHeader:SetPoint("TOPLEFT", 10, secondaryHeaderTopMargin)
CzechQuestsAddon.translationFrame.secondaryText:SetPoint("TOPLEFT", 10, secondaryTextTopMargin)
-- apply changes per wow
if (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) then
CzechQuestsAddon.translationFrame:SetPoint("TOPLEFT", parentFrame, "TOPRIGHT", -8 + xOffset, yOffset)
else
CzechQuestsAddon.translationFrame:SetPoint("TOPLEFT", parentFrame, "TOPRIGHT", 8 + xOffset, yOffset)
end
-- calculate height
local height = 0;
local heights = {
CzechQuestsAddon.translationFrame.primaryHeader:GetHeight(),
CzechQuestsAddon.translationFrame.primaryText:GetHeight(),
CzechQuestsAddon.translationFrame.secondaryHeader:GetHeight(),
CzechQuestsAddon.translationFrame.secondaryText:GetHeight(),
gap,
10
}
for _, value in ipairs(heights) do
height = height + value
end
CzechQuestsAddon.translationFrame:SetParent(parentFrame)
CzechQuestsAddon.translationFrame:SetHeight(height < 200 and 200 or height)
end
function CzechQuestsAddon:ShowQuestTranslation(event)
-- Hide frame, may contain old texts
CzechQuestsAddon.translationFrame:Hide()
CzechQuestsAddon.translationQuestFrame:Hide()
-- Classic Era has QuestLogFrame
if QuestLogFrame then
@ -77,7 +12,7 @@ function CzechQuestsAddon:ShowQuestTranslation(event)
if questData then
local suffix = CzechQuestsAddon_Store.config.DEBUG_MODE and " (" .. questId .. ")" or ""
local questTitle = questData.title .. suffix
CzechQuestsAddon:ShowTranslationFrame(
CzechQuestsAddon:ShowTranslationQuestFrame(
questTitle,
questData.objective,
"Popis",
@ -86,7 +21,7 @@ function CzechQuestsAddon:ShowQuestTranslation(event)
-14,
0
)
CzechQuestsAddon.translationFrame:Show()
CzechQuestsAddon.translationQuestFrame:Show()
end
end
end
@ -105,7 +40,7 @@ function CzechQuestsAddon:ShowQuestTranslation(event)
local suffix = CzechQuestsAddon_Store.config.DEBUG_MODE and " (" .. questId .. ")" or ""
local questTitle = questData.title .. suffix
local xOffset = hasModel and 210 or 0
CzechQuestsAddon:ShowTranslationFrame(
CzechQuestsAddon:ShowTranslationQuestFrame(
questTitle,
questData.objective,
"Popis",
@ -114,9 +49,9 @@ function CzechQuestsAddon:ShowQuestTranslation(event)
0,
xOffset
)
CzechQuestsAddon.translationFrame:Show()
CzechQuestsAddon.translationQuestFrame:Show()
else
CzechQuestsAddon.translationFrame:Hide()
CzechQuestsAddon.translationQuestFrame:Hide()
end
end
end
@ -131,12 +66,12 @@ function CzechQuestsAddon:ShowQuestTranslation(event)
if questId then
local questData = CzechQuestsAddon:GetData("quest", questId)
if questData then
CzechQuestsAddon.translationFrame:Show()
CzechQuestsAddon.translationQuestFrame:Show()
local suffix = CzechQuestsAddon_Store.config.DEBUG_MODE and " (" .. questId .. ")" or ""
local questTitle = questData.title .. suffix
local xOffset = hasModel and 210 or 0
if event == "QUEST_PROGRESS" then
CzechQuestsAddon:ShowTranslationFrame(
CzechQuestsAddon:ShowTranslationQuestFrame(
questTitle,
questData.progress,
"",
@ -146,7 +81,7 @@ function CzechQuestsAddon:ShowQuestTranslation(event)
xOffset
)
elseif event == "QUEST_COMPLETE" then
CzechQuestsAddon:ShowTranslationFrame(
CzechQuestsAddon:ShowTranslationQuestFrame(
questTitle,
questData.completion,
"",
@ -156,7 +91,7 @@ function CzechQuestsAddon:ShowQuestTranslation(event)
xOffset
)
elseif event == "QUEST_DETAIL" then
CzechQuestsAddon:ShowTranslationFrame(
CzechQuestsAddon:ShowTranslationQuestFrame(
questTitle,
questData.description,
"Cíl úkolu",
@ -166,10 +101,10 @@ function CzechQuestsAddon:ShowQuestTranslation(event)
xOffset
)
else
CzechQuestsAddon.translationFrame:Hide()
CzechQuestsAddon.translationQuestFrame:Hide()
end
else
CzechQuestsAddon.translationFrame:Hide()
CzechQuestsAddon.translationQuestFrame:Hide()
end
end
end
@ -177,7 +112,7 @@ end
function CzechQuestsAddon:ShowQuestItemTranslation()
-- Hide frame, may contain old texts
CzechQuestsAddon.translationFrame:Hide()
CzechQuestsAddon.translationQuestFrame:Hide()
-- should work for both wow version
if ItemTextFrame:IsShown() then
@ -197,7 +132,7 @@ function CzechQuestsAddon:ShowQuestItemTranslation()
if contentPage ~= nil then
item.content = contentPage.descriptionMale
if item.name ~= nil and item.content ~= nil then
CzechQuestsAddon:ShowTranslationFrame(
CzechQuestsAddon:ShowTranslationQuestFrame(
item.name,
item.content,
"",
@ -210,48 +145,72 @@ function CzechQuestsAddon:ShowQuestItemTranslation()
end
end
CzechQuestsAddon.translationFrame:Show()
CzechQuestsAddon.translationQuestFrame:Show()
end
end
function CzechQuestsAddon:ShowSpeechTranslation(sender, message)
local blue = "|cffADD8E6"
local yellow = "|cffffd200"
local white = "|cffffffff"
local reset = "|r"
local text = nil
local translation = CzechQuestsAddon:GetData("speech", message)
if translation ~= nil then
text = translation.text
CzechQuestsAddon.translationSpeechFrame.npcName:SetText(sender)
CzechQuestsAddon.translationSpeechFrame.text:SetText(text)
CzechQuestsAddon.translationSpeechFrame.text:SetPoint(
"TOPLEFT", CzechQuestsAddon.translationSpeechFrame.npcName, "BOTTOMLEFT", 0, -10
)
CzechQuestsAddon.translationSpeechFrame:Show()
print(blue .. "[CZ]" .. reset .. " " .. yellow .. sender .. reset .. ": " .. white .. text .. reset)
end
if timerHandle then
timerHandle:Cancel()
end
timerHandle = C_Timer.NewTimer(10, function()
CzechQuestsAddon.translationSpeechFrame:Hide()
end)
end
-- Hover is enabled only for QuestLogFrame and QuestMapDetailsScrollFrame
local function SetHoverScripts(frame)
local frameName = frame:GetName()
frame:SetScript("OnEnter", function()
CzechQuestsAddon:ShowQuestTranslation()
end)
if not string.find(frameName, "QuestLogItem") and not string.find(frameName, "QuestProgressItem") then
frame:SetScript("OnEnter", function()
CzechQuestsAddon:ShowQuestTranslation()
end)
frame:SetScript("OnLeave", function()
CzechQuestsAddon.translationFrame:Hide()
end)
end
frame:SetScript("OnLeave", function()
CzechQuestsAddon.translationQuestFrame:Hide()
end)
end
function CzechQuestsAddon:InitializeTranslations()
-- create translation frame
CzechQuestsAddon.translationFrame = CzechQuestsAddon:CreateTranslationFrame()
CzechQuestsAddon.translationQuestFrame = CzechQuestsAddon:CreateTranslationQuestFrame()
CzechQuestsAddon.translationSpeechFrame = CzechQuestsAddon:CreateTranslationSpeechFrame()
-- Register events with the main frame
CzechQuestsAddon.translationFrame:RegisterEvent("PLAYER_LOGIN")
CzechQuestsAddon.translationFrame:RegisterEvent("QUEST_PROGRESS")
CzechQuestsAddon.translationFrame:RegisterEvent("QUEST_COMPLETE")
CzechQuestsAddon.translationFrame:RegisterEvent("QUEST_FINISHED")
CzechQuestsAddon.translationFrame:RegisterEvent("QUEST_DETAIL")
CzechQuestsAddon.translationFrame:RegisterEvent("ITEM_TEXT_READY")
CzechQuestsAddon.translationFrame:RegisterEvent("PLAYER_STARTED_MOVING")
CzechQuestsAddon.translationFrame:RegisterEvent("PLAYER_STOPPED_MOVING")
-- Preparation for eventually show translation when hover quest in quest tracker for retail
--if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
-- _G.EventRegistry:RegisterCallback("OnQuestBlockHeader.OnEnter", function(sender, self, questID, isGroup)
-- print(questID)
-- end)
--end
-- Register events
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")
-- Define event handler for the main frame
CzechQuestsAddon.translationFrame:SetScript("OnEvent", function(self, event, ...)
CzechQuestsAddon.translationQuestFrame:SetScript("OnEvent", function(self, event)
if event == "PLAYER_LOGIN" then
-- classic
if QuestLogFrame then
@ -272,12 +231,24 @@ function CzechQuestsAddon:InitializeTranslations()
end
if event == "PLAYER_STARTED_MOVING" then
CzechQuestsAddon.translationFrame.texture:SetAlpha(
CzechQuestsAddon.translationQuestFrame.texture:SetAlpha(
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXTURE_ALPHA / 100
)
elseif event == "PLAYER_STOPPED_MOVING" then
CzechQuestsAddon.translationFrame.texture:SetAlpha(1)
CzechQuestsAddon.translationQuestFrame.texture:SetAlpha(1)
end
end)
end
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")
-- Define event handler for the main frame
CzechQuestsAddon.translationSpeechFrame:SetScript("OnEvent", function(self, event, message, sender)
CzechQuestsAddon:ShowSpeechTranslation(sender, message)
end)
end

View file

@ -934,3 +934,10 @@ CzechQuestsAddon.data.quest[86444] = {
completionMale = "Fantastické! Nemůžu uvěřit, že jste se s tím tak trápili! Jsi nějaký stroj? Na mém místě bych asi nechal svět vybuchnout.\n\nSkláním před vámi svůj turban, pane. A žádný dobrý skutek by neměl zůstat bez odměny.",
completionFemale = "",
}
CzechQuestsAddon.data.speech["Fresh bread for sale!"] = {
npc = "",
text = "Čerstvý chléb na prodej!",
}

View file

@ -7767,10 +7767,16 @@ CzechQuestsAddon.data.item["Bloodwake Missive__1"] = {
titleFemale = "",
objectiveMale = "",
objectiveFemale = "",
descriptionMale = "Krvavé zprávy, Asbjorne.\n\nNastal tvůj čas rozhřešení.\n\nNaši zvědové na otevřeném moři poslali Jorunovi zprávy. Poprvé po mnoha letech se opět ozval nešťastný ostrov Cyrandall.\n\nNemusím ti připomínat, že žádný Bloodwake v historii se nikdy neodvážil k jeho břehům.\n\nNespočet bláznivých klanů, zlákaných legendami o zapomenutých pokladech a prokletých příšerách, se nechalo zlákat jeho voláním.\n\nNikdo se nikdy nevrátil.\n\nAle pro mocného Bloodwake legendy nic neznamenají!\n\nPokud chceš získat zpět Jorunovu přízeň pro své neúspěchy, pak připluj se svou flotilou k ostrovu a vzneseš nárok na tajemství.\n\nNajdi Cyrce's Circlet a přines ho Jorunovi.\n\nAť je tvůj prapor potřísněn krví.\n\n- Drottin Fjardgrym",
descriptionMale = "Krvavé zprávy, Asbjorne.\n\nNastal tvůj čas rozhřešení.\n\nNaši zvědové na otevřeném moři poslali Jorunovi zprávy. Poprvé po mnoha letech se opět ozval nešťastný ostrov Cyrandall.\n\nNemusím ti připomínat, že žádný Bloodwake v historii se nikdy neodvážil k jeho břehům.\n\nNespočet bláznivých klanů, zlákaných legendami o zapomenutých pokladech a prokletých příšerách, se nechalo zlákat jeho voláním.\n\nNikdo se nikdy nevrátil.\n\nAle pro mocného Bloodwake legendy nic neznamenají!\n\nPokud chceš získat zpět Jorunovu přízeň pro své neúspěchy, pak připluj se svou flotilou k ostrovu a vzneseš nárok na tajemství.\n\nNajdi Cyrce's Circlet a přines ho Jorunovi.\n\nAť je tvůj prapor potřísněn krví.\n\n- Drottin Fjardgrym",
descriptionFemale = "",
progressMale = "",
progressFemale = "",
completionMale = "",
completionFemale = "",
completionFemale = "",
}
CzechQuestsAddon.data.speech["Aye. It can be lonely, followin' a path that others can't see. But don't make the same mistake I did, puttin' it all on yourself."] = {
npc = "",
text = "Ano. Může to být osamělé, jít cestou, kterou ostatní nevidí. Ale neudělej stejnou chybu jako já, když to všechno svedeš na sebe. ",
}

View file

@ -0,0 +1,29 @@
-- define FontOptions
function GetFontOptions()
local container = Settings.CreateControlTextContainer()
container:Add("morpheus_cz.ttf", "Morpheus (cz)")
container:Add("frizquadratatt_cz.ttf", "Friz Quadrata TT (cz)")
container:Add("quicksand.ttf", "Quicksand")
container:Add("caveat.ttf", "Caveat")
return container:GetData()
end
function CzechQuestsAddon:InitializeSettings()
CzechQuestsAddon.optionsFrame = {};
CzechQuestsAddon.optionsFrame, layout = Settings.RegisterVerticalLayoutCategory("CzechQuests")
-- Add options for quests
layout:AddInitializer(CreateSettingsListSectionHeaderInitializer("Questy"))
CzechQuestsAddon:AddQuestOptions(CzechQuestsAddon.optionsFrame)
-- Add options for speech
layout:AddInitializer(CreateSettingsListSectionHeaderInitializer("Projevy"))
CzechQuestsAddon:AddSpeechOptions(CzechQuestsAddon.optionsFrame)
-- Add options for speech
layout:AddInitializer(CreateSettingsListSectionHeaderInitializer("Ostatní"))
CzechQuestsAddon:AddOthersOptions(CzechQuestsAddon.optionsFrame)
-- Store it into Addon options
Settings.RegisterAddOnCategory(CzechQuestsAddon.optionsFrame)
end

View file

@ -0,0 +1,15 @@
function CzechQuestsAddon:AddOthersOptions(optionsFrame)
-- Add DEBUG checkbox
local debugCheckbox = Settings.RegisterAddOnSetting(
optionsFrame,
"CzechQuestsAddon__DEBUG_MODE",
"DEBUG_MODE",
CzechQuestsAddon_Store.config,
type(CzechQuestsAddon_Store.config.DEBUG_MODE),
"Zapnout DEBUG",
CzechQuestsAddon_Store.config.DEBUG_MODE
)
Settings.CreateCheckbox(optionsFrame, debugCheckbox)
end

View file

@ -0,0 +1,137 @@
function CzechQuestsAddon:AddQuestOptions(optionsFrame)
if (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) then
-- Add DARK mode checkbox
local darkModeCheckbox = Settings.RegisterAddOnSetting(
optionsFrame,
"CzechQuestsAddon__TRANSLATION_QUEST_FRAME_DARK_MODE",
"TRANSLATION_QUEST_FRAME_DARK_MODE",
CzechQuestsAddon_Store.config,
type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_DARK_MODE),
"Použít tmavý režim",
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_DARK_MODE
)
Settings.CreateCheckbox(optionsFrame, darkModeCheckbox)
end
-- define FontOptions
local function GetFontOptions()
local container = Settings.CreateControlTextContainer()
container:Add("morpheus_cz.ttf", "Morpheus (cz)")
container:Add("frizquadratatt_cz.ttf", "Friz Quadrata TT (cz)")
container:Add("quicksand.ttf", "Quicksand")
container:Add("caveat.ttf", "Caveat")
return container:GetData()
end
-- Add header font dropdown menu
local headerFontFamilyDropdown = Settings.RegisterProxySetting(
optionsFrame,
"CzechQuestsAddon__TRANSLATION_QUEST_FRAME_HEADER_FONT_FAMILY",
type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_HEADER_FONT_FAMILY),
"Písmo nadpisu",
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_HEADER_FONT_FAMILY,
function()
return CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_HEADER_FONT_FAMILY
end,
function(value)
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_HEADER_FONT_FAMILY = value
CzechQuestsAddon:UpdateTranslationQuestFrameFontSettings()
end
)
Settings.CreateDropdown(optionsFrame, headerFontFamilyDropdown, GetFontOptions)
-- Add text font dropdown menu
local textFontFamilyDropdown = Settings.RegisterProxySetting(
optionsFrame,
"CzechQuestsAddon__TRANSLATION_QUEST_FRAME_TEXT_FONT_FAMILY",
type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_FAMILY),
"Písmo textu",
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_FAMILY,
function()
return CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_FAMILY
end,
function(value)
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_FAMILY = value
CzechQuestsAddon:UpdateTranslationQuestFrameFontSettings()
end
)
Settings.CreateDropdown(optionsFrame, textFontFamilyDropdown, GetFontOptions)
-- Add slider for change primary header font size
local primaryHeaderFontSizeSlider = Settings.RegisterProxySetting(
optionsFrame,
"CzechQuestsAddon__TRANSLATION_QUEST_FRAME_PRIMARY_HEADER_FONT_SIZE",
type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_PRIMARY_HEADER_FONT_SIZE),
"Velikost názvu",
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_PRIMARY_HEADER_FONT_SIZE,
function()
return CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_PRIMARY_HEADER_FONT_SIZE
end,
function(value)
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_PRIMARY_HEADER_FONT_SIZE = value
CzechQuestsAddon:UpdateTranslationQuestFrameFontSettings()
end
)
local primaryHeaderFontSizeSliderOptions = Settings.CreateSliderOptions(10, 30, 1)
primaryHeaderFontSizeSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
Settings.CreateSlider(optionsFrame, primaryHeaderFontSizeSlider, primaryHeaderFontSizeSliderOptions)
-- Add slider for change secondary header font size
local secondaryHeaderFontSizeSlider = Settings.RegisterProxySetting(
optionsFrame,
"CzechQuestsAddon__TRANSLATION_QUEST_FRAME_SECONDARY_HEADER_FONT_SIZE",
type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_SECONDARY_HEADER_FONT_SIZE),
"Velikost nadpisu",
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_SECONDARY_HEADER_FONT_SIZE,
function()
return CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_SECONDARY_HEADER_FONT_SIZE
end,
function(value)
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_SECONDARY_HEADER_FONT_SIZE = value
CzechQuestsAddon:UpdateTranslationQuestFrameFontSettings()
end
)
local secondaryHeaderFontSizeSliderOptions = Settings.CreateSliderOptions(10, 30, 1)
secondaryHeaderFontSizeSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
Settings.CreateSlider(optionsFrame, secondaryHeaderFontSizeSlider, secondaryHeaderFontSizeSliderOptions)
-- Add slider for change secondary header font size
local textFontSizeSlider = Settings.RegisterProxySetting(
optionsFrame,
"CzechQuestsAddon__TRANSLATION_QUEST_FRAME_TEXT_FONT_SIZE",
type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_SIZE),
"Velikost textu",
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_SIZE,
function()
return CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_SIZE
end,
function(value)
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_SIZE = value
CzechQuestsAddon:UpdateTranslationQuestFrameFontSettings()
end
)
local textFontSizeSliderOptions = Settings.CreateSliderOptions(10, 30, 1)
textFontSizeSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
Settings.CreateSlider(optionsFrame, textFontSizeSlider, textFontSizeSliderOptions)
-- Add slider for change secondary header font size
local textureAlphaSlider = Settings.RegisterProxySetting(
optionsFrame,
"CzechQuestsAddon__TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA",
type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA),
"Pruhlednost pozadí",
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA,
function()
return CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA
end,
function(value)
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA = value
end
)
local textureAlphaSliderOptions = Settings.CreateSliderOptions(10, 100, 10)
textureAlphaSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
Settings.CreateSlider(optionsFrame, textureAlphaSlider, textureAlphaSliderOptions)
end

View file

@ -0,0 +1,94 @@
function CzechQuestsAddon:AddSpeechOptions(optionsFrame)
-- Add header font dropdown menu
local npcFontFamilyDropdown = Settings.RegisterProxySetting(
optionsFrame,
"CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_NPC_FONT_FAMILY",
type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_FAMILY),
"Písmo jména",
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_FAMILY,
function()
return CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_FAMILY
end,
function(value)
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_FAMILY = value
CzechQuestsAddon:UpdateTranslationSpeechFrameSettings()
end
)
Settings.CreateDropdown(optionsFrame, npcFontFamilyDropdown, GetFontOptions)
-- Add text font dropdown menu
local textFontFamilyDropdown = Settings.RegisterProxySetting(
optionsFrame,
"CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY",
type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY),
"Písmo textu",
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY,
function()
return CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY
end,
function(value)
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY = value
CzechQuestsAddon:UpdateTranslationSpeechFrameSettings()
end
)
Settings.CreateDropdown(optionsFrame, textFontFamilyDropdown, GetFontOptions)
-- Add slider for change primary header font size
local npcFontSizeSlider = Settings.RegisterProxySetting(
optionsFrame,
"CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_NPC_FONT_SIZE",
type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_SIZE),
"Velikost jméma",
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_SIZE,
function()
return CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_SIZE
end,
function(value)
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_SIZE = value
CzechQuestsAddon:UpdateTranslationSpeechFrameSettings()
end
)
local npcFontSizeOption = Settings.CreateSliderOptions(8, 30, 1)
npcFontSizeOption:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
Settings.CreateSlider(optionsFrame, npcFontSizeSlider, npcFontSizeOption)
-- Add slider for change secondary header font size
local textFontSizeSlider = Settings.RegisterProxySetting(
optionsFrame,
"CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE",
type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE),
"Velikost textu",
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE,
function()
return CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE
end,
function(value)
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE = value
CzechQuestsAddon:UpdateTranslationSpeechFrameSettings()
end
)
local textFontSizeSliderOptions = Settings.CreateSliderOptions(8, 30, 1)
textFontSizeSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
Settings.CreateSlider(optionsFrame, textFontSizeSlider, textFontSizeSliderOptions)
-- Add slider for change secondary header font size
local windowWidthSizeSlider = Settings.RegisterProxySetting(
optionsFrame,
"CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_WIDTH",
type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH),
"Šírka zpráva",
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH,
function()
return CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH
end,
function(value)
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH = value
CzechQuestsAddon:UpdateTranslationSpeechFrameSettings()
end
)
local windowWidthSizeSliderOption = Settings.CreateSliderOptions(200, 800, 10)
windowWidthSizeSliderOption:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
Settings.CreateSlider(optionsFrame, windowWidthSizeSlider, windowWidthSizeSliderOption)
end

View file

@ -0,0 +1,194 @@
function CzechQuestsAddon:CreateTranslationQuestFrame()
local frame = {};
-- Quest Translation Frame
frame = CreateFrame("Frame", "CzechQuestTranslationQuestFrame", nil, BackdropTemplateMixin and "BackdropTemplate")
frame:SetWidth(300)
frame:SetBackdrop({ edgeFile = "Interface/Tooltips/UI-Tooltip-Border", edgeSize = 8 })
frame:Hide()
-- Background Parchment texture
frame.texture = frame:CreateTexture(nil, "BACKGROUND", nil, -1);
frame.texture:SetAllPoints(true)
frame.texture:SetHorizTile(true)
frame.primaryHeader = CzechQuestsAddon:CreateTranslationQuestFont(
frame,
"CzechQuestTranslationQuestPrimaryHeader",
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_HEADER_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_PRIMARY_HEADER_FONT_SIZE
)
frame.secondaryHeader = CzechQuestsAddon:CreateTranslationQuestFont(
frame,
"CzechQuestTranslationQuestSecondaryHeader",
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_HEADER_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_SECONDARY_HEADER_FONT_SIZE
)
frame.primaryText = CzechQuestsAddon:CreateTranslationQuestFont(
frame,
"CzechQuestTranslationQuestPrimaryText",
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_SIZE
)
frame.secondaryText = CzechQuestsAddon:CreateTranslationQuestFont(
frame,
"CzechQuestTranslationQuestSecondaryText",
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_SIZE
)
-- Apply correct texture for wow version
CzechQuestsAddon:SetTranslationQuestFrameTextureFromSettings(frame)
return frame;
end
function CzechQuestsAddon:CreateTranslationQuestFont(frame, name, font, size)
local label = frame:CreateFontString(name, "OVERLAY")
label:SetWidth(frame:GetWidth() - 20)
label:SetJustifyH("LEFT")
label:SetTextColor(0, 0, 0, 1)
label:SetFont(font, size, nil)
return label;
end
function CzechQuestsAddon:ResetTranslationQuestText(frame)
frame.primaryHeader:SetText("")
frame.secondaryHeader:SetText("")
frame.primaryText:SetText("")
frame.secondaryText:SetText("")
end
function CzechQuestsAddon:SetTranslationQuestFrameTextureFromSettings(frame)
if (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) then
-- setup default
frame.texture:SetTexture("Interface/QUESTFRAME/QuestBG");
frame.texture:SetTexCoord(0, .58, 0.005, 0.66)
frame.primaryHeader:SetTextColor(0, 0, 0, 1)
frame.secondaryHeader:SetTextColor(0, 0, 0, 1)
frame.primaryText:SetTextColor(0, 0, 0, 1)
frame.secondaryText:SetTextColor(0, 0, 0, 1)
if CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_DARK_MODE then
frame:SetBackdropColor(0, 0, 0, 1)
frame.texture:SetColorTexture(0, 0, 0, 1)
frame.primaryHeader:SetTextColor(255, 255, 255, 1)
frame.secondaryHeader:SetTextColor(255, 255, 255, 1)
frame.primaryText:SetTextColor(255, 255, 255, 1)
frame.secondaryText:SetTextColor(255, 255, 255, 1)
end
else
-- setup default
frame.texture:SetTexture("Interface/QUESTFRAME/QuestBackgroundParchment");
frame.texture:SetTexCoord(0, .01, 0, 0.4)
frame.primaryHeader:SetTextColor(0, 0, 0, 1)
frame.secondaryHeader:SetTextColor(0, 0, 0, 1)
frame.primaryText:SetTextColor(0, 0, 0, 1)
frame.secondaryText:SetTextColor(0, 0, 0, 1)
-- Read CVar from settings to setup same parchment as Quest frame
if C_CVar.GetCVar("questTextContrast") == "1" then -- Brown
frame.texture:SetTexCoord(0, .01, .4, .8)
elseif C_CVar.GetCVar("questTextContrast") == "2"
or C_CVar.GetCVar("questTextContrast") == "3" then -- Gray
frame.texture:SetColorTexture(255, 255, 255, 1)
elseif C_CVar.GetCVar("questTextContrast") == "4" then -- Black
frame.texture:SetColorTexture(0, 0, 0, 1)
frame.primaryHeader:SetTextColor(255, 255, 255, 1)
frame.secondaryHeader:SetTextColor(255, 255, 255, 1)
frame.primaryText:SetTextColor(255, 255, 255, 1)
frame.secondaryText:SetTextColor(255, 255, 255, 1)
end
end
end
function CzechQuestsAddon:UpdateTranslationQuestFrameFontSettings()
CzechQuestsAddon.translationQuestFrame.primaryHeader:SetFont(
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_HEADER_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_PRIMARY_HEADER_FONT_SIZE,
nil
)
CzechQuestsAddon.translationQuestFrame.secondaryHeader:SetFont(
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_HEADER_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_SECONDARY_HEADER_FONT_SIZE,
nil
)
CzechQuestsAddon.translationQuestFrame.primaryText:SetFont(
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_SIZE,
nil
)
CzechQuestsAddon.translationQuestFrame.secondaryText:SetFont(
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_SIZE,
nil
)
CzechQuestsAddon.translationQuestFrame.texture:SetAlpha(
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA / 100
)
end
function CzechQuestsAddon:ShowTranslationQuestFrame(primaryHeader, primaryText, secondaryHeader, secondaryText, parentFrame, yOffset, xOffset)
-- replace placeholders with current values
primaryText = CzechQuestsAddon:replacePlaceholders(primaryText);
secondaryText = CzechQuestsAddon:replacePlaceholders(secondaryText);
-- when user change own setting, does not require reload, just apply it
CzechQuestsAddon:SetTranslationQuestFrameTextureFromSettings(CzechQuestsAddon.translationQuestFrame)
-- reset all texts
CzechQuestsAddon:ResetTranslationQuestText(CzechQuestsAddon.translationQuestFrame)
-- set text to labels
CzechQuestsAddon.translationQuestFrame.primaryHeader:SetText(primaryHeader)
CzechQuestsAddon.translationQuestFrame.primaryText:SetText(primaryText)
CzechQuestsAddon.translationQuestFrame.secondaryHeader:SetText(secondaryHeader)
CzechQuestsAddon.translationQuestFrame.secondaryText:SetText(secondaryText)
local primaryTextTopMargin = -CzechQuestsAddon.translationQuestFrame.primaryHeader:GetHeight() - 15
local secondaryHeaderTopMargin = primaryTextTopMargin - CzechQuestsAddon.translationQuestFrame.primaryText:GetHeight() - 20
local secondaryTextTopMargin = secondaryHeaderTopMargin - CzechQuestsAddon.translationQuestFrame.secondaryHeader:GetHeight() - 5
-- apply gap between headers and texts
local gap = 10
local function addPadding(text, value)
if text ~= "" then
gap = gap + value
end
end
addPadding(primaryHeader, 10)
addPadding(primaryText, 5)
addPadding(secondaryHeader, 25)
addPadding(secondaryText, 5)
-- apply positions
CzechQuestsAddon.translationQuestFrame.primaryHeader:SetPoint("TOPLEFT", 10, -10)
CzechQuestsAddon.translationQuestFrame.primaryText:SetPoint("TOPLEFT", 10, primaryTextTopMargin)
CzechQuestsAddon.translationQuestFrame.secondaryHeader:SetPoint("TOPLEFT", 10, secondaryHeaderTopMargin)
CzechQuestsAddon.translationQuestFrame.secondaryText:SetPoint("TOPLEFT", 10, secondaryTextTopMargin)
-- apply changes per wow
if (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) then
CzechQuestsAddon.translationQuestFrame:SetPoint("TOPLEFT", parentFrame, "TOPRIGHT", -8 + xOffset, yOffset)
else
CzechQuestsAddon.translationQuestFrame:SetPoint("TOPLEFT", parentFrame, "TOPRIGHT", 8 + xOffset, yOffset)
end
-- calculate height
local height = 0;
local heights = {
CzechQuestsAddon.translationQuestFrame.primaryHeader:GetHeight(),
CzechQuestsAddon.translationQuestFrame.primaryText:GetHeight(),
CzechQuestsAddon.translationQuestFrame.secondaryHeader:GetHeight(),
CzechQuestsAddon.translationQuestFrame.secondaryText:GetHeight(),
gap,
10
}
for _, value in ipairs(heights) do
height = height + value
end
CzechQuestsAddon.translationQuestFrame:SetParent(parentFrame)
CzechQuestsAddon.translationQuestFrame:SetHeight(height < 200 and 200 or height)
end

View file

@ -0,0 +1,59 @@
function CzechQuestsAddon:CreateTranslationSpeechFrame()
local frame = {};
-- Speech Translation Frame
frame = CreateFrame("Frame", "CzechQuestsTranslationSpeechFrame", UIParant, "BackdropTemplate")
frame:SetSize(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH, 50)
frame:SetPoint("CENTER", UIParent, "CENTER")
-- Make draggable
frame:EnableMouse(true)
frame:SetMovable(true)
frame:RegisterForDrag("LeftButton")
frame:SetScript("OnDragStart", function(self) self:StartMoving() end)
frame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
frame:Hide()
frame.npcName = frame:CreateFontString("CzechQuestsTranslationSpeechNpcName", "OVERLAY")
frame.npcName:SetTextColor(1, 1, 0)
frame.npcName:SetFont(
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_SIZE,
"OUTLINE"
)
frame.npcName:SetPoint("LEFT", frame, "LEFT", 0, 5)
frame.text = frame:CreateFontString("CzechQuestsTranslationSpeechText", "OVERLAY")
frame.text:SetTextColor(1, 1, 1)
frame.text:SetWordWrap(true)
frame.text:SetFont(
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE,
"OUTLINE"
)
frame.text:SetTextColor(1, 1, 1)
frame.text:SetWidth(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH)
frame.text:SetJustifyH("LEFT")
frame.text:SetJustifyV("TOP")
return frame;
end
function CzechQuestsAddon:UpdateTranslationSpeechFrameSettings()
-- Font
CzechQuestsAddon.translationSpeechFrame.npcName:SetFont(
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_SIZE,
"OUTLINE"
)
CzechQuestsAddon.translationSpeechFrame.text:SetFont(
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE,
"OUTLINE"
)
-- Width
CzechQuestsAddon.translationSpeechFrame.text:SetWidth(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH)
CzechQuestsAddon.translationSpeechFrame:SetWidth(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH)
end

View file

@ -1,11 +1,12 @@
-- Namespace
CzechQuestsAddon = {};
CzechQuestsAddon.fontPath = "Interface\\AddOns\\CzechQuests\\Fonts\\"
CzechQuestsAddon.fontPath = "Interface\\AddOns\\CzechQuests\\Assets\\Fonts\\"
-- Define data
CzechQuestsAddon.data = {};
CzechQuestsAddon.data.quest = {};
CzechQuestsAddon.data.item = {};
CzechQuestsAddon.data.speech = {}
-- Event handler frame
local frame = CreateFrame("Frame")
@ -23,30 +24,52 @@ local function OnEvent(self, event, addonName, ...)
if not CzechQuestsAddon_Store.config.DEBUG_MODE then
CzechQuestsAddon_Store.config.DEBUG_MODE = false;
end
if not CzechQuestsAddon_Store.config.DARK_MODE then
CzechQuestsAddon_Store.config.DARK_MODE = false;
-- Quests
if not CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_DARK_MODE then
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_DARK_MODE = false;
end
if not CzechQuestsAddon_Store.config.TRANSLATION_FRAME_PRIMARY_HEADER_FONT_SIZE then
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_PRIMARY_HEADER_FONT_SIZE = 18;
if not CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_PRIMARY_HEADER_FONT_SIZE then
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_PRIMARY_HEADER_FONT_SIZE = 18;
end
if not CzechQuestsAddon_Store.config.TRANSLATION_FRAME_SECONDARY_HEADER_FONT_SIZE then
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_SECONDARY_HEADER_FONT_SIZE = 16;
if not CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_SECONDARY_HEADER_FONT_SIZE then
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_SECONDARY_HEADER_FONT_SIZE = 16;
end
if not CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_SIZE then
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_SIZE = 14;
if not CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_SIZE then
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_SIZE = 14;
end
if not CzechQuestsAddon_Store.config.TRANSLATION_FRAME_HEADER_FONT_FAMILY then
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_HEADER_FONT_FAMILY = 'morpheus_cz.ttf';
if not CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_HEADER_FONT_FAMILY then
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_HEADER_FONT_FAMILY = 'morpheus_cz.ttf';
end
if not CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_FAMILY then
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_FAMILY = 'frizquadratatt_cz.ttf';
if not CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_FAMILY then
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_FAMILY = 'frizquadratatt_cz.ttf';
end
if not CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXTURE_ALPHA then
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXTURE_ALPHA = 80;
if not CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA then
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA = 80;
end
-- Initialize Options
CzechQuestsAddon:InitializeOptions()
-- Speech
if not CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_SIZE then
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_SIZE = 14;
end
if not CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE then
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE = 12;
end
if not CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_FAMILY then
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_FAMILY = 'frizquadratatt_cz.ttf';
end
if not CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY then
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY = 'frizquadratatt_cz.ttf';
end
if not CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH then
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH = 320;
end
if not CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_POSITION then
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_POSITION = "0,0";
end
-- Initialize settings
CzechQuestsAddon:InitializeSettings()
-- Initialize Quests
CzechQuestsAddon:InitializeTranslations()

View file

@ -2,19 +2,22 @@
## Title: CzechQuests
## Notes: Addon displays texts of quests in Czech language as tooltip
## Author: Roman Jaroš
## Version: 0.2.11
## Version: 0.2.10
## SavedVariables: CzechQuestsAddon_Store
CzechQuests.lua
Quests/Data/0.lua
Quests/Data/1.lua
Addon/Data/0.lua
Addon/Data/1.lua
Quests/Data/other.lua
Addon/Data/other.lua
Addon/Frames/Settings/OptionsQuestFrame.lua
Addon/Frames/Settings/OptionsSpeechFrame.lua
Addon/Frames/Settings/OptionsOthersFrame.lua
Addon/Frames/TranslationQuestFrame.lua
Addon/Frames/TranslationSpeechFrame.lua
Addon/Frames/Settings/OptionsFrame.lua
Quests/Frames/TranslationFrame.lua
Quests/Frames/OptionsFrame.lua
Quests/Utils.lua
Quests/Quests.lua
Addon/Utils.lua
Addon/Addon.lua

View file

@ -2,22 +2,26 @@
## Title: CzechQuests
## Notes: Addon displays texts of quests in Czech language as tooltip
## Author: Roman Jaroš
## Version: 0.1.9
## Version: 0.1.10
## SavedVariables: CzechQuestsAddon_Store
CzechQuests.lua
Quests/Data/0.lua
Quests/Data/1.lua
Quests/Data/2.lua
Quests/Data/3.lua
Quests/Data/4.lua
Quests/Data/5.lua
Addon/Data/0.lua
Addon/Data/1.lua
Addon/Data/2.lua
Addon/Data/3.lua
Addon/Data/4.lua
Addon/Data/5.lua
Quests/Data/other.lua
Addon/Data/other.lua
Quests/Frames/TranslationFrame.lua
Quests/Frames/OptionsFrame.lua
Addon/Frames/Settings/OptionsQuestFrame.lua
Addon/Frames/Settings/OptionsSpeechFrame.lua
Addon/Frames/Settings/OptionsOthersFrame.lua
Addon/Frames/TranslationQuestFrame.lua
Addon/Frames/TranslationSpeechFrame.lua
Addon/Frames/Settings/OptionsFrame.lua
Quests/Utils.lua
Quests/Quests.lua
Addon/Utils.lua
Addon/Addon.lua

View file

@ -1,157 +0,0 @@
function CzechQuestsAddon:InitializeOptions()
CzechQuestsAddon.optionsFrame = {};
CzechQuestsAddon.optionsFrame = Settings.RegisterVerticalLayoutCategory("CzechQuests")
-- Add DEBUG checkbox
local debugCheckbox = Settings.RegisterAddOnSetting(
CzechQuestsAddon.optionsFrame,
"CzechQuestsAddon__DEBUG_MODE",
"DEBUG_MODE",
CzechQuestsAddon_Store.config,
type(CzechQuestsAddon_Store.config.DEBUG_MODE),
"Enable DEBUG mode",
CzechQuestsAddon_Store.config.DEBUG_MODE
)
Settings.CreateCheckbox(CzechQuestsAddon.optionsFrame, debugCheckbox)
if (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) then
-- Add DARK mode checkbox
local darkModeCheckbox = Settings.RegisterAddOnSetting(
CzechQuestsAddon.optionsFrame,
"CzechQuestsAddon__DARK_MODE",
"DARK_MODE",
CzechQuestsAddon_Store.config,
type(CzechQuestsAddon_Store.config.DARK_MODE),
"Use dark mode",
CzechQuestsAddon_Store.config.DARK_MODE
)
Settings.CreateCheckbox(CzechQuestsAddon.optionsFrame, darkModeCheckbox)
end
-- define FontOptions
local function GetFontOptions()
local container = Settings.CreateControlTextContainer()
container:Add("morpheus_cz.ttf", "Morpheus (cz)")
container:Add("frizquadratatt_cz.ttf", "Friz Quadrata TT (cz)")
container:Add("quicksand.ttf", "Quicksand")
container:Add("caveat.ttf", "Caveat")
return container:GetData()
end
-- Add header font dropdown menu
local headerFontFamilyDropdown = Settings.RegisterProxySetting(
CzechQuestsAddon.optionsFrame,
"CzechQuestsAddon__TRANSLATION_FRAME_HEADER_FONT_FAMILY",
type(CzechQuestsAddon_Store.config.TRANSLATION_FRAME_HEADER_FONT_FAMILY),
"Header font",
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_HEADER_FONT_FAMILY,
function()
return CzechQuestsAddon_Store.config.TRANSLATION_FRAME_HEADER_FONT_FAMILY
end,
function(value)
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_HEADER_FONT_FAMILY = value
CzechQuestsAddon:UpdateTranslationFrameFontSettings()
end
)
Settings.CreateDropdown(CzechQuestsAddon.optionsFrame, headerFontFamilyDropdown, GetFontOptions)
-- Add text font dropdown menu
local textFontFamilyDropdown = Settings.RegisterProxySetting(
CzechQuestsAddon.optionsFrame,
"CzechQuestsAddon__TRANSLATION_FRAME_TEXT_FONT_FAMILY",
type(CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_FAMILY),
"Text font",
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_FAMILY,
function()
return CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_FAMILY
end,
function(value)
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_FAMILY = value
CzechQuestsAddon:UpdateTranslationFrameFontSettings()
end
)
Settings.CreateDropdown(CzechQuestsAddon.optionsFrame, textFontFamilyDropdown, GetFontOptions)
-- Add slider for change primary header font size
local primaryHeaderFontSizeSlider = Settings.RegisterProxySetting(
CzechQuestsAddon.optionsFrame,
"CzechQuestsAddon__TRANSLATION_FRAME_PRIMARY_HEADER_FONT_SIZE",
type(CzechQuestsAddon_Store.config.TRANSLATION_FRAME_PRIMARY_HEADER_FONT_SIZE),
"Quest title size",
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_PRIMARY_HEADER_FONT_SIZE,
function()
return CzechQuestsAddon_Store.config.TRANSLATION_FRAME_PRIMARY_HEADER_FONT_SIZE
end,
function(value)
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_PRIMARY_HEADER_FONT_SIZE = value
CzechQuestsAddon:UpdateTranslationFrameFontSettings()
end
)
local primaryHeaderFontSizeSliderOptions = Settings.CreateSliderOptions(10, 30, 1)
primaryHeaderFontSizeSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
Settings.CreateSlider(CzechQuestsAddon.optionsFrame, primaryHeaderFontSizeSlider, primaryHeaderFontSizeSliderOptions)
-- Add slider for change secondary header font size
local secondaryHeaderFontSizeSlider = Settings.RegisterProxySetting(
CzechQuestsAddon.optionsFrame,
"CzechQuestsAddon__TRANSLATION_FRAME_SECONDARY_HEADER_FONT_SIZE",
type(CzechQuestsAddon_Store.config.TRANSLATION_FRAME_SECONDARY_HEADER_FONT_SIZE),
"Secondary title size",
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_SECONDARY_HEADER_FONT_SIZE,
function()
return CzechQuestsAddon_Store.config.TRANSLATION_FRAME_SECONDARY_HEADER_FONT_SIZE
end,
function(value)
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_SECONDARY_HEADER_FONT_SIZE = value
CzechQuestsAddon:UpdateTranslationFrameFontSettings()
end
)
local secondaryHeaderFontSizeSliderOptions = Settings.CreateSliderOptions(10, 30, 1)
secondaryHeaderFontSizeSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
Settings.CreateSlider(CzechQuestsAddon.optionsFrame, secondaryHeaderFontSizeSlider, secondaryHeaderFontSizeSliderOptions)
-- Add slider for change secondary header font size
local textFontSizeSlider = Settings.RegisterProxySetting(
CzechQuestsAddon.optionsFrame,
"CzechQuestsAddon__TRANSLATION_FRAME_TEXT_FONT_SIZE",
type(CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_SIZE),
"Text size",
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_SIZE,
function()
return CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_SIZE
end,
function(value)
local currentFont, _, currentFlags = {}
currentFont, _, currentFlags = CzechQuestsAddon.translationFrame.primaryText:GetFont()
CzechQuestsAddon.translationFrame.primaryText:SetFont(currentFont, value, currentFlags)
currentFont, _, currentFlags = CzechQuestsAddon.translationFrame.secondaryText:GetFont()
CzechQuestsAddon.translationFrame.secondaryText:SetFont(currentFont, value, currentFlags)
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_SIZE = value
end
)
local textFontSizeSliderOptions = Settings.CreateSliderOptions(10, 30, 1)
textFontSizeSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
Settings.CreateSlider(CzechQuestsAddon.optionsFrame, textFontSizeSlider, textFontSizeSliderOptions)
-- Add slider for change secondary header font size
local textureAlphaSlider = Settings.RegisterProxySetting(
CzechQuestsAddon.optionsFrame,
"CzechQuestsAddon__TRANSLATION_FRAME_TEXTURE_ALPHA",
type(CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXTURE_ALPHA),
"Texture transparency",
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXTURE_ALPHA,
function()
return CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXTURE_ALPHA
end,
function(value)
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXTURE_ALPHA = value
end
)
local textureAlphaSliderOptions = Settings.CreateSliderOptions(10, 100, 10)
textureAlphaSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
Settings.CreateSlider(CzechQuestsAddon.optionsFrame, textureAlphaSlider, textureAlphaSliderOptions)
-- Store it into Addon options
Settings.RegisterAddOnCategory(CzechQuestsAddon.optionsFrame)
end

View file

@ -1,129 +0,0 @@
function CzechQuestsAddon:CreateTranslationFrame()
local frame = {};
-- Main Translation Frame
frame = CreateFrame("Frame", "CzechQuestTranslationFrame", nil, BackdropTemplateMixin and "BackdropTemplate")
frame:SetWidth(300)
frame:SetBackdrop({ edgeFile = "Interface/Tooltips/UI-Tooltip-Border", edgeSize = 8 })
frame:Hide()
-- Background Parchment texture
frame.texture = frame:CreateTexture(nil, "BACKGROUND", nil, -1);
frame.texture:SetAllPoints(true)
frame.texture:SetHorizTile(true)
frame.primaryHeader = CzechQuestsAddon:CreateTranslationFont(
frame,
"CzechQuestTranslationPrimaryHeader",
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_FRAME_HEADER_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_PRIMARY_HEADER_FONT_SIZE
)
frame.secondaryHeader = CzechQuestsAddon:CreateTranslationFont(
frame,
"CzechQuestTranslationSecondaryHeader",
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_FRAME_HEADER_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_SECONDARY_HEADER_FONT_SIZE
)
frame.primaryText = CzechQuestsAddon:CreateTranslationFont(
frame,
"CzechQuestTranslationPrimaryText",
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_SIZE
)
frame.secondaryText = CzechQuestsAddon:CreateTranslationFont(
frame,
"CzechQuestTranslationSecondaryText",
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_SIZE
)
-- Apply correct texture for wow version
CzechQuestsAddon:SetTextureFromSettings(frame)
return frame;
end
function CzechQuestsAddon:CreateTranslationFont(frame, name, font, size)
local label = frame:CreateFontString(name, "OVERLAY")
label:SetWidth(frame:GetWidth() - 20)
label:SetJustifyH("LEFT")
label:SetTextColor(0, 0, 0, 1)
label:SetFont(font, size, nil)
return label;
end
function CzechQuestsAddon:ResetTranslationText(frame)
frame.primaryHeader:SetText("")
frame.secondaryHeader:SetText("")
frame.primaryText:SetText("")
frame.secondaryText:SetText("")
end
function CzechQuestsAddon:SetTextureFromSettings(frame)
if (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) then
-- setup default
frame.texture:SetTexture("Interface/QUESTFRAME/QuestBG");
frame.texture:SetTexCoord(0, .58, 0.005, 0.66)
frame.primaryHeader:SetTextColor(0, 0, 0, 1)
frame.secondaryHeader:SetTextColor(0, 0, 0, 1)
frame.primaryText:SetTextColor(0, 0, 0, 1)
frame.secondaryText:SetTextColor(0, 0, 0, 1)
if CzechQuestsAddon_Store.config.DARK_MODE then
frame:SetBackdropColor(0, 0, 0, 1)
frame.texture:SetColorTexture(0, 0, 0, 1)
frame.primaryHeader:SetTextColor(255, 255, 255, 1)
frame.secondaryHeader:SetTextColor(255, 255, 255, 1)
frame.primaryText:SetTextColor(255, 255, 255, 1)
frame.secondaryText:SetTextColor(255, 255, 255, 1)
end
else
-- setup default
frame.texture:SetTexture("Interface/QUESTFRAME/QuestBackgroundParchment");
frame.texture:SetTexCoord(0, .01, 0, 0.4)
frame.primaryHeader:SetTextColor(0, 0, 0, 1)
frame.secondaryHeader:SetTextColor(0, 0, 0, 1)
frame.primaryText:SetTextColor(0, 0, 0, 1)
frame.secondaryText:SetTextColor(0, 0, 0, 1)
-- Read CVar from settings to setup same parchment as Quest frame
if C_CVar.GetCVar("questTextContrast") == "1" then -- Brown
frame.texture:SetTexCoord(0, .01, .4, .8)
elseif C_CVar.GetCVar("questTextContrast") == "2"
or C_CVar.GetCVar("questTextContrast") == "3" then -- Gray
frame.texture:SetColorTexture(255, 255, 255, 1)
elseif C_CVar.GetCVar("questTextContrast") == "4" then -- Black
frame.texture:SetColorTexture(0, 0, 0, 1)
frame.primaryHeader:SetTextColor(255, 255, 255, 1)
frame.secondaryHeader:SetTextColor(255, 255, 255, 1)
frame.primaryText:SetTextColor(255, 255, 255, 1)
frame.secondaryText:SetTextColor(255, 255, 255, 1)
end
end
end
function CzechQuestsAddon:UpdateTranslationFrameFontSettings()
CzechQuestsAddon.translationFrame.primaryHeader:SetFont(
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_FRAME_HEADER_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_PRIMARY_HEADER_FONT_SIZE,
nil
)
CzechQuestsAddon.translationFrame.secondaryHeader:SetFont(
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_FRAME_HEADER_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_SECONDARY_HEADER_FONT_SIZE,
nil
)
CzechQuestsAddon.translationFrame.primaryText:SetFont(
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_SIZE,
nil
)
CzechQuestsAddon.translationFrame.secondaryText:SetFont(
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_SIZE,
nil
)
CzechQuestsAddon.translationFrame.texture:SetAlpha(
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXTURE_ALPHA / 100
)
end

View file

@ -13,7 +13,8 @@ wow_destiny_folder="classic_era"
dest_folder="/Applications/World of Warcraft/_${wow_destiny_folder}_/Interface/AddOns/CzechQuests"
fswatch -o "$src_folder" | while read -r change; do
rsync -avu --delete "$src_folder" "$dest_folder" --exclude={'.*','*.png','*.sh','*.md','Quests/Data/**','downloader/**'}
rsync -au --delete "$src_folder/Quests/Data/$wow_source_folder/" "$dest_folder/Quests/Data/"
cp "$src_folder/Quests/Data/other.lua" "$dest_folder/Quests/Data/"
done
rsync -avu --delete "$src_folder" "$dest_folder" --exclude={'.*','*.png','*.sh','*.md','Addon/Data/**','downloader/**'}
rsync -au --delete "$src_folder/Addon/Data/$wow_source_folder/" "$dest_folder/Addon/Data/"
cp "$src_folder/Addon/Data/other.lua" "$dest_folder/Addon/Data/"
done