Decompiled source of ItemInfoDisplayForkedCNPlus v1.1.1

plugins/com.github.cherrycove.ItemInfoDisplay.dll

Decompiled 2 days ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
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 ItemInfoDisplay.Properties;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Peak.Afflictions;
using Photon.Pun;
using TMPro;
using UnityEngine;
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("com.github.cherrycove.ItemInfoDisplay")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+9c458056d43878b9b7687853b9a88dbd5e62154b")]
[assembly: AssemblyProduct("com.github.cherrycove.ItemInfoDisplay")]
[assembly: AssemblyTitle("ItemInfoDisplay")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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.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")]
	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")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace ItemInfoDisplay
{
	[BepInPlugin("com.github.cherrycove.ItemInfoDisplay", "ItemInfoDisplay", "1.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		private static class ItemInfoDisplayUpdatePatch
		{
			[HarmonyPatch(typeof(CharacterItems), "Update")]
			[HarmonyPostfix]
			private static void ItemInfoDisplayUpdate(CharacterItems __instance)
			{
				try
				{
					if ((Object)(object)guiManager == (Object)null)
					{
						AddDisplayObject();
						return;
					}
					if (configEnableTestMode.Value && (Object)(object)Character.localCharacter != (Object)null && __instance.character == Character.localCharacter)
					{
						HandleTestModeInput();
					}
					if ((Object)(object)Character.observedCharacter.data.currentItem != (Object)null)
					{
						UpdateLanternRefreshFlag(Character.observedCharacter.data.currentItem);
						if (hasChanged)
						{
							hasChanged = false;
							ProcessItemGameObject();
						}
						else if (Mathf.Abs(Character.observedCharacter.data.sinceItemAttach - lastKnownSinceItemAttach) >= configForceUpdateTime.Value)
						{
							hasChanged = true;
							lastKnownSinceItemAttach = Character.observedCharacter.data.sinceItemAttach;
						}
						if (!((Component)itemInfoDisplayTextMesh).gameObject.activeSelf)
						{
							((Component)itemInfoDisplayTextMesh).gameObject.SetActive(true);
						}
					}
					else if (((Component)itemInfoDisplayTextMesh).gameObject.activeSelf)
					{
						((Component)itemInfoDisplayTextMesh).gameObject.SetActive(false);
					}
				}
				catch (Exception ex)
				{
					Log.LogError((object)(ex.Message + ex.StackTrace));
				}
			}
		}

		private static class ItemInfoDisplayEquipPatch
		{
			[HarmonyPatch(typeof(CharacterItems), "Equip")]
			[HarmonyPostfix]
			private static void ItemInfoDisplayEquip(CharacterItems __instance)
			{
				try
				{
					if (Character.observedCharacter == __instance.character)
					{
						hasChanged = true;
					}
				}
				catch (Exception ex)
				{
					Log.LogError((object)(ex.Message + ex.StackTrace));
				}
			}
		}

		private static class ItemInfoDisplayFinishCookingPatch
		{
			[HarmonyPatch(typeof(ItemCooking), "FinishCooking")]
			[HarmonyPostfix]
			private static void ItemInfoDisplayFinishCooking(ItemCooking __instance)
			{
				try
				{
					if (Character.observedCharacter == ((ItemComponent)__instance).item.holderCharacter)
					{
						hasChanged = true;
					}
				}
				catch (Exception ex)
				{
					Log.LogError((object)(ex.Message + ex.StackTrace));
				}
			}
		}

		private static class ItemInfoDisplayReduceUsesRPCPatch
		{
			[HarmonyPatch(typeof(Action_ReduceUses), "ReduceUsesRPC")]
			[HarmonyPostfix]
			private static void ItemInfoDisplayReduceUsesRPC(Action_ReduceUses __instance)
			{
				try
				{
					if (Character.observedCharacter == ((ItemActionBase)__instance).character)
					{
						hasChanged = true;
					}
				}
				catch (Exception ex)
				{
					Log.LogError((object)(ex.Message + ex.StackTrace));
				}
			}
		}

		private static GUIManager guiManager;

		private static TextMeshProUGUI itemInfoDisplayTextMesh;

		private static Dictionary<string, string> effectColors = new Dictionary<string, string>();

		private static float lastKnownSinceItemAttach;

		private static bool hasChanged;

		private static ConfigEntry<float> configFontSize;

		private static ConfigEntry<float> configOutlineWidth;

		private static ConfigEntry<float> configLineSpacing;

		private static ConfigEntry<float> configSizeDeltaX;

		private static ConfigEntry<float> configForceUpdateTime;

		private static ConfigEntry<bool> configEnableTestMode;

		private static List<Item> allItemPrefabs = new List<Item>();

		private static int currentTestItemIndex = 0;

		private static bool testModeInitialized = false;

		private static bool testModeInputDisabled = false;

		private static bool inputSystemChecked = false;

		private static bool inputSystemAvailable = false;

		private static PropertyInfo inputSystemKeyboardCurrentProp;

		private static PropertyInfo inputSystemKeyboardItemProp;

		private static PropertyInfo inputSystemKeyControlPressedProp;

		private static Type inputSystemKeyType;

		private static bool legacyInputAvailable = true;

		private static HashSet<string> missingEffectColors = new HashSet<string>();

		private static int lastLanternItemId = 0;

		private static int lastLanternRemainingSeconds = -1;

		public const string Id = "com.github.cherrycove.ItemInfoDisplay";

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


		public static string Name => "ItemInfoDisplay";

		public static string Version => "1.1.0";

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			InitEffectColors(effectColors);
			lastKnownSinceItemAttach = 0f;
			hasChanged = true;
			configFontSize = ((BaseUnityPlugin)this).Config.Bind<float>("ItemInfoDisplay", "Font Size", 20f, "Customize the Font Size for description text.");
			configOutlineWidth = ((BaseUnityPlugin)this).Config.Bind<float>("ItemInfoDisplay", "Outline Width", 0.08f, "Customize the Outline Width for item description text.");
			configLineSpacing = ((BaseUnityPlugin)this).Config.Bind<float>("ItemInfoDisplay", "Line Spacing", -35f, "Customize the Line Spacing for item description text.");
			configSizeDeltaX = ((BaseUnityPlugin)this).Config.Bind<float>("ItemInfoDisplay", "Size Delta X", 550f, "Customize the horizontal length of the container for the mod. Increasing moves text left, decreasing moves text right.");
			configForceUpdateTime = ((BaseUnityPlugin)this).Config.Bind<float>("ItemInfoDisplay", "Force Update Time", 1f, "Customize the time in seconds until the mod forces an update for the item.");
			configEnableTestMode = ((BaseUnityPlugin)this).Config.Bind<bool>("ItemInfoDisplay", "Enable Test Mode", false, "Enable test mode to cycle through all items with F9/F10 keys.");
			Harmony.CreateAndPatchAll(typeof(ItemInfoDisplayUpdatePatch), (string)null);
			Harmony.CreateAndPatchAll(typeof(ItemInfoDisplayEquipPatch), (string)null);
			Harmony.CreateAndPatchAll(typeof(ItemInfoDisplayFinishCookingPatch), (string)null);
			Harmony.CreateAndPatchAll(typeof(ItemInfoDisplayReduceUsesRPCPatch), (string)null);
			Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
		}

		private static void ProcessItemGameObject()
		{
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Expected O, but got Unknown
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Expected O, but got Unknown
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Expected O, but got Unknown
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Expected O, but got Unknown
			//IL_0444: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Expected O, but got Unknown
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Expected O, but got Unknown
			//IL_0528: Unknown result type (might be due to invalid IL or missing references)
			//IL_052f: Expected O, but got Unknown
			//IL_05de: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e5: Expected O, but got Unknown
			//IL_0620: Unknown result type (might be due to invalid IL or missing references)
			//IL_0627: Expected O, but got Unknown
			//IL_07a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a9: Expected O, but got Unknown
			//IL_0818: Unknown result type (might be due to invalid IL or missing references)
			//IL_081f: Expected O, but got Unknown
			//IL_0886: Unknown result type (might be due to invalid IL or missing references)
			//IL_088d: Expected O, but got Unknown
			//IL_094f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0956: Expected O, but got Unknown
			//IL_06a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b91: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b98: Expected O, but got Unknown
			//IL_0c4f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c56: Expected O, but got Unknown
			//IL_0da7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dae: Expected O, but got Unknown
			//IL_0e92: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e99: Expected O, but got Unknown
			//IL_0f2f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f36: Expected O, but got Unknown
			//IL_0fae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fb5: Expected O, but got Unknown
			//IL_12af: Unknown result type (might be due to invalid IL or missing references)
			//IL_12b6: Expected O, but got Unknown
			//IL_14c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_14c8: Expected O, but got Unknown
			//IL_1665: Unknown result type (might be due to invalid IL or missing references)
			//IL_166c: Expected O, but got Unknown
			//IL_17af: Unknown result type (might be due to invalid IL or missing references)
			//IL_17b6: Expected O, but got Unknown
			//IL_184a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1851: Expected O, but got Unknown
			//IL_19dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_19e4: Expected O, but got Unknown
			//IL_1ab6: Unknown result type (might be due to invalid IL or missing references)
			//IL_1abd: Expected O, but got Unknown
			//IL_1d5f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1d66: Expected O, but got Unknown
			//IL_1e6e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1e75: Expected O, but got Unknown
			Item currentItem = Character.observedCharacter.data.currentItem;
			GameObject gameObject = ((Component)currentItem).gameObject;
			Component[] array = (from c in gameObject.GetComponents(typeof(Component))
				group c by ((object)c).GetType() into g
				select g.First()).ToArray();
			bool flag = false;
			string text = "";
			string text2 = "";
			string text3 = "";
			string text4 = "";
			string text5 = "";
			((TMP_Text)itemInfoDisplayTextMesh).text = "";
			text2 = ((Ascents.itemWeightModifier <= 0) ? (text2 + GetText("WEIGHT", effectColors["Weight"], ((float)currentItem.carryWeight * 2.5f).ToString("F1").Replace(".0", "")) + "</color>") : (text2 + GetText("WEIGHT", effectColors["Weight"], ((float)(currentItem.carryWeight + Ascents.itemWeightModifier) * 2.5f).ToString("F1").Replace(".0", "")) + "</color>"));
			if (((Object)gameObject).name.Equals("Bugle(Clone)"))
			{
				TextMeshProUGUI obj = itemInfoDisplayTextMesh;
				((TMP_Text)obj).text = ((TMP_Text)obj).text + GetText("Bugle") + "\n";
			}
			else if (((Object)gameObject).name.Equals("Pirate Compass(Clone)"))
			{
				TextMeshProUGUI obj2 = itemInfoDisplayTextMesh;
				((TMP_Text)obj2).text = ((TMP_Text)obj2).text + GetText("Pirate Compass", effectColors["Injury"]);
			}
			else if (((Object)gameObject).name.Equals("Compass(Clone)"))
			{
				TextMeshProUGUI obj3 = itemInfoDisplayTextMesh;
				((TMP_Text)obj3).text = ((TMP_Text)obj3).text + GetText("Compass", effectColors["Injury"]);
			}
			else if (((Object)gameObject).name.Equals("Shell Big(Clone)"))
			{
				TextMeshProUGUI obj4 = itemInfoDisplayTextMesh;
				((TMP_Text)obj4).text = ((TMP_Text)obj4).text + GetText("Shell Big", effectColors["Hunger"]);
			}
			for (int i = 0; i < array.Length; i++)
			{
				if (((object)array[i]).GetType() == typeof(ItemUseFeedback))
				{
					ItemUseFeedback val = (ItemUseFeedback)array[i];
					if (val.useAnimation.Equals("Eat") || val.useAnimation.Equals("Drink") || val.useAnimation.Equals("Heal"))
					{
						flag = true;
					}
				}
				else if (((object)array[i]).GetType() == typeof(Action_Consume))
				{
					flag = true;
				}
				else if (((object)array[i]).GetType() == typeof(Action_RestoreHunger))
				{
					Action_RestoreHunger val2 = (Action_RestoreHunger)array[i];
					text += ProcessEffect(val2.restorationAmount * -1f, "Hunger");
				}
				else if (((object)array[i]).GetType() == typeof(Action_GiveExtraStamina))
				{
					Action_GiveExtraStamina val3 = (Action_GiveExtraStamina)array[i];
					text += ProcessEffect(val3.amount, "Extra Stamina");
				}
				else if (((object)array[i]).GetType() == typeof(Action_InflictPoison))
				{
					Action_InflictPoison val4 = (Action_InflictPoison)array[i];
					text += GetText("InflictPoison", val4.delay.ToString(), ProcessEffectOverTime(val4.poisonPerSecond, 1f, val4.inflictionTime, "Poison"));
				}
				else if (((object)array[i]).GetType() == typeof(Action_AddOrRemoveThorns))
				{
					Action_AddOrRemoveThorns val5 = (Action_AddOrRemoveThorns)array[i];
					text += ProcessEffect((float)val5.thornCount * 0.05f, "Thorns");
				}
				else if (((object)array[i]).GetType() == typeof(Action_ModifyStatus))
				{
					Action_ModifyStatus val6 = (Action_ModifyStatus)array[i];
					text += ProcessEffect(val6.changeAmount, ((object)(STATUSTYPE)(ref val6.statusType)).ToString());
				}
				else if (((object)array[i]).GetType() == typeof(Action_RandomMushroomEffect))
				{
					string addition = BuildRandomMushroomEffectText(array[i]);
					((TMP_Text)itemInfoDisplayTextMesh).text = AppendWithSectionSpacing(((TMP_Text)itemInfoDisplayTextMesh).text, addition);
				}
				else if (((object)array[i]).GetType() == typeof(Action_ApplyMassAffliction))
				{
					Action_ApplyMassAffliction val7 = (Action_ApplyMassAffliction)array[i];
					text5 += GetText("ApplyMassAffliction");
					text5 += ProcessAffliction(((Action_ApplyAffliction)val7).affliction);
					if (((Action_ApplyAffliction)val7).extraAfflictions.Length == 0)
					{
						continue;
					}
					for (int j = 0; j < ((Action_ApplyAffliction)val7).extraAfflictions.Length; j++)
					{
						if (text5.EndsWith('\n'))
						{
							text5 = text5.Remove(text5.Length - 1);
						}
						text5 = text5 + ",\n" + ProcessAffliction(((Action_ApplyAffliction)val7).extraAfflictions[j]);
					}
				}
				else if (((object)array[i]).GetType() == typeof(Action_ApplyAffliction))
				{
					Action_ApplyAffliction val8 = (Action_ApplyAffliction)array[i];
					text5 += ProcessAffliction(val8.affliction);
				}
				else if (((object)array[i]).GetType() == typeof(Action_ClearAllStatus))
				{
					Action_ClearAllStatus val9 = (Action_ClearAllStatus)array[i];
					string text6 = GetText("ClearAllStatus_Base", effectColors["ItemInfoDisplayPositive"]);
					if (val9.excludeCurse)
					{
						text6 += GetText("ClearAllStatus_ExceptCurse", effectColors["Curse"]);
					}
					if (val9.otherExclusions.Count > 0)
					{
						foreach (STATUSTYPE otherExclusion in val9.otherExclusions)
						{
							STATUSTYPE current = otherExclusion;
							text6 = text6 + ", " + effectColors[((object)(STATUSTYPE)(ref current)).ToString()] + GetText("Effect_" + ((object)(STATUSTYPE)(ref current)).ToString().ToUpper()).ToUpper() + "</color>";
						}
					}
					text6 = text6.Replace(", <#E13542>" + GetText("Effect_CRAB").ToUpper() + "</color>", "") + "\n";
					TextMeshProUGUI obj5 = itemInfoDisplayTextMesh;
					((TMP_Text)obj5).text = ((TMP_Text)obj5).text + text6;
				}
				else if (((object)array[i]).GetType() == typeof(Action_ConsumeAndSpawn))
				{
					Action_ConsumeAndSpawn val10 = (Action_ConsumeAndSpawn)array[i];
					if (((object)val10.itemToSpawn).ToString().Contains("Peel"))
					{
						TextMeshProUGUI obj6 = itemInfoDisplayTextMesh;
						((TMP_Text)obj6).text = ((TMP_Text)obj6).text + GetText("ConsumeAndSpawn_Peel");
					}
				}
				else if (((object)array[i]).GetType() == typeof(Action_ReduceUses))
				{
					OptionableIntItemData val11 = (OptionableIntItemData)currentItem.data.data[(DataEntryKey)2];
					if (val11.HasData && val11.Value > 1)
					{
						text3 += GetText("ReduceUses", val11.Value.ToString());
					}
				}
				else if (((object)array[i]).GetType() == typeof(Lantern))
				{
					Lantern lantern = (Lantern)array[i];
					if (((Object)gameObject).name.Equals("Torch(Clone)"))
					{
						TextMeshProUGUI obj7 = itemInfoDisplayTextMesh;
						((TMP_Text)obj7).text = ((TMP_Text)obj7).text + GetText("Torch");
					}
					else
					{
						text5 += GetText("Lantern");
					}
					if (!((Object)gameObject).name.Equals("Torch(Clone)"))
					{
						int lanternRemainingSecondsInt = GetLanternRemainingSecondsInt(currentItem, lantern);
						text5 += GetText("LanternRemaining", lanternRemainingSecondsInt.ToString());
						text5 = AppendLanternStatusPerSecond(gameObject, text5);
					}
				}
				else if (((object)array[i]).GetType() == typeof(Action_RaycastDart))
				{
					Action_RaycastDart val12 = (Action_RaycastDart)array[i];
					flag = true;
					text5 += GetText("RaycastDart");
					for (int k = 0; k < val12.afflictionsOnHit.Length; k++)
					{
						text5 += ProcessAffliction(val12.afflictionsOnHit[k]);
						if (text5.EndsWith('\n'))
						{
							text5 = text5.Remove(text5.Length - 1);
						}
						text5 += ",\n";
					}
					if (text5.EndsWith('\n'))
					{
						text5 = text5.Remove(text5.Length - 2);
					}
					text5 += "\n";
				}
				else if (((object)array[i]).GetType() == typeof(MagicBugle))
				{
					TextMeshProUGUI obj8 = itemInfoDisplayTextMesh;
					((TMP_Text)obj8).text = ((TMP_Text)obj8).text + GetText("MagicBugle");
				}
				else if (((object)array[i]).GetType() == typeof(ClimbingSpikeComponent))
				{
					TextMeshProUGUI obj9 = itemInfoDisplayTextMesh;
					((TMP_Text)obj9).text = ((TMP_Text)obj9).text + GetText("ClimbingSpike", effectColors["Extra Stamina"]);
				}
				else if (((object)array[i]).GetType() == typeof(Action_Flare))
				{
					TextMeshProUGUI obj10 = itemInfoDisplayTextMesh;
					((TMP_Text)obj10).text = ((TMP_Text)obj10).text + GetText("Flare");
				}
				else if (((object)array[i]).GetType() == typeof(Backpack))
				{
					TextMeshProUGUI obj11 = itemInfoDisplayTextMesh;
					((TMP_Text)obj11).text = ((TMP_Text)obj11).text + GetText("Backpack");
				}
				else if (((object)array[i]).GetType() == typeof(BananaPeel))
				{
					TextMeshProUGUI obj12 = itemInfoDisplayTextMesh;
					((TMP_Text)obj12).text = ((TMP_Text)obj12).text + GetText("BananaPeel", effectColors["Hunger"]);
				}
				else if (((object)array[i]).GetType() == typeof(Constructable))
				{
					Constructable val13 = (Constructable)array[i];
					if (((Object)val13.constructedPrefab).name.Equals("PortableStovetop_Placed"))
					{
						TextMeshProUGUI obj13 = itemInfoDisplayTextMesh;
						((TMP_Text)obj13).text = ((TMP_Text)obj13).text + GetText("Constructable_PortableStovetop_Placed", effectColors["Injury"], val13.constructedPrefab.GetComponent<Campfire>().burnsFor.ToString());
					}
					else
					{
						TextMeshProUGUI obj14 = itemInfoDisplayTextMesh;
						((TMP_Text)obj14).text = ((TMP_Text)obj14).text + GetText("Constructable");
					}
				}
				else if (((object)array[i]).GetType() == typeof(RopeSpool))
				{
					RopeSpool val14 = (RopeSpool)array[i];
					if (val14.isAntiRope)
					{
						TextMeshProUGUI obj15 = itemInfoDisplayTextMesh;
						((TMP_Text)obj15).text = ((TMP_Text)obj15).text + GetText("RopeSpool_AntiRope");
					}
					else
					{
						TextMeshProUGUI obj16 = itemInfoDisplayTextMesh;
						((TMP_Text)obj16).text = ((TMP_Text)obj16).text + GetText("RopeSpool");
					}
					TextMeshProUGUI obj17 = itemInfoDisplayTextMesh;
					((TMP_Text)obj17).text = ((TMP_Text)obj17).text + GetText("RopeSpool_TIP", (val14.minSegments / 4f).ToString("F2").Replace(".0", ""), ((float)Rope.MaxSegments / 4f).ToString("F1").Replace(".0", ""));
					if (configForceUpdateTime.Value <= 1f)
					{
						text3 += GetText("RopeSpool_Left", (val14.RopeFuel / 4f).ToString("F2").Replace(".00", ""));
					}
				}
				else if (((object)array[i]).GetType() == typeof(RopeShooter))
				{
					RopeShooter val15 = (RopeShooter)array[i];
					if (((Object)val15.ropeAnchorWithRopePref).name.Equals("RopeAnchorForRopeShooterAnti"))
					{
						TextMeshProUGUI obj18 = itemInfoDisplayTextMesh;
						((TMP_Text)obj18).text = ((TMP_Text)obj18).text + GetText("RopeShooter_Anti", (val15.maxLength / 4f).ToString("F1").Replace(".0", ""));
					}
					else
					{
						TextMeshProUGUI obj19 = itemInfoDisplayTextMesh;
						((TMP_Text)obj19).text = ((TMP_Text)obj19).text + GetText("RopeShooter", (val15.maxLength / 4f).ToString("F1").Replace(".0", ""));
					}
				}
				else if (((object)array[i]).GetType() == typeof(Antigrav))
				{
					Antigrav val16 = (Antigrav)array[i];
					if (val16.intensity != 0f)
					{
						text5 += GetText("Antigrav", effectColors["Injury"]);
					}
				}
				else if (((object)array[i]).GetType() == typeof(Action_Balloon))
				{
					text5 += GetText("Balloon");
				}
				else if (((object)array[i]).GetType() == typeof(VineShooter))
				{
					VineShooter val17 = (VineShooter)array[i];
					TextMeshProUGUI obj20 = itemInfoDisplayTextMesh;
					((TMP_Text)obj20).text = ((TMP_Text)obj20).text + GetText("VineShooter", (val17.maxLength / 1.6666666f).ToString("F1").Replace(".0", ""));
				}
				else if (((object)array[i]).GetType() == typeof(ShelfShroom))
				{
					ShelfShroom val18 = (ShelfShroom)array[i];
					if ((Object)(object)val18.instantiateOnBreak == (Object)null)
					{
						Log.LogWarning((object)"[ItemInfoDisplay] ShelfShroom instantiateOnBreak was null. Skipping detailed info.");
					}
					else if (((Object)val18.instantiateOnBreak).name.Equals("HealingPuffShroomSpawn"))
					{
						TextMeshProUGUI obj21 = itemInfoDisplayTextMesh;
						((TMP_Text)obj21).text = ((TMP_Text)obj21).text + GetText("HealingPuffShroom", effectColors["Hunger"]);
						((TMP_Text)itemInfoDisplayTextMesh).text = AppendAoeInfoFromPrefab(val18.instantiateOnBreak, ((TMP_Text)itemInfoDisplayTextMesh).text);
					}
					else if (((Object)val18.instantiateOnBreak).name.Equals("ShelfShroomSpawn"))
					{
						TextMeshProUGUI obj22 = itemInfoDisplayTextMesh;
						((TMP_Text)obj22).text = ((TMP_Text)obj22).text + GetText("ShelfShroomSpawn", effectColors["Hunger"]);
					}
					else if (((Object)val18.instantiateOnBreak).name.Equals("BounceShroomSpawn"))
					{
						TextMeshProUGUI obj23 = itemInfoDisplayTextMesh;
						((TMP_Text)obj23).text = ((TMP_Text)obj23).text + GetText("BounceShroomSpawn", effectColors["Hunger"]);
					}
				}
				else if (((object)array[i]).GetType() == typeof(ScoutEffigy))
				{
					TextMeshProUGUI obj24 = itemInfoDisplayTextMesh;
					((TMP_Text)obj24).text = ((TMP_Text)obj24).text + GetText("ScoutEffigy", effectColors["Extra Stamina"]);
				}
				else if (((object)array[i]).GetType() == typeof(Action_Die))
				{
					TextMeshProUGUI obj25 = itemInfoDisplayTextMesh;
					((TMP_Text)obj25).text = ((TMP_Text)obj25).text + GetText("Action_Die", effectColors["Curse"]);
				}
				else if (((object)array[i]).GetType() == typeof(Action_SpawnGuidebookPage))
				{
					flag = true;
					TextMeshProUGUI obj26 = itemInfoDisplayTextMesh;
					((TMP_Text)obj26).text = ((TMP_Text)obj26).text + GetText("SpawnGuidebookPage");
				}
				else if (((object)array[i]).GetType() == typeof(Action_Guidebook))
				{
					TextMeshProUGUI obj27 = itemInfoDisplayTextMesh;
					((TMP_Text)obj27).text = ((TMP_Text)obj27).text + GetText("Guidebook");
				}
				else if (((object)array[i]).GetType() == typeof(Action_CallScoutmaster))
				{
					((TMP_Text)itemInfoDisplayTextMesh).text = AppendWithSectionSpacing(((TMP_Text)itemInfoDisplayTextMesh).text, GetText("CallScoutmaster", effectColors["Injury"]) ?? "");
				}
				else if (((object)array[i]).GetType() == typeof(Action_MoraleBoost))
				{
					Action_MoraleBoost val19 = (Action_MoraleBoost)array[i];
					if (val19.boostRadius < 0f)
					{
						TextMeshProUGUI obj28 = itemInfoDisplayTextMesh;
						((TMP_Text)obj28).text = ((TMP_Text)obj28).text + GetText("MoraleBoost_Self", effectColors["ItemInfoDisplayPositive"], effectColors["Extra Stamina"], (val19.baselineStaminaBoost * 100f).ToString("F1").Replace(".0", ""));
					}
					else if (val19.boostRadius > 0f)
					{
						TextMeshProUGUI obj29 = itemInfoDisplayTextMesh;
						((TMP_Text)obj29).text = ((TMP_Text)obj29).text + GetText("MoraleBoost_Nearby", effectColors["ItemInfoDisplayPositive"], effectColors["Extra Stamina"], (val19.baselineStaminaBoost * 100f).ToString("F1").Replace(".0", ""));
					}
				}
				else if (((object)array[i]).GetType() == typeof(Breakable))
				{
					((TMP_Text)itemInfoDisplayTextMesh).text = AppendWithSectionSpacing(((TMP_Text)itemInfoDisplayTextMesh).text, GetText("Breakable", effectColors["Hunger"]) ?? "");
				}
				else if (((object)array[i]).GetType() == typeof(Bonkable))
				{
					((TMP_Text)itemInfoDisplayTextMesh).text = AppendWithSectionSpacing(((TMP_Text)itemInfoDisplayTextMesh).text, GetText("Bonkable", effectColors["Hunger"], effectColors["Injury"]) ?? "");
				}
				else if (((object)array[i]).GetType() == typeof(MagicBean))
				{
					MagicBean val20 = (MagicBean)array[i];
					TextMeshProUGUI obj30 = itemInfoDisplayTextMesh;
					((TMP_Text)obj30).text = ((TMP_Text)obj30).text + GetText("MagicBean", effectColors["Hunger"], (val20.plantPrefab.maxLength / 2f).ToString("F1").Replace(".0", ""));
				}
				else if (((object)array[i]).GetType() == typeof(BingBong))
				{
					TextMeshProUGUI obj31 = itemInfoDisplayTextMesh;
					((TMP_Text)obj31).text = ((TMP_Text)obj31).text + GetText("BingBong");
				}
				else if (((object)array[i]).GetType() == typeof(Action_Passport))
				{
					TextMeshProUGUI obj32 = itemInfoDisplayTextMesh;
					((TMP_Text)obj32).text = ((TMP_Text)obj32).text + GetText("Passport") + "\n";
				}
				else if (((object)array[i]).GetType() == typeof(Actions_Binoculars))
				{
					TextMeshProUGUI obj33 = itemInfoDisplayTextMesh;
					((TMP_Text)obj33).text = ((TMP_Text)obj33).text + GetText("Binoculars");
				}
				else if (((object)array[i]).GetType() == typeof(Action_WarpToRandomPlayer))
				{
					TextMeshProUGUI obj34 = itemInfoDisplayTextMesh;
					((TMP_Text)obj34).text = ((TMP_Text)obj34).text + GetText("WarpToRandomPlayer");
				}
				else if (((object)array[i]).GetType() == typeof(Action_WarpToBiome))
				{
					Action_WarpToBiome val21 = (Action_WarpToBiome)array[i];
					TextMeshProUGUI obj35 = itemInfoDisplayTextMesh;
					((TMP_Text)obj35).text = ((TMP_Text)obj35).text + GetText("WarpToBiome", ((object)(Segment)(ref val21.segmentToWarpTo)).ToString().ToUpper());
				}
				else if (((object)array[i]).GetType() == typeof(Parasol))
				{
					TextMeshProUGUI obj36 = itemInfoDisplayTextMesh;
					((TMP_Text)obj36).text = ((TMP_Text)obj36).text + GetText("Parasol") + "\n";
				}
				else if (((object)array[i]).GetType() == typeof(Frisbee))
				{
					TextMeshProUGUI obj37 = itemInfoDisplayTextMesh;
					((TMP_Text)obj37).text = ((TMP_Text)obj37).text + GetText("Frisbee", effectColors["Hunger"]);
				}
				else if (((object)array[i]).GetType() == typeof(Action_ConstructableScoutCannonScroll))
				{
					TextMeshProUGUI obj38 = itemInfoDisplayTextMesh;
					((TMP_Text)obj38).text = ((TMP_Text)obj38).text + GetText("ConstructableScoutCannonScroll");
				}
				else if (((object)array[i]).GetType() == typeof(Dynamite))
				{
					Dynamite val22 = (Dynamite)array[i];
					TextMeshProUGUI obj39 = itemInfoDisplayTextMesh;
					((TMP_Text)obj39).text = ((TMP_Text)obj39).text + GetText("Dynamite", effectColors["Injury"], (val22.explosionPrefab.GetComponent<AOE>().statusAmount * 100f).ToString("F1").Replace(".0", ""));
				}
				else if (((object)array[i]).GetType() == typeof(Scorpion))
				{
					Scorpion val23 = (Scorpion)array[i];
					if (configForceUpdateTime.Value <= 1f)
					{
						float num = Mathf.Max(0.5f, 1f - currentItem.holderCharacter.refs.afflictions.statusSum + 0.05f) * 100f;
						TextMeshProUGUI obj40 = itemInfoDisplayTextMesh;
						((TMP_Text)obj40).text = ((TMP_Text)obj40).text + GetText("Scorpion_Dynamic", effectColors["Poison"], effectColors["Curse"], effectColors["Heat"], num.ToString("F1").Replace(".0", ""), val23.totalPoisonTime.ToString("F1").Replace(".0", ""));
					}
					else
					{
						TextMeshProUGUI obj41 = itemInfoDisplayTextMesh;
						((TMP_Text)obj41).text = ((TMP_Text)obj41).text + GetText("Scorpion_Static", effectColors["Poison"], effectColors["Curse"], effectColors["Heat"], val23.totalPoisonTime.ToString("F1").Replace(".0", ""));
					}
				}
				else if (((object)array[i]).GetType() == typeof(Action_Spawn))
				{
					Action_Spawn val24 = (Action_Spawn)array[i];
					if (((Object)val24.objectToSpawn).name.Equals("VFX_Sunscreen"))
					{
						AOE component = ((Component)val24.objectToSpawn.transform.Find("AOE")).GetComponent<AOE>();
						RemoveAfterSeconds component2 = ((Component)val24.objectToSpawn.transform.Find("AOE")).GetComponent<RemoveAfterSeconds>();
						TextMeshProUGUI obj42 = itemInfoDisplayTextMesh;
						((TMP_Text)obj42).text = ((TMP_Text)obj42).text + GetText("VFX_Sunscreen", component2.seconds.ToString("F1").Replace(".0", ""), ProcessAffliction(component.affliction));
					}
				}
				else if (((object)array[i]).GetType() == typeof(CactusBall))
				{
					CactusBall val25 = (CactusBall)array[i];
					TextMeshProUGUI obj43 = itemInfoDisplayTextMesh;
					((TMP_Text)obj43).text = ((TMP_Text)obj43).text + GetText("CactusBall", effectColors["Thorns"], effectColors["Hunger"], (((StickyItemComponent)val25).throwChargeRequirement * 100f).ToString("F1").Replace(".0", ""));
				}
				else if (((object)array[i]).GetType() == typeof(BingBongShieldWhileHolding))
				{
					TextMeshProUGUI obj44 = itemInfoDisplayTextMesh;
					((TMP_Text)obj44).text = ((TMP_Text)obj44).text + GetText("BingBongShieldWhileHolding", effectColors["Shield"]);
				}
				else if (((object)array[i]).GetType() == typeof(RescueHook))
				{
					TextMeshProUGUI obj45 = itemInfoDisplayTextMesh;
					((TMP_Text)obj45).text = ((TMP_Text)obj45).text + GetText("RescueHook");
				}
				else if (((object)array[i]).GetType() == typeof(Beehive))
				{
					TextMeshProUGUI obj46 = itemInfoDisplayTextMesh;
					((TMP_Text)obj46).text = ((TMP_Text)obj46).text + GetText("Beehive", effectColors["Injury"], effectColors["Poison"]);
				}
				else if (((object)array[i]).GetType() == typeof(BugPhobia))
				{
					((TMP_Text)itemInfoDisplayTextMesh).text = AppendWithSectionSpacing(((TMP_Text)itemInfoDisplayTextMesh).text, GetText("BugPhobia"));
				}
				else if (((object)array[i]).GetType() == typeof(Mandrake))
				{
					TextMeshProUGUI obj47 = itemInfoDisplayTextMesh;
					((TMP_Text)obj47).text = ((TMP_Text)obj47).text + GetText("Mandrake", effectColors["Drowsy"], effectColors["Heat"]);
				}
				else if (((object)array[i]).GetType() == typeof(Snowball))
				{
					TextMeshProUGUI obj48 = itemInfoDisplayTextMesh;
					((TMP_Text)obj48).text = ((TMP_Text)obj48).text + GetText("Snowball", effectColors["Cold"]);
				}
				else if (((object)array[i]).GetType() == typeof(StickyItemComponent))
				{
					StickyItemComponent val26 = (StickyItemComponent)array[i];
					string text7 = GetText("StickyItemComponent", effectColors["Hunger"]);
					if (val26.addWeightToStuckPlayer > 0)
					{
						text7 += GetText("StickyItemComponent_Weight", effectColors["Weight"], ((float)val26.addWeightToStuckPlayer * 2.5f).ToString("F1").Replace(".0", ""));
					}
					if (val26.addThornsToStuckPlayer > 0)
					{
						text7 += GetText("StickyItemComponent_Thorns", effectColors["Thorns"], val26.addThornsToStuckPlayer.ToString());
					}
					TextMeshProUGUI obj49 = itemInfoDisplayTextMesh;
					((TMP_Text)obj49).text = ((TMP_Text)obj49).text + text7;
				}
				else if (((object)array[i]).GetType() == typeof(ItemCooking))
				{
					ItemCooking val27 = (ItemCooking)array[i];
					if (val27.wreckWhenCooked && val27.timesCookedLocal >= 1)
					{
						text4 += GetText("COOKED_BROKEN", effectColors["Curse"]);
					}
					else if (val27.wreckWhenCooked)
					{
						text4 += GetText("COOK_BROKEN", effectColors["Curse"]);
					}
					else if (val27.timesCookedLocal >= 12)
					{
						text4 += GetText("COOKED_MAX", effectColors["Curse"], val27.timesCookedLocal.ToString());
					}
					else if (val27.timesCookedLocal == 0)
					{
						text4 = text4 + "\n" + GetText("COOK", effectColors["Extra Stamina"]) + "</color>";
					}
					else if (val27.timesCookedLocal == 1)
					{
						text4 += GetText("COOKED", effectColors["Extra Stamina"], val27.timesCookedLocal.ToString(), effectColors["Hunger"]);
					}
					else if (val27.timesCookedLocal == 2)
					{
						text4 += GetText("COOKED", effectColors["Hunger"], val27.timesCookedLocal.ToString(), effectColors["Injury"]);
					}
					else if (val27.timesCookedLocal == 3)
					{
						text4 += GetText("COOKED", effectColors["Injury"], val27.timesCookedLocal.ToString(), effectColors["Poison"]);
					}
					else if (val27.timesCookedLocal >= 4)
					{
						text4 += GetText("COOKED", effectColors["Poison"], val27.timesCookedLocal.ToString(), "");
					}
				}
			}
			if (text.Length > 0 && flag)
			{
				((TMP_Text)itemInfoDisplayTextMesh).text = text + "\n" + ((TMP_Text)itemInfoDisplayTextMesh).text;
			}
			if (text5.Length > 0)
			{
				TextMeshProUGUI obj50 = itemInfoDisplayTextMesh;
				((TMP_Text)obj50).text = ((TMP_Text)obj50).text + "\n" + text5;
			}
			string text8 = text2 + text3 + text4;
			if (!string.IsNullOrEmpty(text8))
			{
				if (((TMP_Text)itemInfoDisplayTextMesh).text.Length > 0 && !((TMP_Text)itemInfoDisplayTextMesh).text.EndsWith("\n\n"))
				{
					if (((TMP_Text)itemInfoDisplayTextMesh).text.EndsWith("\n"))
					{
						TextMeshProUGUI obj51 = itemInfoDisplayTextMesh;
						((TMP_Text)obj51).text = ((TMP_Text)obj51).text + "\n";
					}
					else
					{
						TextMeshProUGUI obj52 = itemInfoDisplayTextMesh;
						((TMP_Text)obj52).text = ((TMP_Text)obj52).text + "\n\n";
					}
				}
				TextMeshProUGUI obj53 = itemInfoDisplayTextMesh;
				((TMP_Text)obj53).text = ((TMP_Text)obj53).text + text8;
			}
			while (((TMP_Text)itemInfoDisplayTextMesh).text.Contains("\n\n\n"))
			{
				((TMP_Text)itemInfoDisplayTextMesh).text = ((TMP_Text)itemInfoDisplayTextMesh).text.Replace("\n\n\n", "\n\n");
			}
		}

		private static string AppendWithSectionSpacing(string target, string addition)
		{
			if (string.IsNullOrEmpty(addition))
			{
				return target;
			}
			if (target.Length > 0 && !target.EndsWith("\n\n"))
			{
				target += (target.EndsWith("\n") ? "\n" : "\n\n");
			}
			target += addition;
			return target;
		}

		private static string AppendAoeInfoFromPrefab(GameObject prefab, string target)
		{
			if ((Object)(object)prefab == (Object)null)
			{
				return target;
			}
			AOE[] componentsInChildren = prefab.GetComponentsInChildren<AOE>(true);
			if (componentsInChildren == null || componentsInChildren.Length == 0)
			{
				Log.LogWarning((object)"[ItemInfoDisplay] No AOE components found on HealingPuffShroom prefab. Effect info unavailable.");
				return target;
			}
			TimeEvent componentInChildren = prefab.GetComponentInChildren<TimeEvent>(true);
			RemoveAfterSeconds componentInChildren2 = prefab.GetComponentInChildren<RemoveAfterSeconds>(true);
			Dictionary<string, float> dictionary = new Dictionary<string, float>();
			Dictionary<(string, float), float> dictionary2 = new Dictionary<(string, float), float>();
			AOE[] array = componentsInChildren;
			foreach (AOE val in array)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				string text = ((object)(STATUSTYPE)(ref val.statusType)).ToString();
				if (!string.IsNullOrEmpty(text))
				{
					TimeEvent val2 = ((Component)val).GetComponent<TimeEvent>() ?? ((Component)val).GetComponentInParent<TimeEvent>() ?? componentInChildren;
					RemoveAfterSeconds val3 = ((Component)val).GetComponent<RemoveAfterSeconds>() ?? ((Component)val).GetComponentInParent<RemoveAfterSeconds>() ?? componentInChildren2;
					if ((Object)(object)val2 != (Object)null && (Object)(object)val3 != (Object)null && val2.rate > 0f && val3.seconds > 0f)
					{
						float num = val.statusAmount / val2.rate;
						(string, float) key = (text, val3.seconds);
						dictionary2[key] = (dictionary2.TryGetValue(key, out var value) ? (value + num) : num);
					}
					else
					{
						float statusAmount = val.statusAmount;
						dictionary[text] = (dictionary.TryGetValue(text, out var value2) ? (value2 + statusAmount) : statusAmount);
					}
				}
			}
			foreach (KeyValuePair<string, float> item in dictionary.OrderBy((KeyValuePair<string, float> k) => k.Key))
			{
				float amount = Mathf.Round(item.Value * 40f) / 40f;
				target += ProcessEffect(amount, item.Key);
			}
			foreach (KeyValuePair<(string, float), float> item2 in from k in dictionary2
				orderby k.Key.status, k.Key.duration
				select k)
			{
				float amountPerSecond = Mathf.Round(item2.Value * 40f) / 40f;
				target += ProcessEffectPerSecondOverTime(amountPerSecond, item2.Key.Item2, item2.Key.Item1);
			}
			return target;
		}

		private static string AppendLanternStatusPerSecond(GameObject itemGameObj, string target)
		{
			if ((Object)(object)itemGameObj == (Object)null)
			{
				return target;
			}
			StatusField[] componentsInChildren = itemGameObj.GetComponentsInChildren<StatusField>(true);
			if (componentsInChildren == null || componentsInChildren.Length == 0)
			{
				return target;
			}
			Dictionary<string, float> dictionary = new Dictionary<string, float>();
			Dictionary<string, float> dictionary2 = new Dictionary<string, float>();
			StatusField[] array = componentsInChildren;
			foreach (StatusField val in array)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				string text = ((object)(STATUSTYPE)(ref val.statusType)).ToString();
				if (!string.IsNullOrEmpty(text))
				{
					dictionary[text] = (dictionary.TryGetValue(text, out var value) ? (value + val.statusAmountPerSecond) : val.statusAmountPerSecond);
					if (val.statusAmountOnEntry != 0f)
					{
						dictionary2[text] = (dictionary2.TryGetValue(text, out var value2) ? (value2 + val.statusAmountOnEntry) : val.statusAmountOnEntry);
					}
				}
				foreach (StatusFieldStatus additionalStatus in val.additionalStatuses)
				{
					string text2 = ((object)(STATUSTYPE)(ref additionalStatus.statusType)).ToString();
					if (!string.IsNullOrEmpty(text2))
					{
						dictionary[text2] = (dictionary.TryGetValue(text2, out var value3) ? (value3 + additionalStatus.statusAmountPerSecond) : additionalStatus.statusAmountPerSecond);
					}
				}
			}
			AddFaerieLanternSporesPerSecond(itemGameObj, dictionary);
			foreach (KeyValuePair<string, float> item in dictionary.OrderBy((KeyValuePair<string, float> k) => k.Key))
			{
				target += ProcessEffectPerSecond(item.Value, item.Key);
			}
			foreach (KeyValuePair<string, float> item2 in dictionary2.OrderBy((KeyValuePair<string, float> k) => k.Key))
			{
				target += ProcessEffectOnEntry(item2.Value, item2.Key);
			}
			if (TryGetDispelFogFieldInfo(itemGameObj, out var innerRadius, out var outerRadius))
			{
				target += GetText("DispelFogField_Strength", effectColors["ItemInfoDisplayPositive"], GetEffectColor("Spores"), innerRadius.ToString("F1").Replace(".0", ""), outerRadius.ToString("F1").Replace(".0", ""));
			}
			return target;
		}

		private static void AddFaerieLanternSporesPerSecond(GameObject itemGameObj, Dictionary<string, float> totals)
		{
			if (totals != null && !((Object)(object)itemGameObj == (Object)null) && IsFaerieLantern(itemGameObj))
			{
				totals["Spores"] = (totals.TryGetValue("Spores", out var value) ? (value + -0.025f) : (-0.025f));
			}
		}

		private static bool IsFaerieLantern(GameObject itemGameObj)
		{
			if ((Object)(object)itemGameObj == (Object)null)
			{
				return false;
			}
			string text = ((Object)itemGameObj).name ?? string.Empty;
			return text.StartsWith("Lantern_Faerie", StringComparison.OrdinalIgnoreCase);
		}

		private static bool TryGetDispelFogFieldInfo(GameObject itemGameObj, out float innerRadius, out float outerRadius)
		{
			innerRadius = 0f;
			outerRadius = 0f;
			if ((Object)(object)itemGameObj == (Object)null)
			{
				return false;
			}
			Component[] componentsInChildren = itemGameObj.GetComponentsInChildren<Component>(true);
			Component[] array = componentsInChildren;
			foreach (Component val in array)
			{
				if (!((Object)(object)val == (Object)null) && ((object)val).GetType().Name == "DispelFogField")
				{
					Type type = ((object)val).GetType();
					FieldInfo field = type.GetField("innerRadius", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					FieldInfo field2 = type.GetField("outerRadius", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					if (field != null)
					{
						innerRadius = (float)field.GetValue(val);
					}
					if (field2 != null)
					{
						outerRadius = (float)field2.GetValue(val);
					}
					return true;
				}
			}
			return false;
		}

		private static string BuildRandomMushroomEffectText(object effect)
		{
			if (effect is Action_RandomMushroomEffect)
			{
				return BuildRandomMushroomEffectListText();
			}
			if (effect == null)
			{
				return GetText("RandomMushroomEffect");
			}
			HashSet<string> hashSet = new HashSet<string>();
			CollectStatusTypes(effect, hashSet);
			if (hashSet.Count == 0)
			{
				return GetText("RandomMushroomEffect");
			}
			List<string> list = new List<string>();
			foreach (string item in hashSet)
			{
				list.Add(FormatEffectNameWithColor(item));
			}
			string text = string.Join(", ", list);
			return GetText("RandomMushroomEffect_List", text);
		}

		private static string BuildRandomMushroomEffectListText()
		{
			string text = GetText("RandomMushroomEffect_Title");
			text += GetText("RandomMushroomEffect_0", effectColors["Extra Stamina"], "4");
			text += GetText("RandomMushroomEffect_1", effectColors["ItemInfoDisplayPositive"], "50", "150", "5", "1");
			text += GetText("RandomMushroomEffect_2", effectColors["ItemInfoDisplayPositive"], "3", "15");
			text += GetText("RandomMushroomEffect_3", effectColors["ItemInfoDisplayPositive"], "10");
			text += GetText("RandomMushroomEffect_4", effectColors["ItemInfoDisplayPositive"], effectColors["Hunger"], effectColors["Injury"], effectColors["Poison"], "<#CCCCCC>");
			text += GetText("RandomMushroomEffect_5", effectColors["Spores"]);
			text += GetText("RandomMushroomEffect_6", effectColors["ItemInfoDisplayNegative"], "60");
			text += GetText("RandomMushroomEffect_7", effectColors["ItemInfoDisplayNegative"]);
			text += GetText("RandomMushroomEffect_8", effectColors["ItemInfoDisplayNegative"], effectColors["Spores"]);
			return text + GetText("RandomMushroomEffect_9", effectColors["ItemInfoDisplayNegative"], "60");
		}

		private static void CollectStatusTypes(object value, HashSet<string> statusTypes)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (value == null)
			{
				return;
			}
			if (value is STATUSTYPE val)
			{
				statusTypes.Add(((object)(STATUSTYPE)(ref val)).ToString());
				return;
			}
			Affliction val2 = (Affliction)((value is Affliction) ? value : null);
			if (val2 != null)
			{
				AfflictionType afflictionType = val2.GetAfflictionType();
				statusTypes.Add(((object)(AfflictionType)(ref afflictionType)).ToString());
				return;
			}
			if (value is IEnumerable enumerable && !(value is string))
			{
				foreach (object item in enumerable)
				{
					CollectStatusTypes(item, statusTypes);
				}
				return;
			}
			Type type = value.GetType();
			if (!type.IsClass)
			{
				return;
			}
			FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (FieldInfo fieldInfo in fields)
			{
				if (!(fieldInfo.FieldType == typeof(string)))
				{
					object value2 = fieldInfo.GetValue(value);
					CollectStatusTypes(value2, statusTypes);
				}
			}
			PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (PropertyInfo propertyInfo in properties)
			{
				if (propertyInfo.CanRead && propertyInfo.GetIndexParameters().Length == 0 && !(propertyInfo.PropertyType == typeof(string)))
				{
					object obj = null;
					try
					{
						obj = propertyInfo.GetValue(value, null);
					}
					catch
					{
						continue;
					}
					CollectStatusTypes(obj, statusTypes);
				}
			}
		}

		private static string FormatEffectNameWithColor(string effect)
		{
			string text;
			try
			{
				text = GetText("Effect_" + effect.ToUpper()).ToUpper();
			}
			catch
			{
				text = effect.ToUpper();
			}
			return GetEffectColor(effect) + text + "</color>";
		}

		private static string ProcessEffect(float amount, string effect)
		{
			string text = "";
			string text2 = string.Empty;
			string key = string.Empty;
			if (amount == 0f)
			{
				return text;
			}
			if (amount > 0f)
			{
				text2 = ((!effect.Equals("Extra Stamina")) ? effectColors["ItemInfoDisplayNegative"] : effectColors["ItemInfoDisplayPositive"]);
				key = "GAIN";
			}
			else if (amount < 0f)
			{
				text2 = ((!effect.Equals("Extra Stamina")) ? effectColors["ItemInfoDisplayPositive"] : effectColors["ItemInfoDisplayNegative"]);
				key = "REMOVE";
			}
			return text + GetText("ProcessEffect", text2, GetText(key), GetEffectColor(effect), (Mathf.Abs(amount) * 100f).ToString("F1").Replace(".0", ""), GetText("Effect_" + effect.ToUpper()).ToUpper());
		}

		private static string ProcessEffectOverTime(float amountPerSecond, float rate, float time, string effect)
		{
			string text = "";
			string text2 = string.Empty;
			string key = string.Empty;
			if (amountPerSecond == 0f || time == 0f)
			{
				return text;
			}
			if (amountPerSecond > 0f)
			{
				text2 = ((!effect.Equals("Extra Stamina")) ? effectColors["ItemInfoDisplayNegative"] : effectColors["ItemInfoDisplayPositive"]);
				key = "GAIN";
			}
			else if (amountPerSecond < 0f)
			{
				text2 = ((!effect.Equals("Extra Stamina")) ? effectColors["ItemInfoDisplayPositive"] : effectColors["ItemInfoDisplayNegative"]);
				key = "REMOVE";
			}
			return text + GetText("ProcessEffectOverTime", text2, GetText(key), GetEffectColor(effect), (Mathf.Abs(amountPerSecond) * time * (1f / rate) * 100f).ToString("F1").Replace(".0", ""), GetText("Effect_" + effect.ToUpper()).ToUpper(), time.ToString());
		}

		private static string ProcessEffectPerSecond(float amountPerSecond, string effect)
		{
			string text = "";
			string text2 = string.Empty;
			string key = string.Empty;
			if (amountPerSecond == 0f)
			{
				return text;
			}
			if (amountPerSecond > 0f)
			{
				text2 = ((!effect.Equals("Extra Stamina")) ? effectColors["ItemInfoDisplayNegative"] : effectColors["ItemInfoDisplayPositive"]);
				key = "GAIN";
			}
			else if (amountPerSecond < 0f)
			{
				text2 = ((!effect.Equals("Extra Stamina")) ? effectColors["ItemInfoDisplayPositive"] : effectColors["ItemInfoDisplayNegative"]);
				key = "REMOVE";
			}
			string text3 = (Mathf.Abs(amountPerSecond) * 100f).ToString("F1").Replace(".0", "");
			return text + GetText("ProcessEffectPerSecond", text2, GetText(key), GetEffectColor(effect), text3, GetText("Effect_" + effect.ToUpper()).ToUpper());
		}

		private static string ProcessEffectPerSecondOverTime(float amountPerSecond, float time, string effect)
		{
			string text = "";
			string text2 = string.Empty;
			string key = string.Empty;
			if (amountPerSecond == 0f || time <= 0f)
			{
				return text;
			}
			if (amountPerSecond > 0f)
			{
				text2 = ((!effect.Equals("Extra Stamina")) ? effectColors["ItemInfoDisplayNegative"] : effectColors["ItemInfoDisplayPositive"]);
				key = "GAIN";
			}
			else if (amountPerSecond < 0f)
			{
				text2 = ((!effect.Equals("Extra Stamina")) ? effectColors["ItemInfoDisplayPositive"] : effectColors["ItemInfoDisplayNegative"]);
				key = "REMOVE";
			}
			string text3 = (Mathf.Abs(amountPerSecond) * 100f).ToString("F1").Replace(".0", "");
			string text4 = time.ToString("F1").Replace(".0", "");
			return text + GetText("ProcessEffectPerSecondOverTime", text2, GetText(key), GetEffectColor(effect), text3, GetText("Effect_" + effect.ToUpper()).ToUpper(), text4);
		}

		private static string ProcessEffectOnEntry(float amount, string effect)
		{
			string text = "";
			string text2 = string.Empty;
			string key = string.Empty;
			if (amount == 0f)
			{
				return text;
			}
			if (amount > 0f)
			{
				text2 = ((!effect.Equals("Extra Stamina")) ? effectColors["ItemInfoDisplayNegative"] : effectColors["ItemInfoDisplayPositive"]);
				key = "GAIN";
			}
			else if (amount < 0f)
			{
				text2 = ((!effect.Equals("Extra Stamina")) ? effectColors["ItemInfoDisplayPositive"] : effectColors["ItemInfoDisplayNegative"]);
				key = "REMOVE";
			}
			return text + GetText("ProcessEffectOnEntry", text2, GetText(key), GetEffectColor(effect), (Mathf.Abs(amount) * 100f).ToString("F1").Replace(".0", ""), GetText("Effect_" + effect.ToUpper()).ToUpper());
		}

		private static string GetEffectColor(string effect)
		{
			if (effectColors.TryGetValue(effect, out string value))
			{
				return value;
			}
			if (!missingEffectColors.Contains(effect))
			{
				missingEffectColors.Add(effect);
				Log.LogWarning((object)("[ItemInfoDisplay] Missing effect color mapping for '" + effect + "'. Using fallback."));
			}
			return "<#CCCCCC>";
		}

		private static float GetLanternRemainingSeconds(Item item, Lantern lantern)
		{
			try
			{
				if (item?.data?.data != null && item.data.data.ContainsKey((DataEntryKey)10))
				{
					object obj = item.data.data[(DataEntryKey)10];
					FloatItemData val = (FloatItemData)((obj is FloatItemData) ? obj : null);
					if (val != null)
					{
						return val.Value;
					}
				}
			}
			catch
			{
			}
			if (!((Object)(object)lantern != (Object)null))
			{
				return 0f;
			}
			return lantern.startingFuel;
		}

		private static void UpdateLanternRefreshFlag(Item item)
		{
			Lantern val = (((Object)(object)item != (Object)null) ? ((Component)item).GetComponent<Lantern>() : null);
			if ((Object)(object)val == (Object)null)
			{
				lastLanternItemId = 0;
				lastLanternRemainingSeconds = -1;
				return;
			}
			int lanternRemainingSecondsInt = GetLanternRemainingSecondsInt(item, val);
			int instanceID = ((Object)item).GetInstanceID();
			if (instanceID != lastLanternItemId)
			{
				lastLanternItemId = instanceID;
				lastLanternRemainingSeconds = lanternRemainingSecondsInt;
				hasChanged = true;
			}
			else if (lanternRemainingSecondsInt != lastLanternRemainingSeconds)
			{
				lastLanternRemainingSeconds = lanternRemainingSecondsInt;
				hasChanged = true;
			}
		}

		private static int GetLanternRemainingSecondsInt(Item item, Lantern lantern)
		{
			float lanternRemainingSeconds = GetLanternRemainingSeconds(item, lantern);
			int num = Mathf.CeilToInt(lanternRemainingSeconds);
			return Mathf.Max(0, num);
		}

		private static string ProcessAffliction(Affliction affliction)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Invalid comparison between Unknown and I4
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Invalid comparison between Unknown and I4
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Invalid comparison between Unknown and I4
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Expected O, but got Unknown
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Invalid comparison between Unknown and I4
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Expected O, but got Unknown
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Invalid comparison between Unknown and I4
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Expected O, but got Unknown
			//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f2: Invalid comparison between Unknown and I4
			//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Expected O, but got Unknown
			//IL_060f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0615: Invalid comparison between Unknown and I4
			//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ff: Expected O, but got Unknown
			//IL_0721: Unknown result type (might be due to invalid IL or missing references)
			//IL_0727: Invalid comparison between Unknown and I4
			//IL_061b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0622: Expected O, but got Unknown
			//IL_07fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0803: Invalid comparison between Unknown and I4
			//IL_0806: Unknown result type (might be due to invalid IL or missing references)
			//IL_080d: Expected O, but got Unknown
			string text = "";
			string empty = string.Empty;
			string empty2 = string.Empty;
			if ((int)affliction.GetAfflictionType() == 2)
			{
				Affliction_FasterBoi val = (Affliction_FasterBoi)affliction;
				text += GetText("Affliction_FasterBoi", effectColors["ItemInfoDisplayPositive"], (((Affliction)val).totalTime + val.climbDelay).ToString("F1").Replace(".0", ""), effectColors["Extra Stamina"], Mathf.Round(val.moveSpeedMod * 100f).ToString("F1").Replace(".0", ""), ((Affliction)val).totalTime.ToString("F1").Replace(".0", ""), Mathf.Round(val.climbSpeedMod * 100f).ToString("F1").Replace(".0", ""), effectColors["ItemInfoDisplayNegative"], effectColors["Drowsy"], (val.drowsyOnEnd * 100f).ToString("F1").Replace(".0", ""));
			}
			else if ((int)affliction.GetAfflictionType() == 8)
			{
				Affliction_ClearAllStatus val2 = (Affliction_ClearAllStatus)affliction;
				text += GetText("ClearAllStatus_Base", effectColors["ItemInfoDisplayPositive"]);
				if (val2.excludeCurse)
				{
					text += GetText("ClearAllStatus_ExceptCurse", effectColors["Curse"]);
				}
				text += "\n";
			}
			else if ((int)affliction.GetAfflictionType() == 10)
			{
				Affliction_AddBonusStamina val3 = (Affliction_AddBonusStamina)affliction;
				text += GetText("Affliction_AddBonusStamina", effectColors["ItemInfoDisplayPositive"], effectColors["Extra Stamina"], (val3.staminaAmount * 100f).ToString("F1").Replace(".0", ""));
			}
			else if ((int)affliction.GetAfflictionType() == 1)
			{
				Affliction_InfiniteStamina val4 = (Affliction_InfiniteStamina)affliction;
				text = ((!(val4.climbDelay > 0f)) ? (text + GetText("Affliction_InfiniteStamina", effectColors["ItemInfoDisplayPositive"], ((Affliction)val4).totalTime.ToString("F1").Replace(".0", ""), effectColors["Extra Stamina"])) : (text + GetText("Affliction_InfiniteStamina_Climb", effectColors["ItemInfoDisplayPositive"], (((Affliction)val4).totalTime + val4.climbDelay).ToString("F1").Replace(".0", ""), effectColors["Extra Stamina"], ((Affliction)val4).totalTime.ToString("F1").Replace(".0", ""))));
				if (val4.drowsyAffliction != null)
				{
					text = text + GetText("AFTERWARDS") + ProcessAffliction(val4.drowsyAffliction);
				}
			}
			else if ((int)affliction.GetAfflictionType() == 7)
			{
				Affliction_AdjustStatus val5 = (Affliction_AdjustStatus)affliction;
				if (val5.statusAmount > 0f)
				{
					empty = ((!((object)val5).Equals((object?)"Extra Stamina")) ? effectColors["ItemInfoDisplayNegative"] : effectColors["ItemInfoDisplayPositive"]);
					empty2 = "GAIN";
				}
				else
				{
					empty = ((!((object)val5).Equals((object?)"Extra Stamina")) ? effectColors["ItemInfoDisplayPositive"] : effectColors["ItemInfoDisplayNegative"]);
					empty2 = "REMOVE";
				}
				text += GetText("ProcessEffect", empty, GetText(empty2), effectColors[((object)(STATUSTYPE)(ref val5.statusType)).ToString()], (Mathf.Abs(val5.statusAmount) * 100f).ToString("F1").Replace(".0", ""), GetText("Effect_" + ((object)(STATUSTYPE)(ref val5.statusType)).ToString().ToUpper()).ToUpper());
			}
			else if ((int)affliction.GetAfflictionType() == 11)
			{
				Affliction_AdjustDrowsyOverTime val6 = (Affliction_AdjustDrowsyOverTime)affliction;
				empty = ((val6.statusPerSecond > 0f) ? effectColors["ItemInfoDisplayNegative"] : effectColors["ItemInfoDisplayPositive"]);
				empty2 = ((val6.statusPerSecond > 0f) ? "GAIN" : "REMOVE");
				text += GetText("ProcessEffectOverTime", empty, GetText(empty2), effectColors["Drowsy"], (Mathf.Round(Mathf.Abs(val6.statusPerSecond) * ((Affliction)val6).totalTime * 100f * 0.4f) / 0.4f).ToString("F1").Replace(".0", ""), GetText("Effect_DROWSY").ToUpper(), ((Affliction)val6).totalTime.ToString("F1").Replace(".0", ""));
			}
			else if ((int)affliction.GetAfflictionType() == 5)
			{
				Affliction_AdjustColdOverTime val7 = (Affliction_AdjustColdOverTime)affliction;
				empty = ((val7.statusPerSecond > 0f) ? effectColors["ItemInfoDisplayNegative"] : effectColors["ItemInfoDisplayPositive"]);
				empty2 = ((val7.statusPerSecond > 0f) ? "GAIN" : "REMOVE");
				text += GetText("ProcessEffectOverTime", empty, GetText(empty2), effectColors["Cold"], (Mathf.Abs(val7.statusPerSecond) * ((Affliction)val7).totalTime * 100f).ToString("F1").Replace(".0", ""), GetText("Effect_COLD").ToUpper(), ((Affliction)val7).totalTime.ToString("F1").Replace(".0", ""));
			}
			else if ((int)affliction.GetAfflictionType() == 6)
			{
				text += GetText("Affliction_Chaos", effectColors["ItemInfoDisplayPositive"], effectColors["Hunger"], effectColors["Extra Stamina"], effectColors["Injury"], effectColors["Poison"], effectColors["Cold"], effectColors["Hot"], effectColors["Drowsy"], effectColors["Thorns"], effectColors["Spores"]);
			}
			else if ((int)affliction.GetAfflictionType() == 13)
			{
				Affliction_Sunscreen val8 = (Affliction_Sunscreen)affliction;
				text += GetText("ProcessAffliction_Sunscreen", effectColors["Heat"], ((Affliction)val8).totalTime.ToString("F1").Replace(".0", ""));
			}
			return text;
		}

		private static void HandleTestModeInput()
		{
			bool offlineMode = PhotonNetwork.OfflineMode;
			if ((!offlineMode && (!PhotonNetwork.IsConnected || !PhotonNetwork.InRoom || !PhotonNetwork.IsMasterClient)) || (!IsTestKeyDown((KeyCode)282) && !IsTestKeyDown((KeyCode)283) && !IsTestKeyDown((KeyCode)284)))
			{
				return;
			}
			Log.LogInfo((object)string.Format("[TestMode] Input detected. Mode={0} Connected={1} InRoom={2} Master={3}", offlineMode ? "Offline" : "Online", PhotonNetwork.IsConnected, PhotonNetwork.InRoom, PhotonNetwork.IsMasterClient));
			if (!testModeInitialized)
			{
				Log.LogInfo((object)"[TestMode] Initializing item list...");
				if (!InitializeTestItemList())
				{
					Log.LogInfo((object)"[TestMode] Initialization failed. Database not ready.");
					return;
				}
				testModeInitialized = true;
			}
			if (IsTestKeyDown((KeyCode)282))
			{
				SpawnNextTestItem();
			}
			if (IsTestKeyDown((KeyCode)283))
			{
				SpawnPreviousTestItem();
			}
			if (IsTestKeyDown((KeyCode)284))
			{
				LogCurrentItemInfo();
			}
		}

		private static bool IsTestKeyDown(KeyCode keyCode)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (testModeInputDisabled)
			{
				return false;
			}
			if (TryGetInputSystemKeyDown(keyCode, out var pressed))
			{
				return pressed;
			}
			if (TryGetLegacyInputKeyDown(keyCode, out var pressed2))
			{
				return pressed2;
			}
			testModeInputDisabled = true;
			Log.LogWarning((object)"[TestMode] Input not available. Disabling test mode input checks.");
			return false;
		}

		private static bool TryGetInputSystemKeyDown(KeyCode keyCode, out bool pressed)
		{
			pressed = false;
			if (!inputSystemChecked)
			{
				inputSystemAvailable = InitializeInputSystemReflection();
				inputSystemChecked = true;
			}
			if (!inputSystemAvailable)
			{
				return false;
			}
			try
			{
				object obj = inputSystemKeyboardCurrentProp?.GetValue(null, null);
				if (obj == null)
				{
					return true;
				}
				object obj2 = Enum.Parse(inputSystemKeyType, ((object)(KeyCode)(ref keyCode)).ToString());
				object obj3 = inputSystemKeyboardItemProp?.GetValue(obj, new object[1] { obj2 });
				if (obj3 == null)
				{
					return true;
				}
				pressed = (bool)inputSystemKeyControlPressedProp.GetValue(obj3, null);
				return true;
			}
			catch (Exception ex)
			{
				inputSystemAvailable = false;
				Log.LogWarning((object)("[TestMode] Input System unavailable (" + ex.GetType().Name + "). Falling back to legacy input."));
				return false;
			}
		}

		private static bool InitializeInputSystemReflection()
		{
			try
			{
				Type type = Type.GetType("UnityEngine.InputSystem.Keyboard, Unity.InputSystem");
				inputSystemKeyType = Type.GetType("UnityEngine.InputSystem.Key, Unity.InputSystem");
				Type type2 = Type.GetType("UnityEngine.InputSystem.Controls.KeyControl, Unity.InputSystem");
				if (type == null || inputSystemKeyType == null || type2 == null)
				{
					return false;
				}
				inputSystemKeyboardCurrentProp = type.GetProperty("current", BindingFlags.Static | BindingFlags.Public);
				inputSystemKeyboardItemProp = type.GetProperty("Item", BindingFlags.Instance | BindingFlags.Public);
				inputSystemKeyControlPressedProp = type2.GetProperty("wasPressedThisFrame", BindingFlags.Instance | BindingFlags.Public);
				return inputSystemKeyboardCurrentProp != null && inputSystemKeyboardItemProp != null && inputSystemKeyControlPressedProp != null;
			}
			catch
			{
				return false;
			}
		}

		private static bool TryGetLegacyInputKeyDown(KeyCode keyCode, out bool pressed)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			pressed = false;
			if (!legacyInputAvailable)
			{
				return false;
			}
			try
			{
				pressed = Input.GetKeyDown(keyCode);
				return true;
			}
			catch (Exception ex)
			{
				legacyInputAvailable = false;
				Log.LogWarning((object)("[TestMode] Legacy Input unavailable (" + ex.GetType().Name + ")."));
				return false;
			}
		}

		private static bool InitializeTestItemList()
		{
			allItemPrefabs.Clear();
			ItemDatabase instance = SingletonAsset<ItemDatabase>.Instance;
			if ((Object)(object)instance == (Object)null || ((DatabaseAsset<ItemDatabase, Item>)(object)instance).Objects == null || ((DatabaseAsset<ItemDatabase, Item>)(object)instance).Objects.Count == 0)
			{
				int valueOrDefault = (((DatabaseAsset<ItemDatabase, Item>)(object)instance)?.Objects?.Count).GetValueOrDefault(-1);
				Log.LogInfo((object)$"[TestMode] ItemDatabase not ready or empty. Count={valueOrDefault}. Try again after fully entering a match or starting offline.");
				return false;
			}
			allItemPrefabs = (from i in ((DatabaseAsset<ItemDatabase, Item>)(object)instance).Objects
				where (Object)(object)i != (Object)null
				orderby ((Object)i).name
				select i).ToList();
			Log.LogInfo((object)$"[TestMode] Loaded {allItemPrefabs.Count} items from ItemDatabase. Press F1/F2 to cycle, F3 to log current item info.");
			return allItemPrefabs.Count > 0;
		}

		private static void SpawnNextTestItem()
		{
			if (allItemPrefabs.Count != 0)
			{
				currentTestItemIndex = (currentTestItemIndex + 1) % allItemPrefabs.Count;
				SpawnTestItem(currentTestItemIndex);
			}
		}

		private static void SpawnPreviousTestItem()
		{
			if (allItemPrefabs.Count != 0)
			{
				currentTestItemIndex = (currentTestItemIndex - 1 + allItemPrefabs.Count) % allItemPrefabs.Count;
				SpawnTestItem(currentTestItemIndex);
			}
		}

		private static void SpawnTestItem(int index)
		{
			//IL_002f: 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_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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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)
			if (index < 0 || index >= allItemPrefabs.Count)
			{
				return;
			}
			Item val = allItemPrefabs[index];
			Character localCharacter = Character.localCharacter;
			if ((Object)(object)localCharacter == (Object)null)
			{
				return;
			}
			Vector3 val2 = localCharacter.Center + ((Component)localCharacter).transform.forward * 1.5f;
			try
			{
				GameObject val3 = PhotonNetwork.InstantiateItemRoom(((Object)val).name, val2, Quaternion.identity);
				Log.LogInfo((object)$"[TestMode] Spawned [{index + 1}/{allItemPrefabs.Count}]: {((Object)val).name}");
				Component[] components = val3.GetComponents<Component>();
				List<string> values = components.Select((Component c) => ((object)c).GetType().Name).ToList();
				Log.LogInfo((object)("[TestMode] Components: " + string.Join(", ", values)));
			}
			catch (Exception ex)
			{
				Log.LogError((object)("[TestMode] Failed to spawn " + ((Object)val).name + ": " + ex.Message));
			}
		}

		private static void LogCurrentItemInfo()
		{
			Character observedCharacter = Character.observedCharacter;
			object obj;
			if (observedCharacter == null)
			{
				obj = null;
			}
			else
			{
				CharacterData data = observedCharacter.data;
				obj = ((data != null) ? data.currentItem : null);
			}
			Item val = (Item)obj;
			if ((Object)(object)val == (Object)null)
			{
				Log.LogInfo((object)"[TestMode] No item equipped");
				return;
			}
			Log.LogInfo((object)("[TestMode] Current Item: " + ((Object)val).name));
			Component[] components = ((Component)val).GetComponents<Component>();
			Component[] array = components;
			foreach (Component val2 in array)
			{
				Log.LogInfo((object)("[TestMode]   - " + ((object)val2).GetType().Name));
			}
			Log.LogInfo((object)("[TestMode] Display Text:\n" + ((TMP_Text)itemInfoDisplayTextMesh).text));
		}

		private static void AddDisplayObject()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("GAME/GUIManager");
			guiManager = val.GetComponent<GUIManager>();
			TMP_FontAsset font = ((TMP_Text)guiManager.heroDayText).font;
			GameObject gameObject = ((Component)val.transform.Find("Canvas_HUD/Prompts/ItemPromptLayout")).gameObject;
			GameObject val2 = new GameObject("ItemInfoDisplay");
			val2.transform.SetParent(gameObject.transform);
			itemInfoDisplayTextMesh = val2.AddComponent<TextMeshProUGUI>();
			RectTransform component = val2.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(configSizeDeltaX.Value, 0f);
			((TMP_Text)itemInfoDisplayTextMesh).font = font;
			((TMP_Text)itemInfoDisplayTextMesh).fontSize = configFontSize.Value;
			((TMP_Text)itemInfoDisplayTextMesh).alignment = (TextAlignmentOptions)1025;
			((TMP_Text)itemInfoDisplayTextMesh).lineSpacing = configLineSpacing.Value;
			((TMP_Text)itemInfoDisplayTextMesh).text = "";
			((TMP_Text)itemInfoDisplayTextMesh).outlineWidth = configOutlineWidth.Value;
			LoadLocalizedText();
		}

		private static string GetText(string key, params string[] args)
		{
			return string.Format(LocalizedText.GetText(("Mod_" + Name + "_" + key).ToUpper(), true), args);
		}

		private static void LoadLocalizedText()
		{
			Dictionary<string, List<string>> dictionary = JsonConvert.DeserializeObject<Dictionary<string, List<string>>>(Resources.Localized_Text);
			if (dictionary != null)
			{
				foreach (KeyValuePair<string, List<string>> item in dictionary)
				{
					List<string> value = item.Value;
					string firstValue = value[0];
					value = value.Select((string x) => (!string.IsNullOrEmpty(x)) ? x : firstValue).ToList();
					LocalizedText.MAIN_TABLE.Add(("Mod_" + Name + "_" + item.Key).ToUpper(), value);
				}
				return;
			}
			Log.LogError((object)"LoadLocalizedText Fail");
		}

		private static void InitEffectColors(Dictionary<string, string> dict)
		{
			dict.Add("Hunger", "<#FFBD16>");
			dict.Add("Extra Stamina", "<#BFEC1B>");
			dict.Add("Injury", "<#FF5300>");
			dict.Add("Crab", "<#E13542>");
			dict.Add("Poison", "<#A139FF>");
			dict.Add("Cold", "<#00BCFF>");
			dict.Add("Heat", "<#C80918>");
			dict.Add("Hot", "<#C80918>");
			dict.Add("Sleepy", "<#FF5CA4>");
			dict.Add("Drowsy", "<#FF5CA4>");
			dict.Add("Curse", "<#1B0043>");
			dict.Add("Weight", "<#A65A1C>");
			dict.Add("Thorns", "<#768E00>");
			dict.Add("Spores", "<#A45B63>");
			dict.Add("Shield", "<#D48E00>");
			dict.Add("ItemInfoDisplayPositive", "<#DDFFDD>");
			dict.Add("ItemInfoDisplayNegative", "<#FFCCCC>");
		}
	}
}
namespace ItemInfoDisplay.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("ItemInfoDisplay.Properties.Resources", typeof(Resources).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static string Localized_Text => ResourceManager.GetString("Localized_Text", resourceCulture);

		internal Resources()
		{
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}