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

@ -99,7 +99,7 @@ namespace RacesOfValheim
{
new Troop
{
Id = "escort", Display = "Escort", Price = 400, NeedsUpgrade = false, Icon = "TrophyDvergr",
Id = "escort", Display = "$rov_troop_dvergar_escort", Price = 400, NeedsUpgrade = false, Icon = "TrophyDvergr",
Members = new[]
{
new KeyValuePair<string, int>("Dverger", 1),
@ -108,7 +108,7 @@ namespace RacesOfValheim
},
new Troop
{
Id = "yard_patrol", Display = "Yard Patrol", Price = 700, NeedsUpgrade = false, Icon = "TrophyDvergr",
Id = "yard_patrol", Display = "$rov_troop_dvergar_yard_patrol", Price = 700, NeedsUpgrade = false, Icon = "TrophyDvergr",
Members = new[]
{
new KeyValuePair<string, int>("Dverger", 2),
@ -117,7 +117,7 @@ namespace RacesOfValheim
},
new Troop
{
Id = "fire_crew", Display = "Fire Crew", Price = 1000, NeedsUpgrade = false, Icon = "TrophyDvergr",
Id = "fire_crew", Display = "$rov_troop_dvergar_fire_crew", Price = 1000, NeedsUpgrade = false, Icon = "TrophyDvergr",
Members = new[]
{
new KeyValuePair<string, int>("Dverger", 1),
@ -127,7 +127,7 @@ namespace RacesOfValheim
},
new Troop
{
Id = "runic_crew", Display = "Runic Crew", Price = 1500, NeedsUpgrade = true, Icon = "TrophyDvergr",
Id = "runic_crew", Display = "$rov_troop_dvergar_runic_crew", Price = 1500, NeedsUpgrade = true, Icon = "TrophyDvergr",
Members = new[]
{
new KeyValuePair<string, int>("Dverger", 2),
@ -137,7 +137,7 @@ namespace RacesOfValheim
},
new Troop
{
Id = "ash_guard", Display = "Ash Guard", Price = 2000, NeedsUpgrade = true, Icon = "TrophySeekerBrute",
Id = "ash_guard", Display = "$rov_troop_dvergar_ash_guard", Price = 2000, NeedsUpgrade = true, Icon = "TrophySeekerBrute",
Members = new[]
{
new KeyValuePair<string, int>("DvergerAshlands", 2),

View file

@ -123,14 +123,14 @@ namespace RacesOfValheim
else Jotunn.Logger.LogWarning($"[Dvergar] 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);
// The DISCOUNTED price, because that is what will actually leave the player's pocket.
TMP_Text price = FindDescendant<TMP_Text>(element.transform, "price");
if (price != null) price.text = DvergarBanco.PriceFor(troop).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(() =>
@ -154,10 +154,9 @@ namespace RacesOfValheim
int full = troop.Price;
int paid = DvergarBanco.PriceFor(troop);
if (paid < full) text.Append("\n\nList price ").Append(full).Append(" - your seal takes it to ").Append(paid).Append('.');
if (paid < full) text.Append("\n\n").Append(ModText.Get("rov_troop_dvergar_seal_price", full, paid));
text.Append("\n\nThey answer the follow command, knit their own wounds shut, keep your truce with " +
"the mountain's dvergr, drop nothing, and do not come back. A dead crew is money spent.");
text.Append("\n\n").Append(ModText.Get("rov_troop_dvergar_terms"));
return text.ToString();
}