Refactor whole addon to follow best practices
This commit is contained in:
parent
43fc252902
commit
414aef6924
31 changed files with 7843 additions and 29579 deletions
|
@ -1,73 +0,0 @@
|
|||
local function SetHoverScripts(frame)
|
||||
frame:SetScript("OnEnter", function()
|
||||
CzechQuestsAddon:ShowQuestTranslation()
|
||||
end)
|
||||
|
||||
frame:SetScript("OnLeave", function()
|
||||
CzechQuestsAddon.translationQuestFrame:Hide()
|
||||
end)
|
||||
end
|
||||
|
||||
function CzechQuestsAddon:InitializeTranslations()
|
||||
-- Activate Quest translations
|
||||
if CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_ENABLED then
|
||||
CzechQuestsAddon.translationQuestFrame = CzechQuestsAddon:CreateTranslationQuestFrame()
|
||||
|
||||
CzechQuestsAddon.translationQuestFrame:RegisterEvent("PLAYER_LOGIN")
|
||||
CzechQuestsAddon.translationQuestFrame:RegisterEvent("QUEST_PROGRESS")
|
||||
CzechQuestsAddon.translationQuestFrame:RegisterEvent("QUEST_COMPLETE")
|
||||
CzechQuestsAddon.translationQuestFrame:RegisterEvent("QUEST_FINISHED")
|
||||
CzechQuestsAddon.translationQuestFrame:RegisterEvent("QUEST_DETAIL")
|
||||
CzechQuestsAddon.translationQuestFrame:RegisterEvent("ITEM_TEXT_READY")
|
||||
CzechQuestsAddon.translationQuestFrame:RegisterEvent("PLAYER_STARTED_MOVING")
|
||||
CzechQuestsAddon.translationQuestFrame:RegisterEvent("PLAYER_STOPPED_MOVING")
|
||||
|
||||
CzechQuestsAddon.translationQuestFrame:SetScript("OnEvent", function(self, event)
|
||||
if event == "PLAYER_LOGIN" then
|
||||
-- classic
|
||||
if QuestLogFrame then
|
||||
SetHoverScripts(QuestLogFrame)
|
||||
end
|
||||
-- retail
|
||||
if QuestMapDetailsScrollFrame then
|
||||
SetHoverScripts(QuestMapDetailsScrollFrame)
|
||||
end
|
||||
end
|
||||
|
||||
if event == "QUEST_PROGRESS" or event == "QUEST_COMPLETE" or event == "QUEST_DETAIL" or event == "QUEST_FINISHED" then
|
||||
CzechQuestsAddon:ShowQuestTranslation(event)
|
||||
end
|
||||
|
||||
if (event == "ITEM_TEXT_READY") then
|
||||
CzechQuestsAddon:ShowQuestItemTranslation()
|
||||
end
|
||||
|
||||
if CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA_ONLY_MOVING then
|
||||
if event == "PLAYER_STARTED_MOVING" then
|
||||
CzechQuestsAddon.translationQuestFrame.texture:SetAlpha(
|
||||
CzechQuestsAddon_Store.config.TRANSLATION_QUEST_FRAME_TEXTURE_ALPHA / 100
|
||||
)
|
||||
elseif event == "PLAYER_STOPPED_MOVING" then
|
||||
CzechQuestsAddon.translationQuestFrame.texture:SetAlpha(1)
|
||||
end
|
||||
end
|
||||
|
||||
end)
|
||||
end
|
||||
|
||||
-- Activate Speech translations
|
||||
if CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_ENABLED then
|
||||
CzechQuestsAddon.translationSpeechFrame = CzechQuestsAddon:CreateTranslationSpeechFrame()
|
||||
|
||||
CzechQuestsAddon.translationSpeechFrame:RegisterEvent("CHAT_MSG_MONSTER_SAY")
|
||||
CzechQuestsAddon.translationSpeechFrame:RegisterEvent("CHAT_MSG_MONSTER_YELL")
|
||||
CzechQuestsAddon.translationSpeechFrame:RegisterEvent("CHAT_MSG_MONSTER_EMOTE")
|
||||
CzechQuestsAddon.translationSpeechFrame:RegisterEvent("CHAT_MSG_MONSTER_PARTY")
|
||||
CzechQuestsAddon.translationSpeechFrame:RegisterEvent("CHAT_MSG_MONSTER_WHISPER")
|
||||
|
||||
CzechQuestsAddon.translationSpeechFrame:SetScript("OnEvent", function(self, event, message, sender)
|
||||
CzechQuestsAddon:ShowSpeechTranslation(sender, message)
|
||||
end)
|
||||
end
|
||||
|
||||
end
|
|
@ -1,149 +1,23 @@
|
|||
local QuestTextMethod = {
|
||||
Description = GetQuestText,
|
||||
Objective = GetObjectiveText,
|
||||
};
|
||||
|
||||
local function GetQuestText(method)
|
||||
local text = QuestTextMethod[method]();
|
||||
if text then
|
||||
return text
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
local function GetQuestLogQuestIndex(questID)
|
||||
local numEntries = C_QuestLog.GetNumQuestLogEntries()
|
||||
for questLogIndex = 1, numEntries do
|
||||
local info = C_QuestLog.GetInfo(questLogIndex)
|
||||
if info and info.questID == questID then
|
||||
return questLogIndex
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
local function ApplyQuestPlaceholders(text)
|
||||
if text == nil then
|
||||
return text
|
||||
end
|
||||
|
||||
local playerName = UnitName("player")
|
||||
local _, playerClass = UnitClass("player")
|
||||
local _, playerRace = UnitRace("player")
|
||||
|
||||
local class = CzechQuestsAddon:GetData("class", playerClass);
|
||||
local race = CzechQuestsAddon:GetData("race", playerRace);
|
||||
|
||||
local formatted = text;
|
||||
formatted = string.gsub(formatted, '<name>', playerName);
|
||||
|
||||
formatted = string.gsub(formatted, '<cF0>', class.f0);
|
||||
formatted = string.gsub(formatted, '<cF1>', class.f1);
|
||||
formatted = string.gsub(formatted, '<cF2>', class.f2);
|
||||
formatted = string.gsub(formatted, '<cF3>', class.f3);
|
||||
formatted = string.gsub(formatted, '<cF4>', class.f4);
|
||||
formatted = string.gsub(formatted, '<cF5>', class.f5);
|
||||
|
||||
formatted = string.gsub(formatted, '<cM0>', class.m0);
|
||||
formatted = string.gsub(formatted, '<cM1>', class.m1);
|
||||
formatted = string.gsub(formatted, '<cM2>', class.m2);
|
||||
formatted = string.gsub(formatted, '<cM3>', class.m3);
|
||||
formatted = string.gsub(formatted, '<cM4>', class.m4);
|
||||
|
||||
formatted = string.gsub(formatted, '<cP0>', class.p0);
|
||||
formatted = string.gsub(formatted, '<cP1>', class.p1);
|
||||
formatted = string.gsub(formatted, '<cP3>', class.m3);
|
||||
|
||||
formatted = string.gsub(formatted, '<rF0>', race.f0);
|
||||
formatted = string.gsub(formatted, '<rF1>', race.f1);
|
||||
formatted = string.gsub(formatted, '<rF2>', race.f2);
|
||||
formatted = string.gsub(formatted, '<rF3>', race.f3);
|
||||
formatted = string.gsub(formatted, '<rF4>', race.f4);
|
||||
formatted = string.gsub(formatted, '<rF5>', race.f5);
|
||||
|
||||
formatted = string.gsub(formatted, '<rM0>', race.m0);
|
||||
formatted = string.gsub(formatted, '<rM1>', race.m1);
|
||||
formatted = string.gsub(formatted, '<rM2>', race.m2);
|
||||
formatted = string.gsub(formatted, '<rM3>', race.m3);
|
||||
formatted = string.gsub(formatted, '<rM4>', race.m4);
|
||||
|
||||
formatted = string.gsub(formatted, '<rP0>', race.p0);
|
||||
formatted = string.gsub(formatted, '<rP1>', race.p1);
|
||||
formatted = string.gsub(formatted, '<rP3>', race.p3);
|
||||
|
||||
return formatted
|
||||
end
|
||||
|
||||
local function TransformQuestText(text)
|
||||
return ApplyQuestPlaceholders(text)
|
||||
end
|
||||
local _, addon = ...
|
||||
|
||||
local function ResolveGender(maleVersion, femaleVersion)
|
||||
local gender = UnitSex("player")
|
||||
if gender == 2 then
|
||||
return TransformQuestText(maleVersion)
|
||||
return maleVersion
|
||||
else
|
||||
return femaleVersion == nil and TransformQuestText(maleVersion) or TransformQuestText(femaleVersion)
|
||||
return femaleVersion == nil and maleVersion or femaleVersion
|
||||
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
|
||||
|
||||
|
||||
local function ApplySpeechPlaceholders(text)
|
||||
if text == nil then
|
||||
return text
|
||||
end
|
||||
|
||||
local playerName = UnitName("player")
|
||||
|
||||
local formatted = text;
|
||||
formatted = string.gsub(formatted, '<name>', playerName);
|
||||
formatted = string.gsub(formatted, 'Champions', playerName);
|
||||
formatted = string.gsub(formatted, 'champions', playerName);
|
||||
|
||||
return formatted
|
||||
end
|
||||
|
||||
local function GetSpeech(message)
|
||||
local speech = CzechQuestsAddon.data.speech[message];
|
||||
local text = speech and speech.text or nil
|
||||
return ApplySpeechPlaceholders(text)
|
||||
end
|
||||
addon.API.ResolveGender = ResolveGender
|
||||
|
||||
function CzechQuestsAddon:GetData(key, id)
|
||||
if CzechQuestsAddon.data[key] then
|
||||
if addon.data[key] then
|
||||
if key == "quest" then
|
||||
return GetQuest(id)
|
||||
return addon.API.GetQuest(id)
|
||||
elseif key == "speech" then
|
||||
return GetSpeech(id)
|
||||
elseif CzechQuestsAddon.data[key][id] then
|
||||
return CzechQuestsAddon.data[key][id]
|
||||
return addon.API.GetSpeech(id)
|
||||
elseif addon.data[key][id] then
|
||||
return addon.data[key][id]
|
||||
end
|
||||
end
|
||||
return nil
|
||||
|
|
26
Addon/Code/FontUtils.lua
Normal file
26
Addon/Code/FontUtils.lua
Normal file
|
@ -0,0 +1,26 @@
|
|||
local _, addon = ...
|
||||
|
||||
local FontPath = "Interface\\AddOns\\CzechQuests\\Assets\\Fonts\\"
|
||||
|
||||
local TestFont = UIParent:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
|
||||
TestFont:SetPoint("TOP", UIParent, "BOTTOM", 0, -64);
|
||||
|
||||
local function CreateCzechFont(frame, name, size, flags)
|
||||
local font = frame:CreateFontString(nil, "OVERLAY")
|
||||
font:SetTextColor(0, 0, 0, 1)
|
||||
font:SetJustifyH("LEFT")
|
||||
font:SetWidth(frame:GetWidth())
|
||||
font:SetFont(FontPath ..name, size, flags or "")
|
||||
return font
|
||||
end
|
||||
addon.API.CreateCzechFont = CreateCzechFont
|
||||
|
||||
local function GetFontContainer()
|
||||
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
|
||||
addon.API.GetFontContainer = GetFontContainer
|
152
Addon/Code/Options.lua
Normal file
152
Addon/Code/Options.lua
Normal file
|
@ -0,0 +1,152 @@
|
|||
local _, addon = ...
|
||||
|
||||
local Options = {}
|
||||
addon.Options = Options
|
||||
|
||||
local function RegisterAddOnSettings(name, title)
|
||||
return Settings.RegisterAddOnSetting(
|
||||
Options.category,
|
||||
"CzechQuestsAddon__" .. name,
|
||||
name,
|
||||
CzechQuestsAddon_Store.config,
|
||||
type(CzechQuestsAddon_Store.config[name]),
|
||||
title,
|
||||
CzechQuestsAddon_Store.config[name]
|
||||
)
|
||||
end
|
||||
|
||||
local function RegisterProxySettings(name, title, setter)
|
||||
return Settings.RegisterProxySetting(
|
||||
Options.category,
|
||||
"CzechQuestsAddon__" .. name,
|
||||
type(CzechQuestsAddon_Store.config[name]),
|
||||
title,
|
||||
CzechQuestsAddon_Store.config[name],
|
||||
function()
|
||||
return CzechQuestsAddon_Store.config[name]
|
||||
end,
|
||||
setter
|
||||
)
|
||||
end
|
||||
|
||||
local function CreateCheckbox(name, title)
|
||||
Settings.CreateCheckbox(
|
||||
Options.category,
|
||||
RegisterAddOnSettings(name, title)
|
||||
)
|
||||
end
|
||||
|
||||
local function CreateDropdown(name, title, items, setter)
|
||||
Settings.CreateDropdown(
|
||||
Options.category,
|
||||
RegisterProxySettings(name, title, setter),
|
||||
items
|
||||
)
|
||||
end
|
||||
|
||||
local function CreateSlider(name, title, min, max, step, setter)
|
||||
local options = Settings.CreateSliderOptions(min, max, step)
|
||||
options:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
|
||||
Settings.CreateSlider(
|
||||
Options.category,
|
||||
RegisterProxySettings(name, title, setter),
|
||||
options
|
||||
)
|
||||
end
|
||||
|
||||
local function CreateButton(title, label, setter)
|
||||
Options.layout:AddInitializer(
|
||||
CreateSettingsButtonInitializer(title, label, setter, nil, title)
|
||||
)
|
||||
end
|
||||
|
||||
local function InitQuests()
|
||||
local function CreateQuestDropdown(name, title, items)
|
||||
CreateDropdown(name, title, items, function (value)
|
||||
CzechQuestsAddon_Store.config[name] = value
|
||||
addon.QuestFrame:UpdateSettings()
|
||||
end)
|
||||
end
|
||||
|
||||
local function CreateQuestSlider(name, title, min, max, step)
|
||||
CreateSlider(name, title, min, max, step, function (value)
|
||||
CzechQuestsAddon_Store.config[name] = value
|
||||
addon.QuestFrame:UpdateSettings()
|
||||
end)
|
||||
end
|
||||
|
||||
local layout = Options.layout
|
||||
layout:AddInitializer(CreateSettingsListSectionHeaderInitializer("Questy"))
|
||||
|
||||
CreateCheckbox("QUEST_ENABLED", "Zapnout")
|
||||
|
||||
if (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) then
|
||||
CreateCheckbox("QUEST_DARK_MODE", "Pouzit tmavy rezim")
|
||||
end
|
||||
|
||||
CreateQuestDropdown("QUEST_HEADER_FONT_NAME", "Pismo nadpisu", addon.API.GetFontContainer)
|
||||
CreateQuestDropdown("QUEST_TEXT_FONT_NAME", "Pismo textu", addon.API.GetFontContainer)
|
||||
|
||||
CreateQuestSlider("QUEST_HEADER_FONT_SIZE", "Velikost nadpisu", 10, 30, 1)
|
||||
CreateQuestSlider("QUEST_TEXT_FONT_SIZE", "Velikost textu", 10, 30, 1)
|
||||
|
||||
CreateSlider("QUEST_TEXTURE_ALPHA", "Pruhlednost pozadi", 10, 100, 10)
|
||||
CreateCheckbox("QUEST_TEXTURE_ALPHA_ONLY_MOVING", "Pruhlednost pouze pri chuzi")
|
||||
end
|
||||
|
||||
local function InitSpeeches()
|
||||
local function CreateSpeechDropdown(name, title, items)
|
||||
CreateDropdown(name, title, items, function (value)
|
||||
CzechQuestsAddon_Store.config[name] = value
|
||||
addon.SpeechFrame:UpdateSettings()
|
||||
end)
|
||||
end
|
||||
|
||||
local function CreateSpeechSlider(name, title, min, max, step)
|
||||
CreateSlider(name, title, min, max, step, function (value)
|
||||
CzechQuestsAddon_Store.config[name] = value
|
||||
addon.SpeechFrame:UpdateSettings()
|
||||
end)
|
||||
end
|
||||
|
||||
local layout = Options.layout
|
||||
layout:AddInitializer(CreateSettingsListSectionHeaderInitializer("Bubliny"))
|
||||
|
||||
CreateCheckbox("SPEECH_ENABLED", "Zapnout")
|
||||
|
||||
CreateSpeechDropdown("SPEECH_TEXT_FONT_NAME", "Pismo *", addon.API.GetFontContainer)
|
||||
CreateSpeechSlider("SPEECH_TEXT_FONT_SIZE", "Velikost pisma *", 10, 30, 1)
|
||||
|
||||
CreateSpeechSlider("SPEECH_FRAME_WIDTH", "Sirka okna", 200, 1000, 10)
|
||||
|
||||
CreateCheckbox("SPEECH_ORIGINAL_WHEN_MISSING", "Original pokud není preklad ")
|
||||
|
||||
CreateButton('Resetovat pozici okna', "RESET", function()
|
||||
CzechQuestsAddon_Store.config.SPEECH_FRAME_POSITION = { x = 0, y = 0}
|
||||
addon.SpeechFrame:SetPoint(
|
||||
"TOPLEFT", UIParent, "TOPLEFT",
|
||||
CzechQuestsAddon_Store.config.SPEECH_FRAME_POSITION.x,
|
||||
CzechQuestsAddon_Store.config.SPEECH_FRAME_POSITION.y
|
||||
)
|
||||
end)
|
||||
end
|
||||
|
||||
local function InitOthers()
|
||||
local layout = Options.layout
|
||||
layout:AddInitializer(CreateSettingsListSectionHeaderInitializer("Ostatni"))
|
||||
|
||||
CreateCheckbox("DEBUG_MODE", "Zapnout DEBUG")
|
||||
end
|
||||
|
||||
local function InitOptions()
|
||||
local category, layout = Settings.RegisterVerticalLayoutCategory("CzechQuests")
|
||||
Options.category = category
|
||||
Options.layout = layout
|
||||
|
||||
InitQuests()
|
||||
InitSpeeches()
|
||||
InitOthers()
|
||||
|
||||
Settings.RegisterAddOnCategory(category)
|
||||
end
|
||||
addon.API.InitOptions = InitOptions
|
|
@ -1,3 +1,5 @@
|
|||
local _, addon = ...
|
||||
|
||||
local function SplitParagraphs(text)
|
||||
local paragraphs = {}
|
||||
for paragraph in string.gmatch(text, "([^\n]+)") do
|
||||
|
@ -17,20 +19,27 @@ local function SplitSentences(paragraph)
|
|||
return sentences
|
||||
end
|
||||
|
||||
function CzechQuestsAddon:TransformIntoParagraphs(original_text, translation_text)
|
||||
local function ParseParagraphs(original_text, translation_text)
|
||||
if original_text == "" or original_text == nil then
|
||||
return translation_text
|
||||
end
|
||||
|
||||
translation_text = string.gsub(translation_text, "(%d+)%.", function(numberPart)
|
||||
local numberWithDot = numberPart .. "."
|
||||
if string.find(original_text, numberWithDot, 1, true) then
|
||||
return numberWithDot
|
||||
else
|
||||
return numberPart
|
||||
end
|
||||
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 = {}
|
||||
|
||||
|
@ -42,10 +51,11 @@ function CzechQuestsAddon:TransformIntoParagraphs(original_text, translation_tex
|
|||
break
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(translation_paragraphs, table.concat(collected, " "))
|
||||
end
|
||||
|
||||
local final_text = table.concat(translation_paragraphs, "\n")
|
||||
|
||||
return final_text
|
||||
end
|
||||
end
|
||||
addon.API.ParseParagraphs = ParseParagraphs
|
202
Addon/Code/Quest.lua
Executable file → Normal file
202
Addon/Code/Quest.lua
Executable file → Normal file
|
@ -1,27 +1,23 @@
|
|||
function CzechQuestsAddon:ShowQuestTranslation(event)
|
||||
-- Hide frame, may contain old texts
|
||||
CzechQuestsAddon.translationQuestFrame:Hide()
|
||||
local _, addon = ...
|
||||
|
||||
local function GetQuestTitle(title, questId)
|
||||
return title .. (CzechQuestsAddon_Store.config.DEBUG_MODE and " (" .. questId .. ")" or "")
|
||||
end
|
||||
|
||||
local function ShowQuestTranslation(event)
|
||||
local frame = addon.QuestFrame
|
||||
frame:Hide()
|
||||
|
||||
-- Classic Era has QuestLogFrame
|
||||
if QuestLogFrame then
|
||||
if QuestLogFrame:IsShown() then
|
||||
if QuestLogFrame:IsVisible() 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()
|
||||
local data = CzechQuestsAddon:GetData("quest", questId)
|
||||
if data then
|
||||
local title = GetQuestTitle(data.title, questId)
|
||||
frame:SetData(title, data.objective, "Popis", data.description, QuestLogFrame, 0, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -32,23 +28,11 @@ function CzechQuestsAddon:ShowQuestTranslation(event)
|
|||
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()
|
||||
local data = CzechQuestsAddon:GetData("quest", questId)
|
||||
if data then
|
||||
local yOffset = hasModel and 210 or 50
|
||||
local title = GetQuestTitle(data.title, questId)
|
||||
frame:SetData(title, data.objective, "Popis", data.description, QuestMapFrame, 0, yOffset)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -56,89 +40,103 @@ function CzechQuestsAddon:ShowQuestTranslation(event)
|
|||
-- If quest is right from NPC, this work for both wow version
|
||||
if event ~= nil then
|
||||
local questId = GetQuestID()
|
||||
if questId == 0 then
|
||||
return
|
||||
end
|
||||
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
|
||||
local data = CzechQuestsAddon:GetData("quest", questId)
|
||||
if data then
|
||||
local title = GetQuestTitle(data.title, questId)
|
||||
local xOffset = hasModel and 210 or 10
|
||||
if event == "QUEST_PROGRESS" then
|
||||
CzechQuestsAddon:ShowTranslationQuestFrame(
|
||||
questTitle,
|
||||
questData.progress,
|
||||
"",
|
||||
"",
|
||||
QuestFrame,
|
||||
-20,
|
||||
xOffset
|
||||
)
|
||||
frame:SetData(title, data.progress, "", "", QuestFrame, -20, xOffset)
|
||||
elseif event == "QUEST_COMPLETE" then
|
||||
CzechQuestsAddon:ShowTranslationQuestFrame(
|
||||
questTitle,
|
||||
questData.completion,
|
||||
"",
|
||||
"",
|
||||
QuestFrame,
|
||||
-20,
|
||||
xOffset
|
||||
)
|
||||
frame:SetData(title, data.completion, "", "", QuestFrame, -20, xOffset)
|
||||
elseif event == "QUEST_DETAIL" then
|
||||
CzechQuestsAddon:ShowTranslationQuestFrame(
|
||||
questTitle,
|
||||
questData.description,
|
||||
"Cíl úkolu",
|
||||
questData.objective,
|
||||
QuestFrame,
|
||||
-20,
|
||||
xOffset
|
||||
)
|
||||
frame:SetData(title, data.description, "Cíl úkolu", data.objective, QuestFrame, -20, xOffset)
|
||||
else
|
||||
CzechQuestsAddon.translationQuestFrame:Hide()
|
||||
frame:Hide()
|
||||
end
|
||||
else
|
||||
CzechQuestsAddon.translationQuestFrame:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function CzechQuestsAddon:ShowQuestItemTranslation()
|
||||
-- Hide frame, may contain old texts
|
||||
CzechQuestsAddon.translationQuestFrame:Hide()
|
||||
local function ShowQuestItemTranslation()
|
||||
local frame = addon.QuestFrame
|
||||
frame:Hide()
|
||||
|
||||
-- should work for both wow version
|
||||
if ItemTextFrame:IsShown() then
|
||||
local item = {}
|
||||
|
||||
-- get item name
|
||||
-- classic and retail has same frame
|
||||
if ItemTextFrame:IsVisible() then
|
||||
local itemName = ItemTextGetItem();
|
||||
local titlePage = CzechQuestsAddon:GetData("item", itemName)
|
||||
|
||||
-- check if item is translated
|
||||
if titlePage ~= nil then
|
||||
item.name = titlePage.titleMale;
|
||||
local itemNameTranslation = CzechQuestsAddon:GetData("item", itemName)
|
||||
if itemNameTranslation then
|
||||
local pageNum = ItemTextGetPage()
|
||||
local contentPage = CzechQuestsAddon:GetData("item", itemName .. '__' .. pageNum)
|
||||
local itemPageContentTranslation = CzechQuestsAddon:GetData("item", itemName .. '__' .. pageNum)
|
||||
if itemPageContentTranslation then
|
||||
frame:SetData(
|
||||
itemNameTranslation.title,
|
||||
itemPageContentTranslation.text,
|
||||
"",
|
||||
"",
|
||||
ItemTextFrame,
|
||||
-20,
|
||||
0
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- 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
|
||||
local function InitQuests()
|
||||
local frame = addon.QuestFrame
|
||||
|
||||
frame:RegisterEvent("PLAYER_LOGIN")
|
||||
frame:RegisterEvent("QUEST_PROGRESS")
|
||||
frame:RegisterEvent("QUEST_COMPLETE")
|
||||
frame:RegisterEvent("QUEST_FINISHED")
|
||||
frame:RegisterEvent("QUEST_DETAIL")
|
||||
frame:RegisterEvent("ITEM_TEXT_READY")
|
||||
frame:RegisterEvent("PLAYER_STARTED_MOVING")
|
||||
frame:RegisterEvent("PLAYER_STOPPED_MOVING")
|
||||
|
||||
frame:SetScript("OnEvent", function(_, event)
|
||||
if not CzechQuestsAddon_Store.config.QUEST_ENABLED then
|
||||
return
|
||||
end
|
||||
|
||||
if event == "PLAYER_LOGIN" then
|
||||
-- classic
|
||||
if QuestLogFrame then
|
||||
QuestLogFrame:SetScript("OnEnter", function() ShowQuestTranslation() end)
|
||||
QuestLogFrame:SetScript("OnLeave", function() frame:Hide() end)
|
||||
end
|
||||
-- retail
|
||||
if QuestMapDetailsScrollFrame then
|
||||
QuestMapDetailsScrollFrame:SetScript("OnEnter", function() ShowQuestTranslation() end)
|
||||
QuestMapDetailsScrollFrame:SetScript("OnLeave", function() frame:Hide() end)
|
||||
end
|
||||
|
||||
frame:Init()
|
||||
end
|
||||
|
||||
if event == "QUEST_PROGRESS" or event == "QUEST_COMPLETE" or event == "QUEST_DETAIL" or event == "QUEST_FINISHED" then
|
||||
ShowQuestTranslation(event)
|
||||
end
|
||||
|
||||
if (event == "ITEM_TEXT_READY") then
|
||||
ShowQuestItemTranslation()
|
||||
end
|
||||
|
||||
if CzechQuestsAddon_Store.config.QUEST_TEXTURE_ALPHA_ONLY_MOVING then
|
||||
if event == "PLAYER_STARTED_MOVING" then
|
||||
frame.Texture:SetAlpha(CzechQuestsAddon_Store.config.QUEST_TEXTURE_ALPHA / 100)
|
||||
elseif event == "PLAYER_STOPPED_MOVING" then
|
||||
frame.Texture:SetAlpha(1)
|
||||
end
|
||||
end
|
||||
|
||||
CzechQuestsAddon.translationQuestFrame:Show()
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
addon.API.InitQuests = InitQuests
|
109
Addon/Code/QuestDataApi.lua
Executable file
109
Addon/Code/QuestDataApi.lua
Executable file
|
@ -0,0 +1,109 @@
|
|||
local _, addon = ...
|
||||
|
||||
local WowQuestTextMethod = {
|
||||
Description = GetQuestText,
|
||||
Objective = GetObjectiveText,
|
||||
};
|
||||
|
||||
local function GetWowQuestText(method)
|
||||
local text = WowQuestTextMethod[method]();
|
||||
if text then
|
||||
return text
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
local function GetQuestLogQuestIndex(questID)
|
||||
local numEntries = C_QuestLog.GetNumQuestLogEntries()
|
||||
for questLogIndex = 1, numEntries do
|
||||
local info = C_QuestLog.GetInfo(questLogIndex)
|
||||
if info and info.questID == questID then
|
||||
return questLogIndex
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
local function FillPlaceholders(text)
|
||||
if text == nil then
|
||||
return text
|
||||
end
|
||||
|
||||
local playerName = UnitName("player")
|
||||
local _, playerClass = UnitClass("player")
|
||||
local _, playerRace = UnitRace("player")
|
||||
|
||||
local class = CzechQuestsAddon:GetData("class", playerClass);
|
||||
local race = CzechQuestsAddon:GetData("race", playerRace);
|
||||
|
||||
local formatted = text;
|
||||
formatted = string.gsub(formatted, '<name>', playerName);
|
||||
|
||||
formatted = string.gsub(formatted, '<cF0>', class.f0);
|
||||
formatted = string.gsub(formatted, '<cF1>', class.f1);
|
||||
formatted = string.gsub(formatted, '<cF2>', class.f2);
|
||||
formatted = string.gsub(formatted, '<cF3>', class.f3);
|
||||
formatted = string.gsub(formatted, '<cF4>', class.f4);
|
||||
formatted = string.gsub(formatted, '<cF5>', class.f5);
|
||||
|
||||
formatted = string.gsub(formatted, '<cM0>', class.m0);
|
||||
formatted = string.gsub(formatted, '<cM1>', class.m1);
|
||||
formatted = string.gsub(formatted, '<cM2>', class.m2);
|
||||
formatted = string.gsub(formatted, '<cM3>', class.m3);
|
||||
formatted = string.gsub(formatted, '<cM4>', class.m4);
|
||||
|
||||
formatted = string.gsub(formatted, '<cP0>', class.p0);
|
||||
formatted = string.gsub(formatted, '<cP1>', class.p1);
|
||||
formatted = string.gsub(formatted, '<cP3>', class.m3);
|
||||
|
||||
formatted = string.gsub(formatted, '<rF0>', race.f0);
|
||||
formatted = string.gsub(formatted, '<rF1>', race.f1);
|
||||
formatted = string.gsub(formatted, '<rF2>', race.f2);
|
||||
formatted = string.gsub(formatted, '<rF3>', race.f3);
|
||||
formatted = string.gsub(formatted, '<rF4>', race.f4);
|
||||
formatted = string.gsub(formatted, '<rF5>', race.f5);
|
||||
|
||||
formatted = string.gsub(formatted, '<rM0>', race.m0);
|
||||
formatted = string.gsub(formatted, '<rM1>', race.m1);
|
||||
formatted = string.gsub(formatted, '<rM2>', race.m2);
|
||||
formatted = string.gsub(formatted, '<rM3>', race.m3);
|
||||
formatted = string.gsub(formatted, '<rM4>', race.m4);
|
||||
|
||||
formatted = string.gsub(formatted, '<rP0>', race.p0);
|
||||
formatted = string.gsub(formatted, '<rP1>', race.p1);
|
||||
formatted = string.gsub(formatted, '<rP3>', race.p3);
|
||||
|
||||
return formatted
|
||||
end
|
||||
|
||||
local function GetQuestText(maleText, femaleText, original)
|
||||
local translation = addon.API.ResolveGender(maleText, femaleText)
|
||||
local paragraphs = addon.API.ParseParagraphs(original, translation)
|
||||
return FillPlaceholders(paragraphs)
|
||||
end
|
||||
|
||||
local function GetQuest(id)
|
||||
local quest = addon.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 = GetWowQuestText("Description")
|
||||
objective = GetWowQuestText("Objective")
|
||||
end
|
||||
|
||||
return {
|
||||
title = GetQuestText(quest.titleMale, quest.titleFemale),
|
||||
objective = GetQuestText(quest.objectiveMale, quest.objectiveFemale, objective),
|
||||
description = GetQuestText(quest.descriptionMale, quest.descriptionFemale, description),
|
||||
progress = GetQuestText(quest.progressMale, quest.progressFemale),
|
||||
completion = GetQuestText(quest.completionMale, quest.completionFemale),
|
||||
}
|
||||
end
|
||||
end
|
||||
addon.API.GetQuest = GetQuest
|
147
Addon/Code/QuestFrame.lua
Executable file
147
Addon/Code/QuestFrame.lua
Executable file
|
@ -0,0 +1,147 @@
|
|||
local _, addon = ...
|
||||
|
||||
local QuestFrame = CreateFrame("Frame", "CzechQuestsQuestFrame", UIParent, "BackdropTemplate")
|
||||
QuestFrame:Hide()
|
||||
|
||||
addon.QuestFrame = QuestFrame
|
||||
|
||||
function QuestFrame:CreateHeader()
|
||||
local font = addon.API.CreateCzechFont(
|
||||
self,
|
||||
CzechQuestsAddon_Store.config.QUEST_HEADER_FONT_NAME,
|
||||
CzechQuestsAddon_Store.config.QUEST_HEADER_FONT_SIZE
|
||||
)
|
||||
font:SetWidth(self:GetWidth() - 20)
|
||||
return font;
|
||||
end
|
||||
|
||||
function QuestFrame:CreateText()
|
||||
local font = addon.API.CreateCzechFont(
|
||||
self,
|
||||
CzechQuestsAddon_Store.config.QUEST_TEXT_FONT_NAME,
|
||||
CzechQuestsAddon_Store.config.QUEST_TEXT_FONT_SIZE
|
||||
)
|
||||
font:SetWidth(self:GetWidth() - 20)
|
||||
return font;
|
||||
end
|
||||
|
||||
function QuestFrame:Init()
|
||||
-- Default style
|
||||
self:SetSize(300, 200)
|
||||
self:SetBackdrop({ edgeFile = "Interface/Tooltips/UI-Tooltip-Border", edgeSize = 8 })
|
||||
|
||||
-- Background Parchment texture
|
||||
self.Texture = self:CreateTexture(nil, "BACKGROUND", nil, -1);
|
||||
self.Texture:SetAllPoints(true)
|
||||
self.Texture:SetHorizTile(true)
|
||||
|
||||
-- Load settings
|
||||
self:UpdateSettings()
|
||||
end
|
||||
|
||||
function QuestFrame:UpdateSettings()
|
||||
self.Title = self:CreateHeader()
|
||||
self.Text1 = self:CreateText()
|
||||
self.Header = self:CreateHeader()
|
||||
self.Text2 = self:CreateText()
|
||||
|
||||
self:ApplyTheme()
|
||||
|
||||
if not CzechQuestsAddon_Store.config.QUEST_TEXTURE_ALPHA_ONLY_MOVING then
|
||||
self.Texture:SetAlpha(CzechQuestsAddon_Store.config.QUEST_TEXTURE_ALPHA / 100)
|
||||
end
|
||||
end
|
||||
|
||||
function QuestFrame:ResetText()
|
||||
self.Title:SetText("")
|
||||
self.Header:SetText("")
|
||||
self.Text1:SetText("")
|
||||
self.Text2:SetText("")
|
||||
end
|
||||
|
||||
function QuestFrame:SetTextColor(r, g, b, a)
|
||||
self.Title:SetTextColor(r, g, b, a)
|
||||
self.Header:SetTextColor(r, g, b, a)
|
||||
self.Text1:SetTextColor(r, g, b, a)
|
||||
self.Text2:SetTextColor(r, g, b, a)
|
||||
end
|
||||
|
||||
function QuestFrame:ApplyTheme()
|
||||
if (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) then
|
||||
self.Texture:SetTexture("Interface/QUESTFRAME/QuestBG");
|
||||
self.Texture:SetTexCoord(0, .58, 0.005, 0.66)
|
||||
self:SetTextColor(0, 0, 0, 1)
|
||||
if not CzechQuestsAddon_Store.config.QUEST_DARK_MODE then
|
||||
self:SetBackdropColor(0, 0, 0, 1)
|
||||
self.Texture:SetColorTexture(0, 0, 0, 1)
|
||||
self:SetTextColor(255, 255, 255, 1)
|
||||
end
|
||||
else
|
||||
self.Texture:SetTexture("Interface/QUESTFRAME/QuestBackgroundParchment");
|
||||
self.Texture:SetTexCoord(0, .01, 0, 0.4)
|
||||
self:SetTextColor(0, 0, 0, 1)
|
||||
local questTextContrast = C_CVar.GetCVar("questTextContrast")
|
||||
if questTextContrast == "1" then -- Brown
|
||||
self.Texture:SetTexCoord(0, .01, .4, .8)
|
||||
elseif questTextContrast == "2" or questTextContrast == "3" then -- Gray
|
||||
self.Texture:SetColorTexture(255, 255, 255, 1)
|
||||
elseif questTextContrast == "4" then -- Black
|
||||
self.Texture:SetColorTexture(0, 0, 0, 1)
|
||||
self:SetTextColor(0, 0, 0, 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function QuestFrame:CalculateHeight()
|
||||
local height = 0;
|
||||
local heights = {
|
||||
self.Title:GetHeight() ,
|
||||
self.Text1:GetHeight(),
|
||||
self.Header:GetHeight(),
|
||||
self.Text2:GetHeight(),
|
||||
10
|
||||
}
|
||||
for _, value in ipairs(heights) do
|
||||
height = height + value + 10
|
||||
end
|
||||
self:SetHeight(height)
|
||||
end
|
||||
|
||||
function QuestFrame:SetData(name, text1, header, text2, parentFrame, yOffset, xOffset)
|
||||
-- Reset previously values
|
||||
self:ResetText()
|
||||
|
||||
-- Set parent
|
||||
self:SetParent(parentFrame)
|
||||
|
||||
-- set text to labels
|
||||
self.Title:SetText(name)
|
||||
self.Text1:SetText(text1)
|
||||
self.Header:SetText(header)
|
||||
self.Text2:SetText(text2)
|
||||
|
||||
-- apply text positions
|
||||
self.Title:SetPoint("TOPLEFT", self, "TOPLEFT", 10, -10)
|
||||
self.Text1:SetPoint("TOPLEFT", self.Title, "BOTTOMLEFT", 0, -5)
|
||||
self.Header:SetPoint("TOPLEFT", self.Text1, "BOTTOMLEFT", 0, -20)
|
||||
self.Text2:SetPoint("TOPLEFT", self.Header, "BOTTOMLEFT", 0, -5)
|
||||
|
||||
-- apply frame position
|
||||
if (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) then
|
||||
self:SetPoint("TOPLEFT", parentFrame, "TOPRIGHT", xOffset, yOffset)
|
||||
else
|
||||
self:SetPoint("TOPLEFT", parentFrame, "TOPRIGHT", xOffset, yOffset)
|
||||
end
|
||||
|
||||
self:Show()
|
||||
|
||||
-- wait for font render before calculate height
|
||||
local height = self.Title:GetStringHeight()
|
||||
if height == 0 then
|
||||
C_Timer.After(0.5, function()
|
||||
self:CalculateHeight()
|
||||
end)
|
||||
else
|
||||
self:CalculateHeight()
|
||||
end
|
||||
end
|
108
Addon/Code/Speech.lua
Executable file
108
Addon/Code/Speech.lua
Executable file
|
@ -0,0 +1,108 @@
|
|||
local _, addon = ...
|
||||
local messages = {}
|
||||
|
||||
local function ReflowMessages()
|
||||
local offsetY = 5
|
||||
for i = #messages, 1, -1 do
|
||||
local Frame = messages[i]
|
||||
Frame:ClearAllPoints()
|
||||
Frame:SetPoint("BOTTOMLEFT", addon.SpeechFrame.ContentFrame, "BOTTOMLEFT", 5, offsetY)
|
||||
Frame:Show()
|
||||
offsetY = offsetY + Frame:GetHeight()
|
||||
end
|
||||
|
||||
if #messages == 0 then
|
||||
addon.SpeechFrame:Hide()
|
||||
end
|
||||
|
||||
-- calculate Content height
|
||||
-- cannot be smaller then SpeechFrame
|
||||
offsetY = offsetY + 5
|
||||
if offsetY < 150 then
|
||||
offsetY = 150
|
||||
end
|
||||
addon.SpeechFrame.ContentFrame:SetHeight(offsetY)
|
||||
|
||||
-- Scroll down
|
||||
addon.SpeechFrame:UpdateScrollChildRect()
|
||||
local maxScroll = addon.SpeechFrame:GetVerticalScrollRange()
|
||||
addon.SpeechFrame:SetVerticalScroll(maxScroll)
|
||||
end
|
||||
|
||||
local function RemoveMessage(frame)
|
||||
for i, fs in ipairs(messages) do
|
||||
if fs == frame then
|
||||
local animation = fs:CreateAnimationGroup()
|
||||
local fadeOut = animation:CreateAnimation("Alpha")
|
||||
fadeOut:SetFromAlpha(1)
|
||||
fadeOut:SetToAlpha(0)
|
||||
fadeOut:SetDuration(1)
|
||||
fadeOut:SetStartDelay(0)
|
||||
animation:SetScript("OnFinished", function()
|
||||
table.remove(messages, i)
|
||||
fs:Hide()
|
||||
ReflowMessages()
|
||||
end)
|
||||
animation:Play()
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function AddMessage(sender, message)
|
||||
local text = string.format("|cffffd200%s|r\n%s", sender, message)
|
||||
local MessageFrame = addon.SpeechFrame.ContentFrame:CreateMessage(text)
|
||||
|
||||
-- put into table and rerender while queue
|
||||
table.insert(messages, MessageFrame)
|
||||
ReflowMessages()
|
||||
|
||||
-- hide after timeout
|
||||
C_Timer.After(20, function()
|
||||
RemoveMessage(MessageFrame)
|
||||
end)
|
||||
end
|
||||
|
||||
local function ShowSpeechTranslation(sender, message)
|
||||
local text = CzechQuestsAddon:GetData("speech", message)
|
||||
if text == nil and CzechQuestsAddon_Store.config.SPEECH_ORIGINAL_WHEN_MISSING then
|
||||
text = message
|
||||
end
|
||||
|
||||
if text ~= nil then
|
||||
addon.SpeechFrame:Show()
|
||||
addon.SpeechFrame.ContentFrame:Show()
|
||||
AddMessage(sender, text)
|
||||
end
|
||||
end
|
||||
|
||||
local function InitSpeeches()
|
||||
local frame = addon.SpeechFrame
|
||||
|
||||
-- Register Speech events
|
||||
frame:RegisterEvent("PLAYER_LOGIN")
|
||||
frame:RegisterEvent("CHAT_MSG_MONSTER_SAY")
|
||||
frame:RegisterEvent("CHAT_MSG_MONSTER_YELL")
|
||||
frame:RegisterEvent("CHAT_MSG_MONSTER_EMOTE")
|
||||
frame:RegisterEvent("CHAT_MSG_MONSTER_PARTY")
|
||||
frame:RegisterEvent("CHAT_MSG_MONSTER_WHISPER")
|
||||
|
||||
frame:SetScript("OnEvent", function(self, event, message, sender)
|
||||
if not CzechQuestsAddon_Store.config.SPEECH_ENABLED then
|
||||
return
|
||||
end
|
||||
|
||||
if event == "PLAYER_LOGIN" then
|
||||
frame:Init()
|
||||
end
|
||||
|
||||
if event == "CHAT_MSG_MONSTER_SAY"
|
||||
or event == "CHAT_MSG_MONSTER_YELL"
|
||||
or event == "CHAT_MSG_MONSTER_EMOTE"
|
||||
or event == "CHAT_MSG_MONSTER_PARTY"
|
||||
or event == "CHAT_MSG_MONSTER_WHISPER" then
|
||||
ShowSpeechTranslation(sender, message)
|
||||
end
|
||||
end)
|
||||
end
|
||||
addon.API.InitSpeeches = InitSpeeches
|
23
Addon/Code/SpeechDataApi.lua
Executable file
23
Addon/Code/SpeechDataApi.lua
Executable file
|
@ -0,0 +1,23 @@
|
|||
local _, addon = ...
|
||||
|
||||
local function FillPlaceholders(text)
|
||||
if text == nil then
|
||||
return text
|
||||
end
|
||||
|
||||
local playerName = UnitName("player")
|
||||
|
||||
local formatted = text;
|
||||
formatted = string.gsub(formatted, '<name>', playerName);
|
||||
formatted = string.gsub(formatted, 'Champions', playerName);
|
||||
formatted = string.gsub(formatted, 'champions', playerName);
|
||||
|
||||
return formatted
|
||||
end
|
||||
|
||||
local function GetSpeech(message)
|
||||
local speech = addon.data.speech[message];
|
||||
local text = speech and speech.text or nil
|
||||
return FillPlaceholders(text)
|
||||
end
|
||||
addon.API.GetSpeech = GetSpeech
|
101
Addon/Code/SpeechFrame.lua
Executable file
101
Addon/Code/SpeechFrame.lua
Executable file
|
@ -0,0 +1,101 @@
|
|||
local _, addon = ...
|
||||
|
||||
local SpeechFrame = CreateFrame("ScrollFrame", "CzechQuestsSpeechFrame", UIParent, "UIPanelScrollFrameTemplate")
|
||||
SpeechFrame:Hide()
|
||||
|
||||
local ContentFrame = CreateFrame("Frame", nil, SpeechFrame)
|
||||
ContentFrame:Hide()
|
||||
|
||||
addon.SpeechFrame = SpeechFrame
|
||||
SpeechFrame.ContentFrame = ContentFrame
|
||||
|
||||
function SpeechFrame:Init()
|
||||
local frame = self
|
||||
|
||||
-- Default style
|
||||
self:SetSize(CzechQuestsAddon_Store.config.SPEECH_FRAME_WIDTH, 150)
|
||||
|
||||
-- Make movable
|
||||
self:SetMovable(true)
|
||||
self:EnableMouse(true)
|
||||
self:RegisterForDrag("LeftButton")
|
||||
|
||||
-- Hide sidebar
|
||||
self.ScrollBar:Hide()
|
||||
|
||||
-- Register drag event
|
||||
self:SetScript("OnDragStart", function()
|
||||
frame:StartMoving()
|
||||
end)
|
||||
self:SetScript("OnDragStop", function(self)
|
||||
frame:StopMovingOrSizing()
|
||||
local finalLeft, finalTop = self:GetLeft(), self:GetTop()
|
||||
CzechQuestsAddon_Store.config.SPEECH_FRAME_POSITION = {
|
||||
x = finalLeft,
|
||||
y = finalTop
|
||||
}
|
||||
end)
|
||||
|
||||
-- Create ContentFrame
|
||||
ContentFrame:Init()
|
||||
SpeechFrame:SetScrollChild(SpeechFrame.ContentFrame)
|
||||
|
||||
-- Register hover events
|
||||
self:SetScript("OnEnter", function() self.ContentFrame.Texture:SetAlpha(0.8) end)
|
||||
self:SetScript("OnLeave", function() self.ContentFrame.Texture:SetAlpha(0.2) end)
|
||||
|
||||
self:UpdateSettings()
|
||||
end
|
||||
|
||||
function ContentFrame:Init()
|
||||
-- Default style
|
||||
self:SetSize(SpeechFrame:GetWidth(), 1)
|
||||
|
||||
-- Texture for control color and alpha
|
||||
self.Texture = self:CreateTexture(nil, "ARTWORK")
|
||||
self.Texture:SetTexture("Interface\\Buttons\\WHITE8x8")
|
||||
self.Texture:SetVertexColor(0, 0, 0, 0.2)
|
||||
|
||||
-- Set points to edges
|
||||
self.Texture:SetPoint("TOPLEFT", self ,"TOPLEFT", 0, 0)
|
||||
self.Texture:SetPoint("BOTTOMRIGHT", self ,"BOTTOMRIGHT", 0, 0)
|
||||
|
||||
-- Set ContentFrame position
|
||||
self:SetPoint("BOTTOMLEFT", SpeechFrame, "BOTTOMLEFT", 0, 0)
|
||||
end
|
||||
|
||||
function ContentFrame:CreateMessage(message)
|
||||
-- Default style
|
||||
local MessageFrame = CreateFrame("Frame", nil, SpeechFrame.ContentFrame)
|
||||
MessageFrame:SetSize(SpeechFrame.ContentFrame:GetWidth() - 20, 1)
|
||||
|
||||
-- Define Message
|
||||
MessageFrame.Message = addon.API.CreateCzechFont(
|
||||
MessageFrame,
|
||||
CzechQuestsAddon_Store.config.SPEECH_TEXT_FONT_NAME,
|
||||
CzechQuestsAddon_Store.config.SPEECH_TEXT_FONT_SIZE,
|
||||
"THICK"
|
||||
)
|
||||
MessageFrame.Message:SetTextColor(1, 1, 1)
|
||||
MessageFrame.Message:SetPoint("TOPLEFT", MessageFrame, "TOPLEFT", 5, -5)
|
||||
MessageFrame.Message:SetPoint("BOTTOMRIGHT", MessageFrame, "BOTTOMRIGHT", -5, 5)
|
||||
|
||||
-- Set text and height
|
||||
MessageFrame.Message:SetText(message)
|
||||
MessageFrame:SetHeight(MessageFrame.Message:GetHeight() + 10)
|
||||
|
||||
return MessageFrame
|
||||
end
|
||||
|
||||
function SpeechFrame:UpdateSettings()
|
||||
self:SetWidth(CzechQuestsAddon_Store.config.SPEECH_FRAME_WIDTH)
|
||||
self.ContentFrame:SetWidth(self:GetWidth())
|
||||
|
||||
-- Set position
|
||||
self:ClearAllPoints()
|
||||
self:SetPoint(
|
||||
"TOPLEFT", UIParent, "TOPLEFT",
|
||||
CzechQuestsAddon_Store.config.SPEECH_FRAME_POSITION.x,
|
||||
CzechQuestsAddon_Store.config.SPEECH_FRAME_POSITION.y
|
||||
)
|
||||
end
|
|
@ -1,81 +0,0 @@
|
|||
local messages = {}
|
||||
|
||||
local function ReflowMessages()
|
||||
local offsetY = 5
|
||||
for i = #messages, 1, -1 do
|
||||
local fs = messages[i]
|
||||
fs:ClearAllPoints()
|
||||
fs:SetPoint(
|
||||
"BOTTOMLEFT",
|
||||
CzechQuestsAddon.translationSpeechFrame.content,
|
||||
"BOTTOMLEFT",
|
||||
5,
|
||||
offsetY
|
||||
)
|
||||
fs:Show()
|
||||
offsetY = offsetY + fs:GetHeight()
|
||||
end
|
||||
|
||||
if #messages == 0 then
|
||||
CzechQuestsAddon.translationSpeechFrame:Hide()
|
||||
end
|
||||
|
||||
offsetY = offsetY + 5
|
||||
if offsetY < 150 then
|
||||
offsetY = 150
|
||||
end
|
||||
|
||||
CzechQuestsAddon.translationSpeechFrame.content:SetHeight(offsetY)
|
||||
|
||||
CzechQuestsAddon.translationSpeechFrame:UpdateScrollChildRect()
|
||||
local maxScroll = CzechQuestsAddon.translationSpeechFrame:GetVerticalScrollRange()
|
||||
CzechQuestsAddon.translationSpeechFrame:SetVerticalScroll(maxScroll)
|
||||
|
||||
end
|
||||
|
||||
local function RemoveMessage(frame)
|
||||
for i, fs in ipairs(messages) do
|
||||
if fs == frame then
|
||||
local fadeAnimationGroup = fs:CreateAnimationGroup()
|
||||
local fadeOut = fadeAnimationGroup:CreateAnimation("Alpha")
|
||||
fadeOut:SetFromAlpha(1)
|
||||
fadeOut:SetToAlpha(0)
|
||||
fadeOut:SetDuration(1)
|
||||
fadeOut:SetStartDelay(0)
|
||||
|
||||
fadeAnimationGroup:SetScript("OnFinished", function()
|
||||
table.remove(messages, i)
|
||||
fs:Hide()
|
||||
ReflowMessages()
|
||||
end)
|
||||
|
||||
fadeAnimationGroup:Play()
|
||||
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function AddMessage(sender, message)
|
||||
local formattedText = string.format("|cffffd200%s|r\n%s", sender, message)
|
||||
local frame = CzechQuestsAddon:CreateTranslationSpeechFrameMessage(formattedText)
|
||||
|
||||
table.insert(messages, frame)
|
||||
ReflowMessages()
|
||||
|
||||
C_Timer.After(20, function()
|
||||
RemoveMessage(frame)
|
||||
end)
|
||||
end
|
||||
|
||||
function CzechQuestsAddon:ShowSpeechTranslation(sender, message)
|
||||
local text = CzechQuestsAddon:GetData("speech", message)
|
||||
if text == nil and CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_ORIGINAL_WHEN_MISSING then
|
||||
text = message
|
||||
end
|
||||
|
||||
if text ~= nil then
|
||||
CzechQuestsAddon.translationSpeechFrame:Show()
|
||||
AddMessage(sender, text)
|
||||
end
|
||||
end
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,5 @@
|
|||
CzechQuestsAddon.data.class = {
|
||||
local _, addon = ...
|
||||
addon.data.class = {
|
||||
["WARRIOR"] = {
|
||||
f0 = "bojovnice", f1 = "bojovnice", f2 = "bojovnici", f3 = "bojovnici", f4 = "bojovnice", f5 = "bojovnicí",
|
||||
m0 = "bojovník", m1 = "bojovníka", m2 = "bojovníkovi", m3 = "bojovníku", m4 = "bojovníkem",
|
||||
|
@ -66,7 +67,7 @@ CzechQuestsAddon.data.class = {
|
|||
},
|
||||
};
|
||||
|
||||
CzechQuestsAddon.data.race = {
|
||||
addon.data.race = {
|
||||
["Human"] = {
|
||||
f0 = "člověk", f1 = "člověka", f2 = "člověku", f3 = "člověka", f4 = "člověče", f5 = "člověkem",
|
||||
m0 = "člověk", m1 = "člověka", m2 = "člověku", m3 = "člověče", m4 = "člověkem",
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,28 +0,0 @@
|
|||
-- 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()
|
||||
local category, layout = Settings.RegisterVerticalLayoutCategory("CzechQuests")
|
||||
|
||||
-- Add options for quests
|
||||
layout:AddInitializer(CreateSettingsListSectionHeaderInitializer("Questy"))
|
||||
CzechQuestsAddon:AddQuestOptions(category, layout)
|
||||
|
||||
-- Add options for speech
|
||||
layout:AddInitializer(CreateSettingsListSectionHeaderInitializer("Projevy (zatím ve vývoji)"))
|
||||
CzechQuestsAddon:AddSpeechOptions(category, layout)
|
||||
|
||||
-- Add options for speech
|
||||
layout:AddInitializer(CreateSettingsListSectionHeaderInitializer("Ostatní"))
|
||||
CzechQuestsAddon:AddOthersOptions(category, layout)
|
||||
|
||||
-- Store it into Addon options
|
||||
Settings.RegisterAddOnCategory(category)
|
||||
end
|
|
@ -1,15 +0,0 @@
|
|||
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
|
|
@ -1,161 +0,0 @@
|
|||
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
|
||||
-- Add DARK mode checkbox
|
||||
local darkModeCheckbox = Settings.RegisterAddOnSetting(
|
||||
category,
|
||||
"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(category, 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(
|
||||
category,
|
||||
"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(category, headerFontFamilyDropdown, GetFontOptions)
|
||||
|
||||
-- Add text font dropdown menu
|
||||
local textFontFamilyDropdown = Settings.RegisterProxySetting(
|
||||
category,
|
||||
"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(category, textFontFamilyDropdown, GetFontOptions)
|
||||
|
||||
-- Add slider for change primary header font size
|
||||
local primaryHeaderFontSizeSlider = Settings.RegisterProxySetting(
|
||||
category,
|
||||
"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(category, primaryHeaderFontSizeSlider, primaryHeaderFontSizeSliderOptions)
|
||||
|
||||
-- Add slider for change secondary header font size
|
||||
local secondaryHeaderFontSizeSlider = Settings.RegisterProxySetting(
|
||||
category,
|
||||
"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(category, secondaryHeaderFontSizeSlider, secondaryHeaderFontSizeSliderOptions)
|
||||
|
||||
|
||||
-- Add slider for change secondary header font size
|
||||
local textFontSizeSlider = Settings.RegisterProxySetting(
|
||||
category,
|
||||
"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(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
|
||||
local textureAlphaSlider = Settings.RegisterProxySetting(
|
||||
category,
|
||||
"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(category, textureAlphaSlider, textureAlphaSliderOptions)
|
||||
|
||||
end
|
|
@ -1,101 +0,0 @@
|
|||
function CzechQuestsAddon:AddSpeechOptions(category, layout)
|
||||
|
||||
-- Enable translations
|
||||
local enableCheckbox = Settings.RegisterAddOnSetting(
|
||||
category,
|
||||
"CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_ENABLED",
|
||||
"TRANSLATION_SPEECH_FRAME_ENABLED",
|
||||
CzechQuestsAddon_Store.config,
|
||||
type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_ENABLED),
|
||||
"Zapnout *",
|
||||
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_ENABLED
|
||||
)
|
||||
Settings.CreateCheckbox(category, enableCheckbox)
|
||||
|
||||
-- Add text font dropdown menu
|
||||
local textFontFamilyDropdown = Settings.RegisterProxySetting(
|
||||
category,
|
||||
"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
|
||||
end
|
||||
)
|
||||
Settings.CreateDropdown(category, textFontFamilyDropdown, GetFontOptions)
|
||||
|
||||
-- Add slider for change secondary header font size
|
||||
local textFontSizeSlider = Settings.RegisterProxySetting(
|
||||
category,
|
||||
"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
|
||||
end
|
||||
)
|
||||
local textFontSizeSliderOptions = Settings.CreateSliderOptions(8, 30, 1)
|
||||
textFontSizeSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
|
||||
Settings.CreateSlider(category, textFontSizeSlider, textFontSizeSliderOptions)
|
||||
|
||||
-- Add slider for change frame width
|
||||
local windowWidthSizeSlider = Settings.RegisterProxySetting(
|
||||
category,
|
||||
"CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_WIDTH",
|
||||
type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH),
|
||||
"Šírka okna",
|
||||
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.translationSpeechFrame:SetWidth(
|
||||
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH
|
||||
)
|
||||
CzechQuestsAddon.translationSpeechFrame.content:SetWidth(
|
||||
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH
|
||||
)
|
||||
end
|
||||
)
|
||||
local windowWidthSizeSliderOption = Settings.CreateSliderOptions(200, 1000, 10)
|
||||
windowWidthSizeSliderOption:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
|
||||
Settings.CreateSlider(category, windowWidthSizeSlider, windowWidthSizeSliderOption)
|
||||
|
||||
-- Show original
|
||||
local originalWhenMissingCheckbox = Settings.RegisterAddOnSetting(
|
||||
category,
|
||||
"CzechQuestsAddon__TRANSLATION_SPEECH_FRAME_ORIGINAL_WHEN_MISSING",
|
||||
"TRANSLATION_SPEECH_FRAME_ORIGINAL_WHEN_MISSING",
|
||||
CzechQuestsAddon_Store.config,
|
||||
type(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_ORIGINAL_WHEN_MISSING),
|
||||
"Original pokud není preklad",
|
||||
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_ORIGINAL_WHEN_MISSING
|
||||
)
|
||||
Settings.CreateCheckbox(category, originalWhenMissingCheckbox)
|
||||
|
||||
local initializer= CreateSettingsButtonInitializer(
|
||||
'Resetovat pozici okna',
|
||||
'RESET',
|
||||
function()
|
||||
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_POSITION = { x = 0, y = 0}
|
||||
CzechQuestsAddon.translationSpeechFrame:SetPoint(
|
||||
"TOPLEFT", UIParent, "TOPLEFT",
|
||||
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
|
|
@ -1,194 +0,0 @@
|
|||
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
|
||||
|
||||
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
|
||||
|
||||
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)
|
||||
-- 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
|
|
@ -1,99 +0,0 @@
|
|||
function CzechQuestsAddon:CreateTranslationSpeechFrame()
|
||||
local scroll = {};
|
||||
|
||||
-- Speech Translation Frame
|
||||
scroll = CreateFrame("ScrollFrame", "CzechQuestsTranslationSpeechFrame", UIParent, "UIPanelScrollFrameTemplate")
|
||||
scroll:SetSize(CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_WIDTH, 150)
|
||||
scroll:Hide()
|
||||
|
||||
-- Make movable
|
||||
scroll:SetMovable(true)
|
||||
scroll:EnableMouse(true)
|
||||
scroll:RegisterForDrag("LeftButton")
|
||||
|
||||
scroll:SetScript("OnDragStart", function()
|
||||
scroll:StartMoving()
|
||||
end)
|
||||
|
||||
scroll:SetScript("OnDragStop", function(self)
|
||||
scroll:StopMovingOrSizing()
|
||||
local finalLeft, finalTop = self:GetLeft(), self:GetTop()
|
||||
CzechQuestsAddon_Store.config.TRANSLATION_SPEECH_FRAME_POSITION = {
|
||||
x = finalLeft,
|
||||
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
|
||||
)
|
||||
|
||||
scroll.content:SetPoint("BOTTOMLEFT", scroll, "BOTTOMLEFT", 0, 0)
|
||||
|
||||
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)
|
||||
|
||||
-- Hide
|
||||
frame:Hide()
|
||||
|
||||
-- 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_Store.config.TRANSLATION_SPEECH_FRAME_TEXT_FONT_SIZE,
|
||||
"THICK"
|
||||
)
|
||||
|
||||
frame.string:SetText(message)
|
||||
|
||||
frame:SetHeight(frame.string:GetHeight() + 10)
|
||||
|
||||
return frame;
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue