using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using HarmonyLib;
using ItemInfo.Components;
using ItemInfo.Utils;
using Microsoft.CodeAnalysis;
using Peak.Afflictions;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.yueby.ItemInfo")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.7.0")]
[assembly: AssemblyInformationalVersion("0.1.7")]
[assembly: AssemblyProduct("com.github.yueby.ItemInfo")]
[assembly: AssemblyTitle("ItemInfo")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.7.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace ItemInfo
{
[BepInPlugin("com.github.yueby.ItemInfo", "ItemInfo", "0.1.7")]
public class Plugin : BaseUnityPlugin
{
public const string Id = "com.github.yueby.ItemInfo";
internal static ManualLogSource Log { get; private set; }
public static string Name => "ItemInfo";
public static string Version => "0.1.7";
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
Harmony.CreateAndPatchAll(typeof(Plugin), (string)null);
Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
}
[HarmonyPatch(typeof(CharacterItems), "Equip")]
[HarmonyPostfix]
public static void OnItemEquippedPatch(CharacterItems __instance)
{
Character component = ((Component)__instance).GetComponent<Character>();
if (!((Object)(object)component != (Object)(object)Character.observedCharacter))
{
Log.LogInfo((object)"Item equipped - updating item display");
UpdateItemDisplay();
}
}
[HarmonyPatch(typeof(ItemCooking), "FinishCooking")]
[HarmonyPostfix]
public static void OnFinishCookingPatch(ItemCooking __instance)
{
try
{
if ((Object)(object)Character.observedCharacter == (Object)(object)((ItemComponent)__instance).item.holderCharacter)
{
Log.LogInfo((object)"Item finished cooking, updating display");
ItemInfoPanel instance = ItemInfoPanel.Instance;
if (instance.IsVisible())
{
UpdateItemDisplay();
Log.LogInfo((object)"Updated display for cooked item");
}
}
}
catch (Exception ex)
{
Log.LogError((object)("Error in OnFinishCookingPatch: " + ex.Message + "\n" + ex.StackTrace));
}
}
private static void UpdateItemDisplay()
{
ItemInfoPanel instance = ItemInfoPanel.Instance;
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)
{
instance.Hide();
Log.LogInfo((object)"No item currently held by observed character");
}
else
{
instance.Show();
Log.LogInfo((object)("Showing panel for item: " + ((Object)val).name));
}
}
}
}
namespace ItemInfo.Utils
{
public class StatusIcon
{
private const string ICON_PATH_PREFIX = "GAME/GUIManager/Canvas_HUD/BarGroup/Bar/LayoutGroup/";
private static readonly string[] iconPaths = new string[12]
{
"GAME/GUIManager/Canvas_HUD/BarGroup/Bar/LayoutGroup/Injury/Icon", "GAME/GUIManager/Canvas_HUD/BarGroup/Bar/LayoutGroup/Hunger/Icon", "GAME/GUIManager/Canvas_HUD/BarGroup/Bar/LayoutGroup/Cold/Icon", "GAME/GUIManager/Canvas_HUD/BarGroup/Bar/LayoutGroup/Poison/Icon", "GAME/GUIManager/Canvas_HUD/BarGroup/Bar/LayoutGroup/Crab/Icon", "GAME/GUIManager/Canvas_HUD/BarGroup/Bar/LayoutGroup/Curse/Icon", "GAME/GUIManager/Canvas_HUD/BarGroup/Bar/LayoutGroup/Sleepy/Icon", "GAME/GUIManager/Canvas_HUD/BarGroup/Bar/LayoutGroup/Weight/Icon", "GAME/GUIManager/Canvas_HUD/BarGroup/Bar/LayoutGroup/Heat/Icon", "GAME/GUIManager/Canvas_HUD/BarGroup/Bar/LayoutGroup/Thorns/Icon",
"GAME/GUIManager/Canvas_HUD/BarGroup/ExtraStaminaBar/Icon", "GAME/GUIManager/Canvas_HUD/BarGroup/Bar/OutlineMask/Outline/Shield/ShieldIcon"
};
private static Dictionary<int, StatusIcon> statusIconMap = new Dictionary<int, StatusIcon>();
public Color Color { get; private set; }
public Sprite Icon { get; private set; }
public StatusIcon(Color color, Sprite icon)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
Color = color;
Icon = icon;
}
public static void Initialize()
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
statusIconMap.Clear();
for (int i = 0; i < iconPaths.Length; i++)
{
GameObject val = GameObject.Find(iconPaths[i]);
if ((Object)(object)val != (Object)null)
{
Image component = val.GetComponent<Image>();
if ((Object)(object)component != (Object)null)
{
statusIconMap[i] = new StatusIcon(((Graphic)component).color, component.sprite);
}
else
{
statusIconMap[i] = new StatusIcon(Color.white, null);
}
}
else
{
statusIconMap[i] = new StatusIcon(Color.white, null);
}
}
}
public static StatusIcon GetStatusIcon(STATUSTYPE statusType)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Expected I4, but got Unknown
int index = (int)statusType;
return GetStatusIcon(index);
}
public static StatusIcon GetStatusIcon(int index)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
if (statusIconMap.TryGetValue(index, out StatusIcon value))
{
return value;
}
return new StatusIcon(Color.white, null);
}
}
}
namespace ItemInfo.Components
{
public class ItemInfo : MonoBehaviour
{
private TextMeshProUGUI _infoText;
private Image _iconImage;
public void SetInfo(string text, Color color)
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)_infoText))
{
_infoText = ((Component)this).GetComponentInChildren<TextMeshProUGUI>();
TextMeshProUGUI interactNameText = GUIManager.instance.interactNameText;
((TMP_Text)_infoText).font = ((TMP_Text)interactNameText).font;
((TMP_Text)_infoText).fontSharedMaterial = ((TMP_Text)interactNameText).fontSharedMaterial;
}
((TMP_Text)_infoText).text = text;
((Graphic)_infoText).color = color;
}
public void SetIcon(Sprite? sprite, Color color)
{
//IL_008c: 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_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)_iconImage))
{
_iconImage = ((Component)this).GetComponentInChildren<Image>();
}
((Component)_iconImage).gameObject.SetActive((Object)(object)sprite != (Object)null);
if ((Object)(object)sprite == (Object)null)
{
Vector2 sizeDelta = ((TMP_Text)_infoText).rectTransform.sizeDelta;
((TMP_Text)_infoText).rectTransform.sizeDelta = new Vector2(sizeDelta.x, ((Graphic)_iconImage).rectTransform.sizeDelta.y);
}
_iconImage.sprite = sprite;
((Graphic)_iconImage).color = color;
}
public void SetIconColor(Color color)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)_iconImage))
{
_iconImage = ((Component)this).GetComponentInChildren<Image>();
}
((Graphic)_iconImage).color = color;
}
public void SetTextColor(Color color)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)_infoText))
{
_infoText = ((Component)this).GetComponentInChildren<TextMeshProUGUI>();
}
((Graphic)_infoText).color = color;
}
}
public static class ItemInfoFactory
{
private const string PANEL_PARENT_PATH = "GAME/GUIManager/Canvas_HUD/Inventory/Layout";
private const float PANEL_X_POSITION = 73f;
private const float PANEL_Y_POSITION = 140f;
private const float ITEM_INFO_WIDTH = 77.45f;
private const float ITEM_INFO_HEIGHT = 26.82f;
private const float ITEM_INFO_SPACING = 5f;
private const float INFO_TEXT_WIDTH = 47.45f;
private const float INFO_TEXT_X_OFFSET = 23.725f;
private const float INFO_TEXT_Y_OFFSET = -13.41f;
private const float INFO_TEXT_FONT_SIZE = 18f;
private const float ICON_SIZE = 20f;
public static ItemInfoPanel CreatePanel()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.Find("GAME/GUIManager/Canvas_HUD/Inventory/Layout");
if ((Object)(object)val == (Object)null)
{
Plugin.Log.LogError((object)"Parent object not found at path: GAME/GUIManager/Canvas_HUD/Inventory/Layout");
return null;
}
GameObject val2 = new GameObject("ItemInfoPanel");
RectTransform val3 = InitializePanelRectTransform(val2);
val2.AddComponent<LayoutElement>().ignoreLayout = true;
InitializeVerticalLayoutGroup(val2);
InitializeContentSizeFitter(val2);
ItemInfoPanel itemInfoPanel = val2.AddComponent<ItemInfoPanel>();
val2.transform.SetParent(val.transform);
val3.anchoredPosition = new Vector2(73f, 140f);
((Component)itemInfoPanel).gameObject.SetActive(false);
RefreshLayout(val3);
return itemInfoPanel;
}
public static ItemInfo CreateItemInfo()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("ItemInfo");
InitializeItemInfoRectTransform(val);
InitializeHorizontalLayoutGroup(val);
InitializeItemInfoContentSizeFitter(val);
CreateInfoTextComponent(val);
CreateIconComponent(val);
ItemInfo itemInfo = val.AddComponent<ItemInfo>();
itemInfo.SetInfo("", Color.white);
itemInfo.SetIcon(null, Color.white);
return itemInfo;
}
private static RectTransform InitializePanelRectTransform(GameObject panelObject)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
RectTransform val = panelObject.AddComponent<RectTransform>();
val.anchorMax = new Vector2(0.5f, 0f);
val.anchorMin = new Vector2(0.5f, 0f);
val.pivot = new Vector2(0.5f, 0f);
return val;
}
private static VerticalLayoutGroup InitializeVerticalLayoutGroup(GameObject panelObject)
{
VerticalLayoutGroup val = panelObject.AddComponent<VerticalLayoutGroup>();
((LayoutGroup)val).childAlignment = (TextAnchor)7;
((HorizontalOrVerticalLayoutGroup)val).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)val).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)val).spacing = 0f;
return val;
}
private static ContentSizeFitter InitializeContentSizeFitter(GameObject panelObject)
{
ContentSizeFitter val = panelObject.AddComponent<ContentSizeFitter>();
val.horizontalFit = (FitMode)2;
val.verticalFit = (FitMode)2;
return val;
}
private static RectTransform InitializeItemInfoRectTransform(GameObject itemInfoGameObject)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
RectTransform val = itemInfoGameObject.AddComponent<RectTransform>();
val.anchorMax = new Vector2(0f, 1f);
val.anchorMin = new Vector2(0f, 1f);
val.sizeDelta = new Vector2(77.45f, 26.82f);
val.pivot = new Vector2(0.5f, 0.5f);
return val;
}
private static HorizontalLayoutGroup InitializeHorizontalLayoutGroup(GameObject itemInfoGameObject)
{
HorizontalLayoutGroup val = itemInfoGameObject.AddComponent<HorizontalLayoutGroup>();
((LayoutGroup)val).childAlignment = (TextAnchor)4;
((HorizontalOrVerticalLayoutGroup)val).childControlWidth = false;
((HorizontalOrVerticalLayoutGroup)val).childControlHeight = false;
((HorizontalOrVerticalLayoutGroup)val).childForceExpandWidth = false;
((HorizontalOrVerticalLayoutGroup)val).childForceExpandHeight = false;
((HorizontalOrVerticalLayoutGroup)val).childScaleWidth = false;
((HorizontalOrVerticalLayoutGroup)val).spacing = 5f;
return val;
}
private static ContentSizeFitter InitializeItemInfoContentSizeFitter(GameObject itemInfoGameObject)
{
ContentSizeFitter val = itemInfoGameObject.AddComponent<ContentSizeFitter>();
val.horizontalFit = (FitMode)2;
val.verticalFit = (FitMode)0;
return val;
}
private static GameObject CreateInfoTextComponent(GameObject parent)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Info");
val.transform.SetParent(parent.transform);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.sizeDelta = new Vector2(47.45f, 0f);
val2.anchoredPosition = new Vector2(23.725f, -13.41f);
TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)val3).text = "";
((TMP_Text)val3).fontSize = 18f;
((Graphic)val3).color = Color.white;
((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
ContentSizeFitter val4 = val.AddComponent<ContentSizeFitter>();
val4.horizontalFit = (FitMode)2;
val4.verticalFit = (FitMode)0;
return val;
}
private static GameObject CreateIconComponent(GameObject parent)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Icon");
val.transform.SetParent(parent.transform);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.sizeDelta = new Vector2(20f, 20f);
Image val3 = val.AddComponent<Image>();
((Graphic)val3).color = Color.white;
val3.preserveAspect = true;
return val;
}
private static void RefreshLayout(RectTransform rectTransform)
{
LayoutRebuilder.ForceRebuildLayoutImmediate(rectTransform);
}
}
public class ItemInfoPanel : MonoBehaviour
{
[CompilerGenerated]
private sealed class <DelayedRefresh>d__46 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DelayedRefresh>d__46(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.02f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
Refresh();
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static ItemInfoPanel _instance;
private const float WEIGHT_MULTIPLIER = 2.5f;
private const float BASIC_ACTION_MULTIPLIER = 100f;
private readonly Queue<ItemInfo> itemInfoPool = new Queue<ItemInfo>();
private readonly List<ItemInfo> activeItemInfos = new List<ItemInfo>();
private bool isVisible;
private Item? currentItem;
public static ItemInfoPanel Instance
{
get
{
if ((Object)(object)_instance == (Object)null)
{
_instance = Object.FindFirstObjectByType<ItemInfoPanel>();
if ((Object)(object)_instance == (Object)null)
{
_instance = CreatePanel();
StatusIcon.Initialize();
Plugin.Log.LogInfo((object)"ItemInfoPanel created");
}
}
return _instance;
}
}
private void Awake()
{
Hide();
}
private void OnDestroy()
{
_instance = null;
}
public void Show()
{
//IL_0266: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
Item val = GetCurrentItem();
if ((Object)(object)val == (Object)null)
{
Plugin.Log.LogWarning((object)"No current item found");
return;
}
currentItem = val;
((Component)this).gameObject.SetActive(true);
isVisible = true;
RecycleAllItemInfos();
Refresh();
Component[] components = ((Component)val).GetComponents<Component>();
IEnumerable<string> values = components.Select((Component c) => ((object)c).GetType().Name);
string text = string.Join(", ", values);
Plugin.Log.LogInfo((object)("Item " + val.GetName() + " components: " + text));
if (val is Backpack)
{
List<Item> backpackItems = GetBackpackItems(val);
if (backpackItems != null && backpackItems.Count > 0)
{
foreach (Item item in backpackItems.Where((Item i) => (Object)(object)i != (Object)null))
{
DisplayBackpackItem(item);
}
}
}
else
{
ItemAction[] components2 = ((Component)val).GetComponents<ItemAction>();
string text2 = components2.Aggregate("", (string current, ItemAction itemAction) => current + ((object)itemAction).GetType().Name + " ");
DisplayDie(components2);
DisplayLantern(val);
DisplayClearAllStatus(components2);
DisplayAddOrRemoveThorns(components2);
DisplayRaycastDart(components2);
DisplayMoraleBoost(components2);
DisplayBingBongShield(val);
DisplayShelfShroom(val);
DisplayModifyStatus(components2);
DisplayApplyAffliction(components2);
DisplayInflictPoison(components2);
DisplayExtraStamina(components2);
DisplayRestoreHunger(components2);
Plugin.Log.LogInfo((object)("Show " + val.GetName() + " infos: Actions: " + text2));
}
float weight = ((val is Backpack) ? ((((float?)GetBackpackItems(val)?.Sum((Item item) => item.CarryWeight)) ?? 0f) * 2.5f) : ((float)val.CarryWeight * 2.5f));
DisplayWeight(weight);
Refresh();
((Component)this).transform.localScale = Vector3.zero;
TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOScale(((Component)this).transform, Vector3.one, 0.2f), (Ease)30);
if (val is Backpack)
{
Plugin.Log.LogInfo((object)$"Show backpack infos: {GetBackpackItems(val)?.Count ?? 0} items");
}
}
private void DisplayBackpackItem(Item item)
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
if (item?.UIData != null)
{
Texture2D val = item.UIData.icon ?? item.UIData.altIcon;
if (!((Object)(object)val == (Object)null))
{
Sprite icon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
AddItemInfoToPanel(new StatusIcon(Color.white, icon), item.GetName());
}
}
}
private float CalculateStatusAmount(float rawAmount, float multiplier, STATUSTYPE statusType)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Invalid comparison between Unknown and I4
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
if (rawAmount == -1f && ((int)statusType == 3 || (int)statusType == 0))
{
return -100f;
}
return rawAmount * multiplier;
}
private void ProcessStatusAdjustment(STATUSTYPE statusType, float amount, string source)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
StatusIcon statusIcon = StatusIcon.GetStatusIcon(statusType);
AddItemInfoToPanel(statusIcon, amount);
Plugin.Log.LogInfo((object)$"Added status info from {source}: {statusType} = {amount}");
}
private void DisplayModifyStatus(ItemAction[] actions)
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Invalid comparison between Unknown and I4
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
Action_ModifyStatus[] array = actions.Where((ItemAction action) => action is Action_ModifyStatus).Cast<Action_ModifyStatus>().ToArray();
if (array.Length != 0)
{
LogActionFound("modify status", array.Length);
Action_ModifyStatus[] array2 = array;
foreach (Action_ModifyStatus val in array2)
{
if ((int)val.statusType == 7)
{
Plugin.Log.LogInfo((object)"Skipping Weight status type in modify status");
continue;
}
float amount = CalculateStatusAmount(val.changeAmount, 100f, val.statusType);
ProcessStatusAdjustment(val.statusType, amount, "Action");
}
}
else
{
Plugin.Log.LogInfo((object)"No modify status actions found");
}
}
private void DisplayExtraStamina(ItemAction[] actions)
{
if (!(((IEnumerable<ItemAction>)actions).FirstOrDefault((Func<ItemAction, bool>)((ItemAction action) => action is Action_GiveExtraStamina)) is Action_GiveExtraStamina))
{
return;
}
Item val = GetCurrentItem();
bool flag = (Object)(object)((val != null) ? ((Component)val).GetComponent<Action_Consume>() : null) != (Object)null;
bool flag2 = (Object)(object)((val != null) ? ((Component)val).GetComponent<Action_ReduceUses>() : null) != (Object)null;
bool flag3 = val != null && (((Component)val).GetComponent<Action_ReduceUses>()?.consumeOnFullyUsed).GetValueOrDefault();
if (!flag && !(flag2 && flag3))
{
Plugin.Log.LogInfo((object)("Skipped extra stamina display for non-consumable item: " + ((val != null) ? ((Object)val).name : null)));
return;
}
Action_GiveExtraStamina val2 = ((val != null) ? ((Component)val).GetComponent<Action_GiveExtraStamina>() : null);
if (val2 != null)
{
float num = val2.amount * 100f;
if (num != 0f)
{
AddItemInfoToPanel(StatusIcon.GetStatusIcon(10), num);
Plugin.Log.LogInfo((object)$"Added extra stamina info: {val2.amount} -> {num}");
}
}
}
private void DisplayRestoreHunger(ItemAction[] actions)
{
ItemAction? obj = ((IEnumerable<ItemAction>)actions).FirstOrDefault((Func<ItemAction, bool>)((ItemAction action) => action is Action_RestoreHunger));
Action_RestoreHunger val = (Action_RestoreHunger)(object)((obj is Action_RestoreHunger) ? obj : null);
if ((Object)(object)val != (Object)null)
{
Plugin.Log.LogInfo((object)"Found restore hunger action");
StatusIcon statusIcon = StatusIcon.GetStatusIcon((STATUSTYPE)1);
Item? obj2 = GetCurrentItem();
Action_RestoreHunger val2 = ((obj2 != null) ? ((Component)obj2).GetComponent<Action_RestoreHunger>() : null);
if ((Object)(object)val2 != (Object)null)
{
float value = val2.restorationAmount * 100f * -1f;
AddItemInfoToPanel(statusIcon, value);
}
}
}
private void DisplayInflictPoison(ItemAction[] actions)
{
ItemAction? obj = ((IEnumerable<ItemAction>)actions).FirstOrDefault((Func<ItemAction, bool>)((ItemAction action) => action is Action_InflictPoison));
Action_InflictPoison val = (Action_InflictPoison)(object)((obj is Action_InflictPoison) ? obj : null);
if (val != null)
{
StatusIcon statusIcon = StatusIcon.GetStatusIcon((STATUSTYPE)3);
float value = val.poisonPerSecond * 100f;
string suffix = ((val.inflictionTime > 0f) ? $"/s {val.inflictionTime:F1}s" : "");
AddItemInfoToPanel(statusIcon, value, suffix);
}
}
private void DisplayApplyAffliction(ItemAction[] actions)
{
IEnumerable<Action_ApplyAffliction> enumerable = actions.OfType<Action_ApplyAffliction>();
if (!enumerable.Any())
{
return;
}
foreach (Action_ApplyAffliction item in enumerable)
{
Action_ApplyMassAffliction val = (Action_ApplyMassAffliction)(object)((item is Action_ApplyMassAffliction) ? item : null);
if (val != null)
{
DisplayMassAffliction(val);
}
else
{
if (item.affliction == null)
{
continue;
}
ProcessAffliction(item.affliction);
Affliction[] extraAfflictions = item.extraAfflictions;
if (extraAfflictions == null || extraAfflictions.Length == 0)
{
continue;
}
foreach (Affliction item2 in item.extraAfflictions.Where((Affliction e) => e != null))
{
ProcessAffliction(item2);
}
}
}
}
private void ProcessAffliction(Affliction affliction)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected I4, but got Unknown
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
Plugin.Log.LogInfo((object)$"Processing Affliction: Type={affliction.GetAfflictionType()}, TotalTime={affliction.totalTime}, TimeElapsed={affliction.timeElapsed}");
AfflictionType afflictionType = affliction.GetAfflictionType();
switch (afflictionType - 1)
{
case 0:
ProcessInfiniteStaminaAffliction(affliction);
break;
case 1:
ProcessFasterBoiAffliction(affliction);
break;
case 6:
ProcessAdjustStatusAffliction(affliction);
break;
case 9:
ProcessAddBonusStaminaAffliction(affliction);
break;
case 10:
ProcessAdjustDrowsyOverTimeAffliction(affliction);
break;
case 12:
ProcessSunscreenAffliction(affliction);
break;
case 4:
ProcessAdjustColdOverTimeAffliction(affliction);
break;
case 5:
ProcessChaosAffliction(affliction);
break;
case 7:
ProcessClearAllStatusAffliction(affliction);
break;
default:
Plugin.Log.LogInfo((object)$"Unhandled affliction type: {afflictionType}");
break;
}
}
private void ProcessInfiniteStaminaAffliction(Affliction affliction)
{
Affliction_InfiniteStamina val = (Affliction_InfiniteStamina)(object)((affliction is Affliction_InfiniteStamina) ? affliction : null);
if (val != null)
{
StatusIcon statusIcon = StatusIcon.GetStatusIcon(10);
if (val.climbDelay > 0f)
{
AddItemInfoToPanel(statusIcon, ((Affliction)val).totalTime + val.climbDelay, "s (run) ∞");
AddItemInfoToPanel(statusIcon, ((Affliction)val).totalTime, "s (climb) ∞");
}
else
{
AddItemInfoToPanel(statusIcon, ((Affliction)val).totalTime, "s ∞");
}
if (val.drowsyAffliction != null)
{
ProcessAffliction(val.drowsyAffliction);
}
}
}
private void ProcessFasterBoiAffliction(Affliction affliction)
{
Affliction_FasterBoi val = (Affliction_FasterBoi)(object)((affliction is Affliction_FasterBoi) ? affliction : null);
if (val != null)
{
StatusIcon statusIcon = StatusIcon.GetStatusIcon(10);
AddItemInfoToPanel(statusIcon, ((Affliction)val).totalTime + val.climbDelay, "s (run)");
AddItemInfoToPanel(statusIcon, ((Affliction)val).totalTime, "s (climb)");
StatusIcon statusIcon2 = StatusIcon.GetStatusIcon((STATUSTYPE)6);
AddItemInfoToPanel(statusIcon2, val.drowsyOnEnd * 100f);
}
}
private void ProcessAdjustStatusAffliction(Affliction affliction)
{
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
Affliction_AdjustStatus adjustStatusAffliction = (Affliction_AdjustStatus)(object)((affliction is Affliction_AdjustStatus) ? affliction : null);
if (adjustStatusAffliction != null)
{
Item val = GetCurrentItem();
Action_ModifyStatus val2 = ((val != null) ? ((IEnumerable<Action_ModifyStatus>)((Component)val).GetComponents<Action_ModifyStatus>()).FirstOrDefault((Func<Action_ModifyStatus, bool>)((Action_ModifyStatus a) => a.statusType == adjustStatusAffliction.statusType)) : null);
if ((Object)(object)val2 != (Object)null)
{
float amount = CalculateStatusAmount(val2.changeAmount, 100f, val2.statusType);
ProcessStatusAdjustment(val2.statusType, amount, "Action");
}
else
{
float amount2 = CalculateStatusAmount(adjustStatusAffliction.statusAmount, 100f, adjustStatusAffliction.statusType);
ProcessStatusAdjustment(adjustStatusAffliction.statusType, amount2, "Affliction");
}
}
}
private void ProcessAddBonusStaminaAffliction(Affliction affliction)
{
Affliction_AddBonusStamina val = (Affliction_AddBonusStamina)(object)((affliction is Affliction_AddBonusStamina) ? affliction : null);
if (val != null)
{
StatusIcon statusIcon = StatusIcon.GetStatusIcon(10);
float value = val.staminaAmount * 100f;
AddItemInfoToPanel(statusIcon, value);
}
}
private void ProcessAdjustDrowsyOverTimeAffliction(Affliction affliction)
{
Affliction_AdjustDrowsyOverTime val = (Affliction_AdjustDrowsyOverTime)(object)((affliction is Affliction_AdjustDrowsyOverTime) ? affliction : null);
if (val != null)
{
StatusIcon statusIcon = StatusIcon.GetStatusIcon((STATUSTYPE)6);
float value = Mathf.Round(Mathf.Abs(val.statusPerSecond) * ((Affliction)val).totalTime * 100f * 0.4f) / 0.4f;
AddItemInfoToPanel(statusIcon, value);
}
}
private void ProcessSunscreenAffliction(Affliction affliction)
{
Affliction_Sunscreen val = (Affliction_Sunscreen)(object)((affliction is Affliction_Sunscreen) ? affliction : null);
if (val != null)
{
AddItemInfoToPanel(StatusIcon.GetStatusIcon((STATUSTYPE)8), ((Affliction)val).totalTime, "s");
}
}
private void ProcessAdjustColdOverTimeAffliction(Affliction affliction)
{
Affliction_AdjustColdOverTime val = (Affliction_AdjustColdOverTime)(object)((affliction is Affliction_AdjustColdOverTime) ? affliction : null);
if (val != null)
{
StatusIcon statusIcon = StatusIcon.GetStatusIcon((STATUSTYPE)2);
float num = Mathf.Round(Mathf.Abs(val.statusPerSecond) * ((Affliction)val).totalTime * 100f);
AddItemInfoToPanel(statusIcon, $"{num} {((Affliction)val).totalTime:F1}s");
}
}
private void ProcessChaosAffliction(Affliction affliction)
{
//IL_0038: 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)
AddItemInfoToPanel(StatusIcon.GetStatusIcon(10), "RANDOM");
STATUSTYPE[] array = new STATUSTYPE[6];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
STATUSTYPE[] array2 = (STATUSTYPE[])(object)array;
STATUSTYPE[] array3 = array2;
foreach (STATUSTYPE statusType in array3)
{
AddItemInfoToPanel(StatusIcon.GetStatusIcon(statusType), "RANDOM");
}
}
private void ProcessClearAllStatusAffliction(Affliction affliction)
{
Affliction_ClearAllStatus val = (Affliction_ClearAllStatus)(object)((affliction is Affliction_ClearAllStatus) ? affliction : null);
if (val != null)
{
ClearAllStatus(val.excludeCurse, GetFilteredStatusTypesForCurrentItem());
}
}
private void CollectAdjustStatusTypes(Item item, HashSet<STATUSTYPE> filteredTypes)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
Affliction_AdjustStatus[] components = ((Component)item).GetComponents<Affliction_AdjustStatus>();
foreach (Affliction_AdjustStatus val in components)
{
filteredTypes.Add(val.statusType);
}
Action_ApplyAffliction[] components2 = ((Component)item).GetComponents<Action_ApplyAffliction>();
foreach (Action_ApplyAffliction val2 in components2)
{
if (val2.affliction != null)
{
CollectAdjustStatusTypesFromAffliction(val2.affliction, filteredTypes);
}
if (val2.extraAfflictions == null)
{
continue;
}
foreach (Affliction item2 in val2.extraAfflictions.Where((Affliction a) => a != null))
{
CollectAdjustStatusTypesFromAffliction(item2, filteredTypes);
}
}
}
private void CollectAdjustStatusTypesFromAffliction(Affliction affliction, HashSet<STATUSTYPE> filteredTypes)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
Affliction_AdjustStatus val = (Affliction_AdjustStatus)(object)((affliction is Affliction_AdjustStatus) ? affliction : null);
if (val != null)
{
filteredTypes.Add(val.statusType);
}
Affliction_InfiniteStamina val2 = (Affliction_InfiniteStamina)(object)((affliction is Affliction_InfiniteStamina) ? affliction : null);
if (val2 != null && val2.drowsyAffliction != null)
{
CollectAdjustStatusTypesFromAffliction(val2.drowsyAffliction, filteredTypes);
}
}
private void DisplayAddOrRemoveThorns(ItemAction[] actions)
{
ItemAction? obj = ((IEnumerable<ItemAction>)actions).FirstOrDefault((Func<ItemAction, bool>)((ItemAction action) => action is Action_AddOrRemoveThorns));
Action_AddOrRemoveThorns val = (Action_AddOrRemoveThorns)(object)((obj is Action_AddOrRemoveThorns) ? obj : null);
if (val != null)
{
AddItemInfoToPanel(StatusIcon.GetStatusIcon((STATUSTYPE)9), (float)val.thornCount * 0.05f * 100f);
}
}
private void DisplayClearAllStatus(ItemAction[] actions)
{
ItemAction? obj = ((IEnumerable<ItemAction>)actions).FirstOrDefault((Func<ItemAction, bool>)((ItemAction action) => action is Action_ClearAllStatus));
Action_ClearAllStatus val = (Action_ClearAllStatus)(object)((obj is Action_ClearAllStatus) ? obj : null);
if (val != null)
{
IEnumerable<Action_ModifyStatus> source = actions.OfType<Action_ModifyStatus>();
ClearAllStatus(val.excludeCurse, CreateFilteredStatusTypesSet(source.ToArray()));
}
}
private HashSet<STATUSTYPE> CreateFilteredStatusTypesSet(Action_ModifyStatus[] modifyStatusActions)
{
return new HashSet<STATUSTYPE>(modifyStatusActions.Select((Action_ModifyStatus a) => a.statusType));
}
private HashSet<STATUSTYPE> GetFilteredStatusTypesForCurrentItem()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
HashSet<STATUSTYPE> hashSet = new HashSet<STATUSTYPE>();
Item val = GetCurrentItem();
if ((Object)(object)val != (Object)null)
{
Action_ModifyStatus[] components = ((Component)val).GetComponents<Action_ModifyStatus>();
foreach (Action_ModifyStatus val2 in components)
{
hashSet.Add(val2.statusType);
}
CollectAdjustStatusTypes(val, hashSet);
}
return hashSet;
}
private void LogActionFound(string actionType, int count = 1)
{
if (count > 1)
{
Plugin.Log.LogInfo((object)$"Found {count} {actionType} actions");
}
else
{
Plugin.Log.LogInfo((object)("Found " + actionType + " action"));
}
}
private void ClearAllStatus(bool excludeCurse, HashSet<STATUSTYPE> filteredStatusTypes)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Invalid comparison between Unknown and I4
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Invalid comparison between Unknown and I4
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
foreach (STATUSTYPE value in Enum.GetValues(typeof(STATUSTYPE)))
{
if ((int)value != 7)
{
if (excludeCurse && (int)value == 5)
{
Plugin.Log.LogInfo((object)"Skipping Curse status type due to excludeCurse = true");
}
else if (!filteredStatusTypes.Contains(value))
{
StatusIcon statusIcon = StatusIcon.GetStatusIcon(value);
AddItemInfoToPanel(statusIcon, -100f);
Plugin.Log.LogInfo((object)$"Added clear effect for {(object)value}: -100f");
}
}
}
}
private void DisplayRaycastDart(ItemAction[] actions)
{
ItemAction? obj = ((IEnumerable<ItemAction>)actions).FirstOrDefault((Func<ItemAction, bool>)((ItemAction action) => action is Action_RaycastDart));
Action_RaycastDart val = (Action_RaycastDart)(object)((obj is Action_RaycastDart) ? obj : null);
if (val == null)
{
return;
}
AddItemInfoToPanel(null, "Hit players will receive:");
Affliction[] afflictionsOnHit = val.afflictionsOnHit;
if (afflictionsOnHit == null || afflictionsOnHit.Length == 0)
{
return;
}
foreach (Affliction item in val.afflictionsOnHit.Where((Affliction a) => a != null))
{
ProcessAffliction(item);
}
}
private void DisplayMoraleBoost(ItemAction[] actions)
{
ItemAction? obj = ((IEnumerable<ItemAction>)actions).FirstOrDefault((Func<ItemAction, bool>)((ItemAction action) => action is Action_MoraleBoost));
Action_MoraleBoost val = (Action_MoraleBoost)(object)((obj is Action_MoraleBoost) ? obj : null);
if (val != null)
{
AddItemInfoToPanel(StatusIcon.GetStatusIcon(10), val.baselineStaminaBoost * 100f);
}
}
private void DisplayDie(ItemAction[] actions)
{
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
if (((IEnumerable<ItemAction>)actions).FirstOrDefault((Func<ItemAction, bool>)((ItemAction action) => action is Action_Die)) is Action_Die)
{
StatusIcon statusIcon = StatusIcon.GetStatusIcon((STATUSTYPE)3);
StatusIcon statusIcon2 = StatusIcon.GetStatusIcon((STATUSTYPE)5);
ItemInfo itemInfo = AddItemInfoToPanel(statusIcon, "DEATH");
itemInfo.SetIconColor(statusIcon2.Color);
itemInfo.SetTextColor(statusIcon2.Color);
}
}
private void DisplayWeight(float weight)
{
StatusIcon statusIcon = StatusIcon.GetStatusIcon((STATUSTYPE)7);
AddItemInfoToPanel(statusIcon, weight);
}
private string GetValueSymbol(float value)
{
if (value != 0f)
{
if (value > 0f)
{
return "▲ ";
}
return "▼ ";
}
return "";
}
private ItemInfo AddItemInfoToPanel(StatusIcon statusIcon, float value, string suffix = "", string prefix = "")
{
string text = ((value == 0f) ? "0" : $"{Mathf.Abs(value):F1}");
string valueSymbol = GetValueSymbol(value);
string text2 = valueSymbol + text;
if (!string.IsNullOrEmpty(prefix) && prefix.Trim() != "")
{
text2 = prefix + text2;
}
if (!string.IsNullOrEmpty(suffix))
{
text2 += suffix;
}
return AddItemInfoToPanelInternal(statusIcon, text2);
}
private ItemInfo AddItemInfoToPanel(StatusIcon statusIcon, string text, string suffix = "", string prefix = "")
{
string text2 = text;
if (!string.IsNullOrEmpty(prefix) && prefix.Trim() != "")
{
text2 = prefix + text2;
}
if (!string.IsNullOrEmpty(suffix))
{
text2 += suffix;
}
return AddItemInfoToPanelInternal(statusIcon, text2);
}
private ItemInfo AddItemInfoToPanelInternal(StatusIcon statusIcon, string displayText)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
ItemInfo itemInfoFromPool = GetItemInfoFromPool();
Color color = statusIcon?.Color ?? Color.white;
itemInfoFromPool.SetInfo(displayText, color);
itemInfoFromPool.SetIcon(statusIcon?.Icon, color);
((Component)itemInfoFromPool).transform.SetParent(((Component)this).transform);
((Component)itemInfoFromPool).transform.localScale = Vector3.one;
RectTransform component = ((Component)itemInfoFromPool).GetComponent<RectTransform>();
if (component != null)
{
component.anchoredPosition = Vector2.zero;
}
((Component)itemInfoFromPool).gameObject.SetActive(true);
activeItemInfos.Add(itemInfoFromPool);
((MonoBehaviour)this).StartCoroutine(DelayedRefresh());
return itemInfoFromPool;
}
[IteratorStateMachine(typeof(<DelayedRefresh>d__46))]
private IEnumerator DelayedRefresh()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DelayedRefresh>d__46(0);
}
private ItemInfo GetItemInfoFromPool()
{
if (itemInfoPool.Count > 0)
{
ItemInfo itemInfo = itemInfoPool.Dequeue();
((Component)itemInfo).gameObject.SetActive(true);
return itemInfo;
}
return CreateItemInfo();
}
private void RecycleAllItemInfos()
{
foreach (ItemInfo activeItemInfo in activeItemInfos)
{
if ((Object)(object)activeItemInfo != (Object)null)
{
((Component)activeItemInfo).gameObject.SetActive(false);
((Component)activeItemInfo).transform.SetParent((Transform)null);
itemInfoPool.Enqueue(activeItemInfo);
}
}
activeItemInfos.Clear();
}
public void Hide()
{
if (isVisible)
{
((Component)this).gameObject.SetActive(false);
isVisible = false;
currentItem = null;
ManualLogSource log = Plugin.Log;
Item? obj = currentItem;
log.LogInfo((object)("Hide " + ((obj != null) ? ((Object)obj).name : null) + " infos"));
}
}
public bool IsVisible()
{
return isVisible;
}
public InventoryItemUI? GetCurrentInventoryItemUI()
{
return null;
}
private Item? GetCurrentItem()
{
Character observedCharacter = Character.observedCharacter;
object obj;
if (observedCharacter == null)
{
obj = null;
}
else
{
CharacterData data = observedCharacter.data;
obj = ((data != null) ? data.currentItem : null);
}
if ((Object)obj != (Object)null)
{
return Character.observedCharacter.data.currentItem;
}
return currentItem;
}
private static ItemInfoPanel CreatePanel()
{
return ItemInfoFactory.CreatePanel();
}
private ItemInfo CreateItemInfo()
{
return ItemInfoFactory.CreateItemInfo();
}
private List<Item>? GetBackpackItems(Item backpack)
{
Backpack val = (Backpack)(object)((backpack is Backpack) ? backpack : null);
if (val == null)
{
Plugin.Log.LogWarning((object)("Item " + ((Object)backpack).name + " is not a Backpack type"));
return null;
}
BackpackData data = ((Item)val).GetData<BackpackData>((DataEntryKey)7);
if (data == null)
{
Plugin.Log.LogWarning((object)("BackpackData not found for backpack: " + ((Object)backpack).name));
return null;
}
List<ItemSlot> list = data.itemSlots.Where((ItemSlot slot) => !slot.IsEmpty()).ToList();
List<Item> list2 = new List<Item>();
List<string> list3 = new List<string>();
foreach (ItemSlot item in list)
{
if ((Object)(object)item.prefab != (Object)null)
{
list2.Add(item.prefab);
list3.Add(((Object)item.prefab).name);
}
}
Plugin.Log.LogInfo((object)string.Format("Found {0} filled slots in backpack: {1} - Items: {2}", list.Count, ((Object)backpack).name, string.Join(", ", list3)));
return list2;
}
private void DisplayMassAffliction(Action_ApplyMassAffliction massAfflictionAction)
{
if ((Object)(object)massAfflictionAction == (Object)null)
{
return;
}
AddItemInfoToPanel(null, massAfflictionAction.radius.ToString(), "m radius player receive (when use):");
if (((Action_ApplyAffliction)massAfflictionAction).affliction != null)
{
ProcessAffliction(((Action_ApplyAffliction)massAfflictionAction).affliction);
}
Affliction[] extraAfflictions = ((Action_ApplyAffliction)massAfflictionAction).extraAfflictions;
if (extraAfflictions == null || extraAfflictions.Length == 0)
{
return;
}
foreach (Affliction item in ((Action_ApplyAffliction)massAfflictionAction).extraAfflictions.Where((Affliction a) => a != null))
{
ProcessAffliction(item);
}
}
private void DisplayBingBongShield(Item item)
{
if ((Object)(object)((item != null) ? ((Component)item).GetComponent<BingBongShieldWhileHolding>() : null) != (Object)null)
{
AddItemInfoToPanel(StatusIcon.GetStatusIcon(11), "Invincible");
}
}
private void DisplayLantern(Item item)
{
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
Lantern val = ((item != null) ? ((Component)item).GetComponent<Lantern>() : null);
if (val == null)
{
return;
}
if (((Object)((Component)item).gameObject).name.Contains("Torch"))
{
Plugin.Log.LogInfo((object)("Skipped lantern display for torch item: " + ((Object)item).name));
return;
}
AddItemInfoToPanel(null, "Nearby players receive (when lit):");
if (((Object)((Component)item).gameObject).name.Contains("Faerie"))
{
Transform obj = ((Component)item).transform.Find("FaerieLantern/Light/Heat");
StatusField val2 = ((obj != null) ? ((Component)obj).GetComponent<StatusField>() : null);
if (!((Object)(object)val2 != (Object)null))
{
return;
}
StatusIcon statusIcon = StatusIcon.GetStatusIcon(val2.statusType);
float num = Mathf.Round(Mathf.Abs(val2.statusAmountPerSecond) * val.startingFuel * 100f);
AddItemInfoToPanel(statusIcon, 0f - num);
if (val2.additionalStatuses == null)
{
return;
}
{
foreach (StatusFieldStatus additionalStatus in val2.additionalStatuses)
{
StatusIcon statusIcon2 = StatusIcon.GetStatusIcon(additionalStatus.statusType);
float num2 = Mathf.Round(Mathf.Abs(additionalStatus.statusAmountPerSecond) * val.startingFuel * 100f);
AddItemInfoToPanel(statusIcon2, 0f - num2);
}
return;
}
}
Transform obj2 = ((Component)item).transform.Find("GasLantern/Light/Heat");
StatusField val3 = ((obj2 != null) ? ((Component)obj2).GetComponent<StatusField>() : null);
if ((Object)(object)val3 != (Object)null)
{
StatusIcon statusIcon3 = StatusIcon.GetStatusIcon(val3.statusType);
float num3 = Mathf.Round(Mathf.Abs(val3.statusAmountPerSecond) * val.startingFuel * 100f);
AddItemInfoToPanel(statusIcon3, 0f - num3);
}
}
public static void Refresh(RectTransform? rectTransform = null)
{
if ((Object)(object)_instance != (Object)null)
{
LayoutRebuilder.ForceRebuildLayoutImmediate((RectTransform)(((object)rectTransform) ?? ((object)/*isinst with value type is only supported in some contexts*/)));
}
}
private void DisplayShelfShroom(Item item)
{
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
ShelfShroom val = ((item != null) ? ((Component)item).GetComponent<ShelfShroom>() : null);
if (val == null)
{
return;
}
GameObject instantiateOnBreak = val.instantiateOnBreak;
if (instantiateOnBreak != null && ((Object)instantiateOnBreak).name.Equals("HealingPuffShroomSpawn"))
{
GameObject gameObject = ((Component)val.instantiateOnBreak.transform.Find("VFX_SporeHealingExplo")).gameObject;
AOE component = gameObject.GetComponent<AOE>();
GameObject gameObject2 = ((Component)gameObject.transform.Find("VFX_SporePoisonExplo")).gameObject;
AOE component2 = gameObject2.GetComponent<AOE>();
AOE[] components = gameObject2.GetComponents<AOE>();
TimeEvent component3 = gameObject2.GetComponent<TimeEvent>();
RemoveAfterSeconds component4 = gameObject2.GetComponent<RemoveAfterSeconds>();
float num = Mathf.Round(component.statusAmount * 0.9f * 40f) / 40f * 100f;
StatusIcon statusIcon = StatusIcon.GetStatusIcon(component.statusType);
Plugin.Log.LogInfo((object)$"healingAOE statusAmount:{component.statusAmount} -> {num}");
AddItemInfoToPanel(statusIcon, num);
if ((Object)(object)component2 != (Object)null && (Object)(object)component3 != (Object)null && (Object)(object)component4 != (Object)null)
{
float num2 = Mathf.Round(component2.statusAmount * (1f / component3.rate) * 40f) / 40f * 100f;
StatusIcon statusIcon2 = StatusIcon.GetStatusIcon(component2.statusType);
Plugin.Log.LogInfo((object)$"poisonAOE statusAmount:{component2.statusAmount} -> {num2}");
AddItemInfoToPanel(statusIcon2, num2, $"/s {component4.seconds:F1}s");
}
if (components.Length > 1)
{
float num3 = Mathf.Round(components[1].statusAmount * (1f / component3.rate) * 40f) / 40f * 100f;
StatusIcon statusIcon3 = StatusIcon.GetStatusIcon(components[1].statusType);
Plugin.Log.LogInfo((object)$"allPoisonAOEs[1] statusAmount:{components[1].statusAmount} -> {num3}");
AddItemInfoToPanel(statusIcon3, num3, $"/s {component4.seconds + 1f:F1}s");
}
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}