Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of VinsTweaks v1.0.5
VinsTweaks.dll
Decompiled 2 years agousing System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CSync.Extensions; using CSync.Lib; using GameNetcodeStuff; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("VinsTweaks")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("VinsTweaks")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4670b343-dff8-4570-bea1-851aad30c879")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace VinsTweaks { public class Config : SyncedConfig2<Config> { [SyncedEntryField] public SyncedEntry<float> timeSpeed; [SyncedEntryField] public SyncedEntry<float> modMoonGravity; [SyncedEntryField] public SyncedEntry<float> walkSpeed; [SyncedEntryField] public SyncedEntry<float> sprintTime; [SyncedEntryField] public SyncedEntry<float> jumpHeight; [SyncedEntryField] public SyncedEntry<bool> useGravity; [SyncedEntryField] public SyncedEntry<bool> sprintMultiplier; [SyncedEntryField] public SyncedEntry<bool> darkness; [SyncedEntryField] public SyncedEntry<bool> infQuota; public Config(ConfigFile cfg) : base("mogus.vin.tweaks") { infQuota = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "Game", "InfiniteQuota", false, "Disables quota."); darkness = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "World", "Darkness", true, "Disables non-flashlight player generated light."); useGravity = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "World", "Gravity", true, "If per-planet gravity should be enabled."); modMoonGravity = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "World", "Modded Moon Gravity", 0.9f, "The default gravity for modded moons."); walkSpeed = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "Player", "WalkSpeed", 2f, "How fast the player should walk."); sprintMultiplier = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "Player", "SprintMultiplier", true, "(Use if sprinting is too slow/turn off if too fast) Multiplies player speed by sprint speed."); sprintTime = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "Player", "SprintTime", 15f, "How many seconds it takes to deplete stamina."); jumpHeight = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "Player", "JumpHeight", 12.5f, "How high the player can jump. (INFLUENCED BY GRAVITY)"); timeSpeed = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "Time", "DaySpeed", 0.5f, "The lower the number, the longer the day. (Also changes miscellanous features like insanity speed)"); } } [BepInPlugin("mogus.vin.tweaks", "VinsTweaks", "1.0.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static Config Config; public const string PLUGIN_GUID = "mogus.vin.tweaks"; public const string PLUGIN_NAME = "VinsTweaks"; public const string PLUGIN_VER = "1.0.4"; public static Harmony VinPatcher = new Harmony("mogus.vin.tweaks"); public static ManualLogSource VinLogger; public static Plugin Instance { get; private set; } private void Awake() { Config = new Config(((BaseUnityPlugin)this).Config); Instance = this; VinLogger = ((BaseUnityPlugin)this).Logger; VinLogger.LogInfo((object)"Attempting to patch using Harmony."); VinPatcher.PatchAll(); } } } namespace VinsTweaks.UnityStuff { public class ModIcon { public static Sprite TweaksIcon; public static bool Awake() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(256, 256); if (ImageConversion.LoadImage(val, File.ReadAllBytes(Paths.PluginPath + "/mogus-VinsTweaks/icon.png"), true)) { TweaksIcon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); return true; } return false; } } } namespace VinsTweaks.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { private static float GravAccel = 0f; private static Dictionary<string, float> Planets { get; } = new Dictionary<string, float> { ["71 Gordion"] = 1.25f, ["41 Experimentation"] = 1f, ["220 Assurance"] = 2f, ["56 Vow"] = 0.7f, ["21 Offense"] = 1.2f, ["61 March"] = 0.9f, ["20 Adamance"] = 1.1f, ["85 Rend"] = 1.5f, ["7 Dine"] = 1.4f, ["8 Titan"] = 0.5f, ["68 Artifice"] = 0.5f, ["5 Embrion"] = 0.7f, ["44 Liquidation"] = 1f, ["Peter"] = 1.5f, ["74 Solace"] = 1.15f, ["42 Auralis"] = 0.9f, ["27 Triskelion"] = 0.63f, ["StarlancerZero"] = 0.8f, ["9 Celestria"] = 0.4f, ["153 Maritopia"] = 1.3f, ["33 EchoReach"] = 2f, ["111 PsychSanctum"] = 0.5f, ["93 Harloth"] = 0.6f, ["34 Nyx"] = 1f, ["37 Zenit"] = 0.9f, ["618 Budapest"] = 3f, ["32 Argent"] = 0.75f, ["39 Azure"] = 1.05f, ["30 Echelon"] = 1f, ["35 CaltPrime"] = 1.25f, ["43 Orion"] = 0.5f, ["28 Celest"] = 1f, ["112 Aquatis"] = 0.95f, ["10 EGypt"] = 0.8f, ["13 Kast"] = 1.2f, ["Crystallum"] = 1.6f, ["Spectralis"] = 0.6f, ["Nimbus"] = 2.3f, ["Sanguine"] = 0.83f }; [HarmonyPatch("Update")] [HarmonyPostfix] private static void RealisticSprintPatch(ref Light ___nightVision, ref bool ___isInsideFactory, ref float ___sprintTime, ref float ___jumpForce, ref float ___movementSpeed, ref float ___sprintMultiplier, ref float ___sprintMeter, ref float ___fallValue, ref float ___fallValueUncapped) { float num = 1f; if (Plugin.Config.useGravity.Value) { if (___isInsideFactory) { num = 1f; } else if (Object.op_Implicit((Object)(object)TimeOfDayPatch.curLevel)) { if (Planets.ContainsKey(TimeOfDayPatch.curLevel.PlanetName)) { foreach (KeyValuePair<string, float> planet in Planets) { if (TimeOfDayPatch.curLevel.PlanetName == planet.Key) { num = planet.Value; } } } else { num = Plugin.Config.modMoonGravity.Value; } } if (Plugin.Config.darkness.Value) { ((Behaviour)___nightVision).enabled = false; } else { ((Behaviour)___nightVision).enabled = true; } if (___fallValue < -7f) { ___fallValue = -8f - GravAccel; GravAccel += 0.5f / num; } else if (___fallValue != 0f) { GravAccel = 0f; } if (___fallValueUncapped < -7f) { ___fallValueUncapped = -8f - GravAccel; } } float num2 = 1f; if (Plugin.Config.sprintMultiplier.Value) { num2 = ___sprintMultiplier; } ___sprintMeter += 0.0001f; ___movementSpeed = Plugin.Config.walkSpeed.Value * num2; ___sprintTime = Plugin.Config.sprintTime.Value; ___jumpForce = Plugin.Config.jumpHeight.Value * num; } [HarmonyPatch("SetPlayerSanityLevel")] [HarmonyPostfix] private static void SanityMatchDaySpeed(ref float ___insanitySpeedMultiplier) { ___insanitySpeedMultiplier *= Plugin.Config.timeSpeed.Value; } } [HarmonyPatch(typeof(TimeOfDay))] internal class TimeOfDayPatch { public static SelectableLevel curLevel; [HarmonyPatch("Update")] [HarmonyPostfix] private static void LongerDayPatch(ref float ___globalTimeSpeedMultiplier, ref SelectableLevel ___currentLevel, ref int ___daysUntilDeadline, ref int ___profitQuota, ref int ___quotaFulfilled) { if (SyncedEntry<bool>.op_Implicit(Plugin.Config.infQuota)) { if (___daysUntilDeadline <= 1) { ___quotaFulfilled = ___profitQuota + 69; } else { ___quotaFulfilled = 0; } } curLevel = ___currentLevel; ___globalTimeSpeedMultiplier = Plugin.Config.timeSpeed.Value; } } }