using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CSync.Lib;
using CSync.Util;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("ModifiedMovement")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Mod that changes the player's movement values")]
[assembly: AssemblyFileVersion("1.5.3.0")]
[assembly: AssemblyInformationalVersion("1.5.3+27a4a0c10c5271d93e042ab208aa0ea73b90a559")]
[assembly: AssemblyProduct("ModifiedMovement")]
[assembly: AssemblyTitle("ModifiedMovement")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.5.3.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace ModifiedMovement
{
[DataContract]
public class Config : SyncedConfig<Config>
{
[DataMember]
public SyncedEntry<float> MaxStaminaMultiplier { get; private set; }
[DataMember]
public SyncedEntry<float> StaminaUsageMultiplier { get; private set; }
[DataMember]
public SyncedEntry<float> StaminaRegenMultiplierWalking { get; private set; }
[DataMember]
public SyncedEntry<float> StaminaRegenMultiplierStationary { get; private set; }
[DataMember]
public SyncedEntry<float> SprintSpeed { get; private set; }
[DataMember]
public SyncedEntry<float> JumpMultiplier { get; private set; }
[DataMember]
public SyncedEntry<float> JumpStaminaUsageMultiplier { get; private set; }
[DataMember]
public SyncedEntry<float> MoveSpeed { get; private set; }
[DataMember]
public SyncedEntry<float> ClimbSpeed { get; private set; }
[DataMember]
public SyncedEntry<float> LimpMultiplier { get; private set; }
[DataMember]
public SyncedEntry<float> CarryWeightPenaltyMultiplier { get; private set; }
public Config(ConfigFile cfg)
: base("ModifiedMovement")
{
ConfigManager.Register<Config>(this);
MaxStaminaMultiplier = Extensions.BindSyncedEntry<float>(cfg, "Movespeed", "MaxStaminaMultiplier", 1.5f, "Multiplier for maximum stamina (Vanilla Lethal Company = 1)");
StaminaUsageMultiplier = Extensions.BindSyncedEntry<float>(cfg, "Movespeed", "StaminaUsageMultiplier", 1f, "Multiplier for the rate stamina gets used when sprinting (Vanilla Lethal Company = 1)");
StaminaRegenMultiplierWalking = Extensions.BindSyncedEntry<float>(cfg, "Movespeed", "StaminaRegenMultiplierWalking", 1.25f, "Multiplier for the rate stamina regenerates when walking (Vanilla Lethal Company = 1)");
StaminaRegenMultiplierStationary = Extensions.BindSyncedEntry<float>(cfg, "Movespeed", "StaminaRegenMultiplierStationary", 1.5f, "Multiplier for the rate stamina regenerates when stationary (Vanilla Lethal Company = 1)");
SprintSpeed = Extensions.BindSyncedEntry<float>(cfg, "Movespeed", "SprintSpeed", 2.5f, "Multiplier for the walking speed to calculate sprinting speed (Vanilla Lethal Company = 2.25)");
MoveSpeed = Extensions.BindSyncedEntry<float>(cfg, "Movespeed", "WalkSpeed", 5f, "Maximum walking speed (Vanilla Lethal Company = 5)");
ClimbSpeed = Extensions.BindSyncedEntry<float>(cfg, "Movespeed", "ClimbSpeed", 4f, "Maximum climbing speed (Vanilla Lethal Company = 1)");
JumpMultiplier = Extensions.BindSyncedEntry<float>(cfg, "Movespeed", "JumpMultiplier", 1f, "Multiplier for the jump height (Vanilla Lethal Company = 1)");
JumpStaminaUsageMultiplier = Extensions.BindSyncedEntry<float>(cfg, "Movespeed", "JumpStaminaUsageMultiplier", 0.5f, "Multiplier for the rate stamina gets used when jumping (Vanilla Lethal Company = 1)");
LimpMultiplier = Extensions.BindSyncedEntry<float>(cfg, "Movespeed", "LimpMultiplier", 0.2f, "Multiplier for player movespeed when limping (Vanilla Lethal Company = 0.2)");
}
}
[BepInPlugin("ModifiedMovement", "ModifiedMovement", "1.5.3")]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("ModifiedMovement");
public static Config Config { get; private set; }
public static Plugin Instance { get; internal set; }
public static ManualLogSource Logger { get; private set; }
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
Logger = ((BaseUnityPlugin)this).Logger;
Config = new Config(((BaseUnityPlugin)this).Config);
harmony.PatchAll(Assembly.GetExecutingAssembly());
Logger.LogInfo((object)"Plugin ModifiedMovement is loaded!");
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "ModifiedMovement";
public const string PLUGIN_NAME = "ModifiedMovement";
public const string PLUGIN_VERSION = "1.5.3";
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "ModifiedMovement";
public const string PLUGIN_NAME = "ModifiedMovement";
public const string PLUGIN_VERSION = "1.5.3";
}
}
namespace ModifiedMovement.Patches
{
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerControllerBPatch
{
[HarmonyPostfix]
[HarmonyPatch("Update")]
private static void ModifiedMovementPatch(ref float ___sprintMeter, ref bool ___isSprinting, ref bool ___isWalking, ref float ___sprintTime, ref float ___carryWeight, ref float ___sprintMultiplier)
{
if (___isSprinting)
{
___sprintMeter = Mathf.Clamp(___sprintMeter - Time.deltaTime / ___sprintTime * ___carryWeight * SyncedInstance<Config>.Instance.StaminaUsageMultiplier.Value, 0f, SyncedInstance<Config>.Instance.MaxStaminaMultiplier.Value);
___sprintMultiplier = Mathf.Lerp(___sprintMultiplier, SyncedInstance<Config>.Instance.SprintSpeed.Value, Time.deltaTime);
return;
}
___sprintMultiplier = Mathf.Lerp(___sprintMultiplier, 1f, Time.deltaTime);
if (___isWalking)
{
___sprintMeter = Mathf.Clamp(___sprintMeter + Time.deltaTime / (___sprintTime + 9f) * SyncedInstance<Config>.Instance.StaminaRegenMultiplierWalking.Value, 0f, SyncedInstance<Config>.Instance.MaxStaminaMultiplier.Value);
}
else
{
___sprintMeter = Mathf.Clamp(___sprintMeter + Time.deltaTime / (___sprintTime + 4f) * SyncedInstance<Config>.Instance.StaminaRegenMultiplierStationary.Value, 0f, SyncedInstance<Config>.Instance.MaxStaminaMultiplier.Value);
}
}
[HarmonyPrefix]
[HarmonyPatch("Update")]
private static void WalkClimbSpeedPatch(ref float ___movementSpeed, ref float ___climbSpeed, ref float ___limpMultiplier)
{
___movementSpeed = SyncedInstance<Config>.Instance.MoveSpeed.Value;
___climbSpeed = SyncedInstance<Config>.Instance.ClimbSpeed.Value;
___limpMultiplier = SyncedInstance<Config>.Instance.LimpMultiplier.Value;
}
[HarmonyPrefix]
[HarmonyPatch("PlayerJump")]
private static void ModifiedJumpPatch(ref float ___jumpForce)
{
___jumpForce = SyncedInstance<Config>.Instance.JumpMultiplier.Value * 13f;
}
[HarmonyPostfix]
[HarmonyPatch("Jump_performed")]
private static void ModifiedJumpStaminaPatch(ref float ___sprintMeter)
{
___sprintMeter = Mathf.Clamp(___sprintMeter - 0.08f * SyncedEntry<float>.op_Implicit(SyncedInstance<Config>.Instance.JumpStaminaUsageMultiplier), 0f, SyncedEntry<float>.op_Implicit(SyncedInstance<Config>.Instance.MaxStaminaMultiplier));
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}