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 NathansQol Hauling v0.1.0
NathansQol.Hauling.dll
Decompiled 5 days agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn.Configs; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("assembly_guiutils")] [assembly: IgnoresAccessChecksTo("assembly_utils")] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("NathansQol.Hauling")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0+89bf842373b7f77e1a9614431e28d6863f11d5be")] [assembly: AssemblyProduct("NathansQol.Hauling")] [assembly: AssemblyTitle("NathansQol.Hauling")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 NathansQol.Hauling { [BepInPlugin("nathan.qol.hauling", "Nathans Hauling", "0.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class HaulingPlugin : BaseUnityPlugin { public const string PluginGuid = "nathan.qol.hauling"; public const string PluginName = "Nathans Hauling"; public const string PluginVersion = "0.1.0"; private const string SkillId = "nathan.qol.hauling.skill"; internal static ConfigEntry<float> WeightThreshold; internal static ConfigEntry<float> XpPerSecond; internal static ConfigEntry<float> XpPerJump; internal static ConfigEntry<float> CarryWeightPerLevel; internal static SkillType HaulingSkill; private void Awake() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) WeightThreshold = ((BaseUnityPlugin)this).Config.Bind<float>("Hauling", "WeightThreshold", 0.85f, new ConfigDescription("Fraction of max carry weight needed to gain Hauling XP (0.85 = 255/300).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1f), Array.Empty<object>())); XpPerSecond = ((BaseUnityPlugin)this).Config.Bind<float>("Hauling", "XpPerSecondMoving", 0.15f, "Skill XP per second of walking/running while above the weight threshold."); XpPerJump = ((BaseUnityPlugin)this).Config.Bind<float>("Hauling", "XpPerJump", 0.2f, "Skill XP per jump while above the weight threshold."); CarryWeightPerLevel = ((BaseUnityPlugin)this).Config.Bind<float>("Hauling", "CarryWeightPerLevel", 1f, "Extra max carry weight granted per whole Hauling level."); SkillConfig val = new SkillConfig { Identifier = "nathan.qol.hauling.skill", Name = "Hauling", Description = "Carrying heavy loads over long distances.", Icon = MakeIcon(), IncreaseStep = 1f }; SkillManager.Instance.AddSkill(val); HaulingSkill = val.UID; new Harmony("nathan.qol.hauling").PatchAll(); } private static Sprite MakeIcon() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false); Color val2 = default(Color); ((Color)(ref val2))..ctor(0.55f, 0.36f, 0.18f, 1f); for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { val.SetPixel(j, i, val2); } } val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f)); } internal static bool IsHeavilyLoaded(Player player) { Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory != null) { return inventory.GetTotalWeight() >= player.GetMaxCarryWeight() * WeightThreshold.Value; } return false; } } [HarmonyPatch(typeof(Player), "FixedUpdate")] internal static class MovementXpPatch { private static void Postfix(Player __instance) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance != (Object)(object)Player.m_localPlayer) && !((Character)__instance).IsDead() && ((Character)__instance).IsOnGround() && !((Character)__instance).IsSwimming() && !((Character)__instance).InInterior()) { Vector3 velocity = ((Character)__instance).GetVelocity(); velocity.y = 0f; if (!(((Vector3)(ref velocity)).magnitude < 1f) && HaulingPlugin.IsHeavilyLoaded(__instance)) { ((Character)__instance).RaiseSkill(HaulingPlugin.HaulingSkill, HaulingPlugin.XpPerSecond.Value * Time.fixedDeltaTime); } } } } [HarmonyPatch(typeof(Player), "OnJump")] internal static class JumpXpPatch { private static void Postfix(Player __instance) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance != (Object)(object)Player.m_localPlayer) && HaulingPlugin.IsHeavilyLoaded(__instance)) { ((Character)__instance).RaiseSkill(HaulingPlugin.HaulingSkill, HaulingPlugin.XpPerJump.Value); } } } [HarmonyPatch(typeof(Player), "GetMaxCarryWeight")] internal static class CarryWeightPatch { private static void Postfix(Player __instance, ref float __result) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { float num = Mathf.Floor(((Character)__instance).GetSkillLevel(HaulingPlugin.HaulingSkill)); __result += num * HaulingPlugin.CarryWeightPerLevel.Value; } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }