From c7cbd6bece39acd153c22e9edefbc123ea161377 Mon Sep 17 00:00:00 2001 From: Ferdinando Date: Fri, 18 Sep 2026 17:10:24 +0200 Subject: [PATCH] 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 --- JotunnModStub/Dvergar/DvergarPatches.cs | 16 +++++++++------- .../Factions/FactionMerchantSetup.cs | 8 ++++++++ JotunnModStub/Fenrir/FenrirStatusEffects.cs | 4 +++- JotunnModStub/Package/manifest.json | 2 +- JotunnModStub/RacesOfValheim.cs | 2 +- JotunnModStub/Skadi/SkadiPatches.cs | 19 ++++++++++++++++++- JotunnModStub/Trol/TrolTotemBehaviour.cs | 12 ++++++++---- README.md | 11 ++++++++++- manifest.json | 2 +- 9 files changed, 59 insertions(+), 17 deletions(-) diff --git a/JotunnModStub/Dvergar/DvergarPatches.cs b/JotunnModStub/Dvergar/DvergarPatches.cs index 430ff2d..6de3f31 100644 --- a/JotunnModStub/Dvergar/DvergarPatches.cs +++ b/JotunnModStub/Dvergar/DvergarPatches.cs @@ -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"); } /// diff --git a/JotunnModStub/Factions/FactionMerchantSetup.cs b/JotunnModStub/Factions/FactionMerchantSetup.cs index cab0e4b..abe283a 100644 --- a/JotunnModStub/Factions/FactionMerchantSetup.cs +++ b/JotunnModStub/Factions/FactionMerchantSetup.cs @@ -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(), }); } diff --git a/JotunnModStub/Fenrir/FenrirStatusEffects.cs b/JotunnModStub/Fenrir/FenrirStatusEffects.cs index eab5005..b519103 100644 --- a/JotunnModStub/Fenrir/FenrirStatusEffects.cs +++ b/JotunnModStub/Fenrir/FenrirStatusEffects.cs @@ -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); } } diff --git a/JotunnModStub/Package/manifest.json b/JotunnModStub/Package/manifest.json index 7d0605c..fe12525 100644 --- a/JotunnModStub/Package/manifest.json +++ b/JotunnModStub/Package/manifest.json @@ -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", diff --git a/JotunnModStub/RacesOfValheim.cs b/JotunnModStub/RacesOfValheim.cs index 3872a0d..2cf0c9f 100644 --- a/JotunnModStub/RacesOfValheim.cs +++ b/JotunnModStub/RacesOfValheim.cs @@ -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); diff --git a/JotunnModStub/Skadi/SkadiPatches.cs b/JotunnModStub/Skadi/SkadiPatches.cs index 482dad4..6db166c 100644 --- a/JotunnModStub/Skadi/SkadiPatches.cs +++ b/JotunnModStub/Skadi/SkadiPatches.cs @@ -314,6 +314,23 @@ namespace RacesOfValheim /// 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); diff --git a/JotunnModStub/Trol/TrolTotemBehaviour.cs b/JotunnModStub/Trol/TrolTotemBehaviour.cs index c3ab254..4543646 100644 --- a/JotunnModStub/Trol/TrolTotemBehaviour.cs +++ b/JotunnModStub/Trol/TrolTotemBehaviour.cs @@ -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); diff --git a/README.md b/README.md index c78db3e..56c3a61 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ A comprehensive Valheim mod allowing you to play as unique races, each providing ## Development & Feedback This is a stable release, but more races and refinements are planned! -Bug reports, feedback, ideas: [https://discord.gg/gbBEK2VTE](https://discord.gg/gbBEK2VTE) +Bug reports, feedback, ideas: [https://discord.gg/jJzuKBZNC](https://discord.gg/jJzuKBZNC) Support the mod: [Patreon — NandorTheModder](https://www.patreon.com/c/NandorTheModder) --- @@ -410,6 +410,15 @@ Both halves have an off switch under `Factions` in Configuration Manager: **Fact ## Changelog +### v1.4.18 +- **Fix - Drake flight stopped working after the latest Valheim hotfix:** the hotfix changed how the game reads the gamepad's left stick, and the drake's flight still asked for it the old way. Every frame in the air threw a `MissingMethodException` into the log and the drake could not fly. Flight now works on both the new and the old version of the game. +- **Fix - Faction merchants would not open their shop:** Valheim 1.0 added a name, tooltip, buy effects and unlock keys to every shop item, and the shop window reads some of them without checking they are there. The merchants' goods were missing them, so pressing E threw a `NullReferenceException` and nothing opened. Buying is covered too — it would have hit the same wall on the buy effects. Thanks to the tester who tracked this down. +- **Fix - Haldor and Hildir's Dvergar discount broke their shops:** the discounted copies of their goods were rebuilt with only the old fields, so a Dvergar hit the same shop error, and items that unlock something when bought (like Haldor's extra inventory row) lost what they unlock. The discount now copies the whole item and changes only the price. +- **Fix - The Trol totem's own messages were replaced by "Can't use X on Y":** using Yagluth's drop on a totem that already has one, or before Yagluth has fallen, or using any other item on it, now shows the totem's message instead of the generic one. Thanks to the tester who spotted it. +- **Fix - The Fenrir was 100% faster than intended:** the curse's speed bonus was applied as a multiplier on top of normal speed instead of as a bonus, so every Fenrir moved at double speed plus the bonus (103% faster after one boss instead of 3%). It is now the +3% per boss the race has always listed. +- **Changed - New Discord link:** [https://discord.gg/jJzuKBZNC](https://discord.gg/jJzuKBZNC). +- 1.4.17 was 1.4.16 republished on Thunderstore with only the version number changed; there is no separate 1.4.17 changelog. + ### v1.4.16 - **CHANGED - The Trol's True Form no longer runs out after Fader:** once Fader is defeated the form lasts until you press the True Form key again, and there is no cooldown — reverting is a choice there, not the form running out. Before Fader nothing changes: it lasts `Duration` seconds and then the cooldown applies. The radial menu entry presses the same key, so it is a toggle from the gamepad too. A form already running when Fader falls keeps its old duration; the next one is permanent. - **CHANGED - The Trol's thrown log is a Gammeltroll log:** in True Form the log you throw is now one of the projectiles the Gammeltroll (Valheim 1.0) fires in a rose, just one instead of the whole spread. It is read off the monster's own weapons at runtime rather than by a hard-coded name. It hits exactly as hard as a True Form rock, with the same `Throw Rock` bonuses from Bonemass and Yagluth, and it no longer breaks into wood. If the projectile can't be found, the old physical log is thrown instead and a warning goes to the log. `dumpgammel` in the console shows what was found. diff --git a/manifest.json b/manifest.json index 7d0605c..fe12525 100644 --- a/manifest.json +++ b/manifest.json @@ -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",