Decompiled source of MoreSlots v1.0.3

plugins/com.github.hu1hu.MoreSlots.dll

Decompiled 4 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
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.hu1hu.MoreSlots")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3")]
[assembly: AssemblyProduct("com.github.hu1hu.MoreSlots")]
[assembly: AssemblyTitle("MoreSlots")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.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 MoreSlots
{
	[BepInPlugin("com.github.hu1hu.MoreSlots", "MoreSlots", "1.0.3")]
	public class MoreSlots : BaseUnityPlugin
	{
		private static Harmony? harmony;

		public static ManualLogSource? Log;

		private const string PLUGIN_GUID = "com.github.hu1hu.MoreSlots";

		private const string PLUGIN_NAME = "MoreSlots";

		private const string PLUGIN_VERSION = "1.0.3";

		public static ConfigEntry<int>? slotCountConfig;

		private void Awake()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			slotCountConfig = ((BaseUnityPlugin)this).Config.Bind<int>("General", "SlotCount", 6, "Maximum number of player slots (4~9)");
			slotCountConfig.Value = Mathf.Clamp(slotCountConfig.Value, 4, 9);
			Log = ((BaseUnityPlugin)this).Logger;
			harmony = new Harmony("com.github.hu1hu.MoreSlots");
			harmony.PatchAll();
			Log.LogInfo((object)"Plugin MoreSlots is loaded!");
		}

		private void OnDestroy()
		{
			Harmony? obj = harmony;
			if (obj != null)
			{
				obj.UnpatchSelf();
			}
			ManualLogSource? log = Log;
			if (log != null)
			{
				log.LogInfo((object)"Plugin MoreSlots is unloaded!");
			}
		}
	}
	[HarmonyPatch(typeof(Character))]
	public class CharacterPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void PostfixAwake(Character __instance)
		{
			((Component)__instance).gameObject.AddComponent<HotbarManager>();
		}
	}
	[HarmonyPatch(typeof(Player))]
	public class PlayerPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void PostfixAwake(Player __instance)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			ItemSlot[] itemSlots = __instance.itemSlots;
			int num = itemSlots.Length;
			ItemSlot[] array = itemSlots;
			List<ItemSlot> list = new List<ItemSlot>(array.Length);
			list.AddRange(array);
			List<ItemSlot> list2 = list;
			for (int i = num; i < MoreSlots.slotCountConfig.Value; i++)
			{
				if (i == 3)
				{
					list2.Add(list2[2]);
				}
				else
				{
					list2.Add(new ItemSlot((byte)i));
				}
			}
			__instance.itemSlots = list2.ToArray();
			for (int j = 0; j < __instance.itemSlots.Length; j++)
			{
				ManualLogSource? log = MoreSlots.Log;
				if (log != null)
				{
					log.LogInfo((object)$"Player Awake : Slot {j}: {__instance.itemSlots[j].GetPrefabName()}");
				}
			}
		}
	}
	public class HotbarManager : MonoBehaviour
	{
		public int currentSlot;

		public bool disableMouseWheel = true;

		public Action<int> onSlotChanged;

		private float lastSwitchTime;

		private readonly float switchCooldown = 0.1f;

		private GameObject templateUI;

		private bool isUpdated;

		public void Awake()
		{
			if (!PhotonNetwork.IsMasterClient)
			{
				return;
			}
			foreach (Character allCharacter in Character.AllCharacters)
			{
				((MonoBehaviourPun)allCharacter).photonView.RPC("RPCA_slotCount", (RpcTarget)3, new object[1] { MoreSlots.slotCountConfig.Value });
			}
		}

		private void Start()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			onSlotChanged = (Action<int>)Delegate.Combine(onSlotChanged, (Action<int>)delegate(int slot)
			{
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				ManualLogSource? log = MoreSlots.Log;
				if (log != null)
				{
					log.LogInfo((object)$"Switch to slot {slot}");
				}
				Character.localCharacter.refs.items.EquipSlot(Optionable<byte>.Some((byte)slot));
			});
			GUIManager instance = GUIManager.instance;
			InventoryItemUI[] items = instance.items;
			InventoryItemUI temporaryItem = instance.temporaryItem;
			templateUI = ((Component)items[2]).gameObject;
			RectTransform component = ((Component)((Component)items[0]).transform.parent).GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(component.sizeDelta.x + 300f, component.sizeDelta.y);
			component.sizeDelta = new Vector2(component.sizeDelta.x + (float)(60 * (MoreSlots.slotCountConfig.Value - 4)), component.sizeDelta.y);
			AdjustHotbarUI(MoreSlots.slotCountConfig.Value);
			for (int i = 0; i < ((Transform)component).childCount; i++)
			{
				Transform child = ((Transform)component).GetChild(i);
				if (((Object)child).name.Equals("UI_InventoryItem_Temporary") || ((Object)child).name.Equals("GameObject"))
				{
					child.SetParent(child.parent.parent);
				}
			}
		}

		private void Update()
		{
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown((KeyCode)111) && Character.localCharacter.refs.afflictions.m_inAirport)
			{
				MoreSlots.slotCountConfig.Value = Mathf.Clamp(MoreSlots.slotCountConfig.Value + 1, 4, 9);
				isUpdated = true;
				if (PhotonNetwork.IsMasterClient)
				{
					foreach (Character allCharacter in Character.AllCharacters)
					{
						((MonoBehaviourPun)allCharacter).photonView.RPC("RPCA_slotCount", (RpcTarget)3, new object[1] { MoreSlots.slotCountConfig.Value });
					}
				}
				ManualLogSource? log = MoreSlots.Log;
				if (log != null)
				{
					log.LogInfo((object)$"Increase slot count to {MoreSlots.slotCountConfig.Value}");
				}
			}
			if (Input.GetKeyDown((KeyCode)112) && Character.localCharacter.refs.afflictions.m_inAirport)
			{
				MoreSlots.slotCountConfig.Value = Mathf.Clamp(MoreSlots.slotCountConfig.Value - 1, 4, 9);
				isUpdated = true;
				if (PhotonNetwork.IsMasterClient)
				{
					foreach (Character allCharacter2 in Character.AllCharacters)
					{
						((MonoBehaviourPun)allCharacter2).photonView.RPC("RPCA_slotCount", (RpcTarget)3, new object[1] { MoreSlots.slotCountConfig.Value });
					}
				}
				ManualLogSource? log2 = MoreSlots.Log;
				if (log2 != null)
				{
					log2.LogInfo((object)$"Decrease slot count to {MoreSlots.slotCountConfig.Value}");
				}
			}
			AdjustItemSlots(MoreSlots.slotCountConfig.Value);
			AdjustHotbarUI(MoreSlots.slotCountConfig.Value);
			SetupAllHotbarSlots(MoreSlots.slotCountConfig.Value);
			if (Input.GetKeyDown((KeyCode)127))
			{
				disableMouseWheel = !disableMouseWheel;
			}
			if (!disableMouseWheel)
			{
				HandleMouseWheel();
			}
			HandleNumberKeys();
			GUIManager instance = GUIManager.instance;
			InventoryItemUI[] items = instance.items;
			InventoryItemUI temporaryItem = instance.temporaryItem;
			InventoryItemUI val = items[0];
			Vector3 position = ((Transform)val.rectTransform).position;
			float num = 60f;
			((Transform)temporaryItem.rectTransform).position = new Vector3(position.x - num, position.y - 41f, position.z);
		}

		private void AdjustItemSlots(int desiredCount)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			ItemSlot[] itemSlots = Character.localCharacter.player.itemSlots;
			int num = itemSlots.Length;
			ItemSlot[] array = itemSlots;
			List<ItemSlot> list = new List<ItemSlot>(array.Length);
			list.AddRange(array);
			List<ItemSlot> list2 = list;
			if (num < desiredCount)
			{
				for (int i = num; i < desiredCount; i++)
				{
					if (i == 3)
					{
						list2.Add(list2[2]);
					}
					else
					{
						list2.Add(new ItemSlot((byte)i));
					}
				}
				Character.localCharacter.player.itemSlots = list2.ToArray();
			}
			else if (num > desiredCount)
			{
				list2.RemoveRange(desiredCount, num - desiredCount);
				Character.localCharacter.player.itemSlots = list2.ToArray();
				if (currentSlot > desiredCount)
				{
					SelectSlot(0);
				}
			}
		}

		private void AdjustHotbarUI(int desiredCount)
		{
			GUIManager instance = GUIManager.instance;
			InventoryItemUI[] items = instance.items;
			if (items.Length < desiredCount)
			{
				InventoryItemUI[] array = items;
				List<InventoryItemUI> list = new List<InventoryItemUI>(array.Length);
				list.AddRange(array);
				List<InventoryItemUI> list2 = list;
				for (int i = items.Length; i < desiredCount; i++)
				{
					Transform val = templateUI.transform.parent;
					if (i == 3)
					{
						val = null;
					}
					InventoryItemUI component = Object.Instantiate<GameObject>(templateUI, val).GetComponent<InventoryItemUI>();
					((Object)component).name = $"UI_InventoryItem ({i})";
					list2.Add(component);
				}
				instance.items = list2.ToArray();
			}
			else if (items.Length > desiredCount)
			{
				for (int j = desiredCount; j < items.Length; j++)
				{
					Object.Destroy((Object)(object)((Component)items[j]).gameObject);
				}
				InventoryItemUI[] array = items;
				List<InventoryItemUI> list3 = new List<InventoryItemUI>(array.Length);
				list3.AddRange(array);
				List<InventoryItemUI> list4 = list3;
				list4.RemoveRange(desiredCount, items.Length - desiredCount);
				instance.items = list4.ToArray();
			}
		}

		private void SetupHotbarSlotUI(InventoryItemUI[] hotbarUIs, int slotIndex, TMP_FontAsset font, GUIManager gm)
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Expected O, but got Unknown
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			if (isUpdated)
			{
				ManualLogSource? log = MoreSlots.Log;
				if (log != null)
				{
					log.LogInfo((object)$"HotbarManager: Rearranging slot {slotIndex}");
				}
				Transform val = ((Component)hotbarUIs[slotIndex]).transform.Find("UI_InputIcon");
				if (slotIndex == 3)
				{
					val = ((Component)gm.backpack).transform.Find("UI_InputIcon");
				}
				GameObject val2 = new GameObject("Background", new Type[2]
				{
					typeof(RectTransform),
					typeof(Image)
				});
				val2.transform.SetParent(val, false);
				Image component = val2.GetComponent<Image>();
				Image selectedSlotIcon = hotbarUIs[slotIndex].selectedSlotIcon;
				component.sprite = selectedSlotIcon.sprite;
				((Graphic)component).color = ((Graphic)selectedSlotIcon).color;
				((Graphic)component).material = ((Graphic)selectedSlotIcon).material;
				component.type = selectedSlotIcon.type;
				component.fillMethod = selectedSlotIcon.fillMethod;
				component.fillAmount = selectedSlotIcon.fillAmount;
				component.fillClockwise = selectedSlotIcon.fillClockwise;
				component.fillOrigin = selectedSlotIcon.fillOrigin;
				((Graphic)component).rectTransform.sizeDelta = new Vector2(40f, 40f);
				GameObject val3 = new GameObject("Text", new Type[1] { typeof(RectTransform) });
				val3.transform.SetParent(val2.transform, false);
				TextMeshProUGUI val4 = val3.AddComponent<TextMeshProUGUI>();
				((TMP_Text)val4).text = (slotIndex + 1).ToString();
				((TMP_Text)val4).font = font;
				((Graphic)val4).color = new Color(0.4f, 0.26f, 0.13f, 1f);
				((Behaviour)val4).enabled = true;
				((TMP_Text)val4).alignment = (TextAlignmentOptions)514;
				RectTransform component2 = ((Component)val4).GetComponent<RectTransform>();
				component2.anchorMin = new Vector2(0.1f, 0.2f);
				component2.anchorMax = new Vector2(0.9f, 1f);
				component2.pivot = new Vector2(0.5f, 0.5f);
				component2.anchoredPosition = Vector2.zero;
				component2.sizeDelta = Vector2.zero;
				((Transform)component2).localScale = Vector3.one;
				((TMP_Text)val4).enableAutoSizing = true;
				((TMP_Text)val4).fontSizeMin = 8f;
				((TMP_Text)val4).fontSizeMax = 40f;
				((TMP_Text)val4).alignment = (TextAlignmentOptions)544;
				((TMP_Text)val4).margin = Vector4.zero;
			}
		}

		private void SetupAllHotbarSlots(int desiredCount)
		{
			GUIManager instance = GUIManager.instance;
			InventoryItemUI[] items = instance.items;
			GameObject val = GameObject.Find("GAME/GUIManager");
			GUIManager component = val.GetComponent<GUIManager>();
			TMP_FontAsset font = ((TMP_Text)component.heroDayText).font;
			for (int i = 0; i < desiredCount; i++)
			{
				SetupHotbarSlotUI(items, i, font, instance);
			}
			isUpdated = false;
		}

		private void HandleMouseWheel()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (!(Time.time - lastSwitchTime < switchCooldown))
			{
				float y = Input.mouseScrollDelta.y;
				if (y > 0f)
				{
					NextSlot();
					lastSwitchTime = Time.time;
				}
				else if (y < 0f)
				{
					PreviousSlot();
					lastSwitchTime = Time.time;
				}
			}
		}

		private void HandleNumberKeys()
		{
			int num = 4;
			while (true)
			{
				int num2 = num;
				ConfigEntry<int>? slotCountConfig = MoreSlots.slotCountConfig;
				if (!(num2 < ((slotCountConfig != null) ? new int?(slotCountConfig.Value + 1) : null)))
				{
					break;
				}
				if (Input.GetKeyDown((KeyCode)(49 + num)))
				{
					SelectSlot(num);
				}
				num++;
			}
			if (Input.GetKeyDown((KeyCode)48))
			{
				SelectSlot(250);
			}
		}

		public void NextSlot()
		{
			currentSlot = (currentSlot + 1) % (MoreSlots.slotCountConfig.Value + 1);
			onSlotChanged?.Invoke(currentSlot);
		}

		public void PreviousSlot()
		{
			currentSlot--;
			if (currentSlot < 0)
			{
				currentSlot = MoreSlots.slotCountConfig.Value;
			}
			onSlotChanged?.Invoke(currentSlot);
		}

		public void SelectSlot(int slot)
		{
			if (slot >= 0 && slot <= MoreSlots.slotCountConfig.Value)
			{
				currentSlot = slot;
				onSlotChanged?.Invoke(currentSlot);
			}
		}

		[PunRPC]
		public void RPCA_slotCount(int count)
		{
			MoreSlots.slotCountConfig.Value = Mathf.Clamp(count, 4, 9);
			isUpdated = true;
		}
	}
	[HarmonyPatch(typeof(CharacterItems))]
	public class CharacterItemsPatch
	{
		[HarmonyPatch("DropAllItems")]
		[HarmonyPrefix]
		public static void PrefixDropAllItems(CharacterItems __instance, bool includeBackpack)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)Character.localCharacter).transform;
			Vector3 forward = transform.forward;
			Vector3 val = transform.position + forward * 0.5f + Vector3.up * 0.5f;
			for (byte b = 4; b < MoreSlots.slotCountConfig.Value; b++)
			{
				__instance.photonView.RPC("DropItemFromSlotRPC", (RpcTarget)0, new object[2] { b, val });
			}
		}
	}
	[HarmonyPatch(typeof(CharacterAfflictions))]
	public class CharacterAfflictionsPatch
	{
		[HarmonyPatch("UpdateWeight")]
		[HarmonyPrefix]
		private static bool UpdateWeight(CharacterAfflictions __instance)
		{
			int num = 0;
			int num2 = 0;
			float currentStatus = __instance.GetCurrentStatus((STATUSTYPE)9);
			for (int i = 0; i < __instance.character.player.itemSlots.Length; i++)
			{
				if (i != 3)
				{
					ItemSlot val = __instance.character.player.itemSlots[i];
					if ((Object)(object)val.prefab != (Object)null)
					{
						num += val.prefab.CarryWeight;
					}
				}
			}
			BackpackSlot backpackSlot = __instance.character.player.backpackSlot;
			BackpackData val2 = default(BackpackData);
			if (!((ItemSlot)backpackSlot).IsEmpty() && ((ItemSlot)backpackSlot).data.TryGetDataEntry<BackpackData>((DataEntryKey)7, ref val2))
			{
				for (int j = 0; j < val2.itemSlots.Length; j++)
				{
					ItemSlot val3 = val2.itemSlots[j];
					if (!val3.IsEmpty())
					{
						num += val3.prefab.CarryWeight;
					}
				}
			}
			ItemSlot itemSlot = __instance.character.player.GetItemSlot((byte)250);
			if (!itemSlot.IsEmpty())
			{
				num += itemSlot.prefab.CarryWeight;
			}
			if ((Object)(object)__instance.character.data.carriedPlayer != (Object)null)
			{
				num += 8;
			}
			foreach (StickyItemComponent aLL_STUCK_ITEM in StickyItemComponent.ALL_STUCK_ITEMS)
			{
				if ((Object)(object)aLL_STUCK_ITEM.stuckToCharacter == (Object)(object)__instance.character)
				{
					num += aLL_STUCK_ITEM.addWeightToStuckPlayer;
					num2 += aLL_STUCK_ITEM.addThornsToStuckPlayer;
				}
			}
			if (Object.op_Implicit((Object)(object)__instance.character.data.currentStickyItem))
			{
				num2 += __instance.character.data.currentStickyItem.addThornsToStuckPlayer;
			}
			num2 += __instance.GetTotalThornStatusIncrements();
			float num3 = 0.025f * (float)num2;
			if (num3 > currentStatus)
			{
				__instance.StatusSFX((STATUSTYPE)9, num3 - currentStatus);
				if (__instance.character.IsLocal && (Object)(object)__instance.character == (Object)(object)Character.observedCharacter)
				{
					GUIManager.instance.AddStatusFX((STATUSTYPE)9, num3 - currentStatus);
				}
				__instance.PlayParticle((STATUSTYPE)9);
			}
			__instance.SetStatus((STATUSTYPE)7, 0.025f * (float)num);
			__instance.SetStatus((STATUSTYPE)9, 0.025f * (float)num2);
			return false;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}