feat(text): merchants, troops and the hive's shelf come from translation files

The faction merchants' 90 jokes, their generic lines and their names now
read from merchants.json. Merchant names use the game's own creature
tokens where one matches, so they arrive translated in every language
Valheim ships; the Dverg keeps a key of its own, since vanilla's token
reads "Dvergr Rogue".

The Dvergar and Trol troop names and terms, and the Sverm hive's goods,
refusals, stage names and brood kinds, follow. Their panels fill TMP texts
themselves, so they localize the names where they draw them.

The jokes have English text only for now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kanym 2026-09-28 18:50:54 +02:00
commit 1bd09ed31d
13 changed files with 332 additions and 167 deletions

View file

@ -93,7 +93,7 @@ namespace RacesOfValheim
{
new Troop
{
Id = "greydwarf_patrol", Display = "Greydwarf Patrol", Price = 400, NeedsUpgrade = false, Icon = "TrophyGreydwarfBrute",
Id = "greydwarf_patrol", Display = "$rov_troop_trol_greydwarf_patrol", Price = 400, NeedsUpgrade = false, Icon = "TrophyGreydwarfBrute",
Members = new[]
{
new KeyValuePair<string, int>("Greydwarf", 4),
@ -103,17 +103,17 @@ namespace RacesOfValheim
},
new Troop
{
Id = "troll", Display = "Troll", Price = 700, NeedsUpgrade = false, Icon = "TrophyForestTroll",
Id = "troll", Display = "$rov_troop_trol_troll", Price = 700, NeedsUpgrade = false, Icon = "TrophyForestTroll",
Members = new[] { new KeyValuePair<string, int>("Troll", 1) }
},
new Troop
{
Id = "troll_summoned", Display = "Staff Troll", Price = 900, NeedsUpgrade = false, Icon = "TrophyForestTroll",
Id = "troll_summoned", Display = "$rov_troop_trol_troll_summoned", Price = 900, NeedsUpgrade = false, Icon = "TrophyForestTroll",
Members = new[] { new KeyValuePair<string, int>("Troll_Summoned", 1) }
},
new Troop
{
Id = "goblin_patrol", Display = "Fuling Patrol", Price = 1400, NeedsUpgrade = true, Icon = "TrophyGoblinBrute",
Id = "goblin_patrol", Display = "$rov_troop_trol_goblin_patrol", Price = 1400, NeedsUpgrade = true, Icon = "TrophyGoblinBrute",
Members = new[]
{
new KeyValuePair<string, int>("Goblin", 4),
@ -123,7 +123,7 @@ namespace RacesOfValheim
},
new Troop
{
Id = "goblin_band", Display = "Fuling War Band", Price = 2000, NeedsUpgrade = true, Icon = "TrophyGoblin",
Id = "goblin_band", Display = "$rov_troop_trol_goblin_band", Price = 2000, NeedsUpgrade = true, Icon = "TrophyGoblin",
Members = new[]
{
new KeyValuePair<string, int>("Goblin", 4),

View file

@ -128,13 +128,13 @@ namespace RacesOfValheim
else Jotunn.Logger.LogWarning($"[Trol] No icon on '{troop.Icon}' for {troop.Display}; the row keeps " +
"whatever the cloned element was showing.");
element.transform.Find("name").GetComponent<TMP_Text>().text = troop.Display;
element.transform.Find("name").GetComponent<TMP_Text>().text = Localization.instance.Localize(troop.Display);
TMP_Text price = FindDescendant<TMP_Text>(element.transform, "price");
if (price != null) price.text = troop.Price.ToString();
UITooltip tooltip = element.GetComponent<UITooltip>();
if (tooltip != null) tooltip.Set(troop.Display, Composition(troop), gui.m_tooltipAnchor, default(Vector2));
if (tooltip != null) tooltip.Set(Localization.instance.Localize(troop.Display), Composition(troop), gui.m_tooltipAnchor, default(Vector2));
string id = troop.Id;
element.GetComponent<Button>().onClick.AddListener(() =>
@ -155,8 +155,7 @@ namespace RacesOfValheim
if (text.Length > 0) text.Append('\n');
text.Append(member.Value).Append(" x ").Append(CreatureName(member.Key));
}
text.Append("\n\nThey answer the follow command, knit their own wounds shut, drop nothing, and do " +
"not come back. A dead warband is money spent.");
text.Append("\n\n").Append(ModText.Get("rov_troop_trol_terms"));
return text.ToString();
}