Refactor and expand Translation and Quest management.

This commit is contained in:
Roman Jaroš 2025-03-01 21:46:55 +01:00
parent 4660216504
commit 5f21775771
20 changed files with 2546 additions and 9969 deletions

201
Addon/Addon.lua Executable file → Normal file
View file

@ -1,189 +1,3 @@
function CzechQuestsAddon:ShowQuestTranslation(event)
-- Hide frame, may contain old texts
CzechQuestsAddon.translationQuestFrame:Hide()
-- Classic Era has QuestLogFrame
if QuestLogFrame then
if QuestLogFrame:IsShown() then
local questIndex = GetQuestLogSelection()
if questIndex > 0 then
local questId = select(8, GetQuestLogTitle(questIndex))
local questData = CzechQuestsAddon:GetData("quest", questId)
if questData then
local suffix = CzechQuestsAddon_Store.config.DEBUG_MODE and " (" .. questId .. ")" or ""
local questTitle = questData.title .. suffix
CzechQuestsAddon:ShowTranslationQuestFrame(
questTitle,
questData.objective,
"Popis",
questData.description,
QuestLogFrame,
-14,
0
)
CzechQuestsAddon.translationQuestFrame:Show()
end
end
end
end
-- Retail has QuestMapDetailsScrollFrame
if QuestMapDetailsScrollFrame then
if QuestMapDetailsScrollFrame:IsShown() then
-- get quest ID
local questId = C_QuestLog.GetSelectedQuest()
-- detect if quest frame does not include npc preview
local hasModel = QuestModelScene:IsShown()
-- show translation frame
local questData = CzechQuestsAddon:GetData("quest", questId)
if questData then
local suffix = CzechQuestsAddon_Store.config.DEBUG_MODE and " (" .. questId .. ")" or ""
local questTitle = questData.title .. suffix
local xOffset = hasModel and 210 or 0
CzechQuestsAddon:ShowTranslationQuestFrame(
questTitle,
questData.objective,
"Popis",
questData.description,
QuestMapFrame,
0,
xOffset
)
CzechQuestsAddon.translationQuestFrame:Show()
else
CzechQuestsAddon.translationQuestFrame:Hide()
end
end
end
-- If quest is right from NPC, this work for both wow version
if event ~= nil then
-- get quest ID
local questId = GetQuestID()
-- detect if quest frame does not include npc preview
local hasModel = QuestModelScene and QuestModelScene:IsShown() or false
-- show translation frame
if questId then
local questData = CzechQuestsAddon:GetData("quest", questId)
if questData then
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:ShowTranslationQuestFrame(
questTitle,
questData.progress,
"",
"",
QuestFrame,
-20,
xOffset
)
elseif event == "QUEST_COMPLETE" then
CzechQuestsAddon:ShowTranslationQuestFrame(
questTitle,
questData.completion,
"",
"",
QuestFrame,
-20,
xOffset
)
elseif event == "QUEST_DETAIL" then
CzechQuestsAddon:ShowTranslationQuestFrame(
questTitle,
questData.description,
"Cíl úkolu",
questData.objective,
QuestFrame,
-20,
xOffset
)
else
CzechQuestsAddon.translationQuestFrame:Hide()
end
else
CzechQuestsAddon.translationQuestFrame:Hide()
end
end
end
end
function CzechQuestsAddon:ShowQuestItemTranslation()
-- Hide frame, may contain old texts
CzechQuestsAddon.translationQuestFrame:Hide()
-- should work for both wow version
if ItemTextFrame:IsShown() then
local item = {}
-- get item name
local itemName = ItemTextGetItem();
local titlePage = CzechQuestsAddon:GetData("item", itemName)
-- check if item is translated
if titlePage ~= nil then
item.name = titlePage.titleMale;
local pageNum = ItemTextGetPage()
local contentPage = CzechQuestsAddon:GetData("item", itemName..'__'..pageNum)
-- check if item is translated
if contentPage ~= nil then
item.content = contentPage.descriptionMale
if item.name ~= nil and item.content ~= nil then
CzechQuestsAddon:ShowTranslationQuestFrame(
item.name,
item.content,
"",
"",
ItemTextFrame,
-20,
0
)
end
end
end
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 function SetHoverScripts(frame)
frame:SetScript("OnEnter", function() frame:SetScript("OnEnter", function()
CzechQuestsAddon:ShowQuestTranslation() CzechQuestsAddon:ShowQuestTranslation()
@ -195,11 +9,10 @@ local function SetHoverScripts(frame)
end end
function CzechQuestsAddon:InitializeTranslations() function CzechQuestsAddon:InitializeTranslations()
-- create translation frame -- Activate Quest translations
if CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_ENABLED then
CzechQuestsAddon.translationQuestFrame = CzechQuestsAddon:CreateTranslationQuestFrame() CzechQuestsAddon.translationQuestFrame = CzechQuestsAddon:CreateTranslationQuestFrame()
CzechQuestsAddon.translationSpeechFrame = CzechQuestsAddon:CreateTranslationSpeechFrame()
-- Register events
CzechQuestsAddon.translationQuestFrame:RegisterEvent("PLAYER_LOGIN") CzechQuestsAddon.translationQuestFrame:RegisterEvent("PLAYER_LOGIN")
CzechQuestsAddon.translationQuestFrame:RegisterEvent("QUEST_PROGRESS") CzechQuestsAddon.translationQuestFrame:RegisterEvent("QUEST_PROGRESS")
CzechQuestsAddon.translationQuestFrame:RegisterEvent("QUEST_COMPLETE") CzechQuestsAddon.translationQuestFrame:RegisterEvent("QUEST_COMPLETE")
@ -209,7 +22,6 @@ function CzechQuestsAddon:InitializeTranslations()
CzechQuestsAddon.translationQuestFrame:RegisterEvent("PLAYER_STARTED_MOVING") CzechQuestsAddon.translationQuestFrame:RegisterEvent("PLAYER_STARTED_MOVING")
CzechQuestsAddon.translationQuestFrame:RegisterEvent("PLAYER_STOPPED_MOVING") CzechQuestsAddon.translationQuestFrame:RegisterEvent("PLAYER_STOPPED_MOVING")
-- Define event handler for the main frame
CzechQuestsAddon.translationQuestFrame:SetScript("OnEvent", function(self, event) CzechQuestsAddon.translationQuestFrame:SetScript("OnEvent", function(self, event)
if event == "PLAYER_LOGIN" then if event == "PLAYER_LOGIN" then
-- classic -- classic
@ -230,6 +42,7 @@ function CzechQuestsAddon:InitializeTranslations()
CzechQuestsAddon:ShowQuestItemTranslation() CzechQuestsAddon:ShowQuestItemTranslation()
end end
if CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA_ONLY_MOVING then
if event == "PLAYER_STARTED_MOVING" then if event == "PLAYER_STARTED_MOVING" then
CzechQuestsAddon.translationQuestFrame.texture:SetAlpha( CzechQuestsAddon.translationQuestFrame.texture:SetAlpha(
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXTURE_ALPHA / 100 CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXTURE_ALPHA / 100
@ -237,8 +50,14 @@ function CzechQuestsAddon:InitializeTranslations()
elseif event == "PLAYER_STOPPED_MOVING" then elseif event == "PLAYER_STOPPED_MOVING" then
CzechQuestsAddon.translationQuestFrame.texture:SetAlpha(1) CzechQuestsAddon.translationQuestFrame.texture:SetAlpha(1)
end end
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_SAY")
CzechQuestsAddon.translationSpeechFrame:RegisterEvent("CHAT_MSG_MONSTER_YELL") CzechQuestsAddon.translationSpeechFrame:RegisterEvent("CHAT_MSG_MONSTER_YELL")
@ -246,9 +65,9 @@ function CzechQuestsAddon:InitializeTranslations()
CzechQuestsAddon.translationSpeechFrame:RegisterEvent("CHAT_MSG_MONSTER_PARTY") CzechQuestsAddon.translationSpeechFrame:RegisterEvent("CHAT_MSG_MONSTER_PARTY")
CzechQuestsAddon.translationSpeechFrame:RegisterEvent("CHAT_MSG_MONSTER_WHISPER") CzechQuestsAddon.translationSpeechFrame:RegisterEvent("CHAT_MSG_MONSTER_WHISPER")
-- Define event handler for the main frame
CzechQuestsAddon.translationSpeechFrame:SetScript("OnEvent", function(self, event, message, sender) CzechQuestsAddon.translationSpeechFrame:SetScript("OnEvent", function(self, event, message, sender)
CzechQuestsAddon:ShowSpeechTranslation(sender, message) CzechQuestsAddon:ShowSpeechTranslation(sender, message)
end) end)
end
end end

View file

@ -1,35 +1,29 @@
function CzechQuestsAddon:GetData(key, id) local QuestTextMethod = {
if CzechQuestsAddon.data[key] then Description = GetQuestText,
if key == "quest" then Objective = GetObjectiveText,
if CzechQuestsAddon.data[key][id] then };
local quest = CzechQuestsAddon.data[key][id];
local function ResolveFemaleVersion(maleVersion, femaleVersion) local function GetQuestText(method)
local gender = UnitSex("player") local text = QuestTextMethod[method]();
if gender == 2 then if text then
return maleVersion return text
else else
return femaleVersion == "" and maleVersion or femaleVersion return ""
end end
end end
local standardQuest = { local function GetQuestLogQuestIndex(questID)
title = ResolveFemaleVersion(quest.titleMale, quest.titleFemale), local numEntries = C_QuestLog.GetNumQuestLogEntries()
objective = ResolveFemaleVersion(quest.objectiveMale, quest.objectiveFemale), for questLogIndex = 1, numEntries do
description = ResolveFemaleVersion(quest.descriptionMale, quest.descriptionFemale), local info = C_QuestLog.GetInfo(questLogIndex)
progress = ResolveFemaleVersion(quest.progressMale, quest.progressFemale), if info and info.questID == questID then
completion = ResolveFemaleVersion(quest.completionMale, quest.completionFemale), return questLogIndex
}
return standardQuest
end
elseif CzechQuestsAddon.data[key][id] then
return CzechQuestsAddon.data[key][id]
end end
end end
return nil return nil
end end
function CzechQuestsAddon:replacePlaceholders(text) local function ReplacePlaceholders(text)
if text == nil then if text == nil then
return text return text
end end
@ -81,26 +75,52 @@ function CzechQuestsAddon:replacePlaceholders(text)
return formatted return formatted
end end
function CzechQuestsAddon:dumpTable(tbl, indent) local function TransformText(text)
-- Initialize indent if not provided return ReplacePlaceholders(text)
indent = indent or 0
-- Check if the input is actually a table
if type(tbl) ~= "table" then
print(string.rep(" ", indent) .. tostring(tbl))
return
end end
-- Iterate through the table and print keys and values local function ResolveGender(maleVersion, femaleVersion)
for k, v in pairs(tbl) do local gender = UnitSex("player")
local formatting = string.rep(" ", indent) .. tostring(k) .. ": " if gender == 2 then
if type(v) == "table" then return TransformText(maleVersion)
print(formatting)
CzechQuestsAddon:dumpTable(v, indent + 1)
elseif type(v) == "boolean" then
print(formatting .. (v and "true" or "false"))
else else
print(formatting .. tostring(v)) return femaleVersion == nil and TransformText(maleVersion) or TransformText(femaleVersion)
end end
end end
local function GetQuest(id)
local quest = CzechQuestsAddon.data.quest[id];
if quest then
local description = ""
local objective = ""
if QuestMapDetailsScrollFrame and QuestMapDetailsScrollFrame:IsVisible() then
local index = GetQuestLogQuestIndex(id)
description, objective = GetQuestLogQuestText(index)
else
description = GetQuestText("Description")
objective = GetQuestText("Objective")
end
return {
title = ResolveGender(quest.titleMale, quest.titleFemale),
objective = CzechQuestsAddon:TransformIntoParagraphs(
objective, ResolveGender(quest.objectiveMale, quest.objectiveFemale)
),
description = CzechQuestsAddon:TransformIntoParagraphs(
description, ResolveGender(quest.descriptionMale, quest.descriptionFemale)
),
progress = ResolveGender(quest.progressMale, quest.progressFemale),
completion = ResolveGender(quest.completionMale, quest.completionFemale),
}
end
end
function CzechQuestsAddon:GetData(key, id)
if CzechQuestsAddon.data[key] then
if key == "quest" then
return GetQuest(id)
elseif CzechQuestsAddon.data[key][id] then
return CzechQuestsAddon.data[key][id]
end
end
return nil
end end

144
Addon/Code/Quest.lua Executable file
View file

@ -0,0 +1,144 @@
function CzechQuestsAddon:ShowQuestTranslation(event)
-- Hide frame, may contain old texts
CzechQuestsAddon.translationQuestFrame:Hide()
-- Classic Era has QuestLogFrame
if QuestLogFrame then
if QuestLogFrame:IsShown() then
local questIndex = GetQuestLogSelection()
if questIndex > 0 then
local questId = select(8, GetQuestLogTitle(questIndex))
local questData = CzechQuestsAddon:GetData("quest", questId)
if questData then
local suffix = CzechQuestsAddon_Store.config.DEBUG_MODE and " (" .. questId .. ")" or ""
local questTitle = questData.title .. suffix
CzechQuestsAddon:ShowTranslationQuestFrame(
questTitle,
questData.objective,
"Popis",
questData.description,
QuestLogFrame,
-14,
0
)
CzechQuestsAddon.translationQuestFrame:Show()
end
end
end
end
-- Retail has QuestMapDetailsScrollFrame
if QuestMapDetailsScrollFrame then
if QuestMapDetailsScrollFrame:IsVisible() then
local questId = C_QuestLog.GetSelectedQuest()
local hasModel = QuestModelScene:IsVisible()
local questData = CzechQuestsAddon:GetData("quest", questId)
if questData then
local suffix = CzechQuestsAddon_Store.config.DEBUG_MODE and " (" .. questId .. ")" or ""
local questTitle = questData.title .. suffix
local xOffset = hasModel and 210 or 50
CzechQuestsAddon:ShowTranslationQuestFrame(
questTitle,
questData.objective,
"Popis",
questData.description,
QuestMapFrame,
0,
xOffset
)
CzechQuestsAddon.translationQuestFrame:Show()
else
CzechQuestsAddon.translationQuestFrame:Hide()
end
end
end
-- If quest is right from NPC, this work for both wow version
if event ~= nil then
local questId = GetQuestID()
local hasModel = QuestModelScene and QuestModelScene:IsShown() or false
if questId then
local questData = CzechQuestsAddon:GetData("quest", questId)
if questData then
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:ShowTranslationQuestFrame(
questTitle,
questData.progress,
"",
"",
QuestFrame,
-20,
xOffset
)
elseif event == "QUEST_COMPLETE" then
CzechQuestsAddon:ShowTranslationQuestFrame(
questTitle,
questData.completion,
"",
"",
QuestFrame,
-20,
xOffset
)
elseif event == "QUEST_DETAIL" then
CzechQuestsAddon:ShowTranslationQuestFrame(
questTitle,
questData.description,
"Cíl úkolu",
questData.objective,
QuestFrame,
-20,
xOffset
)
else
CzechQuestsAddon.translationQuestFrame:Hide()
end
else
CzechQuestsAddon.translationQuestFrame:Hide()
end
end
end
end
function CzechQuestsAddon:ShowQuestItemTranslation()
-- Hide frame, may contain old texts
CzechQuestsAddon.translationQuestFrame:Hide()
-- should work for both wow version
if ItemTextFrame:IsShown() then
local item = {}
-- get item name
local itemName = ItemTextGetItem();
local titlePage = CzechQuestsAddon:GetData("item", itemName)
-- check if item is translated
if titlePage ~= nil then
item.name = titlePage.titleMale;
local pageNum = ItemTextGetPage()
local contentPage = CzechQuestsAddon:GetData("item", itemName .. '__' .. pageNum)
-- check if item is translated
if contentPage ~= nil then
item.content = contentPage.text
if item.name ~= nil and item.content ~= nil then
CzechQuestsAddon:ShowTranslationQuestFrame(
item.name,
item.content,
"",
"",
ItemTextFrame,
-20,
0
)
end
end
end
CzechQuestsAddon.translationQuestFrame:Show()
end
end

51
Addon/Code/QuestParser.lua Executable file
View file

@ -0,0 +1,51 @@
local function SplitParagraphs(text)
local paragraphs = {}
for paragraph in string.gmatch(text, "([^\n]+)") do
table.insert(paragraphs, paragraph)
end
return paragraphs
end
local function SplitSentences(paragraph)
local sentences = {}
for sentence in string.gmatch(paragraph, "([^%.%?!]+[%.%?!]?)[%s]*") do
local trimmed = sentence:gsub("^%s+", ""):gsub("%s+$", "")
if #trimmed > 0 then
table.insert(sentences, trimmed)
end
end
return sentences
end
function CzechQuestsAddon:TransformIntoParagraphs(original_text, translation_text)
if original_text == "" or original_text == nil then
return translation_text
end
local original_paragraphs = SplitParagraphs(original_text)
local translation_paragraphs = {}
local translation_sentences = SplitSentences(translation_text)
local counter = 1
for _, orig_paragraph in ipairs(original_paragraphs) do
local orig_sentences = SplitSentences(orig_paragraph)
local paragraph_sentence_count = #orig_sentences
local collected = {}
for i = 1, paragraph_sentence_count do
if translation_sentences[counter] then
table.insert(collected, translation_sentences[counter])
counter = counter + 1
else
break
end
end
table.insert(translation_paragraphs, table.concat(collected, " "))
end
local final_text = table.concat(translation_paragraphs, "\n")
return final_text
end

67
Addon/Code/Speeches.lua Executable file
View file

@ -0,0 +1,67 @@
local messages = {}
local function ReflowMessages()
local offsetY = 5
for i = #messages, 1, -1 do
local msg = messages[i]
msg:ClearAllPoints()
msg:SetPoint(
"BOTTOMLEFT",
CzechQuestsAddon.translationSpeechFrame.content,
"BOTTOMLEFT",
10,
offsetY
)
offsetY = offsetY + msg:GetHeight()
end
CzechQuestsAddon.translationSpeechFrame.content:SetHeight(offsetY + 5)
end
local function RemoveMessage(frame)
local emptyMessages = true
for i, fs in ipairs(messages) do
emptyMessages = false
if fs == frame then
local fadeAnimationGroup = fs:CreateAnimationGroup()
local fadeOut = fadeAnimationGroup:CreateAnimation("Alpha")
fadeOut:SetFromAlpha(1)
fadeOut:SetToAlpha(0)
fadeOut:SetDuration(0.2)
fadeOut:SetStartDelay(0)
fadeAnimationGroup:SetScript("OnFinished", function()
table.remove(messages, i)
fs:Hide()
ReflowMessages()
end)
fs:Show()
fadeAnimationGroup:Play()
break
end
end
if emptyMessages then
CzechQuestsAddon.translationSpeechFrame:Hide()
end
end
local function AddMessage(sender, message)
local formattedText = string.format("|cffffd200%s|r\n%s", sender, message)
local frame = CzechQuestsAddon:CreateTranslationSpeechFrameMessage(formattedText)
CzechQuestsAddon.translationSpeechFrame:Show()
table.insert(messages, frame)
ReflowMessages()
C_Timer.After(30, function()
RemoveMessage(frame)
end)
end
function CzechQuestsAddon:ShowSpeechTranslation(sender, message)
local text = CzechQuestsAddon:GetData("speech", message) or message
AddMessage(sender, text)
end

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -9,21 +9,20 @@ function GetFontOptions()
end end
function CzechQuestsAddon:InitializeSettings() function CzechQuestsAddon:InitializeSettings()
CzechQuestsAddon.optionsFrame = {}; local category, layout = Settings.RegisterVerticalLayoutCategory("CzechQuests")
CzechQuestsAddon.optionsFrame, layout = Settings.RegisterVerticalLayoutCategory("CzechQuests")
-- Add options for quests -- Add options for quests
layout:AddInitializer(CreateSettingsListSectionHeaderInitializer("Questy")) layout:AddInitializer(CreateSettingsListSectionHeaderInitializer("Questy"))
CzechQuestsAddon:AddQuestOptions(CzechQuestsAddon.optionsFrame) CzechQuestsAddon:AddQuestOptions(category, layout)
-- Add options for speech -- Add options for speech
layout:AddInitializer(CreateSettingsListSectionHeaderInitializer("Projevy")) layout:AddInitializer(CreateSettingsListSectionHeaderInitializer("Projevy (zatím ve vývoji)"))
CzechQuestsAddon:AddSpeechOptions(CzechQuestsAddon.optionsFrame) CzechQuestsAddon:AddSpeechOptions(category, layout)
-- Add options for speech -- Add options for speech
layout:AddInitializer(CreateSettingsListSectionHeaderInitializer("Ostatní")) layout:AddInitializer(CreateSettingsListSectionHeaderInitializer("Ostatní"))
CzechQuestsAddon:AddOthersOptions(CzechQuestsAddon.optionsFrame) CzechQuestsAddon:AddOthersOptions(category, layout)
-- Store it into Addon options -- Store it into Addon options
Settings.RegisterAddOnCategory(CzechQuestsAddon.optionsFrame) Settings.RegisterAddOnCategory(category)
end end

View file

@ -1,9 +1,21 @@
function CzechQuestsAddon:AddQuestOptions(optionsFrame) function CzechQuestsAddon:AddQuestOptions(category)
-- Enable translations
local enableCheckbox = Settings.RegisterAddOnSetting(
category,
"CzechQuestsAddon__TRANSLATION_QUEST_FRAME_ENABLED",
"TRANSLATION_QUEST_FRAME_ENABLED",
CzechQuestsAddon_Store.config,
type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_ENABLED),
"Zapnout *",
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_ENABLED
)
Settings.CreateCheckbox(category, enableCheckbox)
if (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) then if (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) then
-- Add DARK mode checkbox -- Add DARK mode checkbox
local darkModeCheckbox = Settings.RegisterAddOnSetting( local darkModeCheckbox = Settings.RegisterAddOnSetting(
optionsFrame, category,
"CzechQuestsAddon__TRANSLATION_QUEST_FRAME_DARK_MODE", "CzechQuestsAddon__TRANSLATION_QUEST_FRAME_DARK_MODE",
"TRANSLATION_QUEST_FRAME_DARK_MODE", "TRANSLATION_QUEST_FRAME_DARK_MODE",
CzechQuestsAddon_Store.config, CzechQuestsAddon_Store.config,
@ -11,7 +23,7 @@ function CzechQuestsAddon:AddQuestOptions(optionsFrame)
"Použít tmavý režim", "Použít tmavý režim",
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_DARK_MODE CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_DARK_MODE
) )
Settings.CreateCheckbox(optionsFrame, darkModeCheckbox) Settings.CreateCheckbox(category, darkModeCheckbox)
end end
-- define FontOptions -- define FontOptions
@ -26,7 +38,7 @@ function CzechQuestsAddon:AddQuestOptions(optionsFrame)
-- Add header font dropdown menu -- Add header font dropdown menu
local headerFontFamilyDropdown = Settings.RegisterProxySetting( local headerFontFamilyDropdown = Settings.RegisterProxySetting(
optionsFrame, category,
"CzechQuestsAddon__TRANSLATION_QUEST_FRAME_HEADER_FONT_FAMILY", "CzechQuestsAddon__TRANSLATION_QUEST_FRAME_HEADER_FONT_FAMILY",
type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_HEADER_FONT_FAMILY), type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_HEADER_FONT_FAMILY),
"Písmo nadpisu", "Písmo nadpisu",
@ -39,11 +51,11 @@ function CzechQuestsAddon:AddQuestOptions(optionsFrame)
CzechQuestsAddon:UpdateTranslationQuestFrameFontSettings() CzechQuestsAddon:UpdateTranslationQuestFrameFontSettings()
end end
) )
Settings.CreateDropdown(optionsFrame, headerFontFamilyDropdown, GetFontOptions) Settings.CreateDropdown(category, headerFontFamilyDropdown, GetFontOptions)
-- Add text font dropdown menu -- Add text font dropdown menu
local textFontFamilyDropdown = Settings.RegisterProxySetting( local textFontFamilyDropdown = Settings.RegisterProxySetting(
optionsFrame, category,
"CzechQuestsAddon__TRANSLATION_QUEST_FRAME_TEXT_FONT_FAMILY", "CzechQuestsAddon__TRANSLATION_QUEST_FRAME_TEXT_FONT_FAMILY",
type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_FAMILY), type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_FAMILY),
"Písmo textu", "Písmo textu",
@ -56,11 +68,11 @@ function CzechQuestsAddon:AddQuestOptions(optionsFrame)
CzechQuestsAddon:UpdateTranslationQuestFrameFontSettings() CzechQuestsAddon:UpdateTranslationQuestFrameFontSettings()
end end
) )
Settings.CreateDropdown(optionsFrame, textFontFamilyDropdown, GetFontOptions) Settings.CreateDropdown(category, textFontFamilyDropdown, GetFontOptions)
-- Add slider for change primary header font size -- Add slider for change primary header font size
local primaryHeaderFontSizeSlider = Settings.RegisterProxySetting( local primaryHeaderFontSizeSlider = Settings.RegisterProxySetting(
optionsFrame, category,
"CzechQuestsAddon__TRANSLATION_QUEST_FRAME_PRIMARY_HEADER_FONT_SIZE", "CzechQuestsAddon__TRANSLATION_QUEST_FRAME_PRIMARY_HEADER_FONT_SIZE",
type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_PRIMARY_HEADER_FONT_SIZE), type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_PRIMARY_HEADER_FONT_SIZE),
"Velikost názvu", "Velikost názvu",
@ -75,11 +87,11 @@ function CzechQuestsAddon:AddQuestOptions(optionsFrame)
) )
local primaryHeaderFontSizeSliderOptions = Settings.CreateSliderOptions(10, 30, 1) local primaryHeaderFontSizeSliderOptions = Settings.CreateSliderOptions(10, 30, 1)
primaryHeaderFontSizeSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right); primaryHeaderFontSizeSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
Settings.CreateSlider(optionsFrame, primaryHeaderFontSizeSlider, primaryHeaderFontSizeSliderOptions) Settings.CreateSlider(category, primaryHeaderFontSizeSlider, primaryHeaderFontSizeSliderOptions)
-- Add slider for change secondary header font size -- Add slider for change secondary header font size
local secondaryHeaderFontSizeSlider = Settings.RegisterProxySetting( local secondaryHeaderFontSizeSlider = Settings.RegisterProxySetting(
optionsFrame, category,
"CzechQuestsAddon__TRANSLATION_QUEST_FRAME_SECONDARY_HEADER_FONT_SIZE", "CzechQuestsAddon__TRANSLATION_QUEST_FRAME_SECONDARY_HEADER_FONT_SIZE",
type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_SECONDARY_HEADER_FONT_SIZE), type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_SECONDARY_HEADER_FONT_SIZE),
"Velikost nadpisu", "Velikost nadpisu",
@ -94,12 +106,12 @@ function CzechQuestsAddon:AddQuestOptions(optionsFrame)
) )
local secondaryHeaderFontSizeSliderOptions = Settings.CreateSliderOptions(10, 30, 1) local secondaryHeaderFontSizeSliderOptions = Settings.CreateSliderOptions(10, 30, 1)
secondaryHeaderFontSizeSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right); secondaryHeaderFontSizeSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
Settings.CreateSlider(optionsFrame, secondaryHeaderFontSizeSlider, secondaryHeaderFontSizeSliderOptions) Settings.CreateSlider(category, secondaryHeaderFontSizeSlider, secondaryHeaderFontSizeSliderOptions)
-- Add slider for change secondary header font size -- Add slider for change secondary header font size
local textFontSizeSlider = Settings.RegisterProxySetting( local textFontSizeSlider = Settings.RegisterProxySetting(
optionsFrame, category,
"CzechQuestsAddon__TRANSLATION_QUEST_FRAME_TEXT_FONT_SIZE", "CzechQuestsAddon__TRANSLATION_QUEST_FRAME_TEXT_FONT_SIZE",
type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_SIZE), type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXT_FONT_SIZE),
"Velikost textu", "Velikost textu",
@ -114,11 +126,23 @@ function CzechQuestsAddon:AddQuestOptions(optionsFrame)
) )
local textFontSizeSliderOptions = Settings.CreateSliderOptions(10, 30, 1) local textFontSizeSliderOptions = Settings.CreateSliderOptions(10, 30, 1)
textFontSizeSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right); textFontSizeSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
Settings.CreateSlider(optionsFrame, textFontSizeSlider, textFontSizeSliderOptions) Settings.CreateSlider(category, textFontSizeSlider, textFontSizeSliderOptions)
-- Add DARK mode checkbox
local darkModeCheckbox = Settings.RegisterAddOnSetting(
category,
"CzechQuestsAddon__TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA_ONLY_MOVING",
"TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA_ONLY_MOVING",
CzechQuestsAddon_Store.config,
type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA_ONLY_MOVING),
"Pruhlednost pouze pri chuzi *",
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA_ONLY_MOVING
)
Settings.CreateCheckbox(category, darkModeCheckbox)
-- Add slider for change secondary header font size -- Add slider for change secondary header font size
local textureAlphaSlider = Settings.RegisterProxySetting( local textureAlphaSlider = Settings.RegisterProxySetting(
optionsFrame, category,
"CzechQuestsAddon__TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA", "CzechQuestsAddon__TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA",
type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA), type(CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA),
"Pruhlednost pozadí", "Pruhlednost pozadí",
@ -132,6 +156,6 @@ function CzechQuestsAddon:AddQuestOptions(optionsFrame)
) )
local textureAlphaSliderOptions = Settings.CreateSliderOptions(10, 100, 10) local textureAlphaSliderOptions = Settings.CreateSliderOptions(10, 100, 10)
textureAlphaSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right); textureAlphaSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
Settings.CreateSlider(optionsFrame, textureAlphaSlider, textureAlphaSliderOptions) Settings.CreateSlider(category, textureAlphaSlider, textureAlphaSliderOptions)
end end

View file

@ -1,94 +1,90 @@
function CzechQuestsAddon:AddSpeechOptions(optionsFrame) function CzechQuestsAddon:AddSpeechOptions(category, layout)
-- Add header font dropdown menu -- Enable translations
local npcFontFamilyDropdown = Settings.RegisterProxySetting( local enableCheckbox = Settings.RegisterAddOnSetting(
optionsFrame, category,
"CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_NPC_FONT_FAMILY", "CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_ENABLED",
type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_FAMILY), "TRANSLATION_SPEECH_FRAME_ENABLED",
"Písmo jména", CzechQuestsAddon_Store.config,
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_FAMILY, type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_ENABLED),
function() "Zapnout *",
return CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_FAMILY CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_ENABLED
end,
function(value)
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_FAMILY = value
CzechQuestsAddon:UpdateTranslationSpeechFrameSettings()
end
) )
Settings.CreateDropdown(optionsFrame, npcFontFamilyDropdown, GetFontOptions) Settings.CreateCheckbox(category, enableCheckbox)
-- Add text font dropdown menu -- Add text font dropdown menu
local textFontFamilyDropdown = Settings.RegisterProxySetting( local textFontFamilyDropdown = Settings.RegisterProxySetting(
optionsFrame, category,
"CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY", "CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY",
type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY), type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY),
"Písmo textu", "Písmo textu *",
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY, CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY,
function() function()
return CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY return CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY
end, end,
function(value) function(value)
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY = value CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY = value
CzechQuestsAddon:UpdateTranslationSpeechFrameSettings()
end end
) )
Settings.CreateDropdown(optionsFrame, textFontFamilyDropdown, GetFontOptions) Settings.CreateDropdown(category, 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 -- Add slider for change secondary header font size
local textFontSizeSlider = Settings.RegisterProxySetting( local textFontSizeSlider = Settings.RegisterProxySetting(
optionsFrame, category,
"CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE", "CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE",
type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE), type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE),
"Velikost textu", "Velikost textu *",
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE, CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE,
function() function()
return CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE return CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE
end, end,
function(value) function(value)
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE = value CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE = value
CzechQuestsAddon:UpdateTranslationSpeechFrameSettings()
end end
) )
local textFontSizeSliderOptions = Settings.CreateSliderOptions(8, 30, 1) local textFontSizeSliderOptions = Settings.CreateSliderOptions(8, 30, 1)
textFontSizeSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right); textFontSizeSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
Settings.CreateSlider(optionsFrame, textFontSizeSlider, textFontSizeSliderOptions) Settings.CreateSlider(category, textFontSizeSlider, textFontSizeSliderOptions)
-- Add slider for change secondary header font size -- Add slider for change frame width
local windowWidthSizeSlider = Settings.RegisterProxySetting( local windowWidthSizeSlider = Settings.RegisterProxySetting(
optionsFrame, category,
"CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_WIDTH", "CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_WIDTH",
type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH), type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH),
"Šírka zpráva", "Šírka zprávy",
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH, CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH,
function() function()
return CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH return CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH
end, end,
function(value) function(value)
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH = value CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH = value
CzechQuestsAddon:UpdateTranslationSpeechFrameSettings() CzechQuestsAddon.translationSpeechFrame:SetWidth(
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH
)
CzechQuestsAddon.translationSpeechFrame.content:SetWidth(
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH
)
end end
) )
local windowWidthSizeSliderOption = Settings.CreateSliderOptions(200, 800, 10) local windowWidthSizeSliderOption = Settings.CreateSliderOptions(200, 800, 10)
windowWidthSizeSliderOption:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right); windowWidthSizeSliderOption:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
Settings.CreateSlider(optionsFrame, windowWidthSizeSlider, windowWidthSizeSliderOption) Settings.CreateSlider(category, windowWidthSizeSlider, windowWidthSizeSliderOption)
local initializer= CreateSettingsButtonInitializer(
'Resetovat pozici okna',
'RESET',
function()
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_POSITION = { x = 0, y = 0}
CzechQuestsAddon.translationSpeechFrame:ClearAllPoints()
CzechQuestsAddon.translationSpeechFrame:SetPoint(
"CENTER", UIParent, "CENTER",
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_POSITION.x,
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_POSITION.y
)
end,
nil,
"Resetovat pozici okna"
)
layout:AddInitializer(initializer)
end end

View file

@ -100,6 +100,10 @@ function CzechQuestsAddon:SetTranslationQuestFrameTextureFromSettings(frame)
frame.secondaryText:SetTextColor(255, 255, 255, 1) frame.secondaryText:SetTextColor(255, 255, 255, 1)
end end
end end
if not CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA_ONLY_MOVING then
frame.texture:SetAlpha(CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXTURE_ALPHA / 100)
end
end end
function CzechQuestsAddon:UpdateTranslationQuestFrameFontSettings() function CzechQuestsAddon:UpdateTranslationQuestFrameFontSettings()
@ -129,10 +133,6 @@ function CzechQuestsAddon:UpdateTranslationQuestFrameFontSettings()
end end
function CzechQuestsAddon:ShowTranslationQuestFrame(primaryHeader, primaryText, secondaryHeader, secondaryText, parentFrame, yOffset, xOffset) 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 -- when user change own setting, does not require reload, just apply it
CzechQuestsAddon:SetTranslationQuestFrameTextureFromSettings(CzechQuestsAddon.translationQuestFrame) CzechQuestsAddon:SetTranslationQuestFrameTextureFromSettings(CzechQuestsAddon.translationQuestFrame)

View file

@ -1,59 +1,96 @@
function CzechQuestsAddon:CreateTranslationSpeechFrame() function CzechQuestsAddon:CreateTranslationSpeechFrame()
local frame = {}; local scroll = {};
-- Speech Translation Frame -- Speech Translation Frame
frame = CreateFrame("Frame", "CzechQuestsTranslationSpeechFrame", UIParant, "BackdropTemplate") scroll = CreateFrame("ScrollFrame", "CzechQuestsTranslationSpeechFrame", UIParent, "MinimalScrollFrameTemplate")
frame:SetSize(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH, 50) scroll:SetSize(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH, 120)
frame:SetPoint("CENTER", UIParent, "CENTER")
-- Make draggable -- Make movable
frame:EnableMouse(true) scroll:SetMovable(true)
frame:SetMovable(true) scroll:EnableMouse(true)
frame:RegisterForDrag("LeftButton") scroll:RegisterForDrag("LeftButton")
frame:SetScript("OnDragStart", function(self) self:StartMoving() end)
frame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
frame:Hide() scroll:SetScript("OnDragStart", function()
scroll:StartMoving()
end)
frame.npcName = frame:CreateFontString("CzechQuestsTranslationSpeechNpcName", "OVERLAY") scroll:SetScript("OnDragStop", function(self)
frame.npcName:SetTextColor(1, 1, 0) scroll:StopMovingOrSizing()
frame.npcName:SetFont( local finalLeft, finalTop = self:GetLeft(), self:GetTop()
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_FAMILY, CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_POSITION = {
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_SIZE, x = finalLeft,
"OUTLINE" y = finalTop
}
end)
-- Hide sidebar
scroll.ScrollBar:Hide()
scroll.ScrollBar.Show = function() end
-- Speech Translation Content Frame
scroll.content = CreateFrame("Frame", nil, scroll)
scroll.content:SetSize(scroll:GetWidth(), 1)
scroll:SetScrollChild(scroll.content)
-- Texture for control color and alpha
scroll.content.texture = scroll.content:CreateTexture(nil, "ARTWORK")
scroll.content.texture:SetTexture("Interface\\Buttons\\WHITE8x8")
scroll.content.texture:SetVertexColor(0, 0, 0, 0.2)
-- Set points to edges
scroll.content.texture:SetPoint("TOPLEFT", scroll.content ,"TOPLEFT", 0, 0)
scroll.content.texture:SetPoint("BOTTOMRIGHT", scroll.content ,"BOTTOMRIGHT", 0, 0)
scroll:SetScript("OnEnter", function()
scroll.content.texture:SetAlpha(0.8)
end)
scroll:SetScript("OnLeave", function()
scroll.content.texture:SetAlpha(0.2)
end)
-- Set position
scroll:ClearAllPoints()
scroll:SetPoint(
"TOPLEFT", UIParent, "TOPLEFT",
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_POSITION.x,
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_POSITION.y
) )
frame.npcName:SetPoint("LEFT", frame, "LEFT", 0, 5)
frame.text = frame:CreateFontString("CzechQuestsTranslationSpeechText", "OVERLAY") scroll:Hide()
frame.text:SetTextColor(1, 1, 1)
frame.text:SetWordWrap(true) scroll.content:SetPoint("BOTTOMLEFT", scroll, "BOTTOMLEFT", 0, 0)
frame.text:SetFont(
return scroll;
end
function CzechQuestsAddon:CreateTranslationSpeechFrameMessage(message)
local frame = {};
-- Create content for messages
frame = CreateFrame("Frame", nil, CzechQuestsAddon.translationSpeechFrame.content)
frame:SetSize(CzechQuestsAddon.translationSpeechFrame.content:GetWidth() - 20, 1)
-- Message
frame.string = frame:CreateFontString(nil, "OVERLAY")
frame.string:SetWidth(frame:GetWidth())
frame.string:SetTextColor(1, 1, 1)
frame.string:SetWordWrap(true)
frame.string:SetPoint("TOPLEFT", frame, "TOPLEFT", 5, -5)
frame.string:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -5, 5)
frame.string:SetJustifyH("LEFT")
frame.string:SetFont(
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY, CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY,
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE, CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE,
"OUTLINE" "OUTLINE"
) )
frame.text:SetTextColor(1, 1, 1)
frame.text:SetWidth(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH) frame.string:SetText(message)
frame.text:SetJustifyH("LEFT")
frame.text:SetJustifyV("TOP") frame:SetHeight(frame.string:GetHeight() + 10)
return frame; return frame;
end 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

BIN
Assets/Icons/Logo.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

View file

@ -26,6 +26,9 @@ local function OnEvent(self, event, addonName, ...)
end end
-- Quests -- Quests
if CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_ENABLED == nil then
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_ENABLED = true;
end
if not CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_DARK_MODE then if not CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_DARK_MODE then
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_DARK_MODE = false; CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_DARK_MODE = false;
end end
@ -47,16 +50,16 @@ local function OnEvent(self, event, addonName, ...)
if not CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA then if not CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA then
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA = 80; CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA = 80;
end end
if CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA_ONLY_MOVING == nil then
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA_ONLY_MOVING = true;
end
-- Speech -- Speech
if not CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_SIZE then if CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_ENABLED == nil then
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_NPC_FONT_SIZE = 14; CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_ENABLED = true;
end end
if not CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE then if not CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE then
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE = 12; CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE = 15;
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 end
if not CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY then if not CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY then
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY = 'frizquadratatt_cz.ttf'; CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_FAMILY = 'frizquadratatt_cz.ttf';
@ -65,7 +68,7 @@ local function OnEvent(self, event, addonName, ...)
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH = 320; CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH = 320;
end end
if not CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_POSITION then if not CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_POSITION then
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_POSITION = "0,0"; CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_POSITION = { x = 0, y = 0}
end end
-- Initialize settings -- Initialize settings

View file

@ -1,9 +1,11 @@
## Interface: 110007 ## Interface: 110100
## Title: CzechQuests ## Title: CzechQuests
## Notes: Addon displays texts of quests in Czech language as tooltip ## Notes: Addon displays texts of quests in Czech language as tooltip
## Author: Roman Jaroš ## Author: Roman Jaroš
## Version: 0.2.10 ## Version: 0.2.11
## SavedVariables: CzechQuestsAddon_Store ## SavedVariables: CzechQuestsAddon_Store
## Category: Quests
## IconTexture: Interface\AddOns\CzechQuests\Assets\Icons\Logo
CzechQuests.lua CzechQuests.lua
@ -19,5 +21,8 @@ Addon/Frames/TranslationQuestFrame.lua
Addon/Frames/TranslationSpeechFrame.lua Addon/Frames/TranslationSpeechFrame.lua
Addon/Frames/Settings/OptionsFrame.lua Addon/Frames/Settings/OptionsFrame.lua
Addon/Utils.lua Addon/Code/DataApi.lua
Addon/Code/QuestParser.lua
Addon/Code/Quest.lua
Addon/Code/Speeches.lua
Addon/Addon.lua Addon/Addon.lua

View file

@ -23,5 +23,8 @@ Addon/Frames/TranslationQuestFrame.lua
Addon/Frames/TranslationSpeechFrame.lua Addon/Frames/TranslationSpeechFrame.lua
Addon/Frames/Settings/OptionsFrame.lua Addon/Frames/Settings/OptionsFrame.lua
Addon/Utils.lua Addon/Code/DataApi.lua
Addon/Code/QuestParser.lua
Addon/Code/Quest.lua
Addon/Code/Speeches.lua
Addon/Addon.lua Addon/Addon.lua

View file

@ -6,11 +6,24 @@ import dotenv from 'dotenv';
dotenv.config({ path: '.env' }).parsed; dotenv.config({ path: '.env' }).parsed;
const normalizeTranslation = (translation: string | null | undefined) => {
if (translation == null) {
return '';
}
return translation.replace(/\n/g, '\\n').replace(/"/g, "'");
};
const prepareLuaWithFemaleVersion = (quest: Quest, type: keyof Quest, key: string) => { const prepareLuaWithFemaleVersion = (quest: Quest, type: keyof Quest, key: string) => {
let text = ''; let text = '';
const value = quest[type] as string; const value = quest[type] as string;
text += '\t' + key + 'Male = "' + (value?.[0]?.replace(/\n/g, '\\n') ?? '').replace(/"/g, "'") + '", \n'; const normalizedMaleValue = normalizeTranslation(value?.[0]);
text += '\t' + key + 'Female = "' + (value?.[1]?.replace(/\n/g, '\\n') ?? '').replace(/"/g, "'") + '", \n'; const normalizedFemaleValue = normalizeTranslation(value?.[1]);
if (normalizedMaleValue != '') {
text += '\t' + key + 'Male = "' + normalizedMaleValue + '", \n';
}
if (normalizedFemaleValue != '') {
text += '\t' + key + 'Female = "' + normalizedFemaleValue + '", \n';
}
return text; return text;
}; };
@ -53,7 +66,7 @@ function makeChunks(input: AddonData, chunkSize: number = 1000) {
(async () => { (async () => {
const args = process.argv.slice(2); const args = process.argv.slice(2);
const addonDir = path.join(process.cwd(), `../Quests/Data/${args[0]}`); const addonDir = path.join(process.cwd(), `../Addon/Data/${args[0]}`);
const addonData: Record<string, Quest> = {}; const addonData: Record<string, Quest> = {};
let pageNumber = 0; let pageNumber = 0;
@ -63,7 +76,7 @@ function makeChunks(input: AddonData, chunkSize: number = 1000) {
while (true) { while (true) {
const response = await callTolgee<TolgeeTranslationsResponse>('GET', `/translations`, { const response = await callTolgee<TolgeeTranslationsResponse>('GET', `/translations`, {
filterTranslatedInLang: 'cs', filterTranslatedInLang: 'cs',
languages: 'cs,csf', languages: 'cs,csf,en',
size: 2000, size: 2000,
page: pageNumber, page: pageNumber,
}); });
@ -97,6 +110,7 @@ function makeChunks(input: AddonData, chunkSize: number = 1000) {
tolgeeKey.translations.cs.text === tolgeeKey.translations.csf.text tolgeeKey.translations.cs.text === tolgeeKey.translations.csf.text
? null ? null
: tolgeeKey.translations.csf.text, : tolgeeKey.translations.csf.text,
tolgeeKey.translations.en.text,
], ],
}), }),
...(tolgeeKey.keyNamespace === 'progress' && { ...(tolgeeKey.keyNamespace === 'progress' && {
@ -117,7 +131,9 @@ function makeChunks(input: AddonData, chunkSize: number = 1000) {
}), }),
name: tolgeeKey.keyDescription, name: tolgeeKey.keyDescription,
id: tolgeeKey.keyName.replace('q', '').replace('i', ''), id: tolgeeKey.keyName.replace('q', '').replace('i', ''),
questItem: tolgeeKey.keyName.startsWith('i'), isQuest: tolgeeKey.keyName.startsWith('q'),
isQuestItem: tolgeeKey.keyName.startsWith('i'),
isSpeech: tolgeeKey.keyName.startsWith('s'),
}; };
} }
} else { } else {
@ -136,18 +152,9 @@ function makeChunks(input: AddonData, chunkSize: number = 1000) {
} catch (e) {} } catch (e) {}
for (const [, czechQuest] of Object.entries(chunk)) { for (const [, czechQuest] of Object.entries(chunk)) {
// prepare variables // prepare variables
let variableTable = 'quest'; if (czechQuest.isQuest) {
let variableId = czechQuest.id;
// if quest is quest item witch pages, store it inside item table
if (czechQuest.questItem) {
variableTable = 'item';
const page = czechQuest.id.split('_page')?.[1] ?? null;
variableId = `"${czechQuest.name}${page ? `__${page}` : ''}"`;
}
let luaQuestRecord = ''; let luaQuestRecord = '';
luaQuestRecord += `CzechQuestsAddon.data.${variableTable}[${variableId}] = {\n`; luaQuestRecord += `CzechQuestsAddon.data.quest[${czechQuest.id}] = {\n`;
luaQuestRecord += prepareLuaWithFemaleVersion(czechQuest, 'names', 'title'); luaQuestRecord += prepareLuaWithFemaleVersion(czechQuest, 'names', 'title');
luaQuestRecord += prepareLuaWithFemaleVersion(czechQuest, 'objectives', 'objective'); luaQuestRecord += prepareLuaWithFemaleVersion(czechQuest, 'objectives', 'objective');
luaQuestRecord += prepareLuaWithFemaleVersion(czechQuest, 'descriptions', 'description'); luaQuestRecord += prepareLuaWithFemaleVersion(czechQuest, 'descriptions', 'description');
@ -156,6 +163,26 @@ function makeChunks(input: AddonData, chunkSize: number = 1000) {
luaQuestRecord += `}\n`; luaQuestRecord += `}\n`;
fs.appendFileSync(fileName, luaQuestRecord, 'utf8'); fs.appendFileSync(fileName, luaQuestRecord, 'utf8');
} }
if (czechQuest.isQuestItem) {
const page = czechQuest.id.split('_page')?.[1] ?? null;
const variableId = `"${czechQuest.name}${page ? `__${page}` : ''}"`;
let luaQuestRecord = '';
luaQuestRecord += `CzechQuestsAddon.data.item[${variableId}] = {\n`;
luaQuestRecord += '\ttitle = "' + normalizeTranslation(czechQuest.name) + '", \n';
luaQuestRecord += '\ttext = "' + normalizeTranslation(czechQuest.descriptions?.[0]) + '", \n';
luaQuestRecord += `}\n`;
fs.appendFileSync(fileName, luaQuestRecord, 'utf8');
}
if (czechQuest.isSpeech) {
let luaQuestRecord = '';
luaQuestRecord += `CzechQuestsAddon.data.item["${czechQuest.descriptions?.[2]}"] = {\n`;
luaQuestRecord += '\ttext = "' + normalizeTranslation(czechQuest.descriptions?.[0]) + '", \n';
luaQuestRecord += `}\n`;
fs.appendFileSync(fileName, luaQuestRecord, 'utf8');
}
}
}); });
} catch (e) { } catch (e) {
throw e; throw e;
@ -176,7 +203,9 @@ type Quest = {
completions?: (string | null)[]; completions?: (string | null)[];
objective?: string; objective?: string;
objectives?: (string | null)[]; objectives?: (string | null)[];
questItem: boolean; isQuest: boolean;
isQuestItem: boolean;
isSpeech: boolean;
}; };
type TolgeeKeysData = { type TolgeeKeysData = {

View file

@ -11,9 +11,15 @@ importers:
axios: axios:
specifier: ^1.7.2 specifier: ^1.7.2
version: 1.7.9 version: 1.7.9
diff:
specifier: ^7.0.0
version: 7.0.0
dotenv: dotenv:
specifier: ^16.4.5 specifier: ^16.4.5
version: 16.4.7 version: 16.4.7
pg:
specifier: ^8.13.3
version: 8.13.3
typescript: typescript:
specifier: 5.4.2 specifier: 5.4.2
version: 5.4.2 version: 5.4.2
@ -89,6 +95,10 @@ packages:
resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==}
engines: {node: '>=0.3.1'} engines: {node: '>=0.3.1'}
diff@7.0.0:
resolution: {integrity: sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==}
engines: {node: '>=0.3.1'}
dotenv@16.4.7: dotenv@16.4.7:
resolution: {integrity: sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==} resolution: {integrity: sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==}
engines: {node: '>=12'} engines: {node: '>=12'}
@ -117,6 +127,56 @@ packages:
resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
engines: {node: '>= 0.6'} engines: {node: '>= 0.6'}
pg-cloudflare@1.1.1:
resolution: {integrity: sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q==}
pg-connection-string@2.7.0:
resolution: {integrity: sha512-PI2W9mv53rXJQEOb8xNR8lH7Hr+EKa6oJa38zsK0S/ky2er16ios1wLKhZyxzD7jUReiWokc9WK5nxSnC7W1TA==}
pg-int8@1.0.1:
resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==}
engines: {node: '>=4.0.0'}
pg-pool@3.7.1:
resolution: {integrity: sha512-xIOsFoh7Vdhojas6q3596mXFsR8nwBQBXX5JiV7p9buEVAGqYL4yFzclON5P9vFrpu1u7Zwl2oriyDa89n0wbw==}
peerDependencies:
pg: '>=8.0'
pg-protocol@1.7.1:
resolution: {integrity: sha512-gjTHWGYWsEgy9MsY0Gp6ZJxV24IjDqdpTW7Eh0x+WfJLFsm/TJx1MzL6T0D88mBvkpxotCQ6TwW6N+Kko7lhgQ==}
pg-types@2.2.0:
resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==}
engines: {node: '>=4'}
pg@8.13.3:
resolution: {integrity: sha512-P6tPt9jXbL9HVu/SSRERNYaYG++MjnscnegFh9pPHihfoBSujsrka0hyuymMzeJKFWrcG8wvCKy8rCe8e5nDUQ==}
engines: {node: '>= 8.0.0'}
peerDependencies:
pg-native: '>=3.0.1'
peerDependenciesMeta:
pg-native:
optional: true
pgpass@1.0.5:
resolution: {integrity: sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==}
postgres-array@2.0.0:
resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==}
engines: {node: '>=4'}
postgres-bytea@1.0.0:
resolution: {integrity: sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==}
engines: {node: '>=0.10.0'}
postgres-date@1.0.7:
resolution: {integrity: sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==}
engines: {node: '>=0.10.0'}
postgres-interval@1.2.0:
resolution: {integrity: sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==}
engines: {node: '>=0.10.0'}
prettier@3.2.5: prettier@3.2.5:
resolution: {integrity: sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==} resolution: {integrity: sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==}
engines: {node: '>=14'} engines: {node: '>=14'}
@ -125,6 +185,10 @@ packages:
proxy-from-env@1.1.0: proxy-from-env@1.1.0:
resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==}
split2@4.2.0:
resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==}
engines: {node: '>= 10.x'}
ts-node@10.9.2: ts-node@10.9.2:
resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==}
hasBin: true hasBin: true
@ -150,6 +214,10 @@ packages:
v8-compile-cache-lib@3.0.1: v8-compile-cache-lib@3.0.1:
resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==}
xtend@4.0.2:
resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==}
engines: {node: '>=0.4'}
yn@3.1.1: yn@3.1.1:
resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==}
engines: {node: '>=6'} engines: {node: '>=6'}
@ -209,6 +277,8 @@ snapshots:
diff@4.0.2: {} diff@4.0.2: {}
diff@7.0.0: {}
dotenv@16.4.7: {} dotenv@16.4.7: {}
follow-redirects@1.15.9: {} follow-redirects@1.15.9: {}
@ -227,10 +297,57 @@ snapshots:
dependencies: dependencies:
mime-db: 1.52.0 mime-db: 1.52.0
pg-cloudflare@1.1.1:
optional: true
pg-connection-string@2.7.0: {}
pg-int8@1.0.1: {}
pg-pool@3.7.1(pg@8.13.3):
dependencies:
pg: 8.13.3
pg-protocol@1.7.1: {}
pg-types@2.2.0:
dependencies:
pg-int8: 1.0.1
postgres-array: 2.0.0
postgres-bytea: 1.0.0
postgres-date: 1.0.7
postgres-interval: 1.2.0
pg@8.13.3:
dependencies:
pg-connection-string: 2.7.0
pg-pool: 3.7.1(pg@8.13.3)
pg-protocol: 1.7.1
pg-types: 2.2.0
pgpass: 1.0.5
optionalDependencies:
pg-cloudflare: 1.1.1
pgpass@1.0.5:
dependencies:
split2: 4.2.0
postgres-array@2.0.0: {}
postgres-bytea@1.0.0: {}
postgres-date@1.0.7: {}
postgres-interval@1.2.0:
dependencies:
xtend: 4.0.2
prettier@3.2.5: {} prettier@3.2.5: {}
proxy-from-env@1.1.0: {} proxy-from-env@1.1.0: {}
split2@4.2.0: {}
ts-node@10.9.2(@types/node@22.10.2)(typescript@5.4.2): ts-node@10.9.2(@types/node@22.10.2)(typescript@5.4.2):
dependencies: dependencies:
'@cspotcode/source-map-support': 0.8.1 '@cspotcode/source-map-support': 0.8.1
@ -255,4 +372,6 @@ snapshots:
v8-compile-cache-lib@3.0.1: {} v8-compile-cache-lib@3.0.1: {}
xtend@4.0.2: {}
yn@3.1.1: {} yn@3.1.1: {}

View file

@ -41,18 +41,18 @@ make_zip() {
# prepare output directory # prepare output directory
mkdir -p $output_directory mkdir -p $output_directory
mkdir -p "${output_directory}/Quests/Data/" mkdir -p "${output_directory}/Addon/Data/"
# Includes classic era continents # Includes classic era continents
if [ "$wow_version" = "1" ]; then if [ "$wow_version" = "1" ]; then
cp -r "./Quests/Data/classic_era/" "${output_directory}/Quests/Data/" cp -r "./Addon/Data/classic_era/" "${output_directory}/Addon/Data/"
cp "./CzechQuests_Vanilla.toc" "${output_directory}" cp "./CzechQuests_Vanilla.toc" "${output_directory}"
zip_filename="czech-quests-classic_era-v$current_version.zip" zip_filename="czech-quests-classic_era-v$current_version.zip"
fi fi
# Includes retail continents # Includes retail continents
if [ "$wow_version" = "2" ]; then if [ "$wow_version" = "2" ]; then
cp -r "./Quests/Data/retail/" "${output_directory}/Quests/Data/" cp -r "./Addon/Data/retail/" "${output_directory}/Addon/Data/"
cp "./CzechQuests_Mainline.toc" "${output_directory}" cp "./CzechQuests_Mainline.toc" "${output_directory}"
zip_filename="czech-quests-retail-v$current_version.zip" zip_filename="czech-quests-retail-v$current_version.zip"
fi fi
@ -60,15 +60,15 @@ make_zip() {
# includes frames # includes frames
while IFS= read -r line; do while IFS= read -r line; do
files_to_zip+=("$line") files_to_zip+=("$line")
done < <(find . -name "*.lua" -path "./Quests/Frames/*") done < <(find . -name "*.lua" -path "./Addon/Frames/*")
# includes frames # includes frames
while IFS= read -r line; do while IFS= read -r line; do
files_to_zip+=("$line") files_to_zip+=("$line")
done < <(find . -name "*.ttf" -path "./Fonts/*") done < <(find . -name "*.ttf" -path "./Assets/*")
# includes other files # includes other files
files_to_zip+=("./Quests/Data/other.lua" "./Quests/Quests.lua" "./Quests/Utils.lua" "./CzechQuests.lua") files_to_zip+=("./Addon/Data/other.lua" "./Addon/Addon.lua" "./Addon/Translation.lua" "./Addon/Utils.lua" "./CzechQuests.lua")
# prepare output directory # prepare output directory
for file in "${files_to_zip[@]}"; do for file in "${files_to_zip[@]}"; do

View file

@ -2,12 +2,12 @@
src_folder="." src_folder="."
#wow_source_folder="retail" wow_source_folder="retail"
#wow_destiny_folder="retail" wow_destiny_folder="retail"
#wow_destiny_folder="beta" #wow_destiny_folder="beta"
wow_source_folder="classic_era" #wow_source_folder="classic_era"
wow_destiny_folder="classic_era" #wow_destiny_folder="classic_era"
# CLASSIC ERA # CLASSIC ERA
dest_folder="/Applications/World of Warcraft/_${wow_destiny_folder}_/Interface/AddOns/CzechQuests" dest_folder="/Applications/World of Warcraft/_${wow_destiny_folder}_/Interface/AddOns/CzechQuests"
@ -17,4 +17,3 @@ fswatch -o "$src_folder" | while read -r change; do
rsync -au --delete "$src_folder/Addon/Data/$wow_source_folder/" "$dest_folder/Addon/Data/" 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/" cp "$src_folder/Addon/Data/other.lua" "$dest_folder/Addon/Data/"
done done