Compare commits

...

2 commits

Author SHA1 Message Date
7a12abeda3 Improve QuestFrame font handling
All checks were successful
forgejo/Czech Quests/addon/pipeline/head This commit looks good
2025-03-08 22:57:39 +01:00
d90715c2cc Fix release zip folder structure 2025-03-08 22:57:39 +01:00
11 changed files with 153 additions and 244 deletions

View file

@ -15,6 +15,12 @@ local function CreateCzechFont(frame, name, size, flags)
end
addon.API.CreateCzechFont = CreateCzechFont
local function UpdateCzechFont(FontString, name, size)
local _, _, flags = FontString:GetFont()
FontString:SetFont(FontPath .. name, size, flags)
end
addon.API.UpdateCzechFont = UpdateCzechFont
local function GetFontContainer()
local container = Settings.CreateControlTextContainer()
container:Add("morpheus_cz.ttf", "Morpheus (cz)")

View file

@ -110,6 +110,10 @@ local function InitSpeeches()
addon.SpeechFrame:UpdateSettings()
end)
CreateButton('Zobrazit testovaci zpravu', "Zobrazit", function()
addon.API.AddSpeechMessage("Test", "Text message")
end)
end
local function InitOthers()

View file

@ -49,6 +49,9 @@ local function ShowQuestTranslation(event)
if data then
local title = GetQuestTitle(data.title, questId)
local xOffset = hasModel and 210 or 10
if (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) then
xOffset = -20
end
if event == "QUEST_PROGRESS" then
frame:SetData(title, data.progress, "", "", QuestFrame, -20, xOffset)
elseif event == "QUEST_COMPLETE" then
@ -109,13 +112,21 @@ local function InitQuests()
if event == "PLAYER_LOGIN" then
-- classic
if QuestLogFrame then
QuestLogFrame:SetScript("OnEnter", function() ShowQuestTranslation() end)
QuestLogFrame:SetScript("OnLeave", function() frame:Hide() end)
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)
QuestMapDetailsScrollFrame:SetScript("OnEnter", function()
ShowQuestTranslation()
end)
QuestMapDetailsScrollFrame:SetScript("OnLeave", function()
frame:Hide()
end)
end
frame:Init()

View file

@ -35,30 +35,43 @@ function QuestFrame:Init()
self.Texture:SetAllPoints(true)
self.Texture:SetHorizTile(true)
-- Load settings
self:UpdateSettings()
end
function QuestFrame:UpdateSettings()
-- Create fonts
self.Title = self:CreateHeader()
self.Text1 = self:CreateText()
self.Header = self:CreateHeader()
self.Text2 = self:CreateText()
self:ApplyTheme()
-- Load settings
self:UpdateSettings()
end
function QuestFrame:UpdateSettings()
addon.API.UpdateCzechFont(
self.Title,
CzechQuestsAddon_Store.config.QUEST_HEADER_FONT_NAME,
CzechQuestsAddon_Store.config.QUEST_HEADER_FONT_SIZE
)
addon.API.UpdateCzechFont(
self.Text1,
CzechQuestsAddon_Store.config.QUEST_TEXT_FONT_NAME,
CzechQuestsAddon_Store.config.QUEST_TEXT_FONT_SIZE
)
addon.API.UpdateCzechFont(
self.Header,
CzechQuestsAddon_Store.config.QUEST_HEADER_FONT_NAME,
CzechQuestsAddon_Store.config.QUEST_HEADER_FONT_SIZE
)
addon.API.UpdateCzechFont(
self.Text2,
CzechQuestsAddon_Store.config.QUEST_TEXT_FONT_NAME,
CzechQuestsAddon_Store.config.QUEST_TEXT_FONT_SIZE
)
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)
@ -69,56 +82,53 @@ 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 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)
else
self.Texture:SetTexCoord(0, .58, 0.005, 0.66)
self:SetTextColor(0, 0, 0, 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
if questTextContrast == "1" then
-- Brown
self.Texture:SetTexCoord(0, .01, .4, .8)
elseif questTextContrast == "2" or questTextContrast == "3" then -- Gray
elseif questTextContrast == "2" or questTextContrast == "3" then
-- Gray
self.Texture:SetColorTexture(255, 255, 255, 1)
elseif questTextContrast == "4" then -- Black
elseif questTextContrast == "4" then
-- Black
self.Texture:SetColorTexture(0, 0, 0, 1)
self:SetTextColor(0, 0, 0, 1)
self:SetTextColor(255, 255, 255, 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)
function QuestFrame:ResetFontText()
self.Title:SetText("")
self.Text1:SetText("")
self.Header:SetText("")
self.Text2:SetText("")
end
function QuestFrame:SetData(name, text1, header, text2, parentFrame, yOffset, xOffset)
-- Reset previously values
self:ResetText()
self:ResetFontText()
self:ApplyTheme()
-- 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)
self.Title:SetText(name or "")
self.Text1:SetText(text1 or "")
self.Header:SetText(header or "")
self.Text2:SetText(text2 or "")
-- apply text positions
self.Title:SetPoint("TOPLEFT", self, "TOPLEFT", 10, -10)
@ -127,11 +137,7 @@ function QuestFrame:SetData(name, text1, header, text2, parentFrame, yOffset, xO
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:SetPoint("TOPLEFT", parentFrame, "TOPRIGHT", xOffset, yOffset)
self:Show()
@ -144,4 +150,19 @@ function QuestFrame:SetData(name, text1, header, text2, parentFrame, yOffset, xO
else
self:CalculateHeight()
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

View file

@ -73,6 +73,7 @@ local function AddMessage(sender, message)
RemoveMessage(MessageFrame)
end)
end
addon.API.AddSpeechMessage = AddMessage
local function ShowSpeechTranslation(sender, message)
local text = CzechQuestsAddon:GetData("speech", message)

View file

@ -28,6 +28,7 @@ function SpeechFrame:UpdateSettings()
self:SetWidth(CzechQuestsAddon_Store.config.SPEECH_FRAME_WIDTH)
-- Set position
self:ClearAllPoints()
self:SetPoint(
"BOTTOMLEFT", UIParent, "BOTTOMLEFT",
CzechQuestsAddon_Store.config.SPEECH_FRAME_POSITION_X,

View file

@ -2,7 +2,7 @@
## Title: CzechQuests
## Notes: Addon displays texts of quests in Czech language
## Author: Roman Jaroš
## Version: 0.2.14
## Version: 1.0.0
## SavedVariables: CzechQuestsAddon_Store
## Category: Translations
## IconTexture: Interface\AddOns\CzechQuests\Assets\Icons\Logo

View file

@ -2,7 +2,7 @@
## Title: CzechQuests
## Notes: Addon displays texts of quests in Czech language as tooltip
## Author: Roman Jaroš
## Version: 0.1.13
## Version: 1.0.0
## SavedVariables: CzechQuestsAddon_Store
CzechQuests.lua

116
Jenkinsfile vendored
View file

@ -7,25 +7,22 @@ def SKIP = "skip"
properties([parameters([
choice(
name: 'RELEASE',
choices: ['patch', 'minor', 'major'],
description: 'Release new version'
choices: [SKIP, 'patch', 'minor', 'major'],
description: 'Next new version'
),
choice(
name: 'GAME',
choices: [SKIP, 'classic_era', 'retail', 'all'],
description: 'Create build with manual tag',
)
])])
def outputFolder = "CzechQuests"
def output = "Output"
def addon = "CzechQuests"
def tocFiles = [
"classic_era": "CzechQuests_Vanilla.toc",
"retail" : "CzechQuests_Mainline.toc"
]
def readToCVersion = { String tocFile ->
def readToCVersion = { ->
return sh(
script: "grep '## Version:' $tocFile | cut -d ' ' -f 3",
script: "grep '## Version:' ${tocFiles['classic_era']} | cut -d ' ' -f 3",
returnStdout: true
).trim()
}
@ -36,80 +33,77 @@ def writeToCVersion = { String tocFile, String current, String next ->
writeFile(file: tocFile, text: content)
}
def generateOutput = { String game ->
// prepare output folder
sh "mkdir -p $outputFolder"
// copy toc file
def tocFile = tocFiles[game]
sh "cp $tocFile $outputFolder"
// copy files
sh "find . -name '*.lua' -exec rsync -av {} $outputFolder \\;"
sh "find . -name '*.tga' -exec rsync -av {} $outputFolder \\;"
sh "find . -name '*.ttf' -exec rsync -av {} $outputFolder \\;"
def increaseVersion = { ->
def currentVersion = readToCVersion()
def newVersion = ReleaseUtils.increaseVersion(currentVersion, params.RELEASE)
writeToCVersion(tocFiles['classic_era'], currentVersion, newVersion)
writeToCVersion(tocFiles['retail'], currentVersion, newVersion)
}
def createReleaseFile = { String game ->
def createZipFile = { String game ->
def tocFile = tocFiles[game]
def version = readToCVersion()
// get version
def currentVersion = readToCVersion(tocFile)
def newVersion = ReleaseUtils.increaseVersion(currentVersion, params.RELEASE)
// prepare output folder
sh "mkdir -p $output/$addon/Addon/Data"
// copy toc file
sh "cp $tocFile $output/$addon"
// copy lue files
sh "rsync -av './CzechQuests.lua' ./$output/$addon"
sh "rsync -av './Addon/Data/other.lua' ./$output/$addon/Addon/Data"
sh "find ./Addon/Data/$game/ -name '*.lua' -exec rsync -av {} ./$output/$addon/Addon/Data/ \\;"
sh "find ./Addon/Code/ -name '*.lua' -exec rsync -av {} ./$output/$addon/Addon/Code/ \\;"
// copy assets
sh "find . -name '*.tga' -exec rsync -avR {} $output/$addon \\;"
sh "find . -name '*.ttf' -exec rsync -avR {} $output/$addon \\;"
// create zip
def zipFileName = "czech-quests-$game-v${newVersion}.zip"
zip zipFile: zipFileName, archive: false, dir: outputFolder
def zipFileName = "czech-quests-$game-v${version}.zip"
zip zipFile: zipFileName, archive: false, dir: output
// remove build folder
sh "rm -r $outputFolder"
sh "rm -r $output"
}
// save version
writeToCVersion(tocFile, currentVersion, newVersion)
// commit new version
def tag = "v$newVersion"
def pushToGit = { ->
def version = readToCVersion()
sh "git checkout ${BRANCH_NAME}"
sh "git add $tocFile"
sh "git commit -m 'Release ${tag}'"
sh "git add *.toc"
sh "git commit -m 'Release $version'"
sh "git push"
sh "git tag ${tag}"
sh "git push origin ${tag}"
sh "git tag $version"
sh "git push origin $version"
}
def uploadToForgejo = { ->
def version = readToCVersion()
ForgejoRelease('czech-quests', 'addon', version)
}
MasterJob [:], { ->
if (game == SKIP) {
def version = params.RELEASE
if (version == SKIP) {
currentBuild.result = 'SUCCESS'
return
}
checkout scm
stageWhen("version") {
increaseVersion()
}
stageWhen('build') {
def game = params.GAME
if (game == "all") {
generateOutput("classic_era")
generateOutput("retail")
} else {
generateOutput(game)
}
}
stageWhen('make release') {
def game = params.GAME
createZipFile("classic_era")
createZipFile("retail")
forgejoGit()
if (game == "all") {
createReleaseFile("classic_era")
createReleaseFile("retail")
} else {
createReleaseFile(game)
}
pushToGit()
}
stageWhen('upload release') {
def game = params.GAME
def tocFile = tocFiles[game]
def version = readToCVersion(tocFile)
ForgejoRelease('czech-quests', 'addon', version)
stageWhen('release') {
uploadToForgejo()
}
}

View file

@ -1,129 +0,0 @@
#!/usr/bin/env zsh
output_directory="CzechQuests"
wow_versions=(
"Classic ERA" # 1 - classic_era
"Retail" # 2 - retail
)
toc_files=(
"CzechQuests_Vanilla.toc"
"CzechQuests_Mainline.toc"
)
read_toc_version() {
local wow_version=$1
local toc_file=${toc_files[$wow_version]}
local current_version=0
if [[ -f "$toc_file" ]]; then
current_version=$(grep "## Version:" "$toc_file" | cut -d ' ' -f 3)
fi
echo "$current_version"
}
write_toc_version() {
local wow_version=$1
local next_version=$2
local toc_file=${toc_files[$wow_version]}
if [[ -f "$toc_file" ]]; then
sed -i '' "s/## Version: $current_version/## Version: $next_version/" "$toc_file"
fi
}
make_zip() {
local wow_version=$1
local current_version=$2
local zip_filename=""
local files_to_zip=()
# prepare output directory
mkdir -p $output_directory
mkdir -p "${output_directory}/Addon/Data/"
# Includes classic era continents
if [ "$wow_version" = "1" ]; then
cp -r "./Addon/Data/classic_era/" "${output_directory}/Addon/Data/"
cp "./CzechQuests_Vanilla.toc" "${output_directory}"
zip_filename="czech-quests-classic_era-v$current_version.zip"
fi
# Includes retail continents
if [ "$wow_version" = "2" ]; then
cp -r "./Addon/Data/retail/" "${output_directory}/Addon/Data/"
cp "./CzechQuests_Mainline.toc" "${output_directory}"
zip_filename="czech-quests-retail-v$current_version.zip"
fi
# includes frames
while IFS= read -r line; do
files_to_zip+=("$line")
done < <(find . -name "*.lua" -path "./Addon/Frames/*")
# includes code
while IFS= read -r line; do
files_to_zip+=("$line")
done < <(find . -name "*.lua" -path "./Addon/Code/*")
# includes assets
while IFS= read -r line; do
files_to_zip+=("$line")
done < <(find . -name "*" -path "./Assets/*")
# includes other files
files_to_zip+=("./Addon/Data/other.lua" "./Addon/Addon.lua" "./CzechQuests.lua")
# prepare output directory
for file in "${files_to_zip[@]}"; do
rsync -R "$file" "$output_directory"
done
# Remove invalid files
find "$output_directory" -name ".DS_Store" -type f -delete
# create zip file
zip -r "$zip_filename" $output_directory
# remove output directory
rm -r $output_directory
}
release_wow() {
local wow_version=$1
# Read current version from file for wow version
current_version=$(read_toc_version "$wow_version")
# Increase version
new_version="$current_version"
vared -p "Choose version: " new_version
# Write to file
write_toc_version "$wow_version" "$new_version"
# Generate zip
make_zip $wow_version $new_version
}
init() {
echo "Choose Wow:"
select opt in "${wow_versions[@]}"
do
case $opt in
"Classic ERA")
echo "You chose Classic ERA"
release_wow 1
return 0
;;
"Retail")
echo "You chose Retail"
release_wow 2
return 0
;;
esac
done
}
init

12
sync.sh
View file

@ -1,20 +1,20 @@
#!/bin/bash
wow_source_folder="retail"
wow_destiny_folder="retail"
#wow_source_folder="retail"
#wow_destiny_folder="retail"
#wow_destiny_folder="retail"
#wow_destiny_folder="beta"
#wow_source_folder="classic_era"
#wow_destiny_folder="classic_era"
wow_source_folder="classic_era"
wow_destiny_folder="classic_era"
src_folder="."
dest_folder="/Applications/World of Warcraft/_${wow_destiny_folder}_/Interface/AddOns/CzechQuests"
fswatch -o "$src_folder" | while read -r change; do
rsync -avu --delete "$src_folder" "$dest_folder" --exclude={'.*','*.png','*.sh','*.md','Addon/Data/**','downloader/**'}
rsync -avu --delete "$src_folder" "$dest_folder" --exclude={'.*','*.png','*.sh','*.md','Addon/Data/**','downloader/**',"lib/**","Jenkinsfile"}
rsync -au --delete "$src_folder/Addon/Data/$wow_source_folder/" "$dest_folder/Addon/Data/"
echo "Dest: $dest_folder"
cp "$src_folder/Addon/Data/other.lua" "$dest_folder/Addon/Data/"
done
done