feat(text): status effect names and tooltips come from translation files

Every status effect the mod registers now carries a $rov_se_ token instead
of English, and status_effects.json holds the texts in English and Italian.
Valheim localizes both fields itself when it shows them. The blood
potion's tooltip has numbers in it, so SE_BloodPotion fills its $1 and $2
in GetTooltipString, at display time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kanym 2026-09-26 19:51:10 +02:00
commit 9bf144aedc
16 changed files with 203 additions and 66 deletions

View file

@ -176,7 +176,7 @@ namespace RacesOfValheim
SE_BloodPotion effect = ScriptableObject.CreateInstance<SE_BloodPotion>();
effect.name = name;
effect.m_name = displayName;
effect.m_tooltip = $"Stomachs filled with blood. Healing {Mathf.RoundToInt(fraction * 100f)}% over {HealDuration:0} seconds.";
effect.m_tooltip = "$rov_se_aswid_bloodpotion_tooltip"; // numbers go in at display, see GetTooltipString
effect.m_ttl = HealDuration;
effect.m_healFraction = fraction;
effect.m_essencePrefab = essencePrefab;
@ -287,6 +287,19 @@ namespace RacesOfValheim
public float m_healFraction = 0.05f;
public string m_essencePrefab = "";
/// <summary>
/// The tooltip's $1 and $2 are the heal share and the duration. Filled in here, at display
/// time, because a translation can only be looked up once the language is loaded, and the
/// game localizes this string after us in a single pass that would leave $1 as it is.
/// </summary>
public override string GetTooltipString()
{
string text = base.GetTooltipString();
if (Localization.instance == null) return text;
return Localization.instance.Localize(text,
Mathf.RoundToInt(m_healFraction * 100f).ToString(), m_ttl.ToString("0"));
}
public override void Setup(Character character)
{
// SEMan clones the effect before setting it up, so writing the resolved amount here