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:
parent
19d7cbacbd
commit
99a1817eb0
16 changed files with 164 additions and 79 deletions
|
|
@ -277,16 +277,16 @@ namespace RacesOfValheim
|
|||
|
||||
private string Hover()
|
||||
{
|
||||
string body = $"contracts {CountGroups()}/{DvergarBanco.MaxTroops}";
|
||||
string body = ModText.Get("rov_hover_dvergar_contracts", CountGroups(), DvergarBanco.MaxTroops);
|
||||
|
||||
// Said in as many words: a player who cannot see their own discount will read the lower
|
||||
// number in the window as a mistake.
|
||||
float discount = Mathf.Clamp01(DvergarProgression.Current.TraderBuyDiscount);
|
||||
if (discount > 0f) body += $"\nyour seal is worth {Mathf.RoundToInt(discount * 100f)}% off";
|
||||
if (discount > 0f) body += ModText.Get("rov_hover_dvergar_seal_worth_off", Mathf.RoundToInt(discount * 100f));
|
||||
|
||||
if (!IsUpgraded()) body += "\n(what the Queen left behind buys two more crews)";
|
||||
if (!IsUpgraded()) body += ModText.Get("rov_hover_dvergar_what_queen_left_behind_buys");
|
||||
|
||||
body += "\n[<color=yellow><b>$KEY_Use</b></color>] Read the ledger";
|
||||
body += ModText.Get("rov_hover_dvergar_read_ledger");
|
||||
|
||||
return Localization.instance.Localize($"{DvergarBanco.PieceDisplayName} ({body})");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,14 +252,12 @@ namespace RacesOfValheim
|
|||
string body;
|
||||
if (doses <= 0 || string.IsNullOrEmpty(brew))
|
||||
{
|
||||
body = "empty\n[<color=yellow><b>$KEY_Use</b></color>] Pour a brew in";
|
||||
body = ModText.Get("rov_hover_dvergar_empty_pour_brew");
|
||||
}
|
||||
else
|
||||
{
|
||||
int waiting = InRange().Count;
|
||||
body = $"{DvergarBotte.BrewDisplayName(brew)} {doses}/{DvergarBotte.MaxDoses}" +
|
||||
$"\n{waiting} at the barrel" +
|
||||
$"\n[<color=yellow><b>$KEY_Use</b></color>] Pour a round";
|
||||
body = ModText.Get("rov_hover_dvergar_at_barrel_pour_round", DvergarBotte.BrewDisplayName(brew), doses, DvergarBotte.MaxDoses, waiting);
|
||||
}
|
||||
|
||||
return Localization.instance.Localize($"{DvergarBotte.PieceDisplayName} ({body})");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue