Decompiled source of Realistic Item Weights v1.1.2

Realistic Weights.dll

Decompiled 2 days ago
using 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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[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: AssemblyCompany("Realistic Weights")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Test Mod that gives infinite stamina")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Realistic Weights")]
[assembly: AssemblyTitle("Realistic Weights")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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 Realistic_Weights
{
	[BepInPlugin("com.fighter.realisticitemweights", "Realistic Item Weights", "1.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource RWLogger;

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("com.fighter.realisticitemweights");
			val.PatchAll();
			RWLogger = Logger.CreateLogSource("RWeights");
			RWLogger.LogInfo((object)"Realistic Item Weights mod loaded!");
		}
	}
	[HarmonyPatch(typeof(GrabbableObject), "Start")]
	internal class ItemWeightPatch
	{
		private static void SetItemWeight(GrabbableObject item, string targetName, float newWeight)
		{
			if (item.itemProperties.itemName == targetName)
			{
				item.itemProperties.weight = newWeight;
			}
		}

		private static void SetItemWeightContains(GrabbableObject item, string targetName, float newWeight)
		{
			if (item.itemProperties.itemName.Contains(targetName, StringComparison.OrdinalIgnoreCase))
			{
				item.itemProperties.weight = newWeight;
			}
		}

		[HarmonyPostfix]
		private static void Postfix(GrabbableObject __instance)
		{
			SetItemWeightContains(__instance, "Boombox", 1.07f);
			SetItemWeightContains(__instance, "Pb", 1.07f);
			SetItemWeight(__instance, "Flashlight", 1.002f);
			SetItemWeight(__instance, "Jetpack", 2.04f);
			SetItemWeight(__instance, "Key", 1f);
			SetItemWeight(__instance, "Lockpicker", 1.1f);
			SetItemWeight(__instance, "Apparatus", 1.88f);
			SetItemWeight(__instance, "Mapper", 1.04f);
			SetItemWeight(__instance, "Pro-flashlight", 1.025f);
			SetItemWeight(__instance, "Shovel", 1.075f);
			SetItemWeight(__instance, "Stun grenade", 1.007f);
			SetItemWeight(__instance, "Extension ladder", 1.22f);
			SetItemWeight(__instance, "TZP-Inhalant", 1.04f);
			SetItemWeight(__instance, "Walkie-talkie", 1.005f);
			SetItemWeight(__instance, "Zap gun", 1.06f);
			SetItemWeight(__instance, "Magic 7 ball", 1.017f);
			SetItemWeight(__instance, "Airhorn", 1.012f);
			SetItemWeight(__instance, "Bell", 1.32f);
			SetItemWeight(__instance, "Big bolt", 1.21f);
			SetItemWeight(__instance, "Bottles", 1.17f);
			SetItemWeight(__instance, "Brush", 1.005f);
			SetItemWeight(__instance, "Candy", 1.008f);
			SetItemWeight(__instance, "Cash register", 1.27f);
			SetItemWeight(__instance, "Chemical jug", 1.48f);
			SetItemWeight(__instance, "Clown horn", 1.006f);
			SetItemWeight(__instance, "Large axle", 1.42f);
			SetItemWeight(__instance, "Teeth", 1.005f);
			SetItemWeight(__instance, "Dust pan", 1.014f);
			SetItemWeight(__instance, "Egg beater", 1.006f);
			SetItemWeight(__instance, "V-type engine", 2.26f);
			SetItemWeight(__instance, "Golden cup", 1.047f);
			SetItemWeight(__instance, "Fancy lamp", 1.05f);
			SetItemWeight(__instance, "Painting", 1.11f);
			SetItemWeight(__instance, "Plastic fish", 1.002f);
			SetItemWeight(__instance, "Laser pointer", 1.001f);
			SetItemWeight(__instance, "Gold bar", 1.26f);
			SetItemWeight(__instance, "Hairdryer", 1.017f);
			SetItemWeight(__instance, "Magnifying glass", 1.011f);
			SetItemWeight(__instance, "Metal sheet", 1.05f);
			SetItemWeight(__instance, "Cookie mold pan", 1.02f);
			SetItemWeight(__instance, "Mug", 1.009f);
			SetItemWeight(__instance, "Perfume bottle", 1.002f);
			SetItemWeight(__instance, "Old phone", 1.01f);
			SetItemWeight(__instance, "Jar of Pickles", 1.055f);
			SetItemWeight(__instance, "Pill bottle", 1.003f);
			SetItemWeight(__instance, "Remote", 1.002f);
			SetItemWeight(__instance, "Ring", 1.011f);
			SetItemWeight(__instance, "Toy robot", 1.025f);
			SetItemWeight(__instance, "Rubber Ducky", 1.002f);
			SetItemWeight(__instance, "Red soda", 1.007f);
			SetItemWeight(__instance, "Steering wheel", 1.08f);
			SetItemWeight(__instance, "Stop sign", 1.16f);
			SetItemWeight(__instance, "Tea kettle", 1.028f);
			SetItemWeight(__instance, "Toothpaste", 1.003f);
			SetItemWeight(__instance, "Toy cube", 1.002f);
			SetItemWeight(__instance, "Hive", 1.01f);
			SetItemWeight(__instance, "Radar-booster", 1.12f);
			SetItemWeight(__instance, "Yield sign", 1.24f);
			SetItemWeight(__instance, "Shotgun", 1.07f);
			SetItemWeight(__instance, "Ammo", 1f);
			SetItemWeight(__instance, "Spray paint", 1.01f);
			SetItemWeight(__instance, "Homemade flashbang", 1.02f);
			SetItemWeight(__instance, "Gift", 1.13f);
			SetItemWeight(__instance, "Flask", 1.006f);
			SetItemWeight(__instance, "Tragedy", 1.042f);
			SetItemWeight(__instance, "Comedy", 1.042f);
			SetItemWeight(__instance, "Whoopie cushion", 1.001f);
			SetItemWeight(__instance, "Kitchen knife", 1.008f);
			SetItemWeight(__instance, "Easter egg", 1.004f);
			SetItemWeight(__instance, "Weed killer", 1.09f);
			SetItemWeight(__instance, "Soccer ball", 1.012f);
			SetItemWeight(__instance, "Control pad", 1.06f);
			SetItemWeight(__instance, "Garbage lid", 1.05f);
			SetItemWeight(__instance, "Plastic cup", 1.001f);
			SetItemWeight(__instance, "Toilet paper", 1.07f);
			SetItemWeight(__instance, "Clock", 1.12f);
			SetItemWeight(__instance, "Toy train", 1.04f);
			SetItemWeight(__instance, "Zed Dog", 1.007f);
			SetItemWeight(__instance, "Belt bag", 1.009f);
			SetItemWeight(__instance, "Egg", 1.05f);
			SetItemWeight(__instance, "Hand", 1.01f);
			SetItemWeight(__instance, "Bone", 1.006f);
			SetItemWeight(__instance, "Ribcage", 1.125f);
			SetItemWeight(__instance, "Ear", 1f);
			SetItemWeight(__instance, "Foot", 1.02f);
			SetItemWeight(__instance, "Knee", 1.16f);
			SetItemWeight(__instance, "Heart", 1.007f);
			SetItemWeight(__instance, "Tongue", 1.04f);
		}
	}
}