$l10n_ anpassungen + build automatisierung
This commit is contained in:
Binary file not shown.
@@ -9,6 +9,124 @@ $projectRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$projectZip = Join-Path $projectRoot "$modName.zip"
|
||||
$tempZip = Join-Path ([System.IO.Path]::GetTempPath()) "$modName-build.zip"
|
||||
|
||||
function Format-ProductionAmount {
|
||||
param(
|
||||
[double]$Amount,
|
||||
[string]$CultureName
|
||||
)
|
||||
|
||||
$culture = [System.Globalization.CultureInfo]::GetCultureInfo($CultureName)
|
||||
$roundedAmount = [Math]::Round($Amount)
|
||||
|
||||
if ([Math]::Abs($Amount - $roundedAmount) -lt 0.0001) {
|
||||
return ([int64]$roundedAmount).ToString("N0", $culture)
|
||||
}
|
||||
|
||||
return $Amount.ToString("N1", $culture)
|
||||
}
|
||||
|
||||
function Set-L10nText {
|
||||
param(
|
||||
[xml]$ModDesc,
|
||||
[string]$Name,
|
||||
[string]$EnglishText,
|
||||
[string]$GermanText
|
||||
)
|
||||
|
||||
$textNode = $ModDesc.SelectSingleNode("/modDesc/l10n/text[@name='$Name']")
|
||||
if ($null -eq $textNode) {
|
||||
throw "l10n Eintrag fehlt: $Name"
|
||||
}
|
||||
|
||||
$englishNode = $textNode.SelectSingleNode("en")
|
||||
$germanNode = $textNode.SelectSingleNode("de")
|
||||
|
||||
if ($null -eq $englishNode -or $null -eq $germanNode) {
|
||||
throw "l10n Eintrag ist unvollstaendig: $Name"
|
||||
}
|
||||
|
||||
$englishNode.InnerText = $EnglishText
|
||||
$germanNode.InnerText = $GermanText
|
||||
}
|
||||
|
||||
function Update-ProductionDescriptions {
|
||||
param(
|
||||
[string]$ProjectRoot
|
||||
)
|
||||
|
||||
$modDescPath = Join-Path $ProjectRoot "modDesc.xml"
|
||||
|
||||
$products = @{
|
||||
"PAYDIRT" = @{ En = "paydirt"; De = "Paydirt" }
|
||||
"STONE" = @{ En = "stone"; De = "Stein" }
|
||||
"DIRT" = @{ En = "dirt"; De = "Erde" }
|
||||
"MININGCOAL" = @{ En = "mining coal"; De = "Bergbau-Kohle" }
|
||||
"IRONORE" = @{ En = "iron ore"; De = "Eisenerz" }
|
||||
"SILVERORE" = @{ En = "silver ore"; De = "Silbererz" }
|
||||
}
|
||||
|
||||
$productionItems = @(
|
||||
@{ XmlPath = "placeables\mine\mine.xml"; L10nName = "storeItem_paydirtMine_function" },
|
||||
@{ XmlPath = "placeables\stoneQuarry\stoneQuarry.xml"; L10nName = "storeItem_stoneQuarry_function" },
|
||||
@{ XmlPath = "placeables\dirt\dirt.xml"; L10nName = "storeItem_dirtPit_function" },
|
||||
@{ XmlPath = "placeables\coalmine\coalmine.xml"; L10nName = "storeItem_coalMine_function" },
|
||||
@{ XmlPath = "placeables\ironore\iron.xml"; L10nName = "storeItem_ironMine_function" },
|
||||
@{ XmlPath = "placeables\silverore\silver.xml"; L10nName = "storeItem_silverMine_function" }
|
||||
)
|
||||
|
||||
$modDesc = New-Object System.Xml.XmlDocument
|
||||
$modDesc.PreserveWhitespace = $true
|
||||
$modDesc.Load($modDescPath)
|
||||
|
||||
foreach ($item in $productionItems) {
|
||||
$placeablePath = Join-Path $ProjectRoot $item.XmlPath
|
||||
|
||||
$placeable = New-Object System.Xml.XmlDocument
|
||||
$placeable.PreserveWhitespace = $true
|
||||
$placeable.Load($placeablePath)
|
||||
|
||||
$productionNode = $placeable.SelectSingleNode("/placeable/produktion")
|
||||
if ($null -eq $productionNode) {
|
||||
throw "produktion Eintrag fehlt: $($item.XmlPath)"
|
||||
}
|
||||
|
||||
$fillType = $productionNode.GetAttribute("fillType")
|
||||
$amountText = $productionNode.GetAttribute("amountPerHour")
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($fillType) -or [string]::IsNullOrWhiteSpace($amountText)) {
|
||||
throw "produktion Eintrag ist unvollstaendig: $($item.XmlPath)"
|
||||
}
|
||||
|
||||
$amountPerHour = [double]::Parse($amountText, [System.Globalization.CultureInfo]::InvariantCulture)
|
||||
|
||||
if ($products.ContainsKey($fillType)) {
|
||||
$product = $products[$fillType]
|
||||
} else {
|
||||
$product = @{ En = $fillType.ToLowerInvariant(); De = $fillType }
|
||||
}
|
||||
|
||||
$amountEn = Format-ProductionAmount -Amount $amountPerHour -CultureName "en-US"
|
||||
$amountDe = Format-ProductionAmount -Amount $amountPerHour -CultureName "de-DE"
|
||||
|
||||
Set-L10nText -ModDesc $modDesc -Name $item.L10nName `
|
||||
-EnglishText "Produces $amountEn l $($product.En) per in-game hour." `
|
||||
-GermanText "Produziert $amountDe l $($product.De) pro Ingame-Stunde."
|
||||
}
|
||||
|
||||
$settings = New-Object System.Xml.XmlWriterSettings
|
||||
$settings.Encoding = New-Object System.Text.UTF8Encoding($false)
|
||||
$settings.Indent = $false
|
||||
$settings.NewLineChars = "`r`n"
|
||||
|
||||
$writer = [System.Xml.XmlWriter]::Create($modDescPath, $settings)
|
||||
try {
|
||||
$modDesc.Save($writer)
|
||||
}
|
||||
finally {
|
||||
$writer.Close()
|
||||
}
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($ModsPath)) {
|
||||
$candidates = @(
|
||||
(Join-Path $env:USERPROFILE "OneDrive\Dokumente\My Games\FarmingSimulator2025\mods"),
|
||||
@@ -31,6 +149,8 @@ if (-not (Test-Path -LiteralPath $ModsPath)) {
|
||||
New-Item -ItemType Directory -Force -Path $ModsPath | Out-Null
|
||||
}
|
||||
|
||||
Update-ProductionDescriptions -ProjectRoot $projectRoot
|
||||
|
||||
Add-Type -AssemblyName System.IO.Compression
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
|
||||
|
||||
+57
-1
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<modDesc descVersion="95">
|
||||
<author>Dystroyer8</author>
|
||||
<version>1.0.0.0</version>
|
||||
@@ -13,6 +13,62 @@
|
||||
<de>Minenproduktion für LS25</de>
|
||||
</description>
|
||||
|
||||
<l10n>
|
||||
<text name="storeItem_paydirtMine_name">
|
||||
<en>Paydirt Mine</en>
|
||||
<de>Paydirt-Mine</de>
|
||||
</text>
|
||||
<text name="storeItem_paydirtMine_function">
|
||||
<en>Produces 80,000 l paydirt per in-game hour.</en>
|
||||
<de>Produziert 80.000 l Paydirt pro Ingame-Stunde.</de>
|
||||
</text>
|
||||
|
||||
<text name="storeItem_stoneQuarry_name">
|
||||
<en>Stone Quarry</en>
|
||||
<de>Steinbruch</de>
|
||||
</text>
|
||||
<text name="storeItem_stoneQuarry_function">
|
||||
<en>Produces 120,000 l stone per in-game hour.</en>
|
||||
<de>Produziert 120.000 l Stein pro Ingame-Stunde.</de>
|
||||
</text>
|
||||
|
||||
<text name="storeItem_dirtPit_name">
|
||||
<en>Dirt Pit</en>
|
||||
<de>Erdgrube</de>
|
||||
</text>
|
||||
<text name="storeItem_dirtPit_function">
|
||||
<en>Produces 150,000 l dirt per in-game hour.</en>
|
||||
<de>Produziert 150.000 l Erde pro Ingame-Stunde.</de>
|
||||
</text>
|
||||
|
||||
<text name="storeItem_coalMine_name">
|
||||
<en>Coal Mine</en>
|
||||
<de>Kohlemine</de>
|
||||
</text>
|
||||
<text name="storeItem_coalMine_function">
|
||||
<en>Produces 90,000 l mining coal per in-game hour.</en>
|
||||
<de>Produziert 90.000 l Bergbau-Kohle pro Ingame-Stunde.</de>
|
||||
</text>
|
||||
|
||||
<text name="storeItem_ironMine_name">
|
||||
<en>Iron Ore Mine</en>
|
||||
<de>Eisenerzmine</de>
|
||||
</text>
|
||||
<text name="storeItem_ironMine_function">
|
||||
<en>Produces 45,000 l iron ore per in-game hour.</en>
|
||||
<de>Produziert 45.000 l Eisenerz pro Ingame-Stunde.</de>
|
||||
</text>
|
||||
|
||||
<text name="storeItem_silverMine_name">
|
||||
<en>Silver Ore Mine</en>
|
||||
<de>Silbererzmine</de>
|
||||
</text>
|
||||
<text name="storeItem_silverMine_function">
|
||||
<en>Produces 50,000 l silver ore per in-game hour.</en>
|
||||
<de>Produziert 50.000 l Silbererz pro Ingame-Stunde.</de>
|
||||
</text>
|
||||
</l10n>
|
||||
|
||||
<extraSourceFiles>
|
||||
<sourceFile filename="scripts/produktion.lua" />
|
||||
</extraSourceFiles>
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
<produktion fillType="MININGCOAL" amountPerHour="90000" />
|
||||
|
||||
<storeData>
|
||||
<name>LS25 Kohlemine</name>
|
||||
<name>$l10n_storeItem_coalMine_name</name>
|
||||
<functions>
|
||||
<function>Kohlemine produziert Kohle</function>
|
||||
<function>$l10n_storeItem_coalMine_function</function>
|
||||
</functions>
|
||||
<image>placeables/mine/store_mine.dds</image>
|
||||
<price>600000</price>
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
<produktion fillType="DIRT" amountPerHour="150000" />
|
||||
|
||||
<storeData>
|
||||
<name>LS25 Erde mine</name>
|
||||
<name>$l10n_storeItem_dirtPit_name</name>
|
||||
<functions>
|
||||
<function>Erde mine produziert Erde</function>
|
||||
<function>$l10n_storeItem_dirtPit_function</function>
|
||||
</functions>
|
||||
<image>placeables/mine/store_mine.dds</image>
|
||||
<price>180000</price>
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
<produktion fillType="IRONORE" amountPerHour="45000" />
|
||||
|
||||
<storeData>
|
||||
<name>LS25 Eisenmine</name>
|
||||
<name>$l10n_storeItem_ironMine_name</name>
|
||||
<functions>
|
||||
<function>Eisenmine produziert Eisen</function>
|
||||
<function>$l10n_storeItem_ironMine_function</function>
|
||||
</functions>
|
||||
<image>placeables/mine/store_mine.dds</image>
|
||||
<price>1200000</price>
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
<produktion fillType="PAYDIRT" amountPerHour="80000" />
|
||||
|
||||
<storeData>
|
||||
<name>LS25 Mine</name>
|
||||
<name>$l10n_storeItem_paydirtMine_name</name>
|
||||
<functions>
|
||||
<function>Mine produziert PAYDIRT</function>
|
||||
<function>$l10n_storeItem_paydirtMine_function</function>
|
||||
</functions>
|
||||
<image>placeables/mine/store_mine.dds</image>
|
||||
<price>250000</price>
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
<produktion fillType="SILVERORE" amountPerHour="50000" />
|
||||
|
||||
<storeData>
|
||||
<name>LS25 Silbermine</name>
|
||||
<name>$l10n_storeItem_silverMine_name</name>
|
||||
<functions>
|
||||
<function>Silbermine produziert Silber</function>
|
||||
<function>$l10n_storeItem_silverMine_function</function>
|
||||
</functions>
|
||||
<image>placeables/mine/store_mine.dds</image>
|
||||
<price>1500000</price>
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
<produktion fillType="STONE" amountPerHour="120000" />
|
||||
|
||||
<storeData>
|
||||
<name>LS25 Steinbruch</name>
|
||||
<name>$l10n_storeItem_stoneQuarry_name</name>
|
||||
<functions>
|
||||
<function>Steinbruch produziert STONE</function>
|
||||
<function>$l10n_storeItem_stoneQuarry_function</function>
|
||||
</functions>
|
||||
<image>placeables/mine/store_mine.dds</image>
|
||||
<price>250000</price>
|
||||
|
||||
Reference in New Issue
Block a user