From 9d608bb37b155f3e8ce1d4da54ded496c03c494a Mon Sep 17 00:00:00 2001 From: jneb802 <73610029+jneb802@users.noreply.github.com> Date: Tue, 12 May 2026 10:40:25 -0700 Subject: [PATCH] Localize remaining port UI text --- .../Src/Ports/PortMain/PortInit.cs | 12 +-- .../Src/Ports/src/LocalKeys.cs | 15 ++++ .../Src/Ports/src/Port.cs | 4 +- .../Src/Ports/src/PortUI.cs | 4 +- .../Src/Ports/src/tutorials/PortTutorial.cs | 53 +++-------- ...ious.More_World_Locations_Localization.yml | 89 +++++++++++++++++++ 6 files changed, 124 insertions(+), 53 deletions(-) diff --git a/More World Locations_AIO/Src/Ports/PortMain/PortInit.cs b/More World Locations_AIO/Src/Ports/PortMain/PortInit.cs index 42ae809..e2439ad 100644 --- a/More World Locations_AIO/Src/Ports/PortMain/PortInit.cs +++ b/More World Locations_AIO/Src/Ports/PortMain/PortInit.cs @@ -140,7 +140,7 @@ private static void SetupManifests() prefab.GetComponent().m_persistent = false; // current size 10 - Manifest manifest = new Manifest("Wooden Shipment", prefab.GetComponent()); + Manifest manifest = new Manifest(LocalKeys.ManifestWoodenShipment, prefab.GetComponent()); manifest.CostToShip = 50; manifest.Recipe.Add("Wood", 10); manifest.Recipe.Add("Resin", 5); @@ -158,7 +158,7 @@ private static void SetupManifests() prefab.GetComponent().m_persistent = false; // current size 12 - Manifest manifest = new Manifest("Barrel Shipment", prefab.GetComponent()); + Manifest manifest = new Manifest(LocalKeys.ManifestBarrelShipment, prefab.GetComponent()); manifest.CostToShip = 55; manifest.Recipe.Add("Wood", 10); manifest.Recipe.Add("BarrelRings", 1); @@ -176,7 +176,7 @@ private static void SetupManifests() prefab.GetComponent().m_persistent = false; // current size 24 - Manifest manifest = new Manifest("Fine Shipment", prefab.GetComponent()); + Manifest manifest = new Manifest(LocalKeys.ManifestFineShipment, prefab.GetComponent()); manifest.CostToShip = 100; manifest.Recipe.Add("FineWood", 10); manifest.Recipe.Add("Iron", 2); @@ -195,7 +195,7 @@ private static void SetupManifests() prefab.GetComponent().m_persistent = false; // current size 32 - Manifest manifest = new Manifest("Fuling Shipment", prefab.GetComponent()); + Manifest manifest = new Manifest(LocalKeys.ManifestFulingShipment, prefab.GetComponent()); manifest.CostToShip = 280; manifest.Recipe.Add("FineWood", 10); manifest.Recipe.Add("Tar", 2); @@ -222,7 +222,7 @@ private static void SetupManifests() // new size 40 // this container has default items, remove container.m_defaultItems.m_drops.Clear(); - Manifest manifest = new Manifest("Dvergr Shipment", prefab.GetComponent()); + Manifest manifest = new Manifest(LocalKeys.ManifestDvergrShipment, prefab.GetComponent()); manifest.CostToShip = 410; manifest.Recipe.Add("YggdrasilWood", 10); manifest.Recipe.Add("Copper", 2); @@ -242,4 +242,4 @@ public static void Init(GameObject m_root) SetupManifests(); PortTutorial.Setup(); } -} \ No newline at end of file +} diff --git a/More World Locations_AIO/Src/Ports/src/LocalKeys.cs b/More World Locations_AIO/Src/Ports/src/LocalKeys.cs index 6a03559..d0b6b55 100644 --- a/More World Locations_AIO/Src/Ports/src/LocalKeys.cs +++ b/More World Locations_AIO/Src/Ports/src/LocalKeys.cs @@ -41,6 +41,21 @@ public static class LocalKeys public static readonly string Capacity = "$label_capacity"; public static readonly string CostToShip = "$label_cost_to_ship"; public static readonly string DeliveryCollected = "$msg_delivery_collected"; + public static readonly string PortsTooltipTopic = "$label_ports_tooltip"; + public static readonly string ShipmentSingular = "$label_shipment_single"; + public static readonly string DeliverySingular = "$label_delivery_single"; + public static readonly string TutorialIntroduction = "$label_tutorial_introduction"; + public static readonly string TutorialTextIntroduction = "$tutorial_introduction"; + public static readonly string TutorialTextPort = "$tutorial_port"; + public static readonly string TutorialTextManifest = "$tutorial_manifest"; + public static readonly string TutorialTextShipment = "$tutorial_shipment"; + public static readonly string TutorialTextDelivery = "$tutorial_delivery"; + public static readonly string TutorialTextTeleport = "$tutorial_teleport"; + public static readonly string ManifestWoodenShipment = "$manifest_wooden_shipment"; + public static readonly string ManifestBarrelShipment = "$manifest_barrel_shipment"; + public static readonly string ManifestFineShipment = "$manifest_fine_shipment"; + public static readonly string ManifestFulingShipment = "$manifest_fuling_shipment"; + public static readonly string ManifestDvergrShipment = "$manifest_dvergr_shipment"; public static string ToKey(this ShipmentState state) => state switch { diff --git a/More World Locations_AIO/Src/Ports/src/Port.cs b/More World Locations_AIO/Src/Ports/src/Port.cs index 9d74622..73f9b0d 100644 --- a/More World Locations_AIO/Src/Ports/src/Port.cs +++ b/More World Locations_AIO/Src/Ports/src/Port.cs @@ -461,7 +461,7 @@ public string GetTooltip() string time = Shipment.FormatTime(remainingTime); sb.AppendFormat("\n{3}: {0} ({1}{2})", delivery.OriginPortName, delivery.State.ToKey(), string.IsNullOrEmpty(time) ? "" : $", {time}", LocalKeys.Origin); } - sb.Append($"\n\nShipments ({shipments.Count}): "); + sb.Append($"\n\n{LocalKeys.Shipments} ({shipments.Count}): "); foreach (Shipment? shipment in shipments) { double remainingTime = shipment.State == ShipmentState.InTransit @@ -482,4 +482,4 @@ private static class PortVars public static readonly int TraderName = "PortTraderName".GetStableHashCode(); } -} \ No newline at end of file +} diff --git a/More World Locations_AIO/Src/Ports/src/PortUI.cs b/More World Locations_AIO/Src/Ports/src/PortUI.cs index 0884db8..4acf613 100644 --- a/More World Locations_AIO/Src/Ports/src/PortUI.cs +++ b/More World Locations_AIO/Src/Ports/src/PortUI.cs @@ -916,7 +916,7 @@ public Tab(Transform transform) Tooltip.m_anchor = transform.Find("TooltipAnchor").GetComponent(); Tooltip.m_fixedPosition = new Vector2(0f, 10f); Tooltip.m_tooltipPrefab = _tooltipPrefab; - Tooltip.m_topic = "MWL_Ports_Tooltip"; + Tooltip.m_topic = Localization.instance.Localize(LocalKeys.PortsTooltipTopic); } public void Enable(bool enable) => Prefab.SetActive(enable); @@ -1251,4 +1251,4 @@ public void SetIcon(Sprite sprite) icon.preserveAspect = true; } } -} \ No newline at end of file +} diff --git a/More World Locations_AIO/Src/Ports/src/tutorials/PortTutorial.cs b/More World Locations_AIO/Src/Ports/src/tutorials/PortTutorial.cs index 5575aa8..4c4ab24 100644 --- a/More World Locations_AIO/Src/Ports/src/tutorials/PortTutorial.cs +++ b/More World Locations_AIO/Src/Ports/src/tutorials/PortTutorial.cs @@ -1,61 +1,28 @@ using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Text; -using More_World_Locations_AIO; namespace More_World_Locations_AIO.tutorials; public class PortTutorial { - private static readonly StringBuilder sb = new StringBuilder(); - internal static readonly List tutorials = new(); public readonly string text; public readonly string label; - - private PortTutorial(string label, string resource) : this(label, LoadMarkdownFromAssembly(resource)) - { - } - private PortTutorial(string label, List lines) + private PortTutorial(string label, string text) { this.label = label; - sb.Clear(); - - foreach (string? line in lines) - { - sb.Append(line); - sb.Append('\n'); - } - text = sb.ToString(); + this.text = text; tutorials.Add(this); } public static void Setup() { - PortTutorial introTab = new PortTutorial("Introduction", "introduction.md"); - PortTutorial portTab = new PortTutorial("Port", "port.md"); - PortTutorial manifestTab = new PortTutorial("Manifest", "manifest.md"); - PortTutorial shipmentTab = new PortTutorial("Shipment", "shipment.md"); - PortTutorial deliveryTab = new PortTutorial("Delivery", "delivery.md"); - PortTutorial teleportTab = new PortTutorial("Teleport", "teleport.md"); - } - - private static List LoadMarkdownFromAssembly(string resourceName, string folder = "Src.Ports.src.tutorials") - { - Assembly assembly = Assembly.GetExecutingAssembly(); - string path = $"{More_World_Locations_AIOPlugin.ModName}.{folder}.{resourceName}"; - using Stream? stream = assembly.GetManifestResourceStream(path); - if (stream == null) - throw new FileNotFoundException($"Embedded resource '{resourceName}' not found in assembly '{assembly.FullName}'."); - - using StreamReader reader = new StreamReader(stream); - List lines = new List(); - while (!reader.EndOfStream) - { - lines.Add(reader.ReadLine() ?? string.Empty); - } - return lines; + tutorials.Clear(); + new PortTutorial(LocalKeys.TutorialIntroduction, LocalKeys.TutorialTextIntroduction); + new PortTutorial(LocalKeys.Port, LocalKeys.TutorialTextPort); + new PortTutorial(LocalKeys.Manifest, LocalKeys.TutorialTextManifest); + new PortTutorial(LocalKeys.ShipmentSingular, LocalKeys.TutorialTextShipment); + new PortTutorial(LocalKeys.DeliverySingular, LocalKeys.TutorialTextDelivery); + new PortTutorial(LocalKeys.Teleport, LocalKeys.TutorialTextTeleport); } -} \ No newline at end of file +} diff --git a/More World Locations_AIO/YAML/warpalicious.More_World_Locations_Localization.yml b/More World Locations_AIO/YAML/warpalicious.More_World_Locations_Localization.yml index 30f101a..5e1c92d 100644 --- a/More World Locations_AIO/YAML/warpalicious.More_World_Locations_Localization.yml +++ b/More World Locations_AIO/YAML/warpalicious.More_World_Locations_Localization.yml @@ -77,6 +77,95 @@ label_required_to_defeat: Required to defeat label_capacity: Capacity label_cost_to_ship: Cost to Ship msg_delivery_collected: Delivery marked as collected +label_ports_tooltip: Ports +label_shipment_single: Shipment +label_delivery_single: Delivery +label_tutorial_introduction: Introduction +manifest_wooden_shipment: Wooden Shipment +manifest_barrel_shipment: Barrel Shipment +manifest_fine_shipment: Fine Shipment +manifest_fuling_shipment: Fuling Shipment +manifest_dvergr_shipment: Dvergr Shipment + +# Port tutorials +tutorial_introduction: | + Ports are locations scattered across the world that let you ship items and teleport between them. If this is the first port you've found, congratulations - you've begun your shipping journey! Ports become much more useful as you discover more of them in the world. + + How it works + ● Find a port and talk to its Port Manager to discover it - it will then appear as a destination at all other ports + ● Buy a manifest from the Port Manager. Manifests are the shipping chests you use to transport items between ports. You can purchase up to three manifests per shipment, and higher tiers unlock as you discover more advanced materials. Fill your manifest chests with the items you want to ship + ● Once the chests are loaded, talk to the Port Manager again and use the Port tab to select a destination. There will be a shipment fee that scales with distance - pay the fee by clicking [Send Shipment] and your shipment will be on its way + ● You can see the status of all your active shipments in the Shipment tab + ● Travel to the destination port, open the Delivery tab, and once the shipment has arrived click collect - the chests will appear! + + Note: Travel time is based on in-game time, not real-life time. + + Tabs + Port - Browse discovered ports and send shipments + Manifest - Purchase and manage shipping chests + Shipment - Track outgoing shipments from this port + Delivery - View and collect incoming deliveries + Teleport - Fast travel between ports for a fee (if enabled in config) +tutorial_port: | + The Port tab lists every port you've discovered. Use it to choose where to send your shipments. + + Discovering Ports + ● Talk to the Port Manager at any port to discover it + ● Discovered ports appear as destinations at every other port you visit + + Selecting a Destination + ● Click a port in the list to select it as your destination + ● Hover over a port to see its tooltip: + ♦ Shipment cost (scales with distance) + ♦ Estimated time of arrival + ♦ Items currently loaded in your manifests + ♦ Active shipments and deliveries at that port + + Sending a Shipment + ● Once you've loaded your manifests and selected a destination, click [Send Shipment] + ● The shipping fee will be deducted from your inventory + Empty manifests cannot be sent +tutorial_manifest: | + Manifests are the shipping chests you use to transport items. Purchase them from the Manifest tab before sending a shipment. + + Purchasing + ● Each manifest has a purchase cost shown at the bottom of its tooltip + ● You can purchase up to three manifests per shipment + ● Higher-tier manifests unlock as you discover more advanced materials + + Loading Items + ● Purchased manifests appear as containers near the Port Manager + ● Open a manifest and fill it with the items you want to ship + ● The tooltip shows each manifest's capacity and current contents + + Tip: You don't need to fill every slot - send as many or as few items as you like, but manifests cannot be sent empty. +tutorial_shipment: | + The Shipment tab shows all outgoing shipments from the current port. + + Shipment Details + Each shipment entry displays: + ● The items packed in each manifest + ● The destination port + ● Estimated time of arrival + ● Current status (In Transit or Delivered) + + Note: The Port tab also shows a summary of shipments per destination, but only the Shipment tab shows the full contents of each manifest. +tutorial_delivery: | + The Delivery tab shows incoming shipments at the current port. + + Collecting a Delivery + ● When a shipment's status changes to Delivered, click it to collect + ● The manifest chests will appear near the Port Manager with all your items inside + ● Once you've emptied every chest, the containers disappear and the delivery is marked complete +tutorial_teleport: | + The Teleport tab lets you fast travel directly to any discovered port. + + How it Works + ● Select a destination and click [Teleport] + ● The teleport fee scales with distance, similar to shipping costs + ● You will arrive at the destination port instantly + + Note: Teleporting is a config option and may be disabled by the server. # Port trader names trader_port_name_1: Halmar