feat(text): hover texts come from translation files

What the stations, thralls, the ward and the hive show under the
crosshair now reads its text through ModText.Get, and hover.json holds
50 texts in English and Italian.

The Aswid thralls and the Race Menu Ward wrote the use key as a literal
E; they now use $KEY_Use, which shows the key the player actually bound.
For that to work, ModText.Get runs a second localization pass when a $
is left in the result: Valheim resolves tokens once and never looks
inside what it inserted, and hover texts go to the HUD without another
pass.

The Sverm hive stage names stay English for now: the compendium and the
hive's goods show them too, and those come with the merchants step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kanym 2026-09-28 13:55:14 +02:00
commit 99a1817eb0
16 changed files with 164 additions and 79 deletions

View file

@ -440,13 +440,10 @@ namespace RacesOfValheim
{
Count(out int wolves, out int ulv, out int fenrir);
string body = $"meat {Mathf.Floor(GetFeed())}/{FenrirMangiatoia.TankCap}" +
$"\nwolves {wolves}/{WolfCap()}, ulv {ulv}/{UlvCap()}";
string body = ModText.Get("rov_hover_fenrir_meat_wolves_ulv", Mathf.Floor(GetFeed()), FenrirMangiatoia.TankCap, wolves, WolfCap(), ulv, UlvCap());
// Said in as many words, because the upgrade is deliberately invisible on the model.
body += IsUpgraded()
? $", fenrir {fenrir}/{FenrirCap()}"
: "\nthe blood is thin here - it raises no fenrir yet";
body += (IsUpgraded() ? ModText.Get("rov_hover_fenrir_fenrir", fenrir, FenrirCap()) : ModText.Get("rov_hover_fenrir_blood_thin_here_raises_no"));
if (m_waitingFor != null)
{
@ -458,16 +455,14 @@ namespace RacesOfValheim
: m_waitingFor == FenrirMangiatoia.KindUlv ? FenrirMangiatoia.UlvCost
: FenrirMangiatoia.FenrirCost;
body += GetFeed() < cost
? $"\nnot enough meat for the next one ({cost} needed)"
: $"\nnext in {Mathf.Max(1, Mathf.CeilToInt(wait - m_timer))}s";
body += (GetFeed() < cost ? ModText.Get("rov_hover_fenrir_not_enough_meat_next_one", cost) : ModText.Get("rov_hover_fenrir_next_s", Mathf.Max(1, Mathf.CeilToInt(wait - m_timer))));
}
else
{
body += "\nthe pack is whole";
body += ModText.Get("rov_hover_fenrir_pack_whole");
}
body += "\n[<color=yellow><b>$KEY_Use</b></color>] Fill it with meat";
body += ModText.Get("rov_hover_fenrir_fill_with_meat");
return Localization.instance.Localize($"{FenrirMangiatoia.PieceDisplayName} ({body})");
}