1 Commits
1.1.0 ... 1.2.0

Author SHA1 Message Date
mikx
3db032a530 (1.2.0) Bow Draw Speed + Rain Damage 2026-01-27 05:33:36 -05:00
5 changed files with 56 additions and 1 deletions

View File

@@ -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<int> OreMultiplier;
public static ConfigEntry<float> rangeMultiplier;
public static ConfigEntry<float> bowDrawSpeedBonusPerLevel;
public static ConfigEntry<bool> 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();

View File

@@ -34,6 +34,9 @@
<Reference Include="0Harmony">
<HintPath>E:\SteamLibrary\steamapps\common\Valheim\BepInEx\core\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-publicized">
<HintPath>E:\SteamLibrary\steamapps\common\Valheim\Valheim_Data\Managed\Assembly-CSharp-publicized.dll</HintPath>
</Reference>
<Reference Include="assembly_valheim">
<HintPath>E:\SteamLibrary\steamapps\common\Valheim\Valheim_Data\Managed\assembly_valheim.dll</HintPath>
</Reference>
@@ -61,8 +64,10 @@
</ItemGroup>
<ItemGroup>
<Compile Include="MxValheim.cs" />
<Compile Include="Patch\Bow.cs" />
<Compile Include="Patch\CraftingStation.cs" />
<Compile Include="Patch\Ores.cs" />
<Compile Include="Patch\WearNTear.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

25
MxValheim/Patch/Bow.cs Normal file
View File

@@ -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);
}
}
}
}
}

View File

@@ -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;
}
}
}
}

View File

@@ -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.