Decompiled source of BadCrispberry v1.2.1

plugins/waffl.BadCrispberry.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
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 HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using UnityEngine.SceneManagement;
using Zorro.Core;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("waffl.BadCrispberry")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: AssemblyInformationalVersion("1.2.1+221f880694045e50e1f4c65962206e66dde83ecc")]
[assembly: AssemblyProduct("waffl.BadCrispberry")]
[assembly: AssemblyTitle("BadCrispberry")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace Microsoft.CodeAnalysis
{
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace BadCrispberry
{
	public class CachedFeedData
	{
		[CompilerGenerated]
		private sealed class <WaitThenClear>d__11 : IEnumerator<WaitForSeconds>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private WaitForSeconds <>2__current;

			public float seconds;

			public CachedFeedData <>4__this;

			WaitForSeconds? IEnumerator<WaitForSeconds>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object? IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <WaitThenClear>d__11(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Expected O, but got Unknown
				int num = <>1__state;
				CachedFeedData cachedFeedData = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = new WaitForSeconds(seconds);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					cachedFeedData.feedData = null;
					cachedFeedData._timer = null;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private const float DEFAULT_WAIT_INTERVAL = 0.3f;

		private readonly string _userID;

		private readonly MonoBehaviour _instance;

		private FeedData? _feedData;

		private Coroutine? _timer;

		public FeedData? feedData
		{
			get
			{
				return _feedData;
			}
			set
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Expected O, but got Unknown
				StopTimer();
				if (value == null)
				{
					_feedData = null;
					return;
				}
				if (_feedData == null)
				{
					_feedData = new FeedData();
				}
				_feedData.giverID = value.giverID;
				_feedData.receiverID = value.receiverID;
				_feedData.itemID = value.itemID;
				_feedData.totalItemTime = value.totalItemTime;
			}
		}

		public CachedFeedData(MonoBehaviour instance, string userID)
		{
			_instance = instance;
			_userID = userID;
		}

		public void ScheduleRemoveFeedData(float seconds = 0.3f)
		{
			StopTimer();
			_timer = _instance.StartCoroutine((IEnumerator)WaitThenClear(seconds));
		}

		private void StopTimer()
		{
			if (_timer != null)
			{
				_instance.StopCoroutine(_timer);
				_timer = null;
			}
		}

		[IteratorStateMachine(typeof(<WaitThenClear>d__11))]
		private IEnumerator<WaitForSeconds> WaitThenClear(float seconds)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <WaitThenClear>d__11(0)
			{
				<>4__this = this,
				seconds = seconds
			};
		}
	}
	public class ModConfig
	{
		private ConfigFile configFile;

		private bool _enableAllergies;

		private bool _enableAllergiesItemOverrides;

		private Dictionary<ushort, ConfigEntry<float>> _afflictionsItemConfigs = new Dictionary<ushort, ConfigEntry<float>>();

		public Dictionary<STATUSTYPE, ConfigEntry<float>> afflictions = new Dictionary<STATUSTYPE, ConfigEntry<float>>();

		public Dictionary<ushort, ConfigEntry<float>> afflictionsItemConfigs = new Dictionary<ushort, ConfigEntry<float>>();

		public Dictionary<STATUSTYPE, ConfigEntry<float>> allergicResponse = new Dictionary<STATUSTYPE, ConfigEntry<float>>();

		public Dictionary<ushort, ConfigEntry<bool>> allergiesItemOverrides = new Dictionary<ushort, ConfigEntry<bool>>();

		public ConfigEntry<bool> enableAfflictionsConfig;

		public ConfigEntry<bool> enableAllergiesConfig;

		public ConfigEntry<bool> enableAllergiesItemOverridesConfig;

		public ConfigEntry<float> allergicMin;

		public ConfigEntry<float> allergicMax;

		public ConfigEntry<KeyCode> menuHotkey;

		public bool enableAllergies
		{
			get
			{
				return _enableAllergies;
			}
			set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				Scene activeScene = SceneManager.GetActiveScene();
				if (!((Scene)(ref activeScene)).name.Contains("Level"))
				{
					_enableAllergies = value;
				}
			}
		}

		public bool enableAllergiesItemOverrides
		{
			get
			{
				return _enableAllergiesItemOverrides;
			}
			set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				Scene activeScene = SceneManager.GetActiveScene();
				if (!((Scene)(ref activeScene)).name.Contains("Level"))
				{
					_enableAllergiesItemOverrides = value;
				}
			}
		}

		public ModConfig(ConfigFile configFile)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Expected O, but got Unknown
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Expected O, but got Unknown
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Expected O, but got Unknown
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Expected O, but got Unknown
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Expected O, but got Unknown
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Expected O, but got Unknown
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Expected O, but got Unknown
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Expected O, but got Unknown
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Expected O, but got Unknown
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Expected O, but got Unknown
			//IL_0374: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Expected O, but got Unknown
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Expected O, but got Unknown
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Expected O, but got Unknown
			//IL_0432: Unknown result type (might be due to invalid IL or missing references)
			//IL_043c: Expected O, but got Unknown
			//IL_0471: Unknown result type (might be due to invalid IL or missing references)
			//IL_047b: Expected O, but got Unknown
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ba: Expected O, but got Unknown
			//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f9: Expected O, but got Unknown
			//IL_052e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0538: Expected O, but got Unknown
			//IL_056d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0577: Expected O, but got Unknown
			//IL_05ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b6: Expected O, but got Unknown
			//IL_05eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f5: Expected O, but got Unknown
			//IL_062b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0635: Expected O, but got Unknown
			//IL_066b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0675: Expected O, but got Unknown
			//IL_06ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b5: Expected O, but got Unknown
			this.configFile = configFile;
			enableAfflictionsConfig = configFile.Bind<bool>("Enable - Cursed items", "Enable Cursed Items", true, new ConfigDescription("Enable the cursed items part of the mod.", (AcceptableValueBase)null, Array.Empty<object>()));
			enableAllergiesConfig = configFile.Bind<bool>("Enable - Allergies", "Enable Allergies", true, new ConfigDescription("Enable the EXPERIMENTAL allergies part of the mod. Each player is randomly severely allergic to a specific food item. Some food items are excluded, like clusterberries, since they're too rare.", (AcceptableValueBase)null, Array.Empty<object>()));
			enableAllergiesItemOverridesConfig = configFile.Bind<bool>("Enable - Allergies", "Enable Allergies Item Pool Overrides", false, new ConfigDescription("Toggle whether or not your item pool overrides are used to generate allergies.", (AcceptableValueBase)null, Array.Empty<object>()));
			menuHotkey = configFile.Bind<KeyCode>("Menu Hotkey", "Menu Hotkey", (KeyCode)284, "Key to open mod menu.");
			allergicMin = configFile.Bind<float>("Options - Allergies", "Minimum affliction from allergy", 0.5f, new ConfigDescription("Set minimum affliction to apply.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
			allergicMax = configFile.Bind<float>("Options - Allergies", "Maximum affliction from allergy", 1.05f, new ConfigDescription("Set maximum affliction to apply.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
			allergicResponse[(STATUSTYPE)0] = configFile.Bind<float>("Options - Allergies", "Injury", 0f, new ConfigDescription("Set injury.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			allergicResponse[(STATUSTYPE)1] = configFile.Bind<float>("Options - Allergies", "Hunger", 0f, new ConfigDescription("Set hunger.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			allergicResponse[(STATUSTYPE)2] = configFile.Bind<float>("Options - Allergies", "Cold", 0f, new ConfigDescription("Set cold.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			allergicResponse[(STATUSTYPE)3] = configFile.Bind<float>("Options - Allergies", "Poison", 1f, new ConfigDescription("Set poison.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			allergicResponse[(STATUSTYPE)4] = configFile.Bind<float>("Options - Allergies", "Crab", 0f, new ConfigDescription("Set crab.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			allergicResponse[(STATUSTYPE)5] = configFile.Bind<float>("Options - Allergies", "Curse", 0f, new ConfigDescription("Set curse.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			allergicResponse[(STATUSTYPE)6] = configFile.Bind<float>("Options - Allergies", "Drowsy", 0f, new ConfigDescription("Set drowsy.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			allergicResponse[(STATUSTYPE)8] = configFile.Bind<float>("Options - Allergies", "Hot", 0f, new ConfigDescription("Set hot.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			allergicResponse[(STATUSTYPE)10] = configFile.Bind<float>("Options - Allergies", "Spores", 0f, new ConfigDescription("Set spores.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			allergicResponse[(STATUSTYPE)11] = configFile.Bind<float>("Options - Allergies", "Web", 0f, new ConfigDescription("Set web.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			afflictions[(STATUSTYPE)0] = configFile.Bind<float>("Options - Cursed Items", "Injury", 0f, new ConfigDescription("Set injury.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			afflictions[(STATUSTYPE)1] = configFile.Bind<float>("Options - Cursed Items", "Hunger", 0f, new ConfigDescription("Set hunger.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			afflictions[(STATUSTYPE)2] = configFile.Bind<float>("Options - Cursed Items", "Cold", 0f, new ConfigDescription("Set cold.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			afflictions[(STATUSTYPE)3] = configFile.Bind<float>("Options - Cursed Items", "Poison", 0f, new ConfigDescription("Set poison.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			afflictions[(STATUSTYPE)4] = configFile.Bind<float>("Options - Cursed Items", "Crab", 0f, new ConfigDescription("Set crab.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			afflictions[(STATUSTYPE)5] = configFile.Bind<float>("Options - Cursed Items", "Curse", 0.025f, new ConfigDescription("Set curse.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			afflictions[(STATUSTYPE)6] = configFile.Bind<float>("Options - Cursed Items", "Drowsy", 0f, new ConfigDescription("Set drowsy.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			afflictions[(STATUSTYPE)7] = configFile.Bind<float>("Options - Cursed Items", "Weight", 0f, new ConfigDescription("Set weight.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			afflictions[(STATUSTYPE)8] = configFile.Bind<float>("Options - Cursed Items", "Hot", 0f, new ConfigDescription("Set hot.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			afflictions[(STATUSTYPE)9] = configFile.Bind<float>("Options - Cursed Items", "Thorns", 0f, new ConfigDescription("Set thorns.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			afflictions[(STATUSTYPE)10] = configFile.Bind<float>("Options - Cursed Items", "Spores", 0f, new ConfigDescription("Set spores.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			afflictions[(STATUSTYPE)11] = configFile.Bind<float>("Options - Cursed Items", "Web", 0f, new ConfigDescription("Set web.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			enableAllergiesConfig.SettingChanged += delegate
			{
				enableAllergies = enableAllergiesConfig.Value;
			};
			enableAllergiesItemOverridesConfig.SettingChanged += delegate
			{
				enableAllergiesItemOverrides = enableAllergiesItemOverridesConfig.Value;
			};
		}

		public void GenerateItemConfigs()
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Expected O, but got Unknown
			foreach (KeyValuePair<ushort, Item> item in SingletonAsset<ItemDatabase>.Instance.itemLookup)
			{
				if (Object.op_Implicit((Object)(object)item.Value))
				{
					afflictionsItemConfigs[item.Key] = configFile.Bind<float>("Options - Cursed Items Multiplier", ((Object)item.Value).name, 1f, new ConfigDescription("Strength of afflictions when using/eating " + ((Object)item.Value).name, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1000f), Array.Empty<object>()));
				}
			}
			foreach (KeyValuePair<ushort, Item> item2 in SingletonAsset<ItemDatabase>.Instance.itemLookup)
			{
				if (Object.op_Implicit((Object)(object)item2.Value))
				{
					allergiesItemOverrides[item2.Key] = configFile.Bind<bool>("Options - Allergies Item Pool", ((Object)item2.Value).name, false, new ConfigDescription("Toggle whether or not item " + ((Object)item2.Value).name + " is included in the allergies pool.", (AcceptableValueBase)null, Array.Empty<object>()));
				}
			}
		}
	}
	public class ModMenu : MonoBehaviour
	{
		private Rect _listWindowRect = new Rect(20f, 20f, 220f, 300f);

		private Rect _detailWindowRect = new Rect(260f, 20f, 260f, 300f);

		private int _listWindowID = 667;

		private int _detailWindowID = 666;

		private string? _selectedUserID;

		private Character? _selectedCharacter;

		private Vector2 _listScroll = Vector2.zero;

		private Vector2 _detailScroll = Vector2.zero;

		private const float ResizeHandleSize = 12f;

		private bool _resizingList;

		private bool _resizingDetail;

		private Vector2 _resizeStartMouse;

		private Rect _resizeStartRect;

		public bool ToggleGui;

		public string? selectedUserID
		{
			get
			{
				return _selectedUserID;
			}
			set
			{
			}
		}

		public Character? selectedCharacter
		{
			get
			{
				return _selectedCharacter;
			}
			set
			{
			}
		}

		private void OnGUI()
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			if (ToggleGui)
			{
				GUI.skin.button.fontSize = 16;
				GUI.skin.label.fontSize = 16;
				GUI.skin.box.fontSize = 16;
				GUI.skin.window.fontSize = 16;
				HandleResize(ref _listWindowRect, ref _resizingList, _listWindowID);
				HandleResize(ref _detailWindowRect, ref _resizingDetail, _detailWindowID);
				_listWindowRect = GUILayout.Window(_listWindowID, _listWindowRect, new WindowFunction(DrawListWindow), "[BadCrispberry] Characters", Array.Empty<GUILayoutOption>());
				if ((Object)(object)_selectedCharacter != (Object)null)
				{
					((Rect)(ref _detailWindowRect)).x = ((Rect)(ref _listWindowRect)).xMax + 10f;
					((Rect)(ref _detailWindowRect)).y = ((Rect)(ref _listWindowRect)).y;
					_detailWindowRect = GUILayout.Window(_detailWindowID, _detailWindowRect, new WindowFunction(DrawDetailWindow), ((Object)_selectedCharacter).name, Array.Empty<GUILayoutOption>());
				}
			}
		}

		private void DrawListWindow(int id)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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)
			_listScroll = GUILayout.BeginScrollView(_listScroll, Array.Empty<GUILayoutOption>());
			foreach (KeyValuePair<string, Character> cachedCharacter in Plugin.CachedCharacters)
			{
				GUI.backgroundColor = (((Object)(object)_selectedCharacter == (Object)(object)cachedCharacter.Value) ? Color.cyan : Color.white);
				if (GUILayout.Button(((Object)cachedCharacter.Value).name, Array.Empty<GUILayoutOption>()))
				{
					if ((Object)(object)_selectedCharacter == (Object)(object)cachedCharacter.Value)
					{
						_selectedCharacter = null;
						_selectedUserID = null;
					}
					else
					{
						_selectedCharacter = cachedCharacter.Value;
						_selectedUserID = cachedCharacter.Key;
					}
				}
				GUI.backgroundColor = Color.white;
			}
			GUILayout.EndScrollView();
			DrawResizeHandle(_listWindowRect);
			GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _listWindowRect)).width, 20f));
		}

		private void DrawDetailWindow(int id)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
			_detailScroll = GUILayout.BeginScrollView(_detailScroll, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Allergic to:", GUI.skin.box, Array.Empty<GUILayoutOption>());
			Dictionary<ushort, Item> itemLookup = SingletonAsset<ItemDatabase>.Instance.itemLookup;
			if (Plugin.Allergies.TryGetValue(_selectedUserID, out HashSet<ushort> value))
			{
				foreach (ushort item in value)
				{
					GUILayout.Label("  " + ((Object)itemLookup[item]).name + "  ", Array.Empty<GUILayoutOption>());
				}
			}
			else
			{
				GUILayout.Label("No allergies found", Array.Empty<GUILayoutOption>());
			}
			GUILayout.EndScrollView();
			GUILayout.Space(4f);
			if (GUILayout.Button("Reroll allergies", Array.Empty<GUILayoutOption>()))
			{
				OnActionButton(_selectedCharacter);
			}
			DrawResizeHandle(_detailWindowRect);
			GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _detailWindowRect)).width, 20f));
		}

		private void OnActionButton(Character character)
		{
			Debug.Log((object)("Reroll allergies triggered for " + ((Object)character).name));
			Plugin.GenerateAllergiesPairings(character, forceRegenerate: true);
		}

		private void DrawResizeHandle(Rect windowRect)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref windowRect)).width - 12f, ((Rect)(ref windowRect)).height - 12f, 12f, 12f);
			GUI.Box(val, "↘");
		}

		private void HandleResize(ref Rect windowRect, ref bool isResizing, int windowID)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Invalid comparison between Unknown and I4
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Invalid comparison between Unknown and I4
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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)
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref windowRect)).xMax - 12f, ((Rect)(ref windowRect)).yMax - 12f, 12f, 12f);
			Event current = Event.current;
			if ((int)current.type == 0 && ((Rect)(ref val)).Contains(current.mousePosition))
			{
				isResizing = true;
				_resizeStartMouse = current.mousePosition;
				_resizeStartRect = windowRect;
				current.Use();
			}
			if (isResizing)
			{
				if ((int)current.type == 3)
				{
					Vector2 val2 = current.mousePosition - _resizeStartMouse;
					((Rect)(ref windowRect)).width = Mathf.Max(150f, ((Rect)(ref _resizeStartRect)).width + val2.x);
					((Rect)(ref windowRect)).height = Mathf.Max(100f, ((Rect)(ref _resizeStartRect)).height + val2.y);
					current.Use();
				}
				if ((int)current.type == 1)
				{
					isResizing = false;
					current.Use();
				}
			}
		}
	}
	[HarmonyPatch(typeof(Action_ReduceUses))]
	public static class Action_ReduceUsesPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("ReduceUsesRPC")]
		public static void ReduceUsesRPCPatch(ItemAction __instance)
		{
			Character trueHolderCharacter = ((ItemActionBase)__instance).item.trueHolderCharacter;
			Plugin.TryApplyStatus(((ItemActionBase)__instance).item);
			FeedData feedData = Plugin.CachedFeedDataDict[((MonoBehaviourPun)trueHolderCharacter).photonView.Owner.UserId].feedData;
			if (feedData != null)
			{
				Plugin.Log.LogInfo((object)$"ReduceUsesRPC: {((MonoBehaviourPun)trueHolderCharacter).photonView.Owner.UserId}: [{feedData?.giverID}, {feedData?.receiverID}, {feedData?.itemID}, {feedData?.totalItemTime}]");
			}
			else
			{
				Plugin.Log.LogInfo((object)("ReduceUsesRPC: Null feedData for character " + ((Object)trueHolderCharacter).name));
			}
			Plugin.TryApplyAllergy(((ItemActionBase)__instance).item, trueHolderCharacter, isConsumeMethod: false, isReduceUseMethod: true);
			Plugin.CachedFeedDataDict[((MonoBehaviourPun)trueHolderCharacter).photonView.Owner.UserId].feedData = null;
		}
	}
	[HarmonyPatch(typeof(Character))]
	public static class CharacterPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("RPCA_InitializeScoutReport")]
		public static void RPCA_InitializeScoutReportPostfix(Character __instance)
		{
			Plugin.Log.LogInfo((object)"Going to GenerateAllergiesPairing");
			try
			{
				Plugin.CachedCharacters[((MonoBehaviourPun)__instance).photonView.Owner.UserId] = __instance;
				Plugin.GenerateAllergiesPairings(__instance);
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("Error: " + ex.Message));
				Plugin.Log.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(Item))]
	public static class ItemPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Consume")]
		public static void ConsumePatch(Item __instance)
		{
			Character trueHolderCharacter = __instance.trueHolderCharacter;
			Plugin.TryApplyStatus(__instance, isConsumeMethod: true);
			FeedData feedData = Plugin.CachedFeedDataDict[((MonoBehaviourPun)trueHolderCharacter).photonView.Owner.UserId].feedData;
			if (feedData != null)
			{
				Plugin.Log.LogInfo((object)$"Consume: {((MonoBehaviourPun)trueHolderCharacter).photonView.Owner.UserId}: [{feedData?.giverID}, {feedData?.receiverID}, {feedData?.itemID}, {feedData?.totalItemTime}]");
			}
			else
			{
				Plugin.Log.LogInfo((object)("ReduceUsesRPC: Null feedData for character " + ((Object)trueHolderCharacter).name));
			}
			Plugin.TryApplyAllergy(__instance, trueHolderCharacter, isConsumeMethod: true);
			Plugin.CachedFeedDataDict[((MonoBehaviourPun)trueHolderCharacter).photonView.Owner.UserId].feedData = null;
		}

		[HarmonyPrefix]
		[HarmonyPatch("SendFeedDataRPC")]
		public static void SendFeedDataRPC(ref int giverID, ref int recieverID, ref int itemID, ref float totalUsingTime, Item __instance)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			Character component = ((Component)PhotonView.Find(giverID)).GetComponent<Character>();
			string userId = ((MonoBehaviourPun)component).photonView.Owner.UserId;
			Plugin.CachedFeedDataDict[userId].feedData = new FeedData
			{
				giverID = giverID,
				receiverID = recieverID,
				itemID = (ushort)itemID,
				totalItemTime = totalUsingTime
			};
			Plugin.Log.LogInfo((object)$"{((Object)component).name}: [{giverID}, {recieverID}, {itemID}, {totalUsingTime}]");
		}

		[HarmonyPrefix]
		[HarmonyPatch("RemoveFeedDataRPC")]
		public static void RemoveFeedDataRPC(int giverID, Item __instance)
		{
			string userId = PhotonView.Find(giverID).Owner.UserId;
			Plugin.CachedFeedDataDict[userId].ScheduleRemoveFeedData();
		}
	}
	[HarmonyPatch(typeof(Rope))]
	public static class RopePatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Detach_Rpc")]
		public static void Detach_RpcPatch(Rope __instance)
		{
			Plugin.TryApplyStatus(((ItemComponent)__instance.spool).item);
		}
	}
	[HarmonyPatch(typeof(Lantern))]
	public static class LanternPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("LightLanternRPC")]
		public static void LightLanternRPCPatch(bool litValue, Lantern __instance)
		{
			if (litValue)
			{
				Plugin.TryApplyStatus(__instance.item);
			}
		}
	}
	[HarmonyPatch(typeof(ItemDatabase))]
	public static class ItemDatabasePatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("OnLoaded")]
		public static void OnLoadedPostfix()
		{
			try
			{
				Plugin.config.GenerateItemConfigs();
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("Error: " + ex.Message));
				Plugin.Log.LogError((object)ex.StackTrace);
			}
		}
	}
	[BepInPlugin("waffl.BadCrispberry", "BadCrispberry", "1.2.1")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ModConfig config = null;

		internal static ModMenu Menu = null;

		internal static Dictionary<string, Character> CachedCharacters = new Dictionary<string, Character>();

		internal static Dictionary<string, HashSet<ushort>>? Allergies = new Dictionary<string, HashSet<ushort>>();

		internal static Plugin Instance = null;

		internal static Dictionary<string, CachedFeedData> CachedFeedDataDict = new Dictionary<string, CachedFeedData>();

		internal static Dictionary<BiomeType, bool> Biomes = new Dictionary<BiomeType, bool>();

		internal static bool IsInRun = false;

		internal static bool ToggleGui = false;

		private Harmony _harmony;

		public const string Id = "waffl.BadCrispberry";

		internal static ManualLogSource Log { get; private set; } = null;


		public static string Name => "BadCrispberry";

		public static string Version => "1.2.1";

		private void Awake()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
			config = new ModConfig(((BaseUnityPlugin)this).Config);
			Menu = ((Component)this).gameObject.AddComponent<ModMenu>();
			SceneManager.sceneLoaded += OnSceneLoaded;
			_harmony = new Harmony("waffl.BadCrispberry");
			_harmony.PatchAll();
		}

		private void Update()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(config.menuHotkey.Value))
			{
				Menu.ToggleGui = !Menu.ToggleGui;
			}
		}

		private static void PopulateBiomes(string sceneName)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			Log.LogInfo((object)("activeScene.name: " + sceneName));
			if (!sceneName.Contains("Level"))
			{
				return;
			}
			Log.LogInfo((object)"Scene is a level - populating biomes dict");
			foreach (BiomeType value in Enum.GetValues(typeof(BiomeType)))
			{
				Biomes[value] = false;
			}
			MapSegment[] segments = Singleton<MapHandler>.Instance.segments;
			try
			{
				MapSegment[] array = segments;
				foreach (MapSegment val in array)
				{
					BiomeType biome = val.biome;
					Biomes[biome] = true;
				}
			}
			catch (Exception ex)
			{
				Log.LogError((object)("Error: " + ex.Message));
				Log.LogError((object)ex.StackTrace);
			}
		}

		private static bool IsValidItem(Item item)
		{
			if (Biomes[(BiomeType)1])
			{
				if (((Object)item).name.Contains("Shroomberry") || ((Object)item).name.Contains("Mandrake"))
				{
					return false;
				}
			}
			else if (Biomes[(BiomeType)7] && (((Object)item).name.Contains("Clusterberry") || ((Object)item).name.Contains("Berrynana") || ((Object)item).name.Contains("Kingberry")))
			{
				return false;
			}
			if (Biomes[(BiomeType)2])
			{
				if (((Object)item).name.Contains("Prickleberry"))
				{
					return false;
				}
			}
			else if (Biomes[(BiomeType)6] && (((Object)item).name.Contains("Napberry") || ((Object)item).name.Contains("Orange")))
			{
				return false;
			}
			if (!((Object)item).name.StartsWith("C_") && !((Object)item).name.EndsWith("TEMP") && !((Object)item).name.Contains("UNUSED") && !((Object)item).name.Contains("Milk") && !((Object)item).name.Contains("Mushroom Glow") && !((Object)item).name.Contains("Lollipop"))
			{
				return true;
			}
			return false;
		}

		private static bool ShouldApplyStatus(Item item, bool isConsumeMethod)
		{
			if (config.afflictionsItemConfigs[item.itemID].Value < 0.01f)
			{
				return false;
			}
			if (isConsumeMethod)
			{
				OptionableIntItemData data = item.GetData<OptionableIntItemData>((DataEntryKey)2);
				if (data.HasData && data.Value == 0)
				{
					return false;
				}
				if (item.itemID == 65 || item.itemID == 1)
				{
					return false;
				}
			}
			return true;
		}

		private static bool ShouldApplyAllergy(Item item, Character character, bool isConsumeMethod, bool isReduceUseMethod)
		{
			if (isConsumeMethod)
			{
				OptionableIntItemData data = item.GetData<OptionableIntItemData>((DataEntryKey)2);
				if (data.HasData && data.Value == 0)
				{
					return false;
				}
			}
			string userId = ((MonoBehaviourPun)character).photonView.Owner.UserId;
			if (Allergies == null)
			{
				return false;
			}
			if (!Allergies.TryGetValue(userId, out HashSet<ushort> value))
			{
				return false;
			}
			if (!value.Contains(item.itemID))
			{
				return false;
			}
			return true;
		}

		private static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			try
			{
				Log.LogInfo((object)("LoadScene: " + ((Scene)(ref scene)).name));
				if (((Scene)(ref scene)).name.Contains("Airport"))
				{
					Log.LogInfo((object)"Resetting plugin state");
					IsInRun = false;
					ResetState();
				}
				else if (((Scene)(ref scene)).name.Contains("Level"))
				{
					PopulateBiomes(((Scene)(ref scene)).name);
				}
			}
			catch (Exception ex)
			{
				Log.LogError((object)("Error: " + ex.Message));
				Log.LogError((object)ex.StackTrace);
			}
		}

		private static void ApplyStatus(Item item, Character character)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			float[] array = new float[CharacterAfflictions.NumStatusTypes];
			foreach (STATUSTYPE key in config.afflictions.Keys)
			{
				array[key] = config.afflictions[key].Value * config.afflictionsItemConfigs[item.itemID].Value;
			}
			if (!character.data.dead)
			{
				Log.LogInfo((object)("ApplyStatus: Applying statuses to " + ((Object)character).name));
				((MonoBehaviourPun)character).photonView.RPC("RPC_ApplyStatusesFromFloatArray", (RpcTarget)0, new object[1] { array });
			}
		}

		private static void ApplyAllergy(Character character)
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			float[] array = new float[CharacterAfflictions.NumStatusTypes];
			float[] array2 = new float[CharacterAfflictions.NumStatusTypes];
			float num = 0f;
			foreach (ConfigEntry<float> value in config.allergicResponse.Values)
			{
				num = ((value.Value > 0.001f) ? (num + value.Value) : num);
			}
			foreach (STATUSTYPE key in config.allergicResponse.Keys)
			{
				array2[key] = config.allergicResponse[key].Value / num;
				array[key] = array2[key] * Random.Range(config.allergicMin.Value, config.allergicMax.Value);
			}
			if (!character.data.dead)
			{
				Log.LogInfo((object)("ApplyAllergy: Applying allergic response to " + ((Object)character).name));
				((MonoBehaviourPun)character).photonView.RPC("RPC_ApplyStatusesFromFloatArray", (RpcTarget)0, new object[1] { array });
			}
		}

		internal static void ResetState()
		{
			if (!IsInRun)
			{
				Allergies = new Dictionary<string, HashSet<ushort>>();
				CachedFeedDataDict = new Dictionary<string, CachedFeedData>();
				CachedFeedDataDict[PhotonNetwork.LocalPlayer.UserId] = new CachedFeedData((MonoBehaviour)(object)Instance, PhotonNetwork.LocalPlayer.UserId);
				Biomes = new Dictionary<BiomeType, bool>();
				config.enableAllergies = config.enableAllergiesConfig.Value;
				config.enableAllergiesItemOverrides = config.enableAllergiesItemOverridesConfig.Value;
				Menu.selectedCharacter = null;
				Menu.selectedUserID = null;
			}
		}

		public static void TryApplyStatus(Item item, bool isConsumeMethod = false)
		{
			if (PhotonNetwork.IsMasterClient && config.enableAfflictionsConfig.Value && Object.op_Implicit((Object)(object)item.trueHolderCharacter) && ShouldApplyStatus(item, isConsumeMethod))
			{
				ApplyStatus(item, item.trueHolderCharacter);
			}
		}

		public static void GenerateAllergiesPairings(Character character, bool forceRegenerate = false)
		{
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			if (!PhotonNetwork.IsMasterClient || !config.enableAllergies)
			{
				return;
			}
			if (!IsInRun)
			{
				IsInRun = true;
			}
			string userId = ((MonoBehaviourPun)character).photonView.Owner.UserId;
			if (forceRegenerate)
			{
				Allergies[userId] = new HashSet<ushort>();
			}
			if (!CachedFeedDataDict.TryGetValue(userId, out CachedFeedData _))
			{
				CachedFeedDataDict[userId] = new CachedFeedData((MonoBehaviour)(object)Instance, userId);
			}
			List<ushort> list = new List<ushort>();
			ItemDatabase instance = SingletonAsset<ItemDatabase>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				Log.LogWarning((object)"ItemDatabase not loaded");
			}
			if (config.enableAllergiesItemOverrides)
			{
				foreach (KeyValuePair<ushort, Item> item in instance.itemLookup)
				{
					Log.LogInfo((object)("Item name: " + ((Object)item.Value).name));
					if (config.allergiesItemOverrides[item.Key].Value)
					{
						list.Add(item.Key);
					}
				}
			}
			else
			{
				if (Biomes.Count < 1)
				{
					Scene activeScene = SceneManager.GetActiveScene();
					PopulateBiomes(((Scene)(ref activeScene)).name);
				}
				Log.LogInfo((object)("Biomes: " + Biomes.ToString()));
				foreach (KeyValuePair<ushort, Item> item2 in instance.itemLookup)
				{
					Action_RestoreHunger component = ((Component)item2.Value).gameObject.GetComponent<Action_RestoreHunger>();
					if (!((Object)(object)component == (Object)null) && IsValidItem(item2.Value))
					{
						list.Add(item2.Key);
					}
				}
			}
			Log.LogInfo((object)"Finished adding valid items");
			List<ushort> list2 = new List<ushort>(list);
			for (int i = 1; i < 4; i++)
			{
				int num = Random.Range(0, list2.Count);
				Log.LogInfo((object)$"validItemIDs.Count, randIdx: {list2.Count}, {num}");
				ushort num2 = list2[num];
				float num3 = 1f / (float)i;
				float value2 = Random.value;
				if (!Allergies.ContainsKey(userId))
				{
					Allergies[userId] = new HashSet<ushort>();
				}
				if (value2 <= num3)
				{
					Allergies[userId].Add(num2);
					list2.Remove(num2);
					Log.LogInfo((object)("Character " + ((Object)character).name + " is allergic to " + ((Object)instance.itemLookup[num2]).name));
				}
			}
		}

		public static void TryApplyAllergy(Item item, Character character, bool isConsumeMethod = false, bool isReduceUseMethod = false)
		{
			if (!PhotonNetwork.IsMasterClient)
			{
				return;
			}
			if (!config.enableAllergies)
			{
				Log.LogInfo((object)"Allergies disabled");
				return;
			}
			string userId = ((MonoBehaviourPun)character).photonView.Owner.UserId;
			if (!Allergies.TryGetValue(userId, out HashSet<ushort> value) || value.Count < 1)
			{
				Log.LogInfo((object)"No allergies paired");
				return;
			}
			Character character2 = character;
			if (CachedFeedDataDict[userId].feedData != null)
			{
				try
				{
					PhotonView val = PhotonView.Find(CachedFeedDataDict[userId].feedData.receiverID);
					Character val2 = ((val != null) ? ((Component)val).GetComponent<Character>() : null);
					character2 = val2;
				}
				catch (Exception ex)
				{
					Log.LogError((object)"Null PhotonView?");
					Log.LogError((object)("Error: " + ex.Message));
					Log.LogError((object)ex.StackTrace);
				}
			}
			try
			{
				if (ShouldApplyAllergy(item, character2, isConsumeMethod, isReduceUseMethod))
				{
					ApplyAllergy(character2);
				}
			}
			catch (Exception ex2)
			{
				Log.LogError((object)("Error: " + ex2.Message));
				Log.LogError((object)ex2.StackTrace);
			}
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ConstantExpectedAttribute : Attribute
	{
		public object? Min { get; set; }

		public object? Max { get; set; }
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ExperimentalAttribute : Attribute
	{
		public string DiagnosticId { get; }

		public string? UrlFormat { get; set; }

		public ExperimentalAttribute(string diagnosticId)
		{
			DiagnosticId = diagnosticId;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class SetsRequiredMembersAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class StringSyntaxAttribute : Attribute
	{
		public const string CompositeFormat = "CompositeFormat";

		public const string DateOnlyFormat = "DateOnlyFormat";

		public const string DateTimeFormat = "DateTimeFormat";

		public const string EnumFormat = "EnumFormat";

		public const string GuidFormat = "GuidFormat";

		public const string Json = "Json";

		public const string NumericFormat = "NumericFormat";

		public const string Regex = "Regex";

		public const string TimeOnlyFormat = "TimeOnlyFormat";

		public const string TimeSpanFormat = "TimeSpanFormat";

		public const string Uri = "Uri";

		public const string Xml = "Xml";

		public string Syntax { get; }

		public object?[] Arguments { get; }

		public StringSyntaxAttribute(string syntax)
		{
			Syntax = syntax;
			Arguments = new object[0];
		}

		public StringSyntaxAttribute(string syntax, params object?[] arguments)
		{
			Syntax = syntax;
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class UnscopedRefAttribute : Attribute
	{
	}
}
namespace System.Runtime.Versioning
{
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresPreviewFeaturesAttribute : Attribute
	{
		public string? Message { get; }

		public string? Url { get; set; }

		public RequiresPreviewFeaturesAttribute()
		{
		}

		public RequiresPreviewFeaturesAttribute(string? message)
		{
			Message = message;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CollectionBuilderAttribute : Attribute
	{
		public Type BuilderType { get; }

		public string MethodName { get; }

		public CollectionBuilderAttribute(Type builderType, string methodName)
		{
			BuilderType = builderType;
			MethodName = methodName;
		}
	}
	[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CompilerFeatureRequiredAttribute : Attribute
	{
		public const string RefStructs = "RefStructs";

		public const string RequiredMembers = "RequiredMembers";

		public string FeatureName { get; }

		public bool IsOptional { get; set; }

		public CompilerFeatureRequiredAttribute(string featureName)
		{
			FeatureName = featureName;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute
	{
		public string[] Arguments { get; }

		public InterpolatedStringHandlerArgumentAttribute(string argument)
		{
			Arguments = new string[1] { argument };
		}

		public InterpolatedStringHandlerArgumentAttribute(params string[] arguments)
		{
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class InterpolatedStringHandlerAttribute : Attribute
	{
	}
	[EditorBrowsable(EditorBrowsableState.Never)]
	[ExcludeFromCodeCoverage]
	internal static class IsExternalInit
	{
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ModuleInitializerAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class OverloadResolutionPriorityAttribute : Attribute
	{
		public int Priority { get; }

		public OverloadResolutionPriorityAttribute(int priority)
		{
			Priority = priority;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ParamCollectionAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiredMemberAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresLocationAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class SkipLocalsInitAttribute : Attribute
	{
	}
}