chore(release): v1.4.18 - Valheim hotfix flight fix, 1.0 shop fixes, Fenrir speed
Drake flight resolves ZInput.GetJoyLeftStickY at runtime, since the hotfix dropped its bool parameter. Faction merchant TradeItems now set the 1.0 fields StoreGui dereferences (m_tooltip, m_buyPlayerEffects), and the Dvergar trader discount clones the whole TradeItem instead of rebuilding four fields. Trol totem refusals return true so vanilla's $msg_cantuseon no longer covers them. The Fenrir curse speed modifier is the bonus alone (SE_Stats adds it), not 1 + bonus. New Discord link. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
8aa917cfcb
commit
c7cbd6bece
9 changed files with 59 additions and 17 deletions
|
|
@ -281,17 +281,19 @@ namespace RacesOfValheim
|
|||
{
|
||||
if (item == null) continue;
|
||||
|
||||
discounted.Add(new Trader.TradeItem
|
||||
{
|
||||
m_prefab = item.m_prefab,
|
||||
m_stack = item.m_stack,
|
||||
m_price = Mathf.Max(1, Mathf.RoundToInt(item.m_price * (1f - discount))),
|
||||
m_requiredGlobalKey = item.m_requiredGlobalKey
|
||||
});
|
||||
// A full copy, not a hand-picked one: Valheim 1.0 hangs name, tooltip, icon,
|
||||
// buy/increment keys and buy effects off TradeItem, and StoreGui reads some
|
||||
// of them without null checks. Only the price is ours to change.
|
||||
var copy = (Trader.TradeItem)MemberwiseCloneMethod.Invoke(item, null);
|
||||
copy.m_price = Mathf.Max(1, Mathf.RoundToInt(item.m_price * (1f - discount)));
|
||||
discounted.Add(copy);
|
||||
}
|
||||
|
||||
__result = discounted;
|
||||
}
|
||||
|
||||
private static readonly System.Reflection.MethodInfo MemberwiseCloneMethod =
|
||||
AccessTools.Method(typeof(object), "MemberwiseClone");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -52,6 +52,14 @@ namespace RacesOfValheim
|
|||
m_prefab = itemDrop,
|
||||
m_stack = 1,
|
||||
m_price = entry.Price,
|
||||
// Valheim 1.0 fields that StoreGui dereferences without a null check:
|
||||
// FillList reads m_tooltip.Length, BuySelectedItem calls
|
||||
// m_buyPlayerEffects.Create. Empty means "use the item's own".
|
||||
m_name = string.Empty,
|
||||
m_tooltip = string.Empty,
|
||||
m_buyKey = string.Empty,
|
||||
m_incrementKey = string.Empty,
|
||||
m_buyPlayerEffects = new EffectList(),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,9 @@ namespace RacesOfValheim
|
|||
int state = BossProgressionManager.GetCurrentProgressionState();
|
||||
|
||||
m_fallDamageModifier = FenrirProgression.GetFallDamageModifier(state);
|
||||
m_speedModifier = 1.0f + FenrirProgression.GetSpeedModifier(state);
|
||||
// SE_Stats.ModifySpeed adds baseSpeed * m_speedModifier, so this is the bonus alone:
|
||||
// 0 is vanilla speed, 0.03 is +3%. A leading 1.0f here was a flat +100%.
|
||||
m_speedModifier = FenrirProgression.GetSpeedModifier(state);
|
||||
m_jumpModifier = new Vector3(0, FenrirProgression.GetJumpModifier(state), 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "RacesOfValheim",
|
||||
"description": "A Valheim mod that adds ten custom playable races (Aswid, Draugh, Dvergar, Fenrir, Furling, Skadi, Skeleton, Sverm, Trenta, Trol) each with unique abilities, traits, race stations and a deep boss-driven progression system.",
|
||||
"version_number": "1.4.16",
|
||||
"version_number": "1.4.18",
|
||||
"website_url": "",
|
||||
"dependencies": [
|
||||
"denikson-BepInExPack_Valheim-5.4.2333",
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace RacesOfValheim
|
|||
{
|
||||
public const string PluginGUID = "com.nandor.racesofvalheim";
|
||||
public const string PluginName = "Races Of Valheim";
|
||||
public const string PluginVersion = "1.4.16";
|
||||
public const string PluginVersion = "1.4.18";
|
||||
|
||||
private readonly Harmony harmony = new Harmony(PluginGUID);
|
||||
|
||||
|
|
|
|||
|
|
@ -314,6 +314,23 @@ namespace RacesOfValheim
|
|||
/// </summary>
|
||||
public static bool Reversing { get; private set; }
|
||||
|
||||
// The September 2026 hotfix dropped the bool parameter from ZInput.GetJoyLeftStickY.
|
||||
// A direct call binds to whichever signature we compiled against and throws
|
||||
// MissingMethodException on the other, so resolve it at runtime and accept either.
|
||||
private static readonly MethodInfo JoyLeftStickYMethod =
|
||||
AccessTools.Method(typeof(ZInput), "GetJoyLeftStickY", new System.Type[0]) ??
|
||||
AccessTools.Method(typeof(ZInput), "GetJoyLeftStickY", new[] { typeof(bool) });
|
||||
|
||||
private static float JoyLeftStickY()
|
||||
{
|
||||
if (JoyLeftStickYMethod == null) return 0f;
|
||||
return (float)JoyLeftStickYMethod.Invoke(null, JoyLeftStickYArgs);
|
||||
}
|
||||
|
||||
// Old signature: pass smooth = true, which was its default.
|
||||
private static readonly object[] JoyLeftStickYArgs =
|
||||
JoyLeftStickYMethod != null && JoyLeftStickYMethod.GetParameters().Length == 1 ? new object[] { true } : null;
|
||||
|
||||
public static void Prefix(Character __instance, float dt)
|
||||
{
|
||||
if (__instance != Player.m_localPlayer) return;
|
||||
|
|
@ -332,7 +349,7 @@ namespace RacesOfValheim
|
|||
// PlayerController.FixedUpdate takes forward as the NEGATED GetJoyLeftStickY.
|
||||
// Flight only knows powered forward, reverse or neither, so the stick is a
|
||||
// threshold, not a throttle. Steering stays on the camera, i.e. the right stick.
|
||||
float stick = -ZInput.GetJoyLeftStickY();
|
||||
float stick = -JoyLeftStickY();
|
||||
bool forward = input && (Input.GetKey(KeyCode.W) || stick > StickThreshold);
|
||||
// Forward wins a W+S mash rather than the two cancelling into a dead hover.
|
||||
bool backward = input && !forward && (Input.GetKey(KeyCode.S) || stick < -StickThreshold);
|
||||
|
|
|
|||
|
|
@ -71,7 +71,9 @@ namespace RacesOfValheim
|
|||
if (!TrolRace.IsTrol())
|
||||
{
|
||||
player.Message(MessageHud.MessageType.Center, "The head will not shout for you.");
|
||||
return false;
|
||||
// With an item in hand, false makes Humanoid.UseItem cover this message with its
|
||||
// generic "$msg_cantuseon"; true tells it the use was handled here.
|
||||
return item != null;
|
||||
}
|
||||
|
||||
// Yagluth's drop in hand upgrades it: a new head, and two more warbands on the list.
|
||||
|
|
@ -83,24 +85,26 @@ namespace RacesOfValheim
|
|||
if (item != null)
|
||||
{
|
||||
player.Message(MessageHud.MessageType.Center, "$msg_wontwork");
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
return OpenStore(player);
|
||||
}
|
||||
|
||||
// Every refusal still returns true: this only runs from an item use, where false would
|
||||
// make Humanoid.UseItem replace our message with the generic "$msg_cantuseon".
|
||||
private bool TryUpgrade(Player player, ItemDrop.ItemData item)
|
||||
{
|
||||
if (IsUpgraded())
|
||||
{
|
||||
player.Message(MessageHud.MessageType.Center, "It has already had one.");
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (BossProgressionManager.GetCurrentProgressionState() < TrolTotem.UpgradeProgressionState)
|
||||
{
|
||||
player.Message(MessageHud.MessageType.Center, "Not until the one it belonged to has fallen.");
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
player.GetInventory().RemoveItem(item, 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue