diff --git a/JotunnModStub/Package/manifest.json b/JotunnModStub/Package/manifest.json index 2ea7b24..7ae2ba9 100644 --- a/JotunnModStub/Package/manifest.json +++ b/JotunnModStub/Package/manifest.json @@ -1,7 +1,7 @@ { "name": "RacesOfValheim", "description": "A Valheim mod that adds nine custom playable races (Aswid, Draugh, Dvergar, Fenrir, Furling, Skadi, Skeleton, Trenta, Trol) each with unique abilities, traits, and a deep boss-driven progression system.", - "version_number": "1.3.12", + "version_number": "1.4.0", "website_url": "", "dependencies": [ "denikson-BepInExPack_Valheim-5.4.2333", diff --git a/JotunnModStub/RacesOfValheim.cs b/JotunnModStub/RacesOfValheim.cs index 09d87f8..f39e47e 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.3.12"; + public const string PluginVersion = "1.4.0"; private readonly Harmony harmony = new Harmony(PluginGUID); diff --git a/JotunnModStub/Trol/TrolConfig.cs b/JotunnModStub/Trol/TrolConfig.cs index de2c18e..ab70e87 100644 --- a/JotunnModStub/Trol/TrolConfig.cs +++ b/JotunnModStub/Trol/TrolConfig.cs @@ -22,6 +22,7 @@ namespace RacesOfValheim // ─── Keybinds ────────────────────────────────────────────────────────── public static ConfigEntry ThrowRockKey; public static ConfigEntry TrueFormKey; + public static ConfigEntry GrabLogKey; // ─── Passive combat ────────────────────────────────────────────────── public static ConfigEntry FireWeaknessMultiplier; @@ -65,6 +66,8 @@ namespace RacesOfValheim new ConfigDescription("Throws a rock (or the log you're holding), tier 3+.")); TrueFormKey = config.Bind(keybinds, "True Form", new KeyboardShortcut(KeyCode.H), new ConfigDescription("Transform into (or revert from) True Form, tier 5+.")); + GrabLogKey = config.Bind(keybinds, "Grab Log", new KeyboardShortcut(KeyCode.E), + new ConfigDescription("Grabs a felled log as a weapon while looking at one, tier 7+ and already in True Form. Matches vanilla's own interact key rather than reusing the True Form key a second time.")); const string combat = "Trol - Passive Combat"; FireWeaknessMultiplier = config.Bind(combat, "Fire Weakness Multiplier", 1.5f, diff --git a/JotunnModStub/Trol/TrolLogWeapon.cs b/JotunnModStub/Trol/TrolLogWeapon.cs index 97fcbf8..34b55a4 100644 --- a/JotunnModStub/Trol/TrolLogWeapon.cs +++ b/JotunnModStub/Trol/TrolLogWeapon.cs @@ -94,4 +94,35 @@ namespace RacesOfValheim } } } + + /// + /// A fallen log already shows a hover prompt in vanilla - its own name, via a HoverText + /// component vanilla itself attaches (confirmed live: GetComponentInParent<Hoverable>() + /// on a log resolves to HoverText, not TreeLog itself, which only implements IDestructible). + /// A first attempt added a second, competing Hoverable component to the same GameObject and + /// it was never reached - Unity's GetComponentInParent<T>() returns only the first + /// match, and vanilla's own HoverText was already there first. The fix is to append to + /// HoverText's own result instead of trying to out-compete it. + /// + [HarmonyPatch(typeof(HoverText), "GetHoverText")] + public static class Trol_LogHoverText_Patch + { + public static void Postfix(HoverText __instance, ref string __result) + { + if (Player.m_localPlayer == null || !TrolRace.IsTrol()) return; + if (BossProgressionManager.GetCurrentProgressionState() < 7) return; + if (!Player.m_localPlayer.GetSEMan().HaveStatusEffect("SE_TrolTrueForm".GetStableHashCode())) return; + + TreeLog log = ((Component)__instance).GetComponentInParent(); + if (log == null) return; + + // Already holding a log - grabbing again is a no-op in TrolLogWeapon.GrabLog, so no + // prompt either. + ItemDrop.ItemData rightItem = HarmonyLib.Traverse.Create(Player.m_localPlayer).Field("m_rightItem").Value; + if (rightItem != null && rightItem.m_dropPrefab != null && rightItem.m_dropPrefab.name.StartsWith("TrolWeapon_")) return; + + string key = TrolConfig.GrabLogKey.Value.MainKey.ToString(); + __result += $"\n[{key}] Grab Log"; + } + } } diff --git a/JotunnModStub/Trol/TrolRace.cs b/JotunnModStub/Trol/TrolRace.cs index a132bc8..edb3439 100644 --- a/JotunnModStub/Trol/TrolRace.cs +++ b/JotunnModStub/Trol/TrolRace.cs @@ -130,6 +130,11 @@ namespace RacesOfValheim { TryTrueForm(); } + + if (TrolConfig.GrabLogKey.Value.IsDown()) + { + TryGrabLog(); + } } // Check log durability @@ -176,18 +181,9 @@ namespace RacesOfValheim if (Player.m_localPlayer.GetSEMan().HaveStatusEffect("SE_TrolTrueForm".GetStableHashCode())) { - if (BossProgressionManager.GetCurrentProgressionState() >= 7) - { - GameObject hoverObj = Player.m_localPlayer.GetHoverObject(); - if (hoverObj != null) - { - TreeLog log = hoverObj.GetComponentInParent(); - if (log != null) - { - TrolLogWeapon.GrabLog(Player.m_localPlayer, log); - } - } - } + // Grabbing a log now has its own key (TrolConfig.GrabLogKey, see TryGrabLog) - + // pressing True Form again while already transformed no longer tries to grab + // whatever you happen to be looking at. return; } @@ -205,6 +201,21 @@ namespace RacesOfValheim } } + private void TryGrabLog() + { + if (BossProgressionManager.GetCurrentProgressionState() < 7) return; + if (!Player.m_localPlayer.GetSEMan().HaveStatusEffect("SE_TrolTrueForm".GetStableHashCode())) return; + + GameObject hoverObj = Player.m_localPlayer.GetHoverObject(); + if (hoverObj == null) return; + + TreeLog log = hoverObj.GetComponentInParent(); + if (log != null) + { + TrolLogWeapon.GrabLog(Player.m_localPlayer, log); + } + } + private System.Collections.IEnumerator TransformToTrueFormRoutine() { isTransforming = true; diff --git a/README.md b/README.md index 10a993b..67cc45a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A comprehensive Valheim mod that allows you to play as different unique races, e ## Features -This mod currently introduces 8 custom races: +This mod currently introduces 9 custom races: ### 1. Skeleton - **Stamina-less Combat**: Skeletons do not consume stamina and do not use the stamina bar. @@ -173,6 +173,20 @@ stored on your character and travels with you between servers). In personal mode boss's secondary drop to the ward - Hard Antler, Crypt Key, Wishbone, Dragon Tear, Yagluth's thing, the Queen's carapace, Fader's relic - to claim that boss's tier. +## Factions + +Every race is grouped into one of three factions, alongside a handful of vanilla creatures. +None of your faction's mobs will attack you first, and several of them go a step further: +approach one and press **E** to trade. Buy price and sell price are always the same, so +nothing is a loss to sell back. + +- **Black Forest** - Trenta, Trol, Furling: at peace with Greydwarves (and their Elite and + Shaman kin), Fuling, Goblin Brute, Goblin Shaman, and Troll. +- **Mountain** - Skadi, Fenrir, Dvergar: at peace with the Drake, Wolf, Ulv, Fenring (and its + Cultists), and every Dverger. +- **Swamp** - Aswid, Draugh, Skeleton: at peace with Ghosts, Skeletons, Draugr, Wraiths, + Leeches, Abominations, and Blobs. + ## Development & Feedback This is a stable release of Races of Valheim, but the mod is actively in development! We plan to add more races, gameplay elements, and refine the mechanics in future updates. @@ -181,6 +195,15 @@ Please write to us on my Discord server: **https://discord.gg/gbBEK2VTE** ## Changelog +**v1.4.0** +- **NEW - Factions**: Every race now has peace with a slice of vanilla's hostile roster, grouped into three factions - Black Forest (Trenta, Trol, Furling: Greydwarves, Fuling, Goblin Brute/Shaman, Troll), Mountain (Skadi, Fenrir, Dvergar: Drake, Wolf, Ulv, Fenring/Cultist, Dverger), and Swamp (Aswid, Draugh, Skeleton: Ghost, Skeleton, Draugr, Wraith, Leech, Abomination, Blob). Several of those mobs also talk and trade now - approach one with your matching race and it opens a shop instead of attacking, buying and selling at the same price. +- **NEW - Configuration Manager for every race**: every ability number, cooldown and keybind across all nine races can now be retuned from BepInEx's Configuration Manager, organized into per-topic sections (Keybinds first, then Passive Combat, then the rest), or by hand-editing the .cfg file it generates. +- **Trol**: Grabbing a felled log as a True Form weapon (tier 7+) has its own keybind now (default **E**) instead of piggybacking on the True Form key a second time, and shows a proper crosshair prompt - **[E] Grab Log** - so it's no longer a hidden mechanic with no on-screen hint. +- **Dvergar**: Eyes finally glow - a cold teal-blue that shifts to a starred creature's own colours once you're strong enough to earn them. +- **Aswid**: Eyes glow an evil red, the way the compendium always described them. +- **Skeleton**: Fixed a bug where a helmet or beard could stay visible even while the race's own head-hiding was active. +- **Skeleton**: Your chosen race now shows correctly on the main-menu character preview. + **v1.3.12** - **Skadi**: Dragon flight reworked. The stasis that holds a form level after you stop powering now lasts 5 seconds instead of 2. Hold Shift with W to spend 15 stamina a second on a burst of speed - the only part of flight that costs anything, since the drake arrives at The Elder long before you could pay just to stay airborne, and running dry drops you back to normal speed rather than out of the sky. S beats backwards along your aim, pitch included: look down and press it to rise away from whatever you are watching, without turning to face away from it. - **Skadi**: Water is no longer a trap. A flying form beats its way back out of the sea instead of paddling on the surface until it finds land. Valheim hands a swimming character to its swimming code before it ever asks whether they are flying, which is why the Aswid's bat could always take off from water and Moder never could. diff --git a/manifest.json b/manifest.json index 2ea7b24..7ae2ba9 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "RacesOfValheim", "description": "A Valheim mod that adds nine custom playable races (Aswid, Draugh, Dvergar, Fenrir, Furling, Skadi, Skeleton, Trenta, Trol) each with unique abilities, traits, and a deep boss-driven progression system.", - "version_number": "1.3.12", + "version_number": "1.4.0", "website_url": "", "dependencies": [ "denikson-BepInExPack_Valheim-5.4.2333",