diff --git a/FS25_Mine.zip b/FS25_Mine.zip index f227633..cdef090 100644 Binary files a/FS25_Mine.zip and b/FS25_Mine.zip differ diff --git a/build.ps1 b/build.ps1 index 932b8e1..35b8dbb 100644 --- a/build.ps1 +++ b/build.ps1 @@ -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 diff --git a/modDesc.xml b/modDesc.xml index 910164a..42511b0 100644 --- a/modDesc.xml +++ b/modDesc.xml @@ -1,4 +1,4 @@ - + Dystroyer8 1.0.0.0 @@ -13,27 +13,83 @@ Minenproduktion für LS25 + + + Paydirt Mine + Paydirt-Mine + + + Produces 80,000 l paydirt per in-game hour. + Produziert 80.000 l Paydirt pro Ingame-Stunde. + + + + Stone Quarry + Steinbruch + + + Produces 120,000 l stone per in-game hour. + Produziert 120.000 l Stein pro Ingame-Stunde. + + + + Dirt Pit + Erdgrube + + + Produces 150,000 l dirt per in-game hour. + Produziert 150.000 l Erde pro Ingame-Stunde. + + + + Coal Mine + Kohlemine + + + Produces 90,000 l mining coal per in-game hour. + Produziert 90.000 l Bergbau-Kohle pro Ingame-Stunde. + + + + Iron Ore Mine + Eisenerzmine + + + Produces 45,000 l iron ore per in-game hour. + Produziert 45.000 l Eisenerz pro Ingame-Stunde. + + + + Silver Ore Mine + Silbererzmine + + + Produces 50,000 l silver ore per in-game hour. + Produziert 50.000 l Silbererz pro Ingame-Stunde. + + + - + - + - + - - - - - - + + + + + + diff --git a/placeables/coalmine/coalmine.xml b/placeables/coalmine/coalmine.xml index 38721cb..e1a4fd8 100644 --- a/placeables/coalmine/coalmine.xml +++ b/placeables/coalmine/coalmine.xml @@ -4,9 +4,9 @@ - LS25 Kohlemine + $l10n_storeItem_coalMine_name - Kohlemine produziert Kohle + $l10n_storeItem_coalMine_function placeables/mine/store_mine.dds 600000 diff --git a/placeables/dirt/dirt.xml b/placeables/dirt/dirt.xml index 7e6ba6b..ab09696 100644 --- a/placeables/dirt/dirt.xml +++ b/placeables/dirt/dirt.xml @@ -4,9 +4,9 @@ - LS25 Erde mine + $l10n_storeItem_dirtPit_name - Erde mine produziert Erde + $l10n_storeItem_dirtPit_function placeables/mine/store_mine.dds 180000 diff --git a/placeables/ironore/iron.xml b/placeables/ironore/iron.xml index 4c6deec..3891d07 100644 --- a/placeables/ironore/iron.xml +++ b/placeables/ironore/iron.xml @@ -4,9 +4,9 @@ - LS25 Eisenmine + $l10n_storeItem_ironMine_name - Eisenmine produziert Eisen + $l10n_storeItem_ironMine_function placeables/mine/store_mine.dds 1200000 diff --git a/placeables/mine/mine.xml b/placeables/mine/mine.xml index da8a236..f1123be 100644 --- a/placeables/mine/mine.xml +++ b/placeables/mine/mine.xml @@ -4,9 +4,9 @@ - LS25 Mine + $l10n_storeItem_paydirtMine_name - Mine produziert PAYDIRT + $l10n_storeItem_paydirtMine_function placeables/mine/store_mine.dds 250000 diff --git a/placeables/silverore/silver.xml b/placeables/silverore/silver.xml index 9f3c361..7de93f9 100644 --- a/placeables/silverore/silver.xml +++ b/placeables/silverore/silver.xml @@ -4,9 +4,9 @@ - LS25 Silbermine + $l10n_storeItem_silverMine_name - Silbermine produziert Silber + $l10n_storeItem_silverMine_function placeables/mine/store_mine.dds 1500000 diff --git a/placeables/stoneQuarry/stoneQuarry.xml b/placeables/stoneQuarry/stoneQuarry.xml index 004d94f..e5be5e1 100644 --- a/placeables/stoneQuarry/stoneQuarry.xml +++ b/placeables/stoneQuarry/stoneQuarry.xml @@ -4,9 +4,9 @@ - LS25 Steinbruch + $l10n_storeItem_stoneQuarry_name - Steinbruch produziert STONE + $l10n_storeItem_stoneQuarry_function placeables/mine/store_mine.dds 250000