using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; 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 System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using ItemInfoDisplay.Properties; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Peak; 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.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0")] [assembly: AssemblyProduct("com.github.cherrycove.ItemInfoDisplay")] [assembly: AssemblyTitle("ItemInfoDisplay")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.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] [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] [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.2.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 effectColors = new Dictionary(); private static float lastKnownSinceItemAttach; private static bool hasChanged; private static ConfigEntry configFontSize; private static ConfigEntry configOutlineWidth; private static ConfigEntry configLineSpacing; private static ConfigEntry configSizeDeltaX; private static ConfigEntry configForceUpdateTime; private static ConfigEntry configEnableTestMode; private static List allItemPrefabs = new List(); 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 missingEffectColors = new HashSet(); private static int lastLanternItemId = 0; private static int lastLanternRemainingSeconds = -1; private static Dictionary itemNameKeyMap = new Dictionary(StringComparer.OrdinalIgnoreCase); private static bool itemNameKeyMapInitialized = false; private static bool cookingMultiplierResolved = false; private static Func? cookingMultiplierGetter; private static string? cookingMultiplierSource; 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.2.0"; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; InitEffectColors(effectColors); lastKnownSinceItemAttach = 0f; hasChanged = true; configFontSize = ((BaseUnityPlugin)this).Config.Bind("ItemInfoDisplay", "Font Size", 20f, "Customize the Font Size for description text."); configOutlineWidth = ((BaseUnityPlugin)this).Config.Bind("ItemInfoDisplay", "Outline Width", 0.08f, "Customize the Outline Width for item description text."); configLineSpacing = ((BaseUnityPlugin)this).Config.Bind("ItemInfoDisplay", "Line Spacing", -35f, "Customize the Line Spacing for item description text."); configSizeDeltaX = ((BaseUnityPlugin)this).Config.Bind("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("ItemInfoDisplay", "Force Update Time", 1f, "Customize the time in seconds until the mod forces an update for the item."); configEnableTestMode = ((BaseUnityPlugin)this).Config.Bind("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() { Item currentItem = Character.observedCharacter.data.currentItem; ProcessItemGameObject(currentItem); } private unsafe static void ProcessItemGameObject(Item item) { //IL_059c: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Expected O, but got Unknown //IL_062a: Unknown result type (might be due to invalid IL or missing references) //IL_0631: Expected O, but got Unknown //IL_0684: Unknown result type (might be due to invalid IL or missing references) //IL_068b: Expected O, but got Unknown //IL_0733: Unknown result type (might be due to invalid IL or missing references) //IL_073a: Expected O, but got Unknown //IL_0784: Unknown result type (might be due to invalid IL or missing references) //IL_078b: Expected O, but got Unknown //IL_0803: Unknown result type (might be due to invalid IL or missing references) //IL_080a: Expected O, but got Unknown //IL_08a5: Unknown result type (might be due to invalid IL or missing references) //IL_08ac: Expected O, but got Unknown //IL_09c4: Unknown result type (might be due to invalid IL or missing references) //IL_09cb: Expected O, but got Unknown //IL_097e: Unknown result type (might be due to invalid IL or missing references) //IL_0985: Expected O, but got Unknown //IL_0bd9: Unknown result type (might be due to invalid IL or missing references) //IL_0be0: Expected O, but got Unknown //IL_0cf0: Unknown result type (might be due to invalid IL or missing references) //IL_0cf7: Expected O, but got Unknown //IL_0db8: Unknown result type (might be due to invalid IL or missing references) //IL_0dbf: Expected O, but got Unknown //IL_0a47: Unknown result type (might be due to invalid IL or missing references) //IL_0a4c: Unknown result type (might be due to invalid IL or missing references) //IL_0fda: Unknown result type (might be due to invalid IL or missing references) //IL_0fe1: Expected O, but got Unknown //IL_0efd: Unknown result type (might be due to invalid IL or missing references) //IL_0f04: Expected O, but got Unknown //IL_0f06: Unknown result type (might be due to invalid IL or missing references) //IL_0f0c: Invalid comparison between Unknown and I4 //IL_10e6: Unknown result type (might be due to invalid IL or missing references) //IL_10ed: Expected O, but got Unknown //IL_1240: Unknown result type (might be due to invalid IL or missing references) //IL_1247: Expected O, but got Unknown //IL_133c: Unknown result type (might be due to invalid IL or missing references) //IL_1343: Expected O, but got Unknown //IL_13dc: Unknown result type (might be due to invalid IL or missing references) //IL_13e3: Expected O, but got Unknown //IL_145d: Unknown result type (might be due to invalid IL or missing references) //IL_1464: Expected O, but got Unknown //IL_1760: Unknown result type (might be due to invalid IL or missing references) //IL_1767: Expected O, but got Unknown //IL_197f: Unknown result type (might be due to invalid IL or missing references) //IL_1986: Expected O, but got Unknown //IL_1b68: Unknown result type (might be due to invalid IL or missing references) //IL_1b6f: Expected O, but got Unknown //IL_1b89: Unknown result type (might be due to invalid IL or missing references) //IL_1caf: Unknown result type (might be due to invalid IL or missing references) //IL_1cb6: Expected O, but got Unknown //IL_1d99: Unknown result type (might be due to invalid IL or missing references) //IL_1da0: Expected O, but got Unknown //IL_1f6d: Unknown result type (might be due to invalid IL or missing references) //IL_1f74: Expected O, but got Unknown //IL_2080: Unknown result type (might be due to invalid IL or missing references) //IL_2087: Expected O, but got Unknown //IL_2370: Unknown result type (might be due to invalid IL or missing references) //IL_2377: Expected O, but got Unknown //IL_2481: Unknown result type (might be due to invalid IL or missing references) //IL_2488: Expected O, but got Unknown //IL_25ed: Unknown result type (might be due to invalid IL or missing references) //IL_25f4: Expected O, but got Unknown //IL_2bf9: Unknown result type (might be due to invalid IL or missing references) //IL_2c00: Expected O, but got Unknown //IL_2ffd: Unknown result type (might be due to invalid IL or missing references) //IL_3004: Expected O, but got Unknown //IL_30e5: Unknown result type (might be due to invalid IL or missing references) //IL_30ec: Expected O, but got Unknown //IL_3182: Unknown result type (might be due to invalid IL or missing references) //IL_3189: Expected O, but got Unknown GameObject gameObject = ((Component)item).gameObject; Component[] source = (from c in gameObject.GetComponents(typeof(Component)) where (Object)(object)c != (Object)null select c).ToArray(); Component[] array = source.Where(IsComponentActiveForDisplay).ToArray(); bool isConsumable = IsConsumableForCookingDelta(array); Action_ModifyStatus[] array2 = array.OfType().ToArray(); bool suppressNoEffectHint = array.OfType().Any(); Component[] array3 = (from c in array where ((object)c).GetType() != typeof(Action_ModifyStatus) group c by ((object)c).GetType() into g select g.First()).ToArray(); ItemCooking val = null; foreach (Component obj in array3) { ItemCooking val2 = (ItemCooking)(object)((obj is ItemCooking) ? obj : null); if (val2 != null) { val = val2; break; } } bool flag = false; bool flag2 = false; bool flag3 = false; bool suppressThrowAchievement = false; List list = new List(); if ((Object)(object)val != (Object)null && val.additionalCookingBehaviors != null) { AdditionalCookingBehavior[] additionalCookingBehaviors = val.additionalCookingBehaviors; foreach (AdditionalCookingBehavior val3 in additionalCookingBehaviors) { if (val3 == null) { continue; } list.Add(val3); if (val3 is CookingBehavior_Explode) { flag = true; continue; } if (val3 is CookingBehavior_Wreck) { flag2 = true; continue; } CookingBehavior_EnableScripts val4 = (CookingBehavior_EnableScripts)(object)((val3 is CookingBehavior_EnableScripts) ? val3 : null); if (val4 != null) { if (flag3 || val4.scriptsToEnable == null) { continue; } MonoBehaviour[] scriptsToEnable = val4.scriptsToEnable; foreach (MonoBehaviour val5 in scriptsToEnable) { if ((Object)(object)val5 != (Object)null && ContainsExplodeKeyword(((object)val5).GetType().Name)) { flag3 = true; break; } } if (!flag3 && ScriptsContainSpawnExplosion(val4.scriptsToEnable)) { flag3 = true; } continue; } CookingBehavior_RunActions val6 = (CookingBehavior_RunActions)(object)((val3 is CookingBehavior_RunActions) ? val3 : null); if (val6 != null) { if (flag || val6.actionsToRun == null) { continue; } ItemAction[] actionsToRun = val6.actionsToRun; foreach (ItemAction val7 in actionsToRun) { if (!((Object)(object)val7 == (Object)null)) { if (ContainsExplodeKeyword(((object)val7).GetType().Name)) { flag = true; break; } Action_Spawn val8 = (Action_Spawn)(object)((val7 is Action_Spawn) ? val7 : null); if (val8 != null && (Object)(object)val8.objectToSpawn != (Object)null && ContainsExplodeKeyword(((Object)val8.objectToSpawn).name)) { flag = true; break; } if (val7 is Action_RaycastDart) { flag3 = true; } } } } else if (!flag3 && HasExplodeOnUseBehavior(val3)) { flag3 = true; } } } if ((Object)(object)val != (Object)null && !flag && (Object)(object)val.explosionPrefab != (Object)null) { flag = true; } float cookingEffectMultiplier = GetCookingEffectMultiplier(val); bool flag4 = false; string text = ""; string text2 = ""; string text3 = ""; string suffixCooked = ""; string text4 = ""; ((TMP_Text)itemInfoDisplayTextMesh).text = ""; text2 = ((Ascents.itemWeightModifier <= 0) ? (text2 + GetText("WEIGHT", effectColors["Weight"], ((float)item.carryWeight * 2.5f).ToString("F1").Replace(".0", "")) + "") : (text2 + GetText("WEIGHT", effectColors["Weight"], ((float)(item.carryWeight + Ascents.itemWeightModifier) * 2.5f).ToString("F1").Replace(".0", "")) + "")); if (((Object)gameObject).name.Equals("Bugle(Clone)")) { TextMeshProUGUI obj2 = itemInfoDisplayTextMesh; ((TMP_Text)obj2).text = ((TMP_Text)obj2).text + GetText("Bugle") + "\n"; } else if (((Object)gameObject).name.Equals("Pirate Compass(Clone)")) { TextMeshProUGUI obj3 = itemInfoDisplayTextMesh; ((TMP_Text)obj3).text = ((TMP_Text)obj3).text + GetText("Pirate Compass", effectColors["Injury"]); } else if (((Object)gameObject).name.Equals("Compass(Clone)")) { TextMeshProUGUI obj4 = itemInfoDisplayTextMesh; ((TMP_Text)obj4).text = ((TMP_Text)obj4).text + GetText("Compass", effectColors["Injury"]); } else if (((Object)gameObject).name.Equals("Shell Big(Clone)")) { TextMeshProUGUI obj5 = itemInfoDisplayTextMesh; ((TMP_Text)obj5).text = ((TMP_Text)obj5).text + GetText("Shell Big", effectColors["Hunger"]); } else if (((Object)gameObject).name.Equals("Matchbook(Clone)")) { TextMeshProUGUI obj6 = itemInfoDisplayTextMesh; ((TMP_Text)obj6).text = ((TMP_Text)obj6).text + GetText("Matchbook"); } for (int num5 = 0; num5 < array3.Length; num5++) { if (((object)array3[num5]).GetType() == typeof(ItemUseFeedback)) { ItemUseFeedback val9 = (ItemUseFeedback)array3[num5]; if (val9.useAnimation.Equals("Eat") || val9.useAnimation.Equals("Drink") || val9.useAnimation.Equals("Heal")) { flag4 = true; } } else if (((object)array3[num5]).GetType() == typeof(Action_Consume)) { flag4 = true; } else if (((object)array3[num5]).GetType() == typeof(Action_RestoreHunger)) { Action_RestoreHunger val10 = (Action_RestoreHunger)array3[num5]; float num6 = ApplyCookingMultiplier(val10.restorationAmount, cookingEffectMultiplier); text += ProcessEffect(num6 * -1f, "Hunger"); } else if (((object)array3[num5]).GetType() == typeof(Action_ApplyInfiniteStamina)) { Action_ApplyInfiniteStamina val11 = (Action_ApplyInfiniteStamina)array3[num5]; float num7 = ApplyCookingMultiplier(val11.buffTime, cookingEffectMultiplier); if (num7 > 0f) { TextMeshProUGUI obj7 = itemInfoDisplayTextMesh; ((TMP_Text)obj7).text = ((TMP_Text)obj7).text + GetText("Affliction_InfiniteStamina", effectColors["ItemInfoDisplayPositive"], num7.ToString("F1").Replace(".0", ""), effectColors["Extra Stamina"]); } } else if (((object)array3[num5]).GetType() == typeof(Action_GiveExtraStamina)) { Action_GiveExtraStamina val12 = (Action_GiveExtraStamina)array3[num5]; float amount = ApplyCookingMultiplier(val12.amount, cookingEffectMultiplier); text += ProcessEffect(amount, "Extra Stamina"); } else if (((object)array3[num5]).GetType() == typeof(Action_InflictPoison)) { Action_InflictPoison val13 = (Action_InflictPoison)array3[num5]; float amountPerSecond = ApplyCookingMultiplier(val13.poisonPerSecond, cookingEffectMultiplier); text += GetText("InflictPoison", val13.delay.ToString(), ProcessEffectOverTime(amountPerSecond, 1f, val13.inflictionTime, "Poison")); } else if (((object)array3[num5]).GetType() == typeof(Action_AddOrRemoveThorns)) { Action_AddOrRemoveThorns val14 = (Action_AddOrRemoveThorns)array3[num5]; float amount2 = ApplyCookingMultiplier((float)val14.thornCount * 0.05f, cookingEffectMultiplier); text += ProcessEffect(amount2, "Thorns"); } else if (((object)array3[num5]).GetType() == typeof(Action_RandomMushroomEffect)) { string addition = BuildRandomMushroomEffectText(array3[num5]); ((TMP_Text)itemInfoDisplayTextMesh).text = AppendWithSectionSpacing(((TMP_Text)itemInfoDisplayTextMesh).text, addition); } else if (((object)array3[num5]).GetType() == typeof(Action_ApplyMassAffliction)) { Action_ApplyMassAffliction val15 = (Action_ApplyMassAffliction)array3[num5]; text4 += GetText("ApplyMassAffliction"); text4 += ProcessAffliction(((Action_ApplyAffliction)val15).affliction, cookingEffectMultiplier); if (((Action_ApplyAffliction)val15).extraAfflictions == null || ((Action_ApplyAffliction)val15).extraAfflictions.Length == 0) { continue; } for (int num8 = 0; num8 < ((Action_ApplyAffliction)val15).extraAfflictions.Length; num8++) { if (text4.EndsWith('\n')) { text4 = text4.Remove(text4.Length - 1); } text4 = text4 + ",\n" + ProcessAffliction(((Action_ApplyAffliction)val15).extraAfflictions[num8], cookingEffectMultiplier); } } else if (((object)array3[num5]).GetType() == typeof(Action_ApplyAffliction)) { if ((Object)(object)((Component)item).GetComponent() == (Object)null) { Action_ApplyAffliction val16 = (Action_ApplyAffliction)array3[num5]; text4 += ProcessAffliction(val16.affliction, cookingEffectMultiplier); } } else if (((object)array3[num5]).GetType() == typeof(Action_ClearAllStatus)) { Action_ClearAllStatus val17 = (Action_ClearAllStatus)array3[num5]; string text5 = GetText("ClearAllStatus_Base", effectColors["ItemInfoDisplayPositive"]); if (val17.excludeCurse) { text5 += GetText("ClearAllStatus_ExceptCurse", effectColors["Curse"]); } if (val17.otherExclusions.Count > 0) { foreach (STATUSTYPE otherExclusion in val17.otherExclusions) { text5 = text5 + ", " + effectColors[((object)(*(STATUSTYPE*)(&otherExclusion))/*cast due to .constrained prefix*/).ToString()] + GetText("Effect_" + ((object)(*(STATUSTYPE*)(&otherExclusion))/*cast due to .constrained prefix*/).ToString().ToUpper()).ToUpper() + ""; } } text5 = text5.Replace(", <#E13542>" + GetText("Effect_CRAB").ToUpper() + "", "") + "\n"; TextMeshProUGUI obj8 = itemInfoDisplayTextMesh; ((TMP_Text)obj8).text = ((TMP_Text)obj8).text + text5; } else if (((object)array3[num5]).GetType() == typeof(Action_BecomeSkeleton)) { ((TMP_Text)itemInfoDisplayTextMesh).text = AppendWithSectionSpacing(((TMP_Text)itemInfoDisplayTextMesh).text, GetText("BecomeSkeleton", effectColors["ItemInfoDisplayPositive"], effectColors["Curse"], effectColors["Injury"], effectColors["Curse"])); } else if (((object)array3[num5]).GetType() == typeof(Action_ConsumeAndSpawn)) { Action_ConsumeAndSpawn val18 = (Action_ConsumeAndSpawn)array3[num5]; if (((object)val18.itemToSpawn).ToString().Contains("Peel")) { TextMeshProUGUI obj9 = itemInfoDisplayTextMesh; ((TMP_Text)obj9).text = ((TMP_Text)obj9).text + GetText("ConsumeAndSpawn_Peel"); } } else if (((object)array3[num5]).GetType() == typeof(Action_ReduceUses)) { if (item?.data?.data != null && item.data.data.TryGetValue((DataEntryKey)2, out var value)) { OptionableIntItemData val19 = (OptionableIntItemData)(object)((value is OptionableIntItemData) ? value : null); if (val19 != null && val19.HasData && val19.Value > 1) { text3 += GetText("ReduceUses", val19.Value.ToString()); } } } else if (((object)array3[num5]).GetType() == typeof(Lantern)) { Lantern lantern = (Lantern)array3[num5]; if (((Object)gameObject).name.Equals("Torch(Clone)")) { TextMeshProUGUI obj10 = itemInfoDisplayTextMesh; ((TMP_Text)obj10).text = ((TMP_Text)obj10).text + GetText("Torch"); } else { text4 += GetText("Lantern"); } if (!((Object)gameObject).name.Equals("Torch(Clone)")) { int lanternRemainingSecondsInt = GetLanternRemainingSecondsInt(item, lantern); text4 += GetText("LanternRemaining", lanternRemainingSecondsInt.ToString()); text4 = AppendLanternStatusPerSecond(gameObject, text4); } } else if (((object)array3[num5]).GetType() == typeof(Action_RaycastDart)) { Action_RaycastDart effect = (Action_RaycastDart)array3[num5]; flag4 = true; text4 += BuildRaycastDartSection(effect, cookingEffectMultiplier); } else if (((object)array3[num5]).GetType() == typeof(MagicBugle)) { TextMeshProUGUI obj11 = itemInfoDisplayTextMesh; ((TMP_Text)obj11).text = ((TMP_Text)obj11).text + GetText("MagicBugle"); } else if (((object)array3[num5]).GetType() == typeof(ClimbingSpikeComponent)) { TextMeshProUGUI obj12 = itemInfoDisplayTextMesh; ((TMP_Text)obj12).text = ((TMP_Text)obj12).text + GetText("ClimbingSpike", effectColors["Extra Stamina"]); } else if (((object)array3[num5]).GetType() == typeof(Action_Flare)) { TextMeshProUGUI obj13 = itemInfoDisplayTextMesh; ((TMP_Text)obj13).text = ((TMP_Text)obj13).text + GetText("Flare"); } else if (((object)array3[num5]).GetType() == typeof(Backpack)) { if ((Object)(object)((Component)item).GetComponent() == (Object)null && (Object)(object)((Component)item).GetComponent() == (Object)null) { Backpack val20 = (Backpack)array3[num5]; if ((int)val20.backpackType == 2) { TextMeshProUGUI obj14 = itemInfoDisplayTextMesh; ((TMP_Text)obj14).text = ((TMP_Text)obj14).text + GetText("Fannypack"); } else { TextMeshProUGUI obj15 = itemInfoDisplayTextMesh; ((TMP_Text)obj15).text = ((TMP_Text)obj15).text + GetText("Backpack"); } } } else if (((object)array3[num5]).GetType() == typeof(BananaPeel)) { TextMeshProUGUI obj16 = itemInfoDisplayTextMesh; ((TMP_Text)obj16).text = ((TMP_Text)obj16).text + GetText("BananaPeel", effectColors["Hunger"]); } else if (((object)array3[num5]).GetType() == typeof(Constructable)) { Constructable val21 = (Constructable)array3[num5]; if ((Object)(object)val21.constructedPrefab != (Object)null && ((Object)val21.constructedPrefab).name.Equals("PortableStovetop_Placed")) { Campfire component = val21.constructedPrefab.GetComponent(); if ((Object)(object)component != (Object)null) { TextMeshProUGUI obj17 = itemInfoDisplayTextMesh; ((TMP_Text)obj17).text = ((TMP_Text)obj17).text + GetText("Constructable_PortableStovetop_Placed", effectColors["Injury"], component.burnsFor.ToString()); } else { TextMeshProUGUI obj18 = itemInfoDisplayTextMesh; ((TMP_Text)obj18).text = ((TMP_Text)obj18).text + GetText("Constructable"); } } else { TextMeshProUGUI obj19 = itemInfoDisplayTextMesh; ((TMP_Text)obj19).text = ((TMP_Text)obj19).text + GetText("Constructable"); } } else if (((object)array3[num5]).GetType() == typeof(RopeSpool)) { RopeSpool val22 = (RopeSpool)array3[num5]; if (val22.isAntiRope) { TextMeshProUGUI obj20 = itemInfoDisplayTextMesh; ((TMP_Text)obj20).text = ((TMP_Text)obj20).text + GetText("RopeSpool_AntiRope"); } else { TextMeshProUGUI obj21 = itemInfoDisplayTextMesh; ((TMP_Text)obj21).text = ((TMP_Text)obj21).text + GetText("RopeSpool"); } TextMeshProUGUI obj22 = itemInfoDisplayTextMesh; ((TMP_Text)obj22).text = ((TMP_Text)obj22).text + GetText("RopeSpool_TIP", (val22.minSegments / 4f).ToString("F2").Replace(".0", ""), ((float)Rope.MaxSegments / 4f).ToString("F1").Replace(".0", "")); if (configForceUpdateTime.Value <= 1f) { text3 += GetText("RopeSpool_Left", (val22.RopeFuel / 4f).ToString("F2").Replace(".00", "")); } } else if (((object)array3[num5]).GetType() == typeof(RopeShooter)) { RopeShooter val23 = (RopeShooter)array3[num5]; if ((Object)(object)val23.ropeAnchorWithRopePref != (Object)null && ((Object)val23.ropeAnchorWithRopePref).name.Equals("RopeAnchorForRopeShooterAnti")) { TextMeshProUGUI obj23 = itemInfoDisplayTextMesh; ((TMP_Text)obj23).text = ((TMP_Text)obj23).text + GetText("RopeShooter_Anti", (val23.maxLength / 4f).ToString("F1").Replace(".0", "")); } else { TextMeshProUGUI obj24 = itemInfoDisplayTextMesh; ((TMP_Text)obj24).text = ((TMP_Text)obj24).text + GetText("RopeShooter", (val23.maxLength / 4f).ToString("F1").Replace(".0", "")); } } else if (((object)array3[num5]).GetType() == typeof(Antigrav)) { Antigrav val24 = (Antigrav)array3[num5]; if (val24.intensity != 0f) { text4 += GetText("Antigrav", effectColors["Injury"]); } } else if (((object)array3[num5]).GetType() == typeof(Action_Balloon)) { text4 += GetText("Balloon"); } else if (((object)array3[num5]).GetType() == typeof(VineShooter)) { VineShooter val25 = (VineShooter)array3[num5]; TextMeshProUGUI obj25 = itemInfoDisplayTextMesh; ((TMP_Text)obj25).text = ((TMP_Text)obj25).text + GetText("VineShooter", (val25.maxLength / 1.6666666f).ToString("F1").Replace(".0", "")); } else if (((object)array3[num5]).GetType() == typeof(ShelfShroom)) { ShelfShroom val26 = (ShelfShroom)array3[num5]; if ((Object)(object)val26.instantiateOnBreak == (Object)null) { Log.LogWarning((object)"[ItemInfoDisplay] ShelfShroom instantiateOnBreak was null. Skipping detailed info."); } else if (((Object)val26.instantiateOnBreak).name.Equals("HealingPuffShroomSpawn")) { TextMeshProUGUI obj26 = itemInfoDisplayTextMesh; ((TMP_Text)obj26).text = ((TMP_Text)obj26).text + GetText("HealingPuffShroom", effectColors["Hunger"]); ((TMP_Text)itemInfoDisplayTextMesh).text = AppendHealingPuffShroomEffectInfo(gameObject, ((TMP_Text)itemInfoDisplayTextMesh).text); } else if (((Object)val26.instantiateOnBreak).name.Equals("ShelfShroomSpawn")) { TextMeshProUGUI obj27 = itemInfoDisplayTextMesh; ((TMP_Text)obj27).text = ((TMP_Text)obj27).text + GetText("ShelfShroomSpawn", effectColors["Hunger"]); } else if (((Object)val26.instantiateOnBreak).name.Equals("BounceShroomSpawn")) { TextMeshProUGUI obj28 = itemInfoDisplayTextMesh; ((TMP_Text)obj28).text = ((TMP_Text)obj28).text + GetText("BounceShroomSpawn", effectColors["Hunger"]); } } else if (((object)array3[num5]).GetType() == typeof(ScoutEffigy)) { TextMeshProUGUI obj29 = itemInfoDisplayTextMesh; ((TMP_Text)obj29).text = ((TMP_Text)obj29).text + GetText("ScoutEffigy", effectColors["Extra Stamina"]); } else if (((object)array3[num5]).GetType() == typeof(Action_Die)) { TextMeshProUGUI obj30 = itemInfoDisplayTextMesh; ((TMP_Text)obj30).text = ((TMP_Text)obj30).text + GetText("Action_Die", effectColors["Curse"]); } else if (((object)array3[num5]).GetType() == typeof(Action_SpawnGuidebookPage)) { flag4 = true; TextMeshProUGUI obj31 = itemInfoDisplayTextMesh; ((TMP_Text)obj31).text = ((TMP_Text)obj31).text + GetText("SpawnGuidebookPage"); } else if (((object)array3[num5]).GetType() == typeof(Action_Guidebook)) { TextMeshProUGUI obj32 = itemInfoDisplayTextMesh; ((TMP_Text)obj32).text = ((TMP_Text)obj32).text + GetText("Guidebook"); } else if (((object)array3[num5]).GetType() == typeof(Action_CallScoutmaster)) { ((TMP_Text)itemInfoDisplayTextMesh).text = AppendWithSectionSpacing(((TMP_Text)itemInfoDisplayTextMesh).text, GetText("CallScoutmaster", effectColors["Injury"]) ?? ""); } else if (((object)array3[num5]).GetType() == typeof(Action_MoraleBoost)) { Action_MoraleBoost val27 = (Action_MoraleBoost)array3[num5]; float num9 = ApplyCookingMultiplier(val27.baselineStaminaBoost, cookingEffectMultiplier); if (val27.boostRadius < 0f) { TextMeshProUGUI obj33 = itemInfoDisplayTextMesh; ((TMP_Text)obj33).text = ((TMP_Text)obj33).text + GetText("MoraleBoost_Self", effectColors["ItemInfoDisplayPositive"], effectColors["Extra Stamina"], (num9 * 100f).ToString("F1").Replace(".0", "")); } else if (val27.boostRadius > 0f) { TextMeshProUGUI obj34 = itemInfoDisplayTextMesh; ((TMP_Text)obj34).text = ((TMP_Text)obj34).text + GetText("MoraleBoost_Nearby", effectColors["ItemInfoDisplayPositive"], effectColors["Extra Stamina"], (num9 * 100f).ToString("F1").Replace(".0", "")); } } else if (((object)array3[num5]).GetType() == typeof(Breakable)) { ((TMP_Text)itemInfoDisplayTextMesh).text = AppendWithSectionSpacing(((TMP_Text)itemInfoDisplayTextMesh).text, GetText("Breakable", effectColors["Hunger"]) ?? ""); } else if (((object)array3[num5]).GetType() == typeof(Bonkable)) { ((TMP_Text)itemInfoDisplayTextMesh).text = AppendWithSectionSpacing(((TMP_Text)itemInfoDisplayTextMesh).text, GetText("Bonkable", effectColors["Hunger"], effectColors["Injury"]) ?? ""); } else if (((object)array3[num5]).GetType() == typeof(MagicBean)) { MagicBean val28 = (MagicBean)array3[num5]; string text6 = GetText("MagicBean", effectColors["Hunger"], ""); if ((Object)(object)val28.plantPrefab != (Object)null) { text6 = GetText("MagicBean", effectColors["Hunger"], (val28.plantPrefab.maxLength / 2f).ToString("F1").Replace(".0", "")); } TextMeshProUGUI obj35 = itemInfoDisplayTextMesh; ((TMP_Text)obj35).text = ((TMP_Text)obj35).text + text6; } else if (((object)array3[num5]).GetType() == typeof(BingBong)) { TextMeshProUGUI obj36 = itemInfoDisplayTextMesh; ((TMP_Text)obj36).text = ((TMP_Text)obj36).text + GetText("BingBong"); } else if (((object)array3[num5]).GetType() == typeof(Action_Passport)) { TextMeshProUGUI obj37 = itemInfoDisplayTextMesh; ((TMP_Text)obj37).text = ((TMP_Text)obj37).text + GetText("Passport") + "\n"; } else if (((object)array3[num5]).GetType() == typeof(Actions_Binoculars)) { TextMeshProUGUI obj38 = itemInfoDisplayTextMesh; ((TMP_Text)obj38).text = ((TMP_Text)obj38).text + GetText("Binoculars"); } else if (((object)array3[num5]).GetType() == typeof(Action_WarpToRandomPlayer)) { TextMeshProUGUI obj39 = itemInfoDisplayTextMesh; ((TMP_Text)obj39).text = ((TMP_Text)obj39).text + GetText("WarpToRandomPlayer"); } else if (((object)array3[num5]).GetType() == typeof(Action_WarpToBiome)) { Action_WarpToBiome val29 = (Action_WarpToBiome)array3[num5]; TextMeshProUGUI obj40 = itemInfoDisplayTextMesh; ((TMP_Text)obj40).text = ((TMP_Text)obj40).text + GetText("WarpToBiome", SegmentToBiomeName(val29.segmentToWarpTo)); } else if (((object)array3[num5]).GetType() == typeof(Parasol)) { TextMeshProUGUI obj41 = itemInfoDisplayTextMesh; ((TMP_Text)obj41).text = ((TMP_Text)obj41).text + GetText("Parasol") + "\n"; } else if (((object)array3[num5]).GetType() == typeof(Frisbee)) { TextMeshProUGUI obj42 = itemInfoDisplayTextMesh; ((TMP_Text)obj42).text = ((TMP_Text)obj42).text + GetText("Frisbee", effectColors["Hunger"]); } else if (((object)array3[num5]).GetType() == typeof(Action_ConstructableScoutCannonScroll)) { TextMeshProUGUI obj43 = itemInfoDisplayTextMesh; ((TMP_Text)obj43).text = ((TMP_Text)obj43).text + GetText("ConstructableScoutCannonScroll"); } else if (((object)array3[num5]).GetType() == typeof(Dynamite)) { Dynamite val30 = (Dynamite)array3[num5]; string text7 = GetText("Dynamite", effectColors["Injury"], ""); if ((Object)(object)val30.explosionPrefab != (Object)null) { AOE component2 = val30.explosionPrefab.GetComponent(); if ((Object)(object)component2 != (Object)null) { text7 = GetText("Dynamite", effectColors["Injury"], (component2.statusAmount * 100f).ToString("F1").Replace(".0", "")); } } TextMeshProUGUI obj44 = itemInfoDisplayTextMesh; ((TMP_Text)obj44).text = ((TMP_Text)obj44).text + text7; } else if (((object)array3[num5]).GetType() == typeof(Scorpion)) { Scorpion val31 = (Scorpion)array3[num5]; if (configForceUpdateTime.Value <= 1f) { Character val32 = item.holderCharacter ?? Character.observedCharacter; float num10 = (((Object)(object)val32 != (Object)null && val32.refs != null && (Object)(object)val32.refs.afflictions != (Object)null) ? val32.refs.afflictions.statusSum : 0f); float num11 = Mathf.Max(0.5f, 1f - num10 + 0.05f) * 100f; TextMeshProUGUI obj45 = itemInfoDisplayTextMesh; ((TMP_Text)obj45).text = ((TMP_Text)obj45).text + GetText("Scorpion_Dynamic", effectColors["Poison"], effectColors["Curse"], effectColors["Heat"], num11.ToString("F1").Replace(".0", ""), val31.totalPoisonTime.ToString("F1").Replace(".0", "")); } else { TextMeshProUGUI obj46 = itemInfoDisplayTextMesh; ((TMP_Text)obj46).text = ((TMP_Text)obj46).text + GetText("Scorpion_Static", effectColors["Poison"], effectColors["Curse"], effectColors["Heat"], val31.totalPoisonTime.ToString("F1").Replace(".0", "")); } } else if (((object)array3[num5]).GetType() == typeof(Action_Spawn)) { Action_Spawn val33 = (Action_Spawn)array3[num5]; if ((Object)(object)val33.objectToSpawn != (Object)null && ((Object)val33.objectToSpawn).name.Equals("VFX_Sunscreen")) { Transform val34 = val33.objectToSpawn.transform.Find("AOE"); AOE val35 = (((Object)(object)val34 != (Object)null) ? ((Component)val34).GetComponent() : null); RemoveAfterSeconds val36 = (((Object)(object)val34 != (Object)null) ? ((Component)val34).GetComponent() : null); if ((Object)(object)val35 != (Object)null && (Object)(object)val36 != (Object)null) { TextMeshProUGUI obj47 = itemInfoDisplayTextMesh; ((TMP_Text)obj47).text = ((TMP_Text)obj47).text + GetText("VFX_Sunscreen", val36.seconds.ToString("F1").Replace(".0", ""), ProcessAffliction(val35.affliction, cookingEffectMultiplier)); } } } else if (((object)array3[num5]).GetType() == typeof(CactusBall)) { CactusBall val37 = (CactusBall)array3[num5]; TextMeshProUGUI obj48 = itemInfoDisplayTextMesh; ((TMP_Text)obj48).text = ((TMP_Text)obj48).text + GetText("CactusBall", effectColors["Thorns"], effectColors["Hunger"], (((StickyItemComponent)val37).throwChargeRequirement * 100f).ToString("F1").Replace(".0", "")); } else if (((object)array3[num5]).GetType() == typeof(BingBongShieldWhileHolding)) { TextMeshProUGUI obj49 = itemInfoDisplayTextMesh; ((TMP_Text)obj49).text = ((TMP_Text)obj49).text + GetText("BingBongShieldWhileHolding", effectColors["Shield"]); } else if (((object)array3[num5]).GetType() == typeof(RescueHook)) { if (((Object)gameObject).name.StartsWith("RescueHook_Infinite", StringComparison.Ordinal)) { TextMeshProUGUI obj50 = itemInfoDisplayTextMesh; ((TMP_Text)obj50).text = ((TMP_Text)obj50).text + GetText("RescueHook_Infinite"); } else { TextMeshProUGUI obj51 = itemInfoDisplayTextMesh; ((TMP_Text)obj51).text = ((TMP_Text)obj51).text + GetText("RescueHook"); } } else if (((object)array3[num5]).GetType() == typeof(Beehive)) { TextMeshProUGUI obj52 = itemInfoDisplayTextMesh; ((TMP_Text)obj52).text = ((TMP_Text)obj52).text + GetText("Beehive", effectColors["Injury"], effectColors["Poison"]); } else if (((object)array3[num5]).GetType() == typeof(BugPhobia)) { ((TMP_Text)itemInfoDisplayTextMesh).text = AppendWithSectionSpacing(((TMP_Text)itemInfoDisplayTextMesh).text, GetText("BugPhobia")); } else if (((object)array3[num5]).GetType() == typeof(Mandrake)) { TextMeshProUGUI obj53 = itemInfoDisplayTextMesh; ((TMP_Text)obj53).text = ((TMP_Text)obj53).text + GetText("Mandrake", effectColors["Drowsy"], effectColors["Heat"]); suppressThrowAchievement = true; } else if (((object)array3[num5]).GetType() == typeof(Snowball)) { TextMeshProUGUI obj54 = itemInfoDisplayTextMesh; ((TMP_Text)obj54).text = ((TMP_Text)obj54).text + GetText("Snowball", effectColors["Cold"]); } else if (((object)array3[num5]).GetType() == typeof(StickyItemComponent)) { StickyItemComponent val38 = (StickyItemComponent)array3[num5]; string text8 = GetText("StickyItemComponent", effectColors["Hunger"]); if (val38.addWeightToStuckPlayer > 0) { text8 += GetText("StickyItemComponent_Weight", effectColors["Weight"], ((float)val38.addWeightToStuckPlayer * 2.5f).ToString("F1").Replace(".0", "")); } if (val38.addThornsToStuckPlayer > 0) { text8 += GetText("StickyItemComponent_Thorns", effectColors["Thorns"], val38.addThornsToStuckPlayer.ToString()); } TextMeshProUGUI obj55 = itemInfoDisplayTextMesh; ((TMP_Text)obj55).text = ((TMP_Text)obj55).text + text8; } else if (((object)array3[num5]).GetType() == typeof(JetpackItem)) { JetpackItem val39 = (JetpackItem)array3[num5]; float itemFuelRemaining = GetItemFuelRemaining(item, val39.startingFuel); int num12 = Mathf.RoundToInt(itemFuelRemaining / Mathf.Max(1f, val39.startingFuel) * 100f); int num13 = Mathf.CeilToInt(itemFuelRemaining / 20f); TextMeshProUGUI obj56 = itemInfoDisplayTextMesh; ((TMP_Text)obj56).text = ((TMP_Text)obj56).text + GetText("Jetpack", num12.ToString(), num13.ToString()); } else if (((object)array3[num5]).GetType() == typeof(Rocketpack)) { TextMeshProUGUI obj57 = itemInfoDisplayTextMesh; ((TMP_Text)obj57).text = ((TMP_Text)obj57).text + GetText("Rocketpack", effectColors["Injury"], effectColors["Injury"], effectColors["Curse"]); } else if (((object)array3[num5]).GetType() == typeof(ParachuteItem)) { TextMeshProUGUI obj58 = itemInfoDisplayTextMesh; ((TMP_Text)obj58).text = ((TMP_Text)obj58).text + GetText("Parachute", "1.5"); } else if (((object)array3[num5]).GetType() == typeof(Candle)) { Candle candle = (Candle)array3[num5]; int candleRemainingSecondsInt = GetCandleRemainingSecondsInt(item, candle); TextMeshProUGUI obj59 = itemInfoDisplayTextMesh; ((TMP_Text)obj59).text = ((TMP_Text)obj59).text + GetText("Candle", effectColors["Injury"], candleRemainingSecondsInt.ToString()); } else if (((object)array3[num5]).GetType() == typeof(AmuletBase)) { string name = ((Object)gameObject).name; if (name.StartsWith("Amulet_Clone", StringComparison.Ordinal)) { Action_CloneSelectedItem component3 = ((Component)item).GetComponent(); int num14 = (((Object)(object)component3 != (Object)null) ? component3.petrify : 0); int num15 = (((Object)(object)component3 != (Object)null) ? component3.petrifyMystical : 0); string text9 = ((num15 > num14) ? $"{num14}(神秘物品 {num15})" : num14.ToString()); TextMeshProUGUI obj60 = itemInfoDisplayTextMesh; ((TMP_Text)obj60).text = ((TMP_Text)obj60).text + GetText("Amulet_Clone", effectColors["ItemInfoDisplayPositive"], effectColors["Curse"], text9); } else if (name.StartsWith("Amulet_Healing", StringComparison.Ordinal)) { Action_HealingGem component4 = ((Component)item).GetComponent(); float num16 = (((Object)(object)component4 != (Object)null && component4.healingAffliction != null) ? (component4.healingAffliction.maxHealing * 100f) : 60f); float num17 = (((Object)(object)component4 != (Object)null && component4.invincibilityAffliction != null) ? GetAfflictionTotalTime(component4.invincibilityAffliction) : 10f); float num18 = (((Object)(object)component4 != (Object)null) ? (component4.minPetrify * 100f) : 0f); float num19 = (((Object)(object)component4 != (Object)null) ? (component4.maxPetrify * 100f) : 0f); TextMeshProUGUI obj61 = itemInfoDisplayTextMesh; ((TMP_Text)obj61).text = ((TMP_Text)obj61).text + GetText("Amulet_Healing", effectColors["ItemInfoDisplayPositive"], num16.ToString("F0"), num17.ToString("F1").Replace(".0", ""), effectColors["Curse"], num18.ToString("F0"), num19.ToString("F0")); } else if (name.StartsWith("Amulet_InfiniteStamina", StringComparison.Ordinal)) { float num20 = 0f; float num21 = 0f; Action_ApplyAffliction component5 = ((Component)item).GetComponent(); if ((Object)(object)component5 != (Object)null && component5.affliction != null) { num20 = GetAfflictionRadius(component5.affliction); num21 = GetAfflictionTotalTime(component5.affliction); } Action_ModifyStatus component6 = ((Component)item).GetComponent(); float num22 = (((Object)(object)component6 != (Object)null) ? (component6.changeAmount * 100f) : 0f); TextMeshProUGUI obj62 = itemInfoDisplayTextMesh; ((TMP_Text)obj62).text = ((TMP_Text)obj62).text + GetText("Amulet_InfiniteStamina", effectColors["ItemInfoDisplayPositive"], effectColors["Extra Stamina"], effectColors["Curse"], num21.ToString("F1").Replace(".0", ""), num20.ToString("F1").Replace(".0", ""), num22.ToString("F0")); } else if (name.StartsWith("Amulet_SuperJump", StringComparison.Ordinal)) { Action_SuperJumpAmulet component7 = ((Component)item).GetComponent(); float num23 = (((Object)(object)component7 != (Object)null) ? ((float)Mathf.FloorToInt(component7.petrifyPerUse * 100f)) : 0f); float num24 = (((Object)(object)component7 != (Object)null) ? GetAfflictionRadius(((Action_ApplyAffliction)component7).affliction) : 0f); TextMeshProUGUI obj63 = itemInfoDisplayTextMesh; ((TMP_Text)obj63).text = ((TMP_Text)obj63).text + GetText("Amulet_SuperJump", effectColors["ItemInfoDisplayPositive"], effectColors["Curse"], num23.ToString("F0"), num24.ToString("F1").Replace(".0", "")); } else if (name.StartsWith("ScoutsHonor", StringComparison.Ordinal)) { TextMeshProUGUI obj64 = itemInfoDisplayTextMesh; ((TMP_Text)obj64).text = ((TMP_Text)obj64).text + GetText("ScoutsHonor", effectColors["ItemInfoDisplayPositive"], effectColors["Injury"], effectColors["Curse"]); } else if (!name.Contains("Strange Gem")) { TextMeshProUGUI obj65 = itemInfoDisplayTextMesh; ((TMP_Text)obj65).text = ((TMP_Text)obj65).text + GetText("Amulet_Base", effectColors["ItemInfoDisplayPositive"], effectColors["Curse"]); } } else if (((object)array3[num5]).GetType() == typeof(Action_StrangeGem)) { if (((Object)gameObject).name.Equals("Strange Gem(Clone)") || ((Object)gameObject).name.Equals("Strange Gem")) { TextMeshProUGUI obj66 = itemInfoDisplayTextMesh; ((TMP_Text)obj66).text = ((TMP_Text)obj66).text + GetText("StrangeGem", effectColors["ItemInfoDisplayPositive"]); } } else if (((object)array3[num5]).GetType() == typeof(Action_HealingGem)) { if ((Object)(object)((Component)item).GetComponent() == (Object)null) { Action_HealingGem val40 = (Action_HealingGem)array3[num5]; float num25 = ((val40.healingAffliction != null) ? (val40.healingAffliction.maxHealing * 100f) : 0f); float num26 = ((val40.invincibilityAffliction != null) ? GetAfflictionTotalTime(val40.invincibilityAffliction) : 0f); float num27 = val40.minPetrify * 100f; float num28 = val40.maxPetrify * 100f; TextMeshProUGUI obj67 = itemInfoDisplayTextMesh; ((TMP_Text)obj67).text = ((TMP_Text)obj67).text + GetText("HealingGem", num25.ToString("F1").Replace(".0", ""), effectColors["ItemInfoDisplayPositive"], effectColors["Curse"], num26.ToString("F1").Replace(".0", ""), num27.ToString("F0"), num28.ToString("F0")); } } else if (((object)array3[num5]).GetType() == typeof(Action_CloneSelectedItem)) { if ((Object)(object)((Component)item).GetComponent() == (Object)null) { TextMeshProUGUI obj68 = itemInfoDisplayTextMesh; ((TMP_Text)obj68).text = ((TMP_Text)obj68).text + GetText("Amulet_Clone", effectColors["ItemInfoDisplayPositive"], effectColors["Curse"], ""); } } else if (((object)array3[num5]).GetType() == typeof(Action_SuperJumpAmulet)) { if ((Object)(object)((Component)item).GetComponent() == (Object)null) { Action_SuperJumpAmulet component8 = ((Component)item).GetComponent(); float num29 = (((Object)(object)component8 != (Object)null) ? ((float)Mathf.FloorToInt(component8.petrifyPerUse * 100f)) : 0f); float num30 = (((Object)(object)component8 != (Object)null) ? GetAfflictionRadius(((Action_ApplyAffliction)component8).affliction) : 0f); TextMeshProUGUI obj69 = itemInfoDisplayTextMesh; ((TMP_Text)obj69).text = ((TMP_Text)obj69).text + GetText("Amulet_SuperJump", effectColors["ItemInfoDisplayPositive"], effectColors["Curse"], num29.ToString("F0"), num30.ToString("F1").Replace(".0", "")); } } else if (((object)array3[num5]).GetType() == typeof(Action_WarpToShadowRealm)) { if ((Object)(object)((Component)item).GetComponent() == (Object)null) { TextMeshProUGUI obj70 = itemInfoDisplayTextMesh; ((TMP_Text)obj70).text = ((TMP_Text)obj70).text + GetText("ScoutsHonor", effectColors["ItemInfoDisplayPositive"], effectColors["Injury"], effectColors["Curse"]); } } else if (((object)array3[num5]).GetType() == typeof(Action_Antizooka)) { TextMeshProUGUI obj71 = itemInfoDisplayTextMesh; ((TMP_Text)obj71).text = ((TMP_Text)obj71).text + GetText("AntiZooka", effectColors["Injury"], effectColors["ItemInfoDisplayPositive"]); } else if (((object)array3[num5]).GetType() == typeof(Action_SacrificeFriend)) { TextMeshProUGUI obj72 = itemInfoDisplayTextMesh; ((TMP_Text)obj72).text = ((TMP_Text)obj72).text + GetText("RitualDagger", effectColors["Curse"], "50", "10"); } else if (((object)array3[num5]).GetType() == typeof(Action_Numb)) { Action_Numb val41 = (Action_Numb)array3[num5]; float num31 = ApplyCookingMultiplier(val41.numbAmount, cookingEffectMultiplier); TextMeshProUGUI obj73 = itemInfoDisplayTextMesh; ((TMP_Text)obj73).text = ((TMP_Text)obj73).text + GetText("Numb", effectColors["Drowsy"], num31.ToString("F1").Replace(".0", "")); } else if (((object)array3[num5]).GetType() == typeof(WarpOnThrow)) { TextMeshProUGUI obj74 = itemInfoDisplayTextMesh; ((TMP_Text)obj74).text = ((TMP_Text)obj74).text + GetText("WarpOnThrow", effectColors["Injury"]); } else if (((object)array3[num5]).GetType() == typeof(Glider)) { Glider val42 = (Glider)array3[num5]; TextMeshProUGUI obj75 = itemInfoDisplayTextMesh; ((TMP_Text)obj75).text = ((TMP_Text)obj75).text + GetText("Glider", effectColors["Extra Stamina"], (Mathf.Min(val42.stamUse, 1f) * 100f).ToString("F1").Replace(".0", "")); } else { if (!(((object)array3[num5]).GetType() == typeof(ItemCooking))) { continue; } val = (ItemCooking)array3[num5]; bool flag5 = val.wreckWhenCooked || flag2; bool flag6 = !flag && !flag5; bool hasDeltaHeader; List list2 = BuildNextCookDeltaLines(val, list, flag3, flag5, cookingEffectMultiplier, isConsumable, flag6, suppressThrowAchievement, suppressNoEffectHint, out hasDeltaHeader); bool flag7 = flag6 && val.timesCookedLocal == 0; string text10 = null; bool flag8 = false; if (flag7 && !hasDeltaHeader && list2.Count == 1 && IsCookNextHintLine(list2[0])) { text10 = list2[0]; flag8 = true; } bool flag9 = false; if (!val.canBeCooked) { suffixCooked += GetText("COOK_DISABLED", effectColors["Curse"]); } else if (flag5 && val.timesCookedLocal >= 1) { suffixCooked += GetText("COOKED_BROKEN", effectColors["Curse"]); } else if (val.timesCookedLocal >= 12) { suffixCooked += GetText("COOKED_MAX", effectColors["Curse"], val.timesCookedLocal.ToString()); } else if (val.timesCookedLocal == 0) { if (flag6) { suffixCooked += GetText("COOK", effectColors["Extra Stamina"]); if (hasDeltaHeader) { suffixCooked = suffixCooked + " " + GetText("COOK_NEXT_DELTA"); flag9 = true; } else if (!string.IsNullOrWhiteSpace(text10)) { suffixCooked = suffixCooked + " " + text10; } } } else if (val.timesCookedLocal <= 2) { suffixCooked += GetText("COOKED", effectColors["Extra Stamina"], val.timesCookedLocal.ToString()); if (hasDeltaHeader) { suffixCooked = suffixCooked + " " + GetText("COOK_NEXT_DELTA"); flag9 = true; } } else if (val.timesCookedLocal == 3) { suffixCooked += GetText("COOKED", effectColors["Injury"], val.timesCookedLocal.ToString()); if (hasDeltaHeader) { suffixCooked = suffixCooked + " " + GetText("COOK_NEXT_DELTA"); flag9 = true; } } else if (val.timesCookedLocal >= 4) { suffixCooked += GetText("COOKED", effectColors["Poison"], val.timesCookedLocal.ToString()); if (hasDeltaHeader) { suffixCooked = suffixCooked + " " + GetText("COOK_NEXT_DELTA"); flag9 = true; } } if (val.canBeCooked && val.timesCookedLocal < 12 && list2.Count > 0) { if (flag8 && text10 != null && list2.Count == 1 && list2[0] == text10) { list2.Clear(); } if (hasDeltaHeader && !flag9) { list2.Insert(0, GetText("COOK_NEXT_DELTA")); } AppendCookDeltaLines(ref suffixCooked, list2); } } } if (array2.Length != 0) { bool flag10 = (Object)(object)((Component)item).GetComponent() != (Object)null; Dictionary dictionary = new Dictionary(); Action_ModifyStatus[] array4 = array2; foreach (Action_ModifyStatus val43 in array4) { if (!((Object)(object)val43 == (Object)null) && !flag10) { float num33 = ApplyCookingMultiplier(val43.changeAmount, cookingEffectMultiplier); string key = ((object)Unsafe.As(ref val43.statusType)/*cast due to .constrained prefix*/).ToString(); if (dictionary.TryGetValue(key, out var value2)) { dictionary[key] = value2 + num33; } else { dictionary[key] = num33; } } } foreach (KeyValuePair item2 in dictionary) { text += ProcessEffect(item2.Value, item2.Key); } } if (text.Length > 0 && flag4) { ((TMP_Text)itemInfoDisplayTextMesh).text = text + "\n" + ((TMP_Text)itemInfoDisplayTextMesh).text; } if (text4.Length > 0) { TextMeshProUGUI obj76 = itemInfoDisplayTextMesh; ((TMP_Text)obj76).text = ((TMP_Text)obj76).text + "\n" + text4; } string text11 = text2 + text3; if (!string.IsNullOrEmpty(suffixCooked)) { if (!string.IsNullOrEmpty(text11)) { text11 += "\n\n"; } text11 += suffixCooked; } if (!string.IsNullOrEmpty(text11)) { if (((TMP_Text)itemInfoDisplayTextMesh).text.Length > 0 && !((TMP_Text)itemInfoDisplayTextMesh).text.EndsWith("\n\n")) { if (((TMP_Text)itemInfoDisplayTextMesh).text.EndsWith("\n")) { TextMeshProUGUI obj77 = itemInfoDisplayTextMesh; ((TMP_Text)obj77).text = ((TMP_Text)obj77).text + "\n"; } else { TextMeshProUGUI obj78 = itemInfoDisplayTextMesh; ((TMP_Text)obj78).text = ((TMP_Text)obj78).text + "\n\n"; } } TextMeshProUGUI obj79 = itemInfoDisplayTextMesh; ((TMP_Text)obj79).text = ((TMP_Text)obj79).text + text11; } 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 AppendHealingPuffShroomEffectInfo(GameObject itemGameObj, string target) { return AppendStatusFieldInfo(itemGameObj, target); } private static string AppendStatusFieldInfo(GameObject source, string target) { if ((Object)(object)source == (Object)null) { return target; } StatusField[] array = source.GetComponentsInChildren(true); if (array == null) { array = Array.Empty(); } Dictionary dictionary = new Dictionary(); Dictionary dictionary2 = new Dictionary(); StatusField[] array2 = array; foreach (StatusField val in array2) { if ((Object)(object)val == (Object)null) { continue; } string text = ((object)Unsafe.As(ref ((StatusFieldBase)val).statusType)/*cast due to .constrained prefix*/).ToString(); if (!string.IsNullOrEmpty(text)) { dictionary[text] = (dictionary.TryGetValue(text, out var value) ? (value + ((StatusFieldBase)val).statusAmountPerSecond) : ((StatusFieldBase)val).statusAmountPerSecond); if (((StatusFieldBase)val).statusAmountOnEntry != 0f) { dictionary2[text] = (dictionary2.TryGetValue(text, out var value2) ? (value2 + ((StatusFieldBase)val).statusAmountOnEntry) : ((StatusFieldBase)val).statusAmountOnEntry); } } if (((StatusFieldBase)val).additionalStatuses == null) { continue; } foreach (StatusFieldStatus additionalStatus in ((StatusFieldBase)val).additionalStatuses) { string text2 = ((object)Unsafe.As(ref additionalStatus.statusType)/*cast due to .constrained prefix*/).ToString(); if (!string.IsNullOrEmpty(text2)) { dictionary[text2] = (dictionary.TryGetValue(text2, out var value3) ? (value3 + additionalStatus.statusAmountPerSecond) : additionalStatus.statusAmountPerSecond); } } } if (dictionary.Count == 0 && dictionary2.Count == 0) { dictionary2["Injury"] = -0.15f; dictionary["Injury"] = -0.025f; dictionary["Poison"] = -0.05f; } List list = new List(); string text3 = GetText("HealingPuffShroom_FollowupPerSecond"); foreach (KeyValuePair item in dictionary2.OrderBy((KeyValuePair k) => k.Key)) { string text4 = ToInlineText(ProcessEffectOnEntry(item.Value, item.Key)); if (!string.IsNullOrWhiteSpace(text4)) { list.Add("• " + text4 + text3); } } foreach (KeyValuePair item2 in dictionary.OrderBy((KeyValuePair k) => k.Key)) { string text5 = ToInlineText(ProcessEffectPerSecond(item2.Value, item2.Key)); if (!string.IsNullOrWhiteSpace(text5)) { list.Add("• " + text5); } } if (list.Count > 0) { target = target + string.Join("\n", list) + "\n"; } return target; } private static string AppendLanternStatusPerSecond(GameObject itemGameObj, string target) { if ((Object)(object)itemGameObj == (Object)null) { return target; } StatusField[] componentsInChildren = itemGameObj.GetComponentsInChildren(true); if (componentsInChildren == null || componentsInChildren.Length == 0) { return target; } Dictionary dictionary = new Dictionary(); Dictionary dictionary2 = new Dictionary(); StatusField[] array = componentsInChildren; foreach (StatusField val in array) { if ((Object)(object)val == (Object)null) { continue; } string text = ((object)Unsafe.As(ref ((StatusFieldBase)val).statusType)/*cast due to .constrained prefix*/).ToString(); if (!string.IsNullOrEmpty(text)) { dictionary[text] = (dictionary.TryGetValue(text, out var value) ? (value + ((StatusFieldBase)val).statusAmountPerSecond) : ((StatusFieldBase)val).statusAmountPerSecond); if (((StatusFieldBase)val).statusAmountOnEntry != 0f) { dictionary2[text] = (dictionary2.TryGetValue(text, out var value2) ? (value2 + ((StatusFieldBase)val).statusAmountOnEntry) : ((StatusFieldBase)val).statusAmountOnEntry); } } foreach (StatusFieldStatus additionalStatus in ((StatusFieldBase)val).additionalStatuses) { string text2 = ((object)Unsafe.As(ref additionalStatus.statusType)/*cast due to .constrained prefix*/).ToString(); if (!string.IsNullOrEmpty(text2)) { dictionary[text2] = (dictionary.TryGetValue(text2, out var value3) ? (value3 + additionalStatus.statusAmountPerSecond) : additionalStatus.statusAmountPerSecond); } } } AddFaerieLanternSporesPerSecond(itemGameObj, dictionary); foreach (KeyValuePair item in dictionary.OrderBy((KeyValuePair k) => k.Key)) { target += ProcessEffectPerSecond(item.Value, item.Key); } foreach (KeyValuePair item2 in dictionary2.OrderBy((KeyValuePair 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 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(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 hashSet = new HashSet(); CollectStatusTypes(effect, hashSet); if (hashSet.Count == 0) { return GetText("RandomMushroomEffect"); } List list = new List(); 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 unsafe static void CollectStatusTypes(object value, HashSet 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*)(&val))/*cast due to .constrained prefix*/).ToString()); return; } Affliction val2 = (Affliction)((value is Affliction) ? value : null); if (val2 != null) { statusTypes.Add(((object)val2.GetAfflictionType()/*cast due to .constrained prefix*/).ToString()); } else { if (!(value is IEnumerable enumerable) || value is string) { return; } foreach (object item in enumerable) { CollectStatusTypes(item, statusTypes); } } } private static string FormatEffectNameWithColor(string effect) { string text; try { text = GetText("Effect_" + effect.ToUpper()).ToUpper(); } catch { text = effect.ToUpper(); } return GetEffectColor(effect) + text + ""; } 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 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 ProcessEffectInline(float amount, string effect) { string text = ProcessEffect(amount, effect); if (string.IsNullOrEmpty(text)) { return text; } text = text.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " "); return text.Trim(); } private static float ApplyCookingMultiplier(float amount, float cookingMultiplier) { if (amount == 0f || cookingMultiplier == 1f || float.IsNaN(cookingMultiplier) || float.IsInfinity(cookingMultiplier)) { return amount; } return amount * cookingMultiplier; } private static float GetCookingEffectMultiplier(ItemCooking? itemCooking) { if ((Object)(object)itemCooking == (Object)null || itemCooking.timesCookedLocal <= 0) { return 1f; } EnsureCookingMultiplierGetter(); if (cookingMultiplierGetter == null) { return 1f; } try { float num = cookingMultiplierGetter(itemCooking); if (float.IsNaN(num) || float.IsInfinity(num) || num == 0f) { return 1f; } return num; } catch { return 1f; } } private static void EnsureCookingMultiplierGetter() { if (cookingMultiplierResolved) { return; } cookingMultiplierResolved = true; Type typeFromHandle = typeof(ItemCooking); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; string[] array = new string[7] { "GetCookedEffectMultiplier", "GetCookedMultiplier", "GetCookingEffectMultiplier", "GetCookingMultiplier", "GetCookMultiplier", "GetEffectMultiplier", "GetCookedStatusMultiplier" }; string[] array2 = array; foreach (string b in array2) { MethodInfo[] methods = typeFromHandle.GetMethods(bindingAttr); foreach (MethodInfo methodInfo in methods) { if (!string.Equals(methodInfo.Name, b, StringComparison.OrdinalIgnoreCase) || methodInfo.ReturnType != typeof(float)) { continue; } ParameterInfo[] parameters = methodInfo.GetParameters(); if (parameters.Length == 0) { MethodInfo captured = methodInfo; cookingMultiplierGetter = (ItemCooking itemCooking) => (float)captured.Invoke(itemCooking, null); cookingMultiplierSource = typeFromHandle.Name + "." + captured.Name + "()"; Log.LogInfo((object)("[ItemInfoDisplay] Cooking multiplier resolved via " + cookingMultiplierSource + ".")); return; } if (parameters.Length == 1 && parameters[0].ParameterType == typeof(int)) { MethodInfo captured2 = methodInfo; cookingMultiplierGetter = (ItemCooking itemCooking) => (float)captured2.Invoke(itemCooking, new object[1] { itemCooking.timesCookedLocal }); cookingMultiplierSource = typeFromHandle.Name + "." + captured2.Name + "(int)"; Log.LogInfo((object)("[ItemInfoDisplay] Cooking multiplier resolved via " + cookingMultiplierSource + ".")); return; } } } FieldInfo[] fields = typeFromHandle.GetFields(bindingAttr); foreach (FieldInfo fieldInfo in fields) { if (IsLikelyCookingMultiplierMember(fieldInfo.Name)) { Func func = TryCreateMultiplierGetter(fieldInfo, fieldInfo.FieldType, fieldInfo.IsStatic); if (func != null) { cookingMultiplierGetter = func; cookingMultiplierSource = typeFromHandle.Name + "." + fieldInfo.Name; Log.LogInfo((object)("[ItemInfoDisplay] Cooking multiplier resolved via " + cookingMultiplierSource + ".")); return; } } } PropertyInfo[] properties = typeFromHandle.GetProperties(bindingAttr); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.CanRead && propertyInfo.GetIndexParameters().Length == 0 && IsLikelyCookingMultiplierMember(propertyInfo.Name)) { bool isStatic = propertyInfo.GetMethod != null && propertyInfo.GetMethod.IsStatic; Func func2 = TryCreateMultiplierGetter(propertyInfo, propertyInfo.PropertyType, isStatic); if (func2 != null) { cookingMultiplierGetter = func2; cookingMultiplierSource = typeFromHandle.Name + "." + propertyInfo.Name; Log.LogInfo((object)("[ItemInfoDisplay] Cooking multiplier resolved via " + cookingMultiplierSource + ".")); break; } } } } private static bool IsLikelyCookingMultiplierMember(string name) { if (string.IsNullOrWhiteSpace(name)) { return false; } string text = name.ToLowerInvariant(); if (!text.Contains("cook")) { return false; } if (!text.Contains("mult") && !text.Contains("scale")) { return text.Contains("effect"); } return true; } private static Func? TryCreateMultiplierGetter(MemberInfo member, Type memberType, bool isStatic) { if (memberType == typeof(float)) { return delegate(ItemCooking itemCooking) { object memberValue = GetMemberValue(member, isStatic, itemCooking); return (memberValue is float) ? ((float)memberValue) : 1f; }; } if (memberType == typeof(float[])) { return delegate(ItemCooking itemCooking) { object memberValue = GetMemberValue(member, isStatic, itemCooking); return (memberValue is float[] values) ? GetMultiplierFromList(values, itemCooking.timesCookedLocal) : 1f; }; } if (memberType == typeof(List)) { return delegate(ItemCooking itemCooking) { object memberValue = GetMemberValue(member, isStatic, itemCooking); return (memberValue is List values) ? GetMultiplierFromList(values, itemCooking.timesCookedLocal) : 1f; }; } if (memberType == typeof(AnimationCurve)) { return delegate(ItemCooking itemCooking) { object memberValue = GetMemberValue(member, isStatic, itemCooking); AnimationCurve val = (AnimationCurve)((memberValue is AnimationCurve) ? memberValue : null); return (val != null) ? val.Evaluate((float)itemCooking.timesCookedLocal) : 1f; }; } return null; } private static object GetMemberValue(MemberInfo member, bool isStatic, ItemCooking itemCooking) { try { if (member is FieldInfo fieldInfo) { return fieldInfo.GetValue(isStatic ? null : itemCooking); } if (member is PropertyInfo propertyInfo) { return propertyInfo.GetValue(isStatic ? null : itemCooking, null); } } catch { return null; } return null; } private static float GetMultiplierFromList(IReadOnlyList values, int timesCooked) { if (values == null || values.Count == 0) { return 1f; } int index = Mathf.Clamp(timesCooked, 0, values.Count - 1); return values[index]; } private static List BuildNextCookDeltaLines(ItemCooking itemCooking, IReadOnlyList cookingBehaviors, bool hasCookUseExplosion, bool breaksWhenCooked, float cookingMultiplier, bool isConsumable, bool allowCookPreview, bool suppressThrowAchievement, bool suppressNoEffectHint, out bool hasDeltaHeader) { List list = new List(); hasDeltaHeader = false; if ((Object)(object)itemCooking == (Object)null || !itemCooking.canBeCooked || itemCooking.timesCookedLocal >= 12) { return list; } if (suppressNoEffectHint) { return list; } int nextCooked = itemCooking.timesCookedLocal + 1; bool flag = WillExplodeOnNextCook(itemCooking, cookingBehaviors, nextCooked); List list2 = new List(); if (allowCookPreview && !breaksWhenCooked && !itemCooking.ignoreDefaultCookBehavior && !flag) { list2.AddRange(BuildDefaultNextCookDeltaEffects(itemCooking, nextCooked, cookingMultiplier, isConsumable)); } List list3 = new List(); List list4 = new List(); List list5 = new List(); List list6 = new List(); foreach (AdditionalCookingBehavior cookingBehavior in cookingBehaviors) { if (cookingBehavior == null || !WillTriggerBehavior(cookingBehavior, itemCooking.timesCookedLocal, nextCooked)) { continue; } CookingBehavior_Explode val = (CookingBehavior_Explode)(object)((cookingBehavior is CookingBehavior_Explode) ? cookingBehavior : null); if (val != null) { if (CanExplodeWhenCooked(val, itemCooking)) { list4.Add(TrimLeadingSeparator(GetText("COOK_EXPLODE", effectColors["Injury"]))); } continue; } if (cookingBehavior is CookingBehavior_Wreck) { list4.Add(TrimLeadingSeparator(GetText("COOK_BROKEN", effectColors["Curse"]))); continue; } CookingBehavior_AdjustStatusInstantly val2 = (CookingBehavior_AdjustStatusInstantly)(object)((cookingBehavior is CookingBehavior_AdjustStatusInstantly) ? cookingBehavior : null); if (val2 != null) { float amount = ApplyCookingMultiplier(val2.amount, cookingMultiplier); AppendHint(list3, ProcessEffectInline(amount, ((object)Unsafe.As(ref val2.statusType)/*cast due to .constrained prefix*/).ToString())); continue; } CookingBehavior_ChangeAfflictionTime val3 = (CookingBehavior_ChangeAfflictionTime)(object)((cookingBehavior is CookingBehavior_ChangeAfflictionTime) ? cookingBehavior : null); if (val3 != null) { list4.Add(TrimLeadingSeparator(BuildAfflictionTimeChangeHint(val3))); continue; } CookingBehavior_RunActions val4 = (CookingBehavior_RunActions)(object)((cookingBehavior is CookingBehavior_RunActions) ? cookingBehavior : null); if (val4 != null) { if (val4.actionsToRun == null) { continue; } ItemAction[] actionsToRun = val4.actionsToRun; foreach (ItemAction val5 in actionsToRun) { if (!suppressThrowAchievement || !(val5 is Action_ThrowAchievement)) { string hint = BuildActionEffectInline(val5, cookingMultiplier); AppendHint(list3, hint); } } continue; } CookingBehavior_EnableScripts val6 = (CookingBehavior_EnableScripts)(object)((cookingBehavior is CookingBehavior_EnableScripts) ? cookingBehavior : null); if (val6 != null) { AddScriptEffectHints(list5, val6.scriptsToEnable, cookingMultiplier, suppressThrowAchievement, allowCookPreview); continue; } if (cookingBehavior is CookingBehavior_MessUpAudio || cookingBehavior is CookingBehavior_ModifyAudioSourcePitch) { list4.Add(TrimLeadingSeparator(GetText("COOK_AUDIO", effectColors["ItemInfoDisplayPositive"]))); continue; } CookingBehavior_ReplaceItem val7 = (CookingBehavior_ReplaceItem)(object)((cookingBehavior is CookingBehavior_ReplaceItem) ? cookingBehavior : null); if (val7 != null) { string text = "?"; if ((Object)(object)val7.replaceWithItem != (Object)null) { text = GetLocalizedItemName(val7.replaceWithItem); if (string.IsNullOrEmpty(text) && val7.replaceWithItem.UIData != null) { text = val7.replaceWithItem.UIData.itemName; } } list4.Add(TrimLeadingSeparator(GetText("COOK_REPLACE", effectColors["ItemInfoDisplayPositive"], text))); continue; } if (cookingBehavior is CookingBehavior_AddPoisonOnUse) { list3.Add(GetText("COOK_ADD_POISON_ON_USE", effectColors["Poison"], "10")); continue; } CookingBehavior_ModifyEtcStats val8 = (CookingBehavior_ModifyEtcStats)(object)((cookingBehavior is CookingBehavior_ModifyEtcStats) ? cookingBehavior : null); if (val8 != null) { if (val8.canPocket && val8.canBackpack) { list4.Add(TrimLeadingSeparator(GetText("COOK_MODIFY_ETC", effectColors["ItemInfoDisplayPositive"]))); } else if (!val8.canPocket && !val8.canBackpack) { list4.Add(TrimLeadingSeparator(GetText("COOK_MODIFY_ETC_NOPOCKET", effectColors["Curse"]) + GetText("COOK_MODIFY_ETC_NOBACKPACK", effectColors["Curse"]))); } else if (!val8.canPocket) { list4.Add(TrimLeadingSeparator(GetText("COOK_MODIFY_ETC_NOPOCKET", effectColors["Curse"]))); } else { list4.Add(TrimLeadingSeparator(GetText("COOK_MODIFY_ETC_NOBACKPACK", effectColors["Curse"]))); } } else if (cookingBehavior is CookingBehavior_EnableDisableObjects) { list4.Add(TrimLeadingSeparator(GetText("COOK_ENABLE_DISABLE_OBJECTS", effectColors["ItemInfoDisplayPositive"]))); } else if (cookingBehavior is CookingBehavior_EarlyWorm) { list4.Add(TrimLeadingSeparator(GetText("COOK_EARLYWORM", effectColors["ItemInfoDisplayPositive"]))); } else if (IsDisableScriptsBehavior(cookingBehavior)) { AddScriptEffectHints(list6, GetBehaviorScripts(cookingBehavior), cookingMultiplier, suppressThrowAchievement, allowCookPreview); } else if (IsModifyBugleWobbleBehavior(cookingBehavior)) { list4.Add(TrimLeadingSeparator(GetText("COOK_BUGLE_WOBBLE", effectColors["ItemInfoDisplayPositive"]))); } } if (list5.Count > 0 && list6.Count > 0) { List list7 = list5.Intersect(list6).ToList(); foreach (string duplicatedHint in list7) { list5.RemoveAll((string text4) => text4 == duplicatedHint); list6.RemoveAll((string text4) => text4 == duplicatedHint); } } if (list5.Count > 0) { list4.Add(TrimLeadingSeparator(GetText("COOK_ENABLE")) + string.Join(" ", list5)); } if (list6.Count > 0) { list4.Add(TrimLeadingSeparator(GetText("COOK_DISABLE")) + string.Join(" ", list6)); } if (allowCookPreview && hasCookUseExplosion) { list4.Add(TrimLeadingSeparator(GetText("COOK_USE_EXPLODE", effectColors["Injury"]))); } if (breaksWhenCooked && list4.Count == 0) { list4.Add(TrimLeadingSeparator(GetText("COOK_BROKEN", effectColors["Curse"]))); } if (allowCookPreview && list2.Count > 0) { foreach (string item in list2) { if (!string.IsNullOrWhiteSpace(item)) { list.Add("• " + item); } } hasDeltaHeader = true; } if (list3.Count > 0) { string text2 = TrimLeadingSeparator(GetText("COOK_ON_COOK")); foreach (string item2 in list3) { if (!string.IsNullOrWhiteSpace(item2)) { list.Add(text2 + item2); } } } if (list4.Count > 0) { list.AddRange(list4.Where((string line) => !string.IsNullOrWhiteSpace(line))); } if (allowCookPreview && !suppressNoEffectHint && list2.Count == 0 && !flag && !breaksWhenCooked && !hasCookUseExplosion && list3.Count == 0 && list4.Count == 0) { string text3 = TrimLeadingSeparator(GetText("COOK_NEXT_NONE", effectColors["Curse"])); if (!string.IsNullOrWhiteSpace(text3) && !list.Contains(text3)) { list.Insert(0, text3); } } return list; } private static List BuildDefaultNextCookDeltaEffects(ItemCooking itemCooking, int nextCooked, float cookingMultiplier, bool isConsumable) { //IL_01c3: Unknown result type (might be due to invalid IL or missing references) List list = new List(); if ((Object)(object)itemCooking == (Object)null || !isConsumable) { return list; } Action_RestoreHunger component = ((Component)itemCooking).GetComponent(); bool flag = (Object)(object)component != (Object)null && IsComponentActiveForDisplay((Component)(object)component); Action_GiveExtraStamina component2 = ((Component)itemCooking).GetComponent(); bool flag2 = (Object)(object)component2 != (Object)null && IsComponentActiveForDisplay((Component)(object)component2); Action_InflictPoison component3 = ((Component)itemCooking).GetComponent(); bool flag3 = (Object)(object)component3 != (Object)null && IsComponentActiveForDisplay((Component)(object)component3); if (!flag && !flag2 && !flag3) { return list; } if (flag) { float restorationAmount = component.restorationAmount; float num = restorationAmount; if (nextCooked < 2) { num = restorationAmount * 2f; } else if (nextCooked > 2) { num = Mathf.Max(restorationAmount - 0.05f, 0f); } float num2 = ApplyCookingMultiplier(num - restorationAmount, cookingMultiplier); if (Mathf.Abs(num2) > 0.0001f) { list.Add(ProcessEffectInline(num2 * -1f, "Hunger")); } } float num3 = 0f; bool flag4 = false; if (flag2) { num3 = component2.amount; flag4 = true; } if (flag4) { float num4 = num3; if (nextCooked < 2) { num4 = Mathf.Max(0.1f, num3 * 1.5f); } else if (nextCooked > 2) { num4 = 0f; } float num5 = ApplyCookingMultiplier(num4 - num3, cookingMultiplier); if (Mathf.Abs(num5) > 0.0001f) { list.Add(ProcessEffectInline(num5, "Extra Stamina")); } } bool flag5 = false; if (itemCooking.additionalCookingBehaviors != null) { AdditionalCookingBehavior[] additionalCookingBehaviors = itemCooking.additionalCookingBehaviors; foreach (AdditionalCookingBehavior val in additionalCookingBehaviors) { if (val is CookingBehavior_AddPoisonOnUse && WillTriggerBehavior(val, itemCooking.timesCookedLocal, nextCooked)) { flag5 = true; break; } } } if (nextCooked > 3 && !flag5) { float num6 = ApplyCookingMultiplier(0.1f, cookingMultiplier); if (Mathf.Abs(num6) > 0.0001f) { list.Add(ProcessEffectInline(num6, ((object)(STATUSTYPE)3/*cast due to .constrained prefix*/).ToString())); } } return list; } private static bool WillExplodeOnNextCook(ItemCooking itemCooking, IReadOnlyList cookingBehaviors, int nextCooked) { if ((Object)(object)itemCooking == (Object)null) { return false; } foreach (AdditionalCookingBehavior cookingBehavior in cookingBehaviors) { CookingBehavior_Explode val = (CookingBehavior_Explode)(object)((cookingBehavior is CookingBehavior_Explode) ? cookingBehavior : null); if (val != null && WillTriggerBehavior(cookingBehavior, itemCooking.timesCookedLocal, nextCooked) && CanExplodeWhenCooked(val, itemCooking)) { return true; } } return false; } private static bool WillTriggerBehavior(AdditionalCookingBehavior behavior, int currentCooked, int nextCooked) { if (behavior == null) { return false; } if (nextCooked < behavior.cookedAmountToTrigger) { return false; } if (behavior.onlyOnce && currentCooked >= behavior.cookedAmountToTrigger) { return false; } return true; } private static bool CanExplodeWhenCooked(CookingBehavior_Explode explode, ItemCooking itemCooking) { if (explode == null || (Object)(object)itemCooking == (Object)null) { return false; } if (!explode.dontRunIfOutOfFuel) { return true; } try { FloatItemData data = ((ItemComponent)itemCooking).item.GetData((DataEntryKey)10); return data != null && data.Value > 0f; } catch { return true; } } private static bool IsDisableScriptsBehavior(AdditionalCookingBehavior behavior) { if (behavior != null) { return ((object)behavior).GetType().Name.IndexOf("DisableScripts", StringComparison.OrdinalIgnoreCase) >= 0; } return false; } private static bool IsModifyBugleWobbleBehavior(AdditionalCookingBehavior behavior) { if (behavior != null) { return ((object)behavior).GetType().Name.IndexOf("ModifyBugleWobble", StringComparison.OrdinalIgnoreCase) >= 0; } return false; } private static void AppendHint(List target, string hint) { if (!string.IsNullOrWhiteSpace(hint) && !target.Contains(hint)) { target.Add(hint); } } private static string BuildRaycastDartSection(Action_RaycastDart? effect, float cookingMultiplier) { string text = GetText("RaycastDart"); if ((Object)(object)effect == (Object)null || effect.afflictionsOnHit == null || effect.afflictionsOnHit.Length == 0) { return text; } List list = new List(); Affliction[] afflictionsOnHit = effect.afflictionsOnHit; foreach (Affliction val in afflictionsOnHit) { if (val != null) { string text2 = ToInlineText(ProcessAffliction(val, cookingMultiplier)).TrimEnd(',', ','); if (!string.IsNullOrWhiteSpace(text2)) { list.Add(text2); } } } if (list.Count == 0) { return text; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(text); stringBuilder.Append('\n'); for (int j = 0; j < list.Count; j++) { bool flag = j < list.Count - 1; stringBuilder.Append("• "); stringBuilder.Append(list[j]); if (flag) { stringBuilder.Append(','); } stringBuilder.Append('\n'); } return stringBuilder.ToString(); } private static bool IsComponentActiveForDisplay(Component component) { if ((Object)(object)component == (Object)null) { return false; } if (component is ItemCooking) { return true; } Behaviour val = (Behaviour)(object)((component is Behaviour) ? component : null); if (val != null) { return val.isActiveAndEnabled; } return true; } private static bool IsConsumableForCookingDelta(IEnumerable components) { if (components == null) { return false; } foreach (Component component in components) { if ((Object)(object)component == (Object)null) { continue; } ItemUseFeedback val = (ItemUseFeedback)(object)((component is ItemUseFeedback) ? component : null); if (val != null) { if (val.useAnimation.Equals("Eat") || val.useAnimation.Equals("Drink") || val.useAnimation.Equals("Heal")) { return true; } continue; } if (component is Action_Consume) { return true; } if (component is Action_ConsumeAndSpawn) { return true; } if (component is Action_RaycastDart) { return true; } if (component is Action_SpawnGuidebookPage) { return true; } if (component is Action_RestoreHunger) { return true; } if (component is Action_GiveExtraStamina) { return true; } } return false; } private static void AppendCookDeltaLines(ref string suffixCooked, IReadOnlyList lines) { if (lines == null || lines.Count == 0) { return; } string text = string.Join("\n", lines.Where((string line) => !string.IsNullOrWhiteSpace(line))); if (string.IsNullOrWhiteSpace(text)) { return; } if (!string.IsNullOrEmpty(suffixCooked) && !suffixCooked.EndsWith("\n\n")) { if (suffixCooked.EndsWith("\n")) { suffixCooked += "\n"; } else { suffixCooked += "\n\n"; } } suffixCooked += text; } private static bool IsCookNextHintLine(string line) { if (string.IsNullOrWhiteSpace(line)) { return false; } if (line.IndexOf("NEXT COOK", StringComparison.OrdinalIgnoreCase) < 0 && !line.Contains("下次烹饪", StringComparison.Ordinal)) { return line.Contains("下次烹飪", StringComparison.Ordinal); } return true; } private static string TrimLeadingSeparator(string text) { if (string.IsNullOrEmpty(text)) { return string.Empty; } if (text.StartsWith(" | ", StringComparison.Ordinal)) { return text.Substring(3); } if (text.StartsWith("| ", StringComparison.Ordinal)) { return text.Substring(2); } if (text.StartsWith("|", StringComparison.Ordinal)) { return text.Substring(1); } return text; } private static string BuildAfflictionTimeChangeHint(CookingBehavior_ChangeAfflictionTime change) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (change == null) { return string.Empty; } string text = Mathf.Abs(change.change).ToString("F1").Replace(".0", ""); string text2 = ((change.change >= 0f) ? "+" : "-"); string name = "Affliction"; try { if ((Object)(object)change.action != (Object)null && change.action.affliction != null) { name = ((object)change.action.affliction.GetAfflictionType()/*cast due to .constrained prefix*/).ToString(); } } catch { name = "Affliction"; } name = GetAfflictionDisplayName(name); return GetText("COOK_AFFLICTION_TIME", name, text2, text); } private static string GetAfflictionDisplayName(string name) { if (string.IsNullOrWhiteSpace(name)) { return string.Empty; } string text = name.Trim(); if (!(text == "Invincibility")) { if (text == "Numb") { return GetText("AFFLICTION_NAME_NUMB"); } return name; } return GetText("AFFLICTION_NAME_INVINCIBILITY"); } private static void AddScriptEffectHints(List target, IEnumerable scripts, float cookingMultiplier, bool suppressThrowAchievement, bool allowCookPreview) { if (scripts == null) { return; } foreach (MonoBehaviour script in scripts) { if ((Object)(object)script == (Object)null || (suppressThrowAchievement && script is Action_ThrowAchievement)) { continue; } ItemAction val = (ItemAction)(object)((script is ItemAction) ? script : null); if (val != null) { if (!allowCookPreview || !(val is Action_Spawn)) { AppendHint(target, BuildActionEffectInline(val, cookingMultiplier)); } } else { AppendHint(target, GetFriendlyActionName(((object)script).GetType())); } } } private static List GetBehaviorScripts(object behavior) { List list = new List(); if (behavior == null) { return list; } BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; Type type = behavior.GetType(); FieldInfo[] fields = type.GetFields(bindingAttr); foreach (FieldInfo fieldInfo in fields) { if (NameContainsActionOrScript(fieldInfo.Name)) { AddScriptsFromValue(list, fieldInfo.GetValue(behavior)); } } PropertyInfo[] properties = type.GetProperties(bindingAttr); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.CanRead && propertyInfo.GetIndexParameters().Length == 0 && NameContainsActionOrScript(propertyInfo.Name)) { object obj = null; try { obj = propertyInfo.GetValue(behavior, null); } catch { continue; } AddScriptsFromValue(list, obj); } } return list; } private static void AddScriptsFromValue(List scripts, object value) { MonoBehaviour val = (MonoBehaviour)((value is MonoBehaviour) ? value : null); if (val != null) { scripts.Add(val); } else if (value is MonoBehaviour[] source) { scripts.AddRange(source.Where((MonoBehaviour s) => (Object)(object)s != (Object)null)); } else if (value is IEnumerable source2) { scripts.AddRange(source2.Where((MonoBehaviour s) => (Object)(object)s != (Object)null)); } } private unsafe static string BuildActionEffectInline(ItemAction action, float cookingMultiplier) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Invalid comparison between Unknown and I4 //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)action == (Object)null) { return string.Empty; } Action_RestoreHunger val = (Action_RestoreHunger)(object)((action is Action_RestoreHunger) ? action : null); if (val != null) { float num = ApplyCookingMultiplier(val.restorationAmount, cookingMultiplier); return ProcessEffectInline(num * -1f, "Hunger"); } Action_GiveExtraStamina val2 = (Action_GiveExtraStamina)(object)((action is Action_GiveExtraStamina) ? action : null); if (val2 != null) { float amount = ApplyCookingMultiplier(val2.amount, cookingMultiplier); return ProcessEffectInline(amount, "Extra Stamina"); } Action_ModifyStatus val3 = (Action_ModifyStatus)(object)((action is Action_ModifyStatus) ? action : null); if (val3 != null) { float num2 = ApplyCookingMultiplier(val3.changeAmount, cookingMultiplier); if ((int)val3.statusType == 5 && num2 > 0f && num2 <= 0.5001f) { num2 = 0.25f; } string text = ProcessEffectInline(num2, ((object)Unsafe.As(ref val3.statusType)/*cast due to .constrained prefix*/).ToString()); if (val3.ifSkeleton) { text = text + " " + GetText("COOK_IF_SKELETON"); } return text; } Action_InflictPoison val4 = (Action_InflictPoison)(object)((action is Action_InflictPoison) ? action : null); if (val4 != null) { float amountPerSecond = ApplyCookingMultiplier(val4.poisonPerSecond, cookingMultiplier); string text2 = GetText("InflictPoison", val4.delay.ToString(), ProcessEffectOverTime(amountPerSecond, 1f, val4.inflictionTime, "Poison")); return ToInlineText(text2); } Action_AddOrRemoveThorns val5 = (Action_AddOrRemoveThorns)(object)((action is Action_AddOrRemoveThorns) ? action : null); if (val5 != null) { float amount2 = ApplyCookingMultiplier((float)val5.thornCount * 0.05f, cookingMultiplier); return ProcessEffectInline(amount2, "Thorns"); } Action_ThrowAchievement val6 = (Action_ThrowAchievement)(object)((action is Action_ThrowAchievement) ? action : null); if (val6 != null) { string text3 = ((object)Unsafe.As(ref val6.achievementType)/*cast due to .constrained prefix*/).ToString().Replace('_', ' '); if (string.IsNullOrWhiteSpace(text3)) { return string.Empty; } return GetText("COOK_ACTION_THROW_ACHIEVEMENT", effectColors["ItemInfoDisplayPositive"], effectColors["ItemInfoDisplayPositive"], text3); } Action_Numb val7 = (Action_Numb)(object)((action is Action_Numb) ? action : null); if (val7 != null) { string text4 = ApplyCookingMultiplier(val7.numbAmount, cookingMultiplier).ToString("F1").Replace(".0", ""); if (string.IsNullOrWhiteSpace(text4)) { return string.Empty; } return GetText("COOK_ACTION_NUMB", effectColors["ItemInfoDisplayNegative"], text4); } Action_ClearAllStatus val8 = (Action_ClearAllStatus)(object)((action is Action_ClearAllStatus) ? action : null); if (val8 != null) { string text5 = GetText("ClearAllStatus_Base", effectColors["ItemInfoDisplayPositive"]); if (val8.excludeCurse) { text5 += GetText("ClearAllStatus_ExceptCurse", effectColors["Curse"]); } if (val8.otherExclusions.Count > 0) { foreach (STATUSTYPE otherExclusion in val8.otherExclusions) { text5 = text5 + ", " + effectColors[((object)(*(STATUSTYPE*)(&otherExclusion))/*cast due to .constrained prefix*/).ToString()] + GetText("Effect_" + ((object)(*(STATUSTYPE*)(&otherExclusion))/*cast due to .constrained prefix*/).ToString().ToUpper()).ToUpper() + ""; } } text5 = text5.Replace(", <#E13542>" + GetText("Effect_CRAB").ToUpper() + "", ""); return ToInlineText(text5); } if (action is Action_BecomeSkeleton) { return GetText("COOK_ACTION_BECOME_SKELETON", effectColors["Curse"]); } Action_ApplyAffliction val9 = (Action_ApplyAffliction)(object)((action is Action_ApplyAffliction) ? action : null); if (val9 != null) { List list = new List(); if (val9.affliction != null) { list.Add(ToInlineText(ProcessAffliction(val9.affliction, cookingMultiplier))); } if (val9.extraAfflictions != null) { Affliction[] extraAfflictions = val9.extraAfflictions; foreach (Affliction val10 in extraAfflictions) { if (val10 != null) { list.Add(ToInlineText(ProcessAffliction(val10, cookingMultiplier))); } } } return string.Join(" ", list.Where((string p) => !string.IsNullOrWhiteSpace(p))); } Action_ApplyMassAffliction val11 = (Action_ApplyMassAffliction)(object)((action is Action_ApplyMassAffliction) ? action : null); if (val11 != null) { string text6 = GetText("ApplyMassAffliction"); text6 += ProcessAffliction(((Action_ApplyAffliction)val11).affliction, cookingMultiplier); if (((Action_ApplyAffliction)val11).extraAfflictions != null && ((Action_ApplyAffliction)val11).extraAfflictions.Length != 0) { for (int num3 = 0; num3 < ((Action_ApplyAffliction)val11).extraAfflictions.Length; num3++) { text6 += ProcessAffliction(((Action_ApplyAffliction)val11).extraAfflictions[num3], cookingMultiplier); } } return ToInlineText(text6); } Action_ConsumeAndSpawn val12 = (Action_ConsumeAndSpawn)(object)((action is Action_ConsumeAndSpawn) ? action : null); if (val12 != null && (Object)(object)val12.itemToSpawn != (Object)null && ((object)val12.itemToSpawn).ToString().Contains("Peel")) { return ToInlineText(GetText("ConsumeAndSpawn_Peel")); } if (action is Action_Die) { return GetText("COOK_ACTION_DIE", effectColors["Injury"]); } Action_RaycastDart val13 = (Action_RaycastDart)(object)((action is Action_RaycastDart) ? action : null); if (val13 != null) { List list2 = new List(); if (val13.afflictionsOnHit != null) { Affliction[] afflictionsOnHit = val13.afflictionsOnHit; foreach (Affliction val14 in afflictionsOnHit) { if (val14 != null) { string text7 = ToInlineText(ProcessAffliction(val14, cookingMultiplier)); if (!string.IsNullOrWhiteSpace(text7)) { list2.Add(text7); } } } } if (list2.Count > 0) { return string.Join(" ", list2); } return ToInlineText(GetText("RaycastDart")); } Action_ApplyInfiniteStamina val15 = (Action_ApplyInfiniteStamina)(object)((action is Action_ApplyInfiniteStamina) ? action : null); if (val15 != null) { float num5 = ApplyCookingMultiplier(val15.buffTime, cookingMultiplier); if (num5 <= 0f) { return string.Empty; } return GetText("Affliction_InfiniteStamina", effectColors["ItemInfoDisplayPositive"], num5.ToString("F1").Replace(".0", ""), effectColors["Extra Stamina"]); } if (action is Action_ApplySuperJump) { return GetText("Affliction_MassSuperJump", effectColors["Extra Stamina"], "1"); } Action_SuperJumpAmulet val16 = (Action_SuperJumpAmulet)(object)((action is Action_SuperJumpAmulet) ? action : null); if (val16 != null) { float num6 = Mathf.FloorToInt(val16.petrifyPerUse * 100f); return GetText("Amulet_SuperJump", effectColors["ItemInfoDisplayPositive"], effectColors["Curse"], num6.ToString("F0"), GetAfflictionRadius(((Action_ApplyAffliction)val16).affliction).ToString("F1").Replace(".0", "")); } Action_HealingGem val17 = (Action_HealingGem)(object)((action is Action_HealingGem) ? action : null); if (val17 != null) { float num7 = ((val17.healingAffliction != null) ? (val17.healingAffliction.maxHealing * 100f) : 0f); float num8 = ((val17.invincibilityAffliction != null) ? GetAfflictionTotalTime(val17.invincibilityAffliction) : 0f); float num9 = val17.minPetrify * 100f; float num10 = val17.maxPetrify * 100f; return GetText("HealingGem", num7.ToString("F1").Replace(".0", ""), effectColors["ItemInfoDisplayPositive"], effectColors["Curse"], num8.ToString("F1").Replace(".0", ""), num9.ToString("F0"), num10.ToString("F0")); } if (action is Action_Antizooka) { return ToInlineText(GetText("AntiZooka", effectColors["Injury"], effectColors["ItemInfoDisplayPositive"])); } if (action is Action_SacrificeFriend) { return ToInlineText(GetText("RitualDagger", effectColors["Curse"], "50", "10")); } if (action is Action_StrangeGem) { return ToInlineText(GetText("StrangeGem", effectColors["ItemInfoDisplayPositive"])); } if (action is Action_CloneSelectedItem) { return ToInlineText(GetText("Amulet_Clone", effectColors["ItemInfoDisplayPositive"], effectColors["Curse"], "")); } return GetFriendlyActionName(((object)action).GetType()); } private static string GetFriendlyActionName(Type type) { if (type == null) { return string.Empty; } string localizedActionName = GetLocalizedActionName(type); if (!string.IsNullOrWhiteSpace(localizedActionName)) { return localizedActionName; } string text = type.Name; if (text.StartsWith("Action_", StringComparison.Ordinal)) { text = text.Substring("Action_".Length); } return text.Replace('_', ' '); } private static string GetLocalizedActionName(Type type) { if (type == null) { return string.Empty; } string text = ("Mod_" + Name + "_" + type.Name).ToUpper(); if (!LocalizedText.MAIN_TABLE.ContainsKey(text)) { return string.Empty; } string text2 = LocalizedText.GetText(text, true); if (string.IsNullOrWhiteSpace(text2)) { return string.Empty; } text2 = text2.Trim(); if (text2.StartsWith("LOC:", StringComparison.OrdinalIgnoreCase)) { return string.Empty; } if (string.Equals(text2, text, StringComparison.OrdinalIgnoreCase)) { return string.Empty; } return text2; } private static string ToInlineText(string text) { if (string.IsNullOrWhiteSpace(text)) { return string.Empty; } string text2 = text.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " "); return text2.Trim(); } private static bool HasExplodeOnUseBehavior(object behavior) { if (behavior == null) { return false; } string name = behavior.GetType().Name; if (ContainsExplodeKeyword(name) && !string.Equals(name, "CookingBehavior_Explode", StringComparison.OrdinalIgnoreCase)) { return true; } if (name.IndexOf("RunActions", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("EnableScripts", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("DisableScripts", StringComparison.OrdinalIgnoreCase) >= 0) { return BehaviorContainsExplodeTarget(behavior); } return false; } private static bool BehaviorContainsExplodeTarget(object behavior) { if (behavior == null) { return false; } BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; Type type = behavior.GetType(); FieldInfo[] fields = type.GetFields(bindingAttr); foreach (FieldInfo fieldInfo in fields) { if (NameContainsActionOrScript(fieldInfo.Name) && ValueContainsExplodeKeyword(fieldInfo.GetValue(behavior))) { return true; } } PropertyInfo[] properties = type.GetProperties(bindingAttr); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.CanRead && propertyInfo.GetIndexParameters().Length == 0 && NameContainsActionOrScript(propertyInfo.Name)) { object obj = null; try { obj = propertyInfo.GetValue(behavior, null); } catch { continue; } if (ValueContainsExplodeKeyword(obj)) { return true; } } } return false; } private static bool NameContainsActionOrScript(string name) { if (string.IsNullOrWhiteSpace(name)) { return false; } string text = name.ToLowerInvariant(); if (!text.Contains("action")) { return text.Contains("script"); } return true; } private static bool ValueContainsExplodeKeyword(object value) { if (value == null) { return false; } if (value is string text) { return ContainsExplodeKeyword(text); } Object val = (Object)((value is Object) ? value : null); if (val != null) { return ContainsExplodeKeyword(((object)val).GetType().Name); } if (value is IEnumerable enumerable) { foreach (object item in enumerable) { if (ValueContainsExplodeKeyword(item)) { return true; } } return false; } return ContainsExplodeKeyword(value.GetType().Name); } private static bool ContainsExplodeKeyword(string text) { if (string.IsNullOrWhiteSpace(text)) { return false; } if (text.IndexOf("Explode", StringComparison.OrdinalIgnoreCase) < 0) { return text.IndexOf("Explosion", StringComparison.OrdinalIgnoreCase) >= 0; } return true; } private static bool ScriptsContainSpawnExplosion(IEnumerable scripts) { if (scripts == null) { return false; } foreach (MonoBehaviour script in scripts) { Action_Spawn val = (Action_Spawn)(object)((script is Action_Spawn) ? script : null); if (val == null || (Object)(object)val.objectToSpawn == (Object)null) { continue; } if (ContainsExplodeKeyword(((Object)val.objectToSpawn).name)) { return true; } try { Component[] components = val.objectToSpawn.GetComponents(); foreach (Component val2 in components) { if ((Object)(object)val2 != (Object)null && ContainsExplodeKeyword(((object)val2).GetType().Name)) { return true; } } } catch { } } return false; } 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 float GetItemFuelRemaining(Item item, float startingFuel) { 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 { } return startingFuel; } private static int GetCandleRemainingSecondsInt(Item item, Candle candle) { if ((Object)(object)candle == (Object)null) { return 0; } float itemFuelRemaining = GetItemFuelRemaining(item, candle.startingFuel); return Mathf.Max(0, Mathf.CeilToInt(itemFuelRemaining)); } private static void UpdateLanternRefreshFlag(Item item) { Lantern val = (((Object)(object)item != (Object)null) ? ((Component)item).GetComponent() : 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 float GetAfflictionTotalTime(Affliction affliction) { if (affliction == null) { return 0f; } BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; Type type = ((object)affliction).GetType(); try { FieldInfo field = type.GetField("totalTime", bindingAttr); if (field != null && field.FieldType == typeof(float)) { return (float)field.GetValue(affliction); } PropertyInfo property = type.GetProperty("totalTime", bindingAttr); if (property != null && property.PropertyType == typeof(float)) { return (float)property.GetValue(affliction, null); } } catch { return 0f; } return 0f; } private static float GetAfflictionRadius(Affliction affliction) { if (affliction == null) { return 0f; } BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; Type type = ((object)affliction).GetType(); try { FieldInfo field = type.GetField("radius", bindingAttr); if (field != null && field.FieldType == typeof(float)) { return (float)field.GetValue(affliction); } PropertyInfo property = type.GetProperty("radius", bindingAttr); if (property != null && property.PropertyType == typeof(float)) { return (float)property.GetValue(affliction, null); } } catch { return 0f; } return 0f; } private unsafe static string SegmentToBiomeName(Segment segment) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 if ((int)segment != 3) { if ((int)segment == 4) { return "熔炉"; } return ((object)(*(Segment*)(&segment))/*cast due to .constrained prefix*/).ToString().ToUpper(); } return "火山口"; } private static string ProcessAffliction(Affliction affliction, float cookingMultiplier) { //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_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0274: 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_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Invalid comparison between Unknown and I4 //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Expected O, but got Unknown //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Expected O, but got Unknown //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Invalid comparison between Unknown and I4 //IL_0667: Unknown result type (might be due to invalid IL or missing references) //IL_066d: Invalid comparison between Unknown and I4 //IL_0550: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Expected O, but got Unknown //IL_0779: Unknown result type (might be due to invalid IL or missing references) //IL_077f: Invalid comparison between Unknown and I4 //IL_0673: Unknown result type (might be due to invalid IL or missing references) //IL_067a: Expected O, but got Unknown //IL_0857: Unknown result type (might be due to invalid IL or missing references) //IL_085e: Invalid comparison between Unknown and I4 //IL_08ba: Unknown result type (might be due to invalid IL or missing references) //IL_08c1: Invalid comparison between Unknown and I4 //IL_0861: Unknown result type (might be due to invalid IL or missing references) //IL_0868: Expected O, but got Unknown //IL_0926: Unknown result type (might be due to invalid IL or missing references) //IL_092d: Invalid comparison between Unknown and I4 //IL_08c4: Unknown result type (might be due to invalid IL or missing references) //IL_08cb: Expected O, but got Unknown //IL_0980: Unknown result type (might be due to invalid IL or missing references) //IL_0987: Invalid comparison between Unknown and I4 //IL_0930: Unknown result type (might be due to invalid IL or missing references) //IL_0937: Expected O, but got Unknown //IL_09b8: Unknown result type (might be due to invalid IL or missing references) //IL_09bf: Invalid comparison between Unknown and I4 //IL_0a24: Unknown result type (might be due to invalid IL or missing references) //IL_0a2b: Invalid comparison between Unknown and I4 //IL_09c2: Unknown result type (might be due to invalid IL or missing references) //IL_09c9: Expected O, but got Unknown //IL_0a88: Unknown result type (might be due to invalid IL or missing references) //IL_0a8f: Invalid comparison between Unknown and I4 //IL_0aec: Unknown result type (might be due to invalid IL or missing references) //IL_0af3: Invalid comparison between Unknown and I4 //IL_0b4d: Unknown result type (might be due to invalid IL or missing references) //IL_0b54: Invalid comparison between Unknown and I4 //IL_0af6: Unknown result type (might be due to invalid IL or missing references) //IL_0afd: Expected O, but got Unknown //IL_0b8a: Unknown result type (might be due to invalid IL or missing references) //IL_0b91: Invalid comparison between Unknown and I4 //IL_0b57: Unknown result type (might be due to invalid IL or missing references) //IL_0b5e: Expected O, but got Unknown //IL_0bc2: Unknown result type (might be due to invalid IL or missing references) //IL_0bc9: Invalid comparison between Unknown and I4 //IL_0c2f: Unknown result type (might be due to invalid IL or missing references) //IL_0c36: Invalid comparison between Unknown and I4 //IL_0bcc: Unknown result type (might be due to invalid IL or missing references) //IL_0bd3: Expected O, but got Unknown //IL_0c93: Unknown result type (might be due to invalid IL or missing references) //IL_0c99: Invalid comparison between Unknown and I4 //IL_0cf6: Unknown result type (might be due to invalid IL or missing references) //IL_0cfc: Invalid comparison between Unknown and I4 //IL_0d59: Unknown result type (might be due to invalid IL or missing references) //IL_0d60: Invalid comparison between Unknown and I4 //IL_0dbd: Unknown result type (might be due to invalid IL or missing references) //IL_0dc4: Invalid comparison between Unknown and I4 //IL_0eb6: Unknown result type (might be due to invalid IL or missing references) //IL_0dca: Unknown result type (might be due to invalid IL or missing references) //IL_0dd1: Expected O, but got Unknown //IL_0ec1: Unknown result type (might be due to invalid IL or missing references) //IL_0ec8: 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; float num = ApplyCookingMultiplier(val3.staminaAmount, cookingMultiplier); text += GetText("Affliction_AddBonusStamina", effectColors["ItemInfoDisplayPositive"], effectColors["Extra Stamina"], (num * 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, cookingMultiplier); } } else if ((int)affliction.GetAfflictionType() == 7) { Affliction_AdjustStatus val5 = (Affliction_AdjustStatus)affliction; float num2 = ApplyCookingMultiplier(val5.statusAmount, cookingMultiplier); if (num2 > 0f) { empty = effectColors["ItemInfoDisplayNegative"]; empty2 = "GAIN"; } else { empty = effectColors["ItemInfoDisplayPositive"]; empty2 = "REMOVE"; } text += GetText("ProcessEffect", empty, GetText(empty2), effectColors[((object)Unsafe.As(ref val5.statusType)/*cast due to .constrained prefix*/).ToString()], (Mathf.Abs(num2) * 100f).ToString("F1").Replace(".0", ""), GetText("Effect_" + ((object)Unsafe.As(ref val5.statusType)/*cast due to .constrained prefix*/).ToString().ToUpper()).ToUpper()); } else if (string.Equals(((object)affliction.GetAfflictionType()/*cast due to .constrained prefix*/).ToString(), "Invincibility", StringComparison.OrdinalIgnoreCase)) { float num3 = ApplyCookingMultiplier(GetAfflictionTotalTime(affliction), cookingMultiplier); if (num3 > 0f) { text += GetText("Affliction_Invincibility", effectColors["ItemInfoDisplayPositive"], num3.ToString("F1").Replace(".0", "")); } } else if ((int)affliction.GetAfflictionType() == 11) { Affliction_AdjustDrowsyOverTime val6 = (Affliction_AdjustDrowsyOverTime)affliction; float num4 = ApplyCookingMultiplier(val6.statusPerSecond, cookingMultiplier); empty = ((num4 > 0f) ? effectColors["ItemInfoDisplayNegative"] : effectColors["ItemInfoDisplayPositive"]); empty2 = ((num4 > 0f) ? "GAIN" : "REMOVE"); text += GetText("ProcessEffectOverTime", empty, GetText(empty2), effectColors["Drowsy"], (Mathf.Round(Mathf.Abs(num4) * ((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; float num5 = ApplyCookingMultiplier(val7.statusPerSecond, cookingMultiplier); empty = ((num5 > 0f) ? effectColors["ItemInfoDisplayNegative"] : effectColors["ItemInfoDisplayPositive"]); empty2 = ((num5 > 0f) ? "GAIN" : "REMOVE"); text += GetText("ProcessEffectOverTime", empty, GetText(empty2), effectColors["Cold"], (Mathf.Abs(num5) * ((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", "")); } else if ((int)affliction.GetAfflictionType() == 19) { Affliction_Numb val9 = (Affliction_Numb)affliction; float num6 = ApplyCookingMultiplier(GetAfflictionTotalTime(affliction), cookingMultiplier); text += GetText("Numb", effectColors["Drowsy"], num6.ToString("F1").Replace(".0", "")); } else if ((int)affliction.GetAfflictionType() == 20) { Affliction_ClimbingChalk val10 = (Affliction_ClimbingChalk)affliction; float num7 = ApplyCookingMultiplier(GetAfflictionTotalTime(affliction), cookingMultiplier); text += GetText("ClimbingChalk", num7.ToString("F1").Replace(".0", "")); } else if ((int)affliction.GetAfflictionType() == 14) { text += GetText("Affliction_BingBongShield", effectColors["Shield"]); } else if ((int)affliction.GetAfflictionType() == 15) { Affliction_ZombieBite val11 = (Affliction_ZombieBite)affliction; float num8 = ApplyCookingMultiplier(GetAfflictionTotalTime(affliction), cookingMultiplier); text += GetText("Affliction_ZombieBite", effectColors["Poison"], num8.ToString("F1").Replace(".0", "")); } else if ((int)affliction.GetAfflictionType() == 18) { float num9 = ApplyCookingMultiplier(GetAfflictionTotalTime(affliction), cookingMultiplier); text += GetText("Affliction_Blind", effectColors["Curse"], num9.ToString("F1").Replace(".0", "")); } else if ((int)affliction.GetAfflictionType() == 21) { float num10 = ApplyCookingMultiplier(GetAfflictionTotalTime(affliction), cookingMultiplier); text += GetText("Affliction_NoHunger", effectColors["ItemInfoDisplayPositive"], num10.ToString("F1").Replace(".0", "")); } else if ((int)affliction.GetAfflictionType() == 22) { Affliction_HealAll val12 = (Affliction_HealAll)affliction; float num11 = ApplyCookingMultiplier(val12.maxHealing, cookingMultiplier) * 100f; text += GetText("Affliction_HealAll", num11.ToString("F1").Replace(".0", "")); } else if ((int)affliction.GetAfflictionType() == 23) { Affliction_DoubleJumpAmulet val13 = (Affliction_DoubleJumpAmulet)affliction; text += GetText("Affliction_DoubleJumpAmulet", val13.stacks.ToString()); } else if ((int)affliction.GetAfflictionType() == 24) { text += GetText("Affliction_RadiateInfiniteStam", effectColors["Extra Stamina"]); } else if ((int)affliction.GetAfflictionType() == 25) { Affliction_MassSuperJump val14 = (Affliction_MassSuperJump)affliction; float num12 = ApplyCookingMultiplier(val14.forceTime, cookingMultiplier); text += GetText("Affliction_MassSuperJump", effectColors["Extra Stamina"], num12.ToString("F1").Replace(".0", "")); } else if ((int)affliction.GetAfflictionType() == 17) { float num13 = ApplyCookingMultiplier(GetAfflictionTotalTime(affliction), cookingMultiplier); text += GetText("Affliction_LowGravity", effectColors["Extra Stamina"], num13.ToString("F1").Replace(".0", "")); } else if ((int)affliction.GetAfflictionType() == 4) { float num14 = ApplyCookingMultiplier(GetAfflictionTotalTime(affliction), cookingMultiplier); text += GetText("Affliction_Glowing", effectColors["ItemInfoDisplayPositive"], num14.ToString("F1").Replace(".0", "")); } else if ((int)affliction.GetAfflictionType() == 3) { float num15 = ApplyCookingMultiplier(GetAfflictionTotalTime(affliction), cookingMultiplier); text += GetText("Affliction_Exhausted", effectColors["ItemInfoDisplayNegative"], num15.ToString("F1").Replace(".0", "")); } else if ((int)affliction.GetAfflictionType() == 9) { float num16 = ApplyCookingMultiplier(GetAfflictionTotalTime(affliction), cookingMultiplier); text += GetText("Affliction_PreventPoisonHealing", effectColors["Poison"], num16.ToString("F1").Replace(".0", "")); } else if ((int)affliction.GetAfflictionType() == 12) { Affliction_AdjustStatusOverTime val15 = (Affliction_AdjustStatusOverTime)affliction; float num17 = ApplyCookingMultiplier(val15.statusPerSecond, cookingMultiplier); float num18 = ApplyCookingMultiplier(GetAfflictionTotalTime(affliction), cookingMultiplier); string text2 = ((num17 > 0f) ? effectColors["ItemInfoDisplayNegative"] : effectColors["ItemInfoDisplayPositive"]); string text3 = ((num17 > 0f) ? GetText("GAIN") : GetText("REMOVE")); text += GetText("Affliction_AdjustStatusOverTime", text2, text3, (Mathf.Abs(num17) * 100f).ToString("F1").Replace(".0", ""), num18.ToString("F1").Replace(".0", "")); } else if ((int)affliction.GetAfflictionType() == 0) { Affliction_PoisonOverTime val16 = (Affliction_PoisonOverTime)affliction; float num19 = ApplyCookingMultiplier(GetAfflictionTotalTime(affliction), cookingMultiplier); float delayBeforeEffect = val16.delayBeforeEffect; float time = Mathf.Max(0f, num19 - delayBeforeEffect); text += GetText("InflictPoison", delayBeforeEffect.ToString("F1").Replace(".0", ""), ProcessEffectOverTime(val16.statusPerSecond, 1f, time, "Poison")); } 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) && !IsTestKeyDown((KeyCode)285))) { 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(); } if (IsTestKeyDown((KeyCode)285)) { LogAllItemInfo(); } } 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 unsafe 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*)(&keyCode))/*cast due to .constrained prefix*/).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.Instance; if ((Object)(object)instance == (Object)null || ((DatabaseAsset)(object)instance).Objects == null || ((DatabaseAsset)(object)instance).Objects.Count == 0) { int num = ((DatabaseAsset)(object)instance)?.Objects?.Count ?? (-1); Log.LogInfo((object)$"[TestMode] ItemDatabase not ready or empty. Count={num}. Try again after fully entering a match or starting offline."); return false; } allItemPrefabs = ((DatabaseAsset)(object)instance).Objects.Where((Item i) => (Object)(object)i != (Object)null).ToList(); EnsureItemNameKeyMap(); Log.LogInfo((object)$"[TestMode] Loaded {allItemPrefabs.Count} items from ItemDatabase. Press F1/F2 to cycle, F3 to log current item info, F4 to log all items."); 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(); List values = components.Select((Component c) => (!((Object)(object)c == (Object)null)) ? ((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; } string localizedItemName = GetLocalizedItemName(val); string text = (string.IsNullOrEmpty(localizedItemName) ? "" : (" (" + localizedItemName + ")")); Log.LogInfo((object)("[TestMode] Current Item: " + ((Object)val).name + text)); Component[] components = ((Component)val).GetComponents(); Component[] array = components; foreach (Component val2 in array) { Log.LogInfo((object)("[TestMode] - " + (((Object)(object)val2 == (Object)null) ? "" : ((object)val2).GetType().Name))); } LogItemCookingDetails(val); LogHealingPuffShroomSpawnDetails(val); Log.LogInfo((object)("[TestMode] Display Text:\n" + ((TMP_Text)itemInfoDisplayTextMesh).text)); } private static void LogAllItemInfo() { if (allItemPrefabs.Count == 0) { Log.LogInfo((object)"[TestMode] No items loaded"); return; } Log.LogInfo((object)$"[TestMode] F4 logging {allItemPrefabs.Count} items..."); int num = 0; int num2 = 0; string text = ((TMP_Text)itemInfoDisplayTextMesh).text; foreach (Item allItemPrefab in allItemPrefabs) { if ((Object)(object)allItemPrefab == (Object)null) { num2++; continue; } try { LogItemInfoForTest(allItemPrefab); num++; } catch (Exception ex) { num2++; Log.LogWarning((object)("[TestMode] Failed to log " + ((Object)allItemPrefab).name + ": " + ex.GetType().Name + " " + ex.Message)); } } ((TMP_Text)itemInfoDisplayTextMesh).text = text; Log.LogInfo((object)$"[TestMode] F4 completed. Logged={num}, Failed={num2}."); } private static void LogItemInfoForTest(Item item) { Item val = item; GameObject val2 = null; string text = ((TMP_Text)itemInfoDisplayTextMesh).text; try { try { val2 = Object.Instantiate(((Component)item).gameObject); Item component = val2.GetComponent(); if ((Object)(object)component != (Object)null) { val = component; } } catch (Exception ex) { Log.LogWarning((object)("[TestMode] Clone failed for " + ((Object)item).name + ": " + ex.GetType().Name + " " + ex.Message)); } string localizedItemName = GetLocalizedItemName(val); string text2 = (string.IsNullOrEmpty(localizedItemName) ? "" : (" (" + localizedItemName + ")")); Log.LogInfo((object)("[TestMode] Current Item: " + ((Object)val).name + text2)); Component[] components = ((Component)val).GetComponents(); Component[] array = components; foreach (Component val3 in array) { Log.LogInfo((object)("[TestMode] - " + (((Object)(object)val3 == (Object)null) ? "" : ((object)val3).GetType().Name))); } LogItemCookingDetails(val); LogHealingPuffShroomSpawnDetails(val); ProcessItemGameObject(val); string text3 = ((TMP_Text)itemInfoDisplayTextMesh).text; Log.LogInfo((object)("[TestMode] Display Text:\n" + text3)); } finally { ((TMP_Text)itemInfoDisplayTextMesh).text = text; if ((Object)(object)val2 != (Object)null) { Object.Destroy((Object)(object)val2); } } } private static void LogItemCookingDetails(Item item) { //IL_0185: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item == (Object)null) { return; } ItemCooking component = ((Component)item).GetComponent(); if ((Object)(object)component == (Object)null) { Log.LogInfo((object)"[TestMode] Cooking: "); return; } Log.LogInfo((object)$"[TestMode] Cooking: preCooked={component.preCooked}, timesCookedLocal={component.timesCookedLocal}, canBeCooked={component.canBeCooked}, wreckWhenCooked={component.wreckWhenCooked}, ignoreDefaultCookBehavior={component.ignoreDefaultCookBehavior}"); if ((Object)(object)component.explosionPrefab != (Object)null) { Log.LogInfo((object)("[TestMode] Cooking: explosionPrefab=" + ((Object)component.explosionPrefab).name)); } AdditionalCookingBehavior[] additionalCookingBehaviors = component.additionalCookingBehaviors; if (additionalCookingBehaviors == null || additionalCookingBehaviors.Length == 0) { Log.LogInfo((object)"[TestMode] CookingBehaviors: "); return; } Log.LogInfo((object)$"[TestMode] CookingBehaviors: {additionalCookingBehaviors.Length}"); foreach (AdditionalCookingBehavior val in additionalCookingBehaviors) { if (val == null) { Log.LogInfo((object)"[TestMode] - "); continue; } string text = $"{((object)val).GetType().Name} (trigger>={val.cookedAmountToTrigger}, onlyOnce={val.onlyOnce})"; CookingBehavior_Explode val2 = (CookingBehavior_Explode)(object)((val is CookingBehavior_Explode) ? val : null); if (val2 != null) { text += $" dontRunIfOutOfFuel={val2.dontRunIfOutOfFuel}"; } else { CookingBehavior_AdjustStatusInstantly val3 = (CookingBehavior_AdjustStatusInstantly)(object)((val is CookingBehavior_AdjustStatusInstantly) ? val : null); if (val3 != null) { text += $" status={val3.statusType} amount={val3.amount}"; } else { CookingBehavior_ChangeAfflictionTime val4 = (CookingBehavior_ChangeAfflictionTime)(object)((val is CookingBehavior_ChangeAfflictionTime) ? val : null); if (val4 != null) { string arg = (((Object)(object)val4.action == (Object)null) ? "null" : ((object)val4.action).GetType().Name); text += $" change={val4.change} action={arg}"; } else { CookingBehavior_EnableScripts val5 = (CookingBehavior_EnableScripts)(object)((val is CookingBehavior_EnableScripts) ? val : null); if (val5 != null) { text = text + " scripts=" + FormatComponentList(val5.scriptsToEnable); } else { CookingBehavior_MessUpAudio val6 = (CookingBehavior_MessUpAudio)(object)((val is CookingBehavior_MessUpAudio) ? val : null); if (val6 != null) { text += $" pitchReductionPerCooking={val6.pitchReductionPerCooking} volumeReductionPerCooking={val6.volumeReductionPerCooking}"; } else { CookingBehavior_ModifyAudioSourcePitch val7 = (CookingBehavior_ModifyAudioSourcePitch)(object)((val is CookingBehavior_ModifyAudioSourcePitch) ? val : null); if (val7 != null) { text += $" changePerCooking={val7.changePerCooking}"; } } } } } } Log.LogInfo((object)("[TestMode] - " + text)); CookingBehavior_RunActions val8 = (CookingBehavior_RunActions)(object)((val is CookingBehavior_RunActions) ? val : null); if (val8 != null) { LogRunActions(val8); } } } private static void LogRunActions(CookingBehavior_RunActions runActions) { //IL_00ed: Unknown result type (might be due to invalid IL or missing references) if (runActions.actionsToRun == null || runActions.actionsToRun.Length == 0) { Log.LogInfo((object)"[TestMode] * actionsToRun: "); return; } Log.LogInfo((object)$"[TestMode] * actionsToRun: {runActions.actionsToRun.Length}"); ItemAction[] actionsToRun = runActions.actionsToRun; foreach (ItemAction val in actionsToRun) { if ((Object)(object)val == (Object)null) { Log.LogInfo((object)"[TestMode] - "); continue; } string text = ((object)val).GetType().Name; Action_RestoreHunger val2 = (Action_RestoreHunger)(object)((val is Action_RestoreHunger) ? val : null); if (val2 != null) { text += $" restore={val2.restorationAmount}"; } else { Action_GiveExtraStamina val3 = (Action_GiveExtraStamina)(object)((val is Action_GiveExtraStamina) ? val : null); if (val3 != null) { text += $" amount={val3.amount}"; } else { Action_ModifyStatus val4 = (Action_ModifyStatus)(object)((val is Action_ModifyStatus) ? val : null); if (val4 != null) { text += $" status={val4.statusType} change={val4.changeAmount} ifSkeleton={val4.ifSkeleton}"; } else { Action_ApplyAffliction val5 = (Action_ApplyAffliction)(object)((val is Action_ApplyAffliction) ? val : null); if (val5 != null) { text = text + " affliction=" + FormatAfflictionInfo(val5.affliction); if (val5.extraAfflictions != null && val5.extraAfflictions.Length != 0) { string text2 = string.Join(", ", val5.extraAfflictions.Select(FormatAfflictionInfo)); text = text + " extraAfflictions=[" + text2 + "]"; } } } } } Log.LogInfo((object)("[TestMode] - " + text)); } } private static string FormatComponentList(MonoBehaviour[] scripts) { if (scripts == null || scripts.Length == 0) { return "[]"; } List list = new List(); foreach (MonoBehaviour val in scripts) { list.Add(((Object)(object)val == (Object)null) ? "" : ((object)val).GetType().Name); } return "[" + string.Join(", ", list) + "]"; } private static string FormatAfflictionInfo(Affliction affliction) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (affliction == null) { return "null"; } string name = ((object)affliction).GetType().Name; string empty = string.Empty; try { empty = ((object)affliction.GetAfflictionType()/*cast due to .constrained prefix*/).ToString(); } catch { empty = string.Empty; } if (!string.IsNullOrEmpty(empty)) { return name + "(" + empty + ")"; } return name; } private static void LogHealingPuffShroomSpawnDetails(Item item) { //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item == (Object)null) { return; } ShelfShroom component = ((Component)item).GetComponent(); if ((Object)(object)component == (Object)null || (Object)(object)component.instantiateOnBreak == (Object)null) { return; } GameObject instantiateOnBreak = component.instantiateOnBreak; if (!((Object)instantiateOnBreak).name.Equals("HealingPuffShroomSpawn", StringComparison.OrdinalIgnoreCase)) { return; } AOE[] componentsInChildren = instantiateOnBreak.GetComponentsInChildren(true); StatusField[] componentsInChildren2 = instantiateOnBreak.GetComponentsInChildren(true); TimeEvent componentInChildren = instantiateOnBreak.GetComponentInChildren(true); RemoveAfterSeconds componentInChildren2 = instantiateOnBreak.GetComponentInChildren(true); Log.LogInfo((object)("[TestMode] HealingPuffShroomSpawn: prefab=" + ((Object)instantiateOnBreak).name)); Log.LogInfo((object)$"[TestMode] HealingPuffShroomSpawn: aoeCount={componentsInChildren.Length}, statusFieldCount={componentsInChildren2.Length}"); for (int i = 0; i < componentsInChildren.Length; i++) { AOE val = componentsInChildren[i]; if ((Object)(object)val == (Object)null) { Log.LogInfo((object)$"[TestMode] AOE[{i}]: "); continue; } TimeEvent val2 = ((Component)val).GetComponent() ?? ((Component)val).GetComponentInParent() ?? componentInChildren; RemoveAfterSeconds val3 = ((Component)val).GetComponent() ?? ((Component)val).GetComponentInParent() ?? componentInChildren2; bool flag = (Object)(object)val2 != (Object)null && val2.rate > 0f; float num = (flag ? (val.statusAmount / val2.rate) : 0f); string text = (((Object)(object)val2 == (Object)null) ? "" : val2.rate.ToString("F3")); string text2 = (((Object)(object)val3 == (Object)null) ? "" : val3.seconds.ToString("F3")); string text3 = (flag ? num.ToString("F4") : ""); string transformPath = GetTransformPath(((Component)val).transform, instantiateOnBreak.transform); Log.LogInfo((object)$"[TestMode] AOE[{i}]: path={transformPath}, activeSelf={((Component)val).gameObject.activeSelf}, activeInHierarchy={((Component)val).gameObject.activeInHierarchy}, status={val.statusType}, amount={val.statusAmount:F4}, rate={text}, duration={text2}, derivedPerSecond={text3}, affliction={FormatAfflictionInfo(val.affliction)}"); } for (int j = 0; j < componentsInChildren2.Length; j++) { StatusField val4 = componentsInChildren2[j]; if ((Object)(object)val4 == (Object)null) { Log.LogInfo((object)$"[TestMode] StatusField[{j}]: "); continue; } string transformPath2 = GetTransformPath(((Component)val4).transform, instantiateOnBreak.transform); string text4 = "[]"; if (((StatusFieldBase)val4).additionalStatuses != null && ((StatusFieldBase)val4).additionalStatuses.Count > 0) { List list = new List(); foreach (StatusFieldStatus additionalStatus in ((StatusFieldBase)val4).additionalStatuses) { list.Add($"{additionalStatus.statusType}:{additionalStatus.statusAmountPerSecond:F4}"); } text4 = "[" + string.Join(", ", list) + "]"; } Log.LogInfo((object)$"[TestMode] StatusField[{j}]: path={transformPath2}, activeSelf={((Component)val4).gameObject.activeSelf}, activeInHierarchy={((Component)val4).gameObject.activeInHierarchy}, status={((StatusFieldBase)val4).statusType}, onEntry={((StatusFieldBase)val4).statusAmountOnEntry:F4}, perSecond={((StatusFieldBase)val4).statusAmountPerSecond:F4}, additional={text4}"); } } private static string GetTransformPath(Transform transform, Transform root) { if ((Object)(object)transform == (Object)null) { return ""; } List list = new List(); Transform val = transform; while ((Object)(object)val != (Object)null) { list.Add(((Object)val).name); if ((Object)(object)val == (Object)(object)root) { break; } val = val.parent; } list.Reverse(); return string.Join("/", list); } private static void AddDisplayObject() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = GameObject.Find("GAME/GUIManager"); GUIManager component = val.GetComponent(); TMP_FontAsset font = ((TMP_Text)component.heroDayText).font; GameObject gameObject = ((Component)val.transform.Find("Canvas_HUD/Prompts/ItemPromptLayout")).gameObject; GameObject val2 = new GameObject("ItemInfoDisplay"); val2.transform.SetParent(gameObject.transform); TextMeshProUGUI val3 = val2.AddComponent(); RectTransform component2 = val2.GetComponent(); component2.sizeDelta = new Vector2(configSizeDeltaX.Value, 0f); ((TMP_Text)val3).font = font; ((TMP_Text)val3).fontSize = configFontSize.Value; ((TMP_Text)val3).alignment = (TextAlignmentOptions)1025; ((TMP_Text)val3).lineSpacing = configLineSpacing.Value; ((TMP_Text)val3).text = ""; ((TMP_Text)val3).outlineWidth = configOutlineWidth.Value; guiManager = component; itemInfoDisplayTextMesh = val3; } catch (Exception ex) { Log.LogError((object)("[ItemInfoDisplay] AddDisplayObject failed: " + ex)); guiManager = null; itemInfoDisplayTextMesh = null; } LoadLocalizedText(); } private static string GetLocalizedItemName(Item item) { if ((Object)(object)item == (Object)null) { return string.Empty; } EnsureItemNameKeyMap(); string text = ((Object)item).name ?? string.Empty; if (ContainsNonAscii(text)) { return text.Trim(); } string text2 = NormalizeItemNameForMap(text); if (!string.IsNullOrEmpty(text2) && itemNameKeyMap.TryGetValue(text2, out string value)) { return ResolveLocalizedText(value); } return string.Empty; } private static void EnsureItemNameKeyMap() { if (!itemNameKeyMapInitialized) { LoadItemNameKeyMap(); itemNameKeyMapInitialized = true; } } private static void LoadItemNameKeyMap() { itemNameKeyMap.Clear(); try { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ItemNameKeyMap.json"); if (stream == null) { Log.LogWarning((object)"[TestMode] Embedded ItemNameKeyMap.json not found."); return; } using StreamReader streamReader = new StreamReader(stream); string text = streamReader.ReadToEnd(); Dictionary dictionary = JsonConvert.DeserializeObject>(text); if (dictionary == null) { return; } foreach (KeyValuePair item in dictionary) { if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value)) { itemNameKeyMap[item.Key] = item.Value; } } } catch (Exception ex) { Log.LogWarning((object)("[TestMode] Failed to load embedded ItemNameKeyMap.json: " + ex.GetType().Name + " " + ex.Message)); } } private static string NormalizeItemNameForMap(string name) { if (string.IsNullOrWhiteSpace(name)) { return string.Empty; } string text = StripLocPrefix(name.Trim()); return text.Replace("(Clone)", "").Trim(); } private static bool ContainsNonAscii(string text) { if (string.IsNullOrEmpty(text)) { return false; } for (int i = 0; i < text.Length; i++) { if (text[i] > '\u007f') { return true; } } return false; } private static string StripLocPrefix(string key) { if (string.IsNullOrEmpty(key)) { return string.Empty; } if (key.StartsWith("LOC:", StringComparison.OrdinalIgnoreCase)) { return key.Substring("LOC:".Length).Trim(); } return key; } private static string ResolveLocalizedText(string key) { if (string.IsNullOrEmpty(key)) { return string.Empty; } try { string text = StripLocPrefix(key.Trim()); if (string.IsNullOrEmpty(text)) { return string.Empty; } string text2 = LocalizedText.GetText(text, true); if (string.IsNullOrEmpty(text2)) { return string.Empty; } string text3 = text2.Trim(); if (text3.StartsWith("LOC:", StringComparison.OrdinalIgnoreCase)) { return string.Empty; } if (string.Equals(text3, text, StringComparison.OrdinalIgnoreCase)) { return string.Empty; } return text3; } catch { return string.Empty; } } 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> dictionary = JsonConvert.DeserializeObject>>(Resources.Localized_Text); if (dictionary != null) { foreach (KeyValuePair> item in dictionary) { List value = item.Value; string firstValue = value[0]; value = value.Select((string x) => (!string.IsNullOrEmpty(x)) ? x : firstValue).ToList(); string key = ("Mod_" + Name + "_" + item.Key).ToUpper(); LocalizedText.MAIN_TABLE[key] = value; } return; } Log.LogError((object)"LoadLocalizedText Fail"); } private static void InitEffectColors(Dictionary 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("Web", "<#D8D8D8>"); dict.Add("Arrow", "<#B87333>"); dict.Add("Petrify", "<#9E9E9E>"); dict.Add("FlyTrap", "<#5CA04A>"); 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) { } } }