Decompiled source of MultiplayerItemHandicap v1.0.0

ItemWeightMod.dll

Decompiled 4 hours ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RoR2;
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: AssemblyCompany("TunnyMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+55547a3010a5cd50216d8b61286fb858c61afaa6")]
[assembly: AssemblyProduct("TunnyMod")]
[assembly: AssemblyTitle("TunnyMod")]
[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 TunnyMod
{
	public static class Asset
	{
		public static AssetBundle mainBundle;

		public const string bundleName = "itemweightmod";

		public const string assetBundleFolder = "assetbundles";

		public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(TunnyMod.PInfo.Location), "assetbundles", "itemweightmod");

		public static void Init()
		{
			mainBundle = AssetBundle.LoadFromFile(AssetBundlePath);
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Offbeatsofa.ItemWeightMod", "ItemWeightMod", "1.0.0")]
	public class TunnyMod : BaseUnityPlugin
	{
		public const string PluginGUID = "Offbeatsofa.ItemWeightMod";

		public const string PluginAuthor = "Offbeatsofa";

		public const string PluginName = "ItemWeightMod";

		public const string PluginVersion = "1.0.0";

		public static BuffDef itemWeightBuff;

		public static PluginInfo PInfo { get; private set; }

		public static ConfigEntry<bool> multipleScalingTypes { get; set; }

		public static ConfigEntry<int> earlyGameItemNum { get; set; }

		public static ConfigEntry<int> midGameItemNum { get; set; }

		public static ConfigEntry<bool> itemWeighting { get; set; }

		public static ConfigEntry<int> greenItemWeight { get; set; }

		public static ConfigEntry<int> redItemWeight { get; set; }

		public static ConfigEntry<int> bossItemWeight { get; set; }

		public static ConfigEntry<int> lunarItemWeight { get; set; }

		public void Awake()
		{
			PInfo = ((BaseUnityPlugin)this).Info;
			Log.Init(((BaseUnityPlugin)this).Logger);
			multipleScalingTypes = ((BaseUnityPlugin)this).Config.Bind<bool>("Scaling", "multipleScalingTypes", true, "Whether scaling is changed depending on the stage of the game");
			earlyGameItemNum = ((BaseUnityPlugin)this).Config.Bind<int>("Scaling", "earlyGameItemNum", 7, "Number of items (per player) that encompasses early game scaling. Only used if multipleScalingTypes is true.");
			midGameItemNum = ((BaseUnityPlugin)this).Config.Bind<int>("Scaling", "midGameItemNum", 30, "Number of items (per player) that encompasses mid game scaling. Only used if multipleScalingTypes is true.");
			itemWeighting = ((BaseUnityPlugin)this).Config.Bind<bool>("Items", "itemWeighting", true, "Whether your weight is based of item rarity or not");
			greenItemWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "greenItemWeight", 2, "How much a green item affects your rate (as a multiple of white items)");
			redItemWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "redItemWeight", 5, "How much a red item affects your rate (as a multiple of white items)");
			bossItemWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "bossItemWeight", 2, "How much a boss item affects your rate (as a multiple of white items)");
			lunarItemWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "lunarItemWeight", 2, "How much a lunar item affects your rate (as a multiple of white items)");
			AddContent();
		}

		private void OnEnable()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats);
		}

		private void OnDisable()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats);
		}

		private void AddContent()
		{
			SetupBuff();
			ContentAddition.AddBuffDef(itemWeightBuff);
		}

		private void SetupBuff()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			Asset.Init();
			itemWeightBuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)itemWeightBuff).name = "ItemWeightBuff";
			itemWeightBuff.canStack = true;
			itemWeightBuff.isCooldown = false;
			itemWeightBuff.isDebuff = true;
			itemWeightBuff.buffColor = Color.white;
			itemWeightBuff.iconSprite = Asset.mainBundle.LoadAsset<Sprite>("texItemWeightModBuffIcon.png");
		}

		private void OnDestroy()
		{
		}

		private void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Invalid comparison between Unknown and I4
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: 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_00bf: Invalid comparison between Unknown and I4
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Invalid comparison between Unknown and I4
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Invalid comparison between Unknown and I4
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Invalid comparison between Unknown and I4
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Invalid comparison between Unknown and I4
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Invalid comparison between Unknown and I4
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Invalid comparison between Unknown and I4
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if ((int)self.teamComponent.teamIndex != 1 || !self.isPlayerControlled)
			{
				return;
			}
			int num = 0;
			int num2 = 0;
			float num3 = 0f;
			float num4 = 0f;
			float num5 = 0f;
			int num6 = 0;
			GenericStaticEnumerable<ItemIndex, AllItemsEnumerator> allItems = ItemCatalog.allItems;
			AllItemsEnumerator enumerator = allItems.GetEnumerator();
			try
			{
				while (((AllItemsEnumerator)(ref enumerator)).MoveNext())
				{
					ItemIndex current = ((AllItemsEnumerator)(ref enumerator)).Current;
					if (ItemCatalog.GetItemDef(current).hidden || (int)ItemCatalog.GetItemDef(current).tier == 5)
					{
						continue;
					}
					if (itemWeighting.Value)
					{
						if ((int)ItemCatalog.GetItemDef(current).tier == 0 || (int)ItemCatalog.GetItemDef(current).tier == 6)
						{
							num += Util.GetItemCountForTeam((TeamIndex)1, current, true, true);
							num2 += self.inventory.GetItemCount(current);
						}
						else if ((int)ItemCatalog.GetItemDef(current).tier == 1 || (int)ItemCatalog.GetItemDef(current).tier == 7)
						{
							num += Util.GetItemCountForTeam((TeamIndex)1, current, true, true) * greenItemWeight.Value;
							num2 += self.inventory.GetItemCount(current) * greenItemWeight.Value;
						}
						else if ((int)ItemCatalog.GetItemDef(current).tier == 2 || (int)ItemCatalog.GetItemDef(current).tier == 8)
						{
							num += Util.GetItemCountForTeam((TeamIndex)1, current, true, true) * redItemWeight.Value;
							num2 += self.inventory.GetItemCount(current) * redItemWeight.Value;
						}
						else if ((int)ItemCatalog.GetItemDef(current).tier == 4)
						{
							num += Util.GetItemCountForTeam((TeamIndex)1, current, true, true) * bossItemWeight.Value;
							num2 += self.inventory.GetItemCount(current) * bossItemWeight.Value;
						}
						else if ((int)ItemCatalog.GetItemDef(current).tier == 4)
						{
							num += Util.GetItemCountForTeam((TeamIndex)1, current, true, true) * lunarItemWeight.Value;
							num2 += self.inventory.GetItemCount(current) * lunarItemWeight.Value;
						}
					}
					else
					{
						num += Util.GetItemCountForTeam((TeamIndex)1, current, true, true);
						num2 += self.inventory.GetItemCount(current);
					}
				}
			}
			finally
			{
				((IDisposable)(AllItemsEnumerator)(ref enumerator)).Dispose();
			}
			num3 = (float)num / (float)PlayerCharacterMasterController.instances.Count;
			num4 = (float)num2 / num3 * 100f;
			num5 = ((!multipleScalingTypes.Value) ? ((float)Math.Min(Math.Max(-0.0001 * Math.Pow(num4 - 100f, 3.0) + 1.0, 0.25), 2.1)) : ((num <= 7 * PlayerCharacterMasterController.instances.Count) ? ((float)Math.Min(Math.Max((double)((float)num2 - num3) / -6.6666 + 1.0, 0.25), 2.1)) : ((num < 30 * PlayerCharacterMasterController.instances.Count) ? ((float)Math.Min(Math.Max(((float)num2 - num3) / -20f + 1f, 0.25), 2.1)) : ((float)Math.Min(Math.Max(-0.0001 * Math.Pow(num4 - 100f, 3.0) + 1.0, 0.1), 2.1)))));
			self.moveSpeed *= num5;
			num6 = Convert.ToInt32(num5 * 100f);
			self.SetBuffCount(itemWeightBuff.buffIndex, num6);
			Log.Debug($"Name: {((Object)self).name} Steam Name: {self.GetUserName()} Player Item Count: {num2} " + $"Average Item Count: {num3} Item Percent: {num4} Multiplier: {num5} Has Buff: {self.HasBuff(itemWeightBuff)} Buff Count: {self.GetBuffCount(itemWeightBuff)} ");
		}
	}
}

MultiplayerItemHandicap.dll

Decompiled 4 hours ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RoR2;
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: AssemblyCompany("TunnyMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+55547a3010a5cd50216d8b61286fb858c61afaa6")]
[assembly: AssemblyProduct("TunnyMod")]
[assembly: AssemblyTitle("TunnyMod")]
[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 TunnyMod
{
	public static class Asset
	{
		public static AssetBundle mainBundle;

		public const string bundleName = "itemweightmod";

		public const string assetBundleFolder = "assetbundles";

		public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(TunnyMod.PInfo.Location), "assetbundles", "itemweightmod");

		public static void Init()
		{
			mainBundle = AssetBundle.LoadFromFile(AssetBundlePath);
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Offbeatsofa.ItemWeightMod", "ItemWeightMod", "1.0.0")]
	public class TunnyMod : BaseUnityPlugin
	{
		public const string PluginGUID = "Offbeatsofa.ItemWeightMod";

		public const string PluginAuthor = "Offbeatsofa";

		public const string PluginName = "ItemWeightMod";

		public const string PluginVersion = "1.0.0";

		public static BuffDef itemWeightBuff;

		public static PluginInfo PInfo { get; private set; }

		public static ConfigEntry<bool> multipleScalingTypes { get; set; }

		public static ConfigEntry<int> earlyGameItemNum { get; set; }

		public static ConfigEntry<int> midGameItemNum { get; set; }

		public static ConfigEntry<bool> itemWeighting { get; set; }

		public static ConfigEntry<int> greenItemWeight { get; set; }

		public static ConfigEntry<int> redItemWeight { get; set; }

		public static ConfigEntry<int> bossItemWeight { get; set; }

		public static ConfigEntry<int> lunarItemWeight { get; set; }

		public void Awake()
		{
			PInfo = ((BaseUnityPlugin)this).Info;
			Log.Init(((BaseUnityPlugin)this).Logger);
			multipleScalingTypes = ((BaseUnityPlugin)this).Config.Bind<bool>("Scaling", "multipleScalingTypes", true, "Whether scaling is changed depending on the stage of the game");
			earlyGameItemNum = ((BaseUnityPlugin)this).Config.Bind<int>("Scaling", "earlyGameItemNum", 7, "Number of items (per player) that encompasses early game scaling. Only used if multipleScalingTypes is true.");
			midGameItemNum = ((BaseUnityPlugin)this).Config.Bind<int>("Scaling", "midGameItemNum", 30, "Number of items (per player) that encompasses mid game scaling. Only used if multipleScalingTypes is true.");
			itemWeighting = ((BaseUnityPlugin)this).Config.Bind<bool>("Items", "itemWeighting", true, "Whether your weight is based of item rarity or not");
			greenItemWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "greenItemWeight", 2, "How much a green item affects your rate (as a multiple of white items)");
			redItemWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "redItemWeight", 5, "How much a red item affects your rate (as a multiple of white items)");
			bossItemWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "bossItemWeight", 2, "How much a boss item affects your rate (as a multiple of white items)");
			lunarItemWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "lunarItemWeight", 2, "How much a lunar item affects your rate (as a multiple of white items)");
			AddContent();
		}

		private void OnEnable()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats);
		}

		private void OnDisable()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats);
		}

		private void AddContent()
		{
			SetupBuff();
			ContentAddition.AddBuffDef(itemWeightBuff);
		}

		private void SetupBuff()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			Asset.Init();
			itemWeightBuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)itemWeightBuff).name = "ItemWeightBuff";
			itemWeightBuff.canStack = true;
			itemWeightBuff.isCooldown = false;
			itemWeightBuff.isDebuff = true;
			itemWeightBuff.buffColor = Color.white;
			itemWeightBuff.iconSprite = Asset.mainBundle.LoadAsset<Sprite>("texItemWeightModBuffIcon.png");
		}

		private void OnDestroy()
		{
		}

		private void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Invalid comparison between Unknown and I4
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: 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_00bf: Invalid comparison between Unknown and I4
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Invalid comparison between Unknown and I4
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Invalid comparison between Unknown and I4
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Invalid comparison between Unknown and I4
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Invalid comparison between Unknown and I4
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Invalid comparison between Unknown and I4
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Invalid comparison between Unknown and I4
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if ((int)self.teamComponent.teamIndex != 1 || !self.isPlayerControlled)
			{
				return;
			}
			int num = 0;
			int num2 = 0;
			float num3 = 0f;
			float num4 = 0f;
			float num5 = 0f;
			int num6 = 0;
			GenericStaticEnumerable<ItemIndex, AllItemsEnumerator> allItems = ItemCatalog.allItems;
			AllItemsEnumerator enumerator = allItems.GetEnumerator();
			try
			{
				while (((AllItemsEnumerator)(ref enumerator)).MoveNext())
				{
					ItemIndex current = ((AllItemsEnumerator)(ref enumerator)).Current;
					if (ItemCatalog.GetItemDef(current).hidden || (int)ItemCatalog.GetItemDef(current).tier == 5)
					{
						continue;
					}
					if (itemWeighting.Value)
					{
						if ((int)ItemCatalog.GetItemDef(current).tier == 0 || (int)ItemCatalog.GetItemDef(current).tier == 6)
						{
							num += Util.GetItemCountForTeam((TeamIndex)1, current, true, true);
							num2 += self.inventory.GetItemCount(current);
						}
						else if ((int)ItemCatalog.GetItemDef(current).tier == 1 || (int)ItemCatalog.GetItemDef(current).tier == 7)
						{
							num += Util.GetItemCountForTeam((TeamIndex)1, current, true, true) * greenItemWeight.Value;
							num2 += self.inventory.GetItemCount(current) * greenItemWeight.Value;
						}
						else if ((int)ItemCatalog.GetItemDef(current).tier == 2 || (int)ItemCatalog.GetItemDef(current).tier == 8)
						{
							num += Util.GetItemCountForTeam((TeamIndex)1, current, true, true) * redItemWeight.Value;
							num2 += self.inventory.GetItemCount(current) * redItemWeight.Value;
						}
						else if ((int)ItemCatalog.GetItemDef(current).tier == 4)
						{
							num += Util.GetItemCountForTeam((TeamIndex)1, current, true, true) * bossItemWeight.Value;
							num2 += self.inventory.GetItemCount(current) * bossItemWeight.Value;
						}
						else if ((int)ItemCatalog.GetItemDef(current).tier == 4)
						{
							num += Util.GetItemCountForTeam((TeamIndex)1, current, true, true) * lunarItemWeight.Value;
							num2 += self.inventory.GetItemCount(current) * lunarItemWeight.Value;
						}
					}
					else
					{
						num += Util.GetItemCountForTeam((TeamIndex)1, current, true, true);
						num2 += self.inventory.GetItemCount(current);
					}
				}
			}
			finally
			{
				((IDisposable)(AllItemsEnumerator)(ref enumerator)).Dispose();
			}
			num3 = (float)num / (float)PlayerCharacterMasterController.instances.Count;
			num4 = (float)num2 / num3 * 100f;
			num5 = ((!multipleScalingTypes.Value) ? ((float)Math.Min(Math.Max(-0.0001 * Math.Pow(num4 - 100f, 3.0) + 1.0, 0.25), 2.1)) : ((num <= 7 * PlayerCharacterMasterController.instances.Count) ? ((float)Math.Min(Math.Max((double)((float)num2 - num3) / -6.6666 + 1.0, 0.25), 2.1)) : ((num < 30 * PlayerCharacterMasterController.instances.Count) ? ((float)Math.Min(Math.Max(((float)num2 - num3) / -20f + 1f, 0.25), 2.1)) : ((float)Math.Min(Math.Max(-0.0001 * Math.Pow(num4 - 100f, 3.0) + 1.0, 0.1), 2.1)))));
			self.moveSpeed *= num5;
			num6 = Convert.ToInt32(num5 * 100f);
			self.SetBuffCount(itemWeightBuff.buffIndex, num6);
			Log.Debug($"Name: {((Object)self).name} Steam Name: {self.GetUserName()} Player Item Count: {num2} " + $"Average Item Count: {num3} Item Percent: {num4} Multiplier: {num5} Has Buff: {self.HasBuff(itemWeightBuff)} Buff Count: {self.GetBuffCount(itemWeightBuff)} ");
		}
	}
}