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:
parent
c055455027
commit
9bf144aedc
16 changed files with 203 additions and 66 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -502,9 +502,9 @@ namespace RacesOfValheim
|
|||
__instance.m_icon = null;
|
||||
}
|
||||
|
||||
__instance.m_name = "Night Aura";
|
||||
__instance.m_name = "$rov_se_aswid_nightaura_name";
|
||||
__instance.m_startMessage = ""; // "The darkness empowers you.";
|
||||
__instance.m_tooltip = "The cold strengthens your beastly senses.";
|
||||
__instance.m_tooltip = "$rov_se_aswid_nightaura_tooltip";
|
||||
|
||||
if (__instance is SE_Stats stats)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ namespace RacesOfValheim
|
|||
{
|
||||
base.Setup(character);
|
||||
name = "SE_AswidStats";
|
||||
m_name = "Benedictus et Afflictus";
|
||||
m_tooltip = "Vampiric senses and life drain.";
|
||||
m_name = "$rov_se_aswid_stats_name";
|
||||
m_tooltip = "$rov_se_aswid_stats_tooltip";
|
||||
}
|
||||
|
||||
public void UpdateStats(int state)
|
||||
|
|
@ -59,8 +59,8 @@ namespace RacesOfValheim
|
|||
{
|
||||
base.Setup(character);
|
||||
name = "SE_BatForm";
|
||||
m_name = "Like a Bat out of Hell";
|
||||
m_tooltip = "You have taken the form of a Bat. You can fly, but cannot attack.";
|
||||
m_name = "$rov_se_aswid_batform_name";
|
||||
m_tooltip = "$rov_se_aswid_batform_tooltip";
|
||||
m_fallDamageModifier = -1f; // Immune to fall damage just in case
|
||||
}
|
||||
}
|
||||
|
|
@ -71,8 +71,8 @@ namespace RacesOfValheim
|
|||
{
|
||||
base.Setup(character);
|
||||
name = "SE_MistForm";
|
||||
m_name = "Weight of Shadows";
|
||||
m_tooltip = "You are mist. Immune to physical damage and poison. Cannot attack or run.";
|
||||
m_name = "$rov_se_aswid_mistform_name";
|
||||
m_tooltip = "$rov_se_aswid_mistform_tooltip";
|
||||
m_fallDamageModifier = -1f;
|
||||
m_mods = new System.Collections.Generic.List<HitData.DamageModPair>
|
||||
{
|
||||
|
|
@ -90,7 +90,7 @@ namespace RacesOfValheim
|
|||
{
|
||||
base.Setup(character);
|
||||
name = "SE_AswidSensesMark";
|
||||
m_name = "Sensed";
|
||||
m_name = "$rov_se_aswid_sensed_name";
|
||||
m_tooltip = "";
|
||||
m_ttl = 2f;
|
||||
m_icon = null; // No icon needed for mobs
|
||||
|
|
@ -103,8 +103,8 @@ namespace RacesOfValheim
|
|||
{
|
||||
base.Setup(character);
|
||||
name = "SE_SuperhumanSenses";
|
||||
m_name = "Auspex";
|
||||
m_tooltip = "Sensing life force of nearby creatures.";
|
||||
m_name = "$rov_se_aswid_auspex_name";
|
||||
m_tooltip = "$rov_se_aswid_auspex_tooltip";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ namespace RacesOfValheim
|
|||
|
||||
var sensesMark = ScriptableObject.CreateInstance<SE_AswidSensesMark>();
|
||||
sensesMark.name = "SE_AswidSensesMark";
|
||||
sensesMark.m_name = "Sensed";
|
||||
sensesMark.m_name = "$rov_se_aswid_sensed_name";
|
||||
sensesMark.m_ttl = 2f;
|
||||
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(sensesMark, fixReference: false));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue