diff --git a/MxValheim/MxValheim.cs b/MxValheim/MxValheim.cs index da66742..401de05 100644 --- a/MxValheim/MxValheim.cs +++ b/MxValheim/MxValheim.cs @@ -9,10 +9,12 @@ public class MxValheimMod : BaseUnityPlugin { private const string ModGUID = "ovh.mxdev.mxvalheim"; private const string ModName = "MxValheim"; - private const string ModVersion = "1.1.0"; + private const string ModVersion = "1.2.0"; public static ConfigEntry OreMultiplier; public static ConfigEntry rangeMultiplier; + public static ConfigEntry bowDrawSpeedBonusPerLevel; + public static ConfigEntry rainDamage; // Set your multiplier here public static int Multiplier = 3; @@ -21,6 +23,8 @@ public class MxValheimMod : BaseUnityPlugin { OreMultiplier = Config.Bind("General","OreMultiplier",3,"How many items should drop for every 1 ore/scrap found."); rangeMultiplier = Config.Bind("General", "CraftingRangeMultiplier",2.0f,"Multiplier for the workbench build/crafting range. Default is 2x."); + bowDrawSpeedBonusPerLevel = Config.Bind("General", "BowDrawSpeedBonusPercentPerLevel", 0.20f, "Shorten the bow draw speed by this percent for every bow upgrade level."); + rainDamage = Config.Bind("General", "RainDamage", true, "Set to true to stop rain damage, false to return to vanilla behavior."); Harmony harmony = new Harmony(ModGUID); harmony.PatchAll(); diff --git a/MxValheim/MxValheim.csproj b/MxValheim/MxValheim.csproj index c2948fe..760ed94 100644 --- a/MxValheim/MxValheim.csproj +++ b/MxValheim/MxValheim.csproj @@ -34,6 +34,9 @@ E:\SteamLibrary\steamapps\common\Valheim\BepInEx\core\0Harmony.dll + + E:\SteamLibrary\steamapps\common\Valheim\Valheim_Data\Managed\Assembly-CSharp-publicized.dll + E:\SteamLibrary\steamapps\common\Valheim\Valheim_Data\Managed\assembly_valheim.dll @@ -61,8 +64,10 @@ + + diff --git a/MxValheim/Patch/Bow.cs b/MxValheim/Patch/Bow.cs new file mode 100644 index 0000000..c623662 --- /dev/null +++ b/MxValheim/Patch/Bow.cs @@ -0,0 +1,25 @@ +using BepInEx; +using HarmonyLib; +using UnityEngine; +using BepInEx.Logging; +using HarmonyLib.Tools; + +namespace MxValheim.Patch +{ + public class Bow_Patch + { + // We patch Start because that's when the Attack object initializes its timers + [HarmonyPatch(typeof(Player), "UpdateAttackBowDraw")] + public static class Patch_AttackStart + { + static void Prefix(ItemDrop.ItemData weapon, ref float ___m_attackDrawTime, bool ___m_attackHold) + { + if (___m_attackDrawTime >= 0f && ___m_attackHold) + { + int quality = weapon.m_quality; + ___m_attackDrawTime += UnityEngine.Time.fixedDeltaTime * (MxValheimMod.bowDrawSpeedBonusPerLevel.Value*quality); + } + } + } + } +} diff --git a/MxValheim/Patch/WearNTear.cs b/MxValheim/Patch/WearNTear.cs new file mode 100644 index 0000000..7ca93ab --- /dev/null +++ b/MxValheim/Patch/WearNTear.cs @@ -0,0 +1,19 @@ +using BepInEx; +using HarmonyLib; + +namespace MxValheim.Patch +{ + public class WearNTear_Patch + { + [HarmonyPatch(typeof(WearNTear), "HaveRoof")] + class WearNTear_HaveRoof_Patch + { + static void Postfix(WearNTear __instance, ref bool __result) + { + if (!MxValheimMod.rainDamage.Value) return; + + __result = true; + } + } + } +} diff --git a/README.md b/README.md index 1d823ec..d262e53 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ Official Mx Valheim Mod. ## Features - Ore drop multiplier. (Value available in the generated config.) - Workbench crafting range multiplier. (Value available in the generated config.) +- Reduce Bow draw time for each upgrade level. (Value available in the generated config.) +- Disable rain damage. (Enable/Disable in the generated config.) ## How-To Install 1. Download the latest dll.