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:
parent
594b333f68
commit
1bd09ed31d
13 changed files with 332 additions and 167 deletions
|
|
@ -51,10 +51,10 @@ namespace RacesOfValheim
|
|||
/// </summary>
|
||||
public static readonly List<Kind> Roster = new List<Kind>
|
||||
{
|
||||
new Kind { Id = "brood", Display = "Brood", Source = "SeekerBrood", Icon = "TrophySeeker", Price = 100f, Stage = 1, Cooldown = 60f },
|
||||
new Kind { Id = "seeker", Display = "Seeker", Source = "Seeker", Icon = "TrophySeeker", Price = 250f, Stage = 2, Cooldown = 150f },
|
||||
new Kind { Id = "soldier", Display = "Soldier", Source = "SeekerBrute", Icon = "TrophySeekerBrute", Price = 500f, Stage = 3, Cooldown = 300f },
|
||||
new Kind { Id = "gjall", Display = "Gjall", Source = "Gjall", Icon = "TrophyGjall", Price = 1000f, Stage = 4, Cooldown = 600f, SpawnHeight = 10f },
|
||||
new Kind { Id = "brood", Display = "$rov_troop_sverm_brood", Source = "SeekerBrood", Icon = "TrophySeeker", Price = 100f, Stage = 1, Cooldown = 60f },
|
||||
new Kind { Id = "seeker", Display = "$rov_troop_sverm_seeker", Source = "Seeker", Icon = "TrophySeeker", Price = 250f, Stage = 2, Cooldown = 150f },
|
||||
new Kind { Id = "soldier", Display = "$rov_troop_sverm_soldier", Source = "SeekerBrute", Icon = "TrophySeekerBrute", Price = 500f, Stage = 3, Cooldown = 300f },
|
||||
new Kind { Id = "gjall", Display = "$rov_troop_sverm_gjall", Source = "Gjall", Icon = "TrophyGjall", Price = 1000f, Stage = 4, Cooldown = 600f, SpawnHeight = 10f },
|
||||
};
|
||||
|
||||
private static int CapOf(string id)
|
||||
|
|
|
|||
|
|
@ -468,7 +468,7 @@ namespace RacesOfValheim
|
|||
// serialised m_hoverOffset, which is 0 unless the prefab sets one, so 0 is vanilla behaviour.
|
||||
public float GetHoverOffset() => 0f;
|
||||
|
||||
public string GetHoverName() => SvermHiveStage.NameOf(SvermHiveStage.Of(transform));
|
||||
public string GetHoverName() => Localization.instance.Localize(SvermHiveStage.NameOf(SvermHiveStage.Of(transform)));
|
||||
|
||||
private ZNetView nview;
|
||||
private float nextSweep;
|
||||
|
|
|
|||
|
|
@ -68,13 +68,11 @@ namespace RacesOfValheim
|
|||
StageUpgrade(3, "TrophySeekerBrute"),
|
||||
StageUpgrade(4, "TrophySeekerQueen"),
|
||||
|
||||
Star(1, "Surrenal Glands", 800f, "TrophySeeker",
|
||||
"Every troop hatched from now on is born with one star.\n\n" +
|
||||
"It does nothing for the ones already walking around: what is born is born."),
|
||||
Star(1, ModText.Get("rov_sverm_good_glands_name"), 800f, "TrophySeeker",
|
||||
ModText.Get("rov_sverm_good_glands_desc")),
|
||||
|
||||
Star(2, "Hyperplasia", 1600f, "TrophySeekerQueen",
|
||||
"Every troop hatched from now on is born with two stars.\n\n" +
|
||||
"The colony has to have grown the glands first."),
|
||||
Star(2, ModText.Get("rov_sverm_good_hyperplasia_name"), 1600f, "TrophySeekerQueen",
|
||||
ModText.Get("rov_sverm_good_hyperplasia_desc")),
|
||||
};
|
||||
|
||||
foreach (SvermBrood.Kind kind in SvermBrood.Roster) shelf.Add(Troop(kind));
|
||||
|
|
@ -94,23 +92,20 @@ namespace RacesOfValheim
|
|||
return new Good
|
||||
{
|
||||
Id = "blistertick",
|
||||
Name = SvermBlisterTick.DisplayName,
|
||||
Name = Localization.instance.Localize(SvermBlisterTick.DisplayName),
|
||||
Price = SvermConfig.TickPrice,
|
||||
Icon = "TrophyTick",
|
||||
Description = "Buys a PERMANENT slot in the colony. What stands in it runs at whatever " +
|
||||
"the colony is fighting and bursts, and thirty seconds later the nest " +
|
||||
"grows another one - no egg, no biomass, forever.\n\n" +
|
||||
"The blast spares you, your tames and the rest of the colony.",
|
||||
Description = ModText.Get("rov_sverm_good_tick_desc"),
|
||||
|
||||
Refusal = hive =>
|
||||
{
|
||||
int slots = SvermBlisterTick.SlotsOf(hive.transform);
|
||||
if (slots >= SvermConfigManagement.BlisterTick)
|
||||
{
|
||||
return $"The colony already keeps {slots} of them.";
|
||||
return ModText.Get("rov_sverm_refusal_keeps", slots);
|
||||
}
|
||||
|
||||
if (SvermBroodEggs.Count(hive.transform) < 1) return "No brood egg ready.";
|
||||
if (SvermBroodEggs.Count(hive.transform) < 1) return ModText.Get("rov_sverm_refusal_no_egg");
|
||||
|
||||
return null;
|
||||
},
|
||||
|
|
@ -143,20 +138,17 @@ namespace RacesOfValheim
|
|||
return new Good
|
||||
{
|
||||
Id = "stage" + target,
|
||||
Name = SvermHiveStage.NameOf(target),
|
||||
Name = Localization.instance.Localize(SvermHiveStage.NameOf(target)),
|
||||
Price = SvermHiveStage.PriceToLeave(from),
|
||||
Icon = icon,
|
||||
Description = $"Grows the nest into a {SvermHiveStage.NameOf(target)}: it holds " +
|
||||
$"{SvermHiveStage.Capacity(target):0} biomass instead of " +
|
||||
$"{SvermHiveStage.Capacity(from):0}, and stands half again as tall.\n\n" +
|
||||
"It costs this stage's whole tankful, so it leaves the hive all but " +
|
||||
"empty. Grow or field an army - never both in the same breath.",
|
||||
Description = ModText.Get("rov_sverm_good_stage_desc", SvermHiveStage.NameOf(target),
|
||||
SvermHiveStage.Capacity(target).ToString("0"), SvermHiveStage.Capacity(from).ToString("0")),
|
||||
|
||||
Refusal = hive =>
|
||||
{
|
||||
int stage = SvermHiveStage.Of(hive.transform);
|
||||
if (stage > from) return "Already grown past this.";
|
||||
if (stage < from) return $"The nest has to be a {SvermHiveStage.NameOf(from)} first.";
|
||||
if (stage > from) return ModText.Get("rov_sverm_refusal_grown_past");
|
||||
if (stage < from) return ModText.Get("rov_sverm_refusal_stage_first", SvermHiveStage.NameOf(from));
|
||||
return null;
|
||||
},
|
||||
|
||||
|
|
@ -187,8 +179,8 @@ namespace RacesOfValheim
|
|||
Refusal = hive =>
|
||||
{
|
||||
int have = SvermBroodStars.Of(hive.transform);
|
||||
if (have >= stars) return "The colony already breeds like this.";
|
||||
if (have < stars - 1) return "One star at a time.";
|
||||
if (have >= stars) return ModText.Get("rov_sverm_refusal_already_breeds");
|
||||
if (have < stars - 1) return ModText.Get("rov_sverm_refusal_one_star");
|
||||
return null;
|
||||
},
|
||||
|
||||
|
|
@ -208,25 +200,23 @@ namespace RacesOfValheim
|
|||
return new Good
|
||||
{
|
||||
Id = "troop_" + kind.Id,
|
||||
Name = kind.Display,
|
||||
Name = Localization.instance.Localize(kind.Display),
|
||||
Price = kind.Price,
|
||||
Icon = kind.Icon,
|
||||
Description = $"Hatches a {kind.Display}, bound to this nest: it follows when you ask, " +
|
||||
$"walks home when you let it go, and mends itself.\n\n" +
|
||||
$"Costs one brood egg as well as the biomass. At most {kind.Cap} of them alive at once.",
|
||||
Description = ModText.Get("rov_sverm_good_troop_desc", kind.Display, kind.Cap),
|
||||
|
||||
Refusal = hive =>
|
||||
{
|
||||
int stage = SvermHiveStage.Of(hive.transform);
|
||||
if (stage < kind.Stage)
|
||||
{
|
||||
return $"The nest has to be a {SvermHiveStage.NameOf(kind.Stage)} first.";
|
||||
return ModText.Get("rov_sverm_refusal_stage_first", SvermHiveStage.NameOf(kind.Stage));
|
||||
}
|
||||
|
||||
int alive = SvermBrood.CountAlive(hive, kind);
|
||||
if (alive >= kind.Cap) return $"The colony is already keeping {alive} of them.";
|
||||
if (alive >= kind.Cap) return ModText.Get("rov_sverm_refusal_keeping", alive);
|
||||
|
||||
if (SvermBroodEggs.Count(hive.transform) < 1) return "No brood egg ready.";
|
||||
if (SvermBroodEggs.Count(hive.transform) < 1) return ModText.Get("rov_sverm_refusal_no_egg");
|
||||
|
||||
return null;
|
||||
},
|
||||
|
|
@ -265,7 +255,7 @@ namespace RacesOfValheim
|
|||
/// </summary>
|
||||
public static string RefusalFor(Good good, SvermHiveBehaviour hive)
|
||||
{
|
||||
if (good == null || hive == null) return "No hive.";
|
||||
if (good == null || hive == null) return ModText.Get("rov_sverm_refusal_no_hive");
|
||||
|
||||
string ownRefusal = good.Refusal != null ? good.Refusal(hive) : null;
|
||||
if (ownRefusal != null) return ownRefusal;
|
||||
|
|
@ -274,11 +264,11 @@ namespace RacesOfValheim
|
|||
if (waitingSeconds > 0L)
|
||||
{
|
||||
return waitingSeconds >= 60L
|
||||
? $"The hive is still working on the last one ({waitingSeconds / 60}m)."
|
||||
: $"The hive is still working on the last one ({waitingSeconds}s).";
|
||||
? ModText.Get("rov_sverm_refusal_working_m", waitingSeconds / 60)
|
||||
: ModText.Get("rov_sverm_refusal_working_s", waitingSeconds);
|
||||
}
|
||||
|
||||
if (SvermBiomass.Bank(hive.transform) < good.Price) return "Not enough biomass in the bank.";
|
||||
if (SvermBiomass.Bank(hive.transform) < good.Price) return ModText.Get("rov_msg_sverm_not_enough_biomass_bank");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,12 +27,13 @@ namespace RacesOfValheim
|
|||
public const int Last = 4;
|
||||
|
||||
/// <summary>The four names from section 2. The piece is registered under the first one.</summary>
|
||||
/// Translation tokens, not text: localize them wherever they are shown.
|
||||
public static readonly string[] Names =
|
||||
{
|
||||
"Brood Mound",
|
||||
"Gorged Hive",
|
||||
"Nesting Spire",
|
||||
"Hive Citadel",
|
||||
"$rov_piece_sverm_broodmound_name",
|
||||
"$rov_sverm_stage_gorgedhive",
|
||||
"$rov_sverm_stage_nestingspire",
|
||||
"$rov_sverm_stage_hivecitadel",
|
||||
};
|
||||
|
||||
public static int Of(Transform nest)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue