Decompiled source of SillyItems v0.5.0

SillyItems.dll

Decompiled 7 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using TMPro;
using UnityEngine;
using UnityEngine.Serialization;
using Zorro.Core;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SillyItems")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SillyItems")]
[assembly: AssemblyTitle("SillyItems")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
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;
		}
	}
}
public class BananaPeel : ItemInstanceBehaviour
{
	private OnOffEntry onOffEntry;

	private StashAbleEntry stashAbleEntry;

	public SFX_Instance sfx;

	public float flipStrength = 10f;

	public float ragdollTime = 5f;

	private bool on;

	private bool hitSomething;

	private Player player;

	private float counter = 1f;

	public bool IsHeld => base.isHeld;

	public bool IsActive => onOffEntry.on;

	private void Update()
	{
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0237: Unknown result type (might be due to invalid IL or missing references)
		//IL_023c: Unknown result type (might be due to invalid IL or missing references)
		counter += Time.deltaTime;
		if (counter > 2f && hitSomething)
		{
			counter = 0f;
			hitSomething = false;
			onOffEntry.on = !onOffEntry.on;
			((ItemDataEntry)onOffEntry).SetDirty();
		}
		if (onOffEntry == null || on == onOffEntry.on)
		{
			return;
		}
		try
		{
			if ((Object)(object)((Component)this).GetComponent<Rigidbody>() != (Object)null)
			{
				sfx.Play(((Component)this).transform.position, false, 1f, (Transform)null);
				((Component)this).GetComponent<Rigidbody>().AddForce(RandomUpwardDirection() * 5000f);
				player.CallTakeDamageAndAddForceAndFall(0f, Vector3.up * 1.5f, ragdollTime);
				if (player.refs.ragdoll.GetBodyPartID((BodypartType)4) != -1)
				{
					player.CallAddForceToBodyParts(new int[1] { player.refs.ragdoll.GetBodyPartID((BodypartType)4) }, (Vector3[])(object)new Vector3[1] { Vector3.down * flipStrength });
				}
				if (player.refs.ragdoll.GetBodyPartID((BodypartType)13) != -1)
				{
					player.CallAddForceToBodyParts(new int[1] { player.refs.ragdoll.GetBodyPartID((BodypartType)13) }, (Vector3[])(object)new Vector3[1] { Vector3.up * 50f });
				}
				if (player.refs.ragdoll.GetBodyPartID((BodypartType)16) != -1)
				{
					player.CallAddForceToBodyParts(new int[1] { player.refs.ragdoll.GetBodyPartID((BodypartType)16) }, (Vector3[])(object)new Vector3[1] { Vector3.up * 50f });
				}
			}
		}
		catch
		{
			Debug.Log((object)"Failed to add force for some reason.");
		}
		on = onOffEntry.on;
	}

	private void OnTriggerEnter(Collider other)
	{
		if (!base.isHeldByMe && !hitSomething && (Object)(object)((Component)other).GetComponentInParent<Player>() != (Object)null)
		{
			player = ((Component)other).GetComponentInParent<Player>();
			hitSomething = true;
		}
	}

	private void OnTriggerExit(Collider other)
	{
		hitSomething = false;
	}

	public override void ConfigItem(ItemInstanceData data, PhotonView playerView)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		if (!data.TryGetEntry<OnOffEntry>(ref onOffEntry))
		{
			onOffEntry = new OnOffEntry
			{
				on = false
			};
			data.AddDataEntry((ItemDataEntry)(object)onOffEntry);
		}
		else
		{
			on = onOffEntry.on;
		}
	}

	private Vector3 RandomUpwardDirection()
	{
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: 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)
		float num = Random.Range(0f, MathF.PI);
		float num2 = Random.Range(0f, MathF.PI * 2f);
		float num3 = Mathf.Sin(num);
		Vector3 result = default(Vector3);
		((Vector3)(ref result))..ctor(num3 * Mathf.Cos(num2), Mathf.Cos(num), num3 * Mathf.Sin(num2));
		return result;
	}
}
public class ClownHorn : ItemInstanceBehaviour
{
	private OnOffEntry onOffEntry;

	private StashAbleEntry stashAbleEntry;

	public SFX_Instance sfx;

	private bool on;

	private float counter = 1f;

	public bool IsHeld => base.isHeld;

	public bool IsActive => onOffEntry.on;

	private void Update()
	{
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		counter += Time.deltaTime;
		if (counter > 0.25f && base.isHeldByMe && !Player.localPlayer.HasLockedInput() && GlobalInputHandler.CanTakeInput() && Player.localPlayer.input.clickWasPressed)
		{
			counter = 0f;
			onOffEntry.on = !onOffEntry.on;
			((ItemDataEntry)onOffEntry).SetDirty();
		}
		if (onOffEntry != null && on != onOffEntry.on)
		{
			sfx.Play(((Component)this).transform.position, false, 1f, (Transform)null);
			on = onOffEntry.on;
		}
	}

	public override void ConfigItem(ItemInstanceData data, PhotonView playerView)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		if (!data.TryGetEntry<OnOffEntry>(ref onOffEntry))
		{
			onOffEntry = new OnOffEntry
			{
				on = false
			};
			data.AddDataEntry((ItemDataEntry)(object)onOffEntry);
		}
		else
		{
			on = onOffEntry.on;
		}
	}
}
public class Magic8Ball : ItemInstanceBehaviour
{
	private OnOffEntry onOffEntry;

	private StashAbleEntry stashAbleEntry;

	private IntRangeEntry intRangeEntry;

	private int textInt = -1;

	public SFX_Instance sfx;

	public TextMeshPro currentText = null;

	private List<TextMeshPro> allTexts = new List<TextMeshPro>();

	public List<TextMeshPro> textsGood = new List<TextMeshPro>();

	public List<TextMeshPro> textsNeutral = new List<TextMeshPro>();

	public List<TextMeshPro> textsBad = new List<TextMeshPro>();

	public List<TextMeshPro> textsFunny = new List<TextMeshPro>();

	private bool on;

	private float counter = 1f;

	public bool IsHeld => base.isHeld;

	public bool IsActive => onOffEntry.on;

	private void Awake()
	{
		allTexts.AddRange(textsGood);
		allTexts.AddRange(textsNeutral);
		allTexts.AddRange(textsBad);
		allTexts.AddRange(textsFunny);
	}

	private void Update()
	{
		//IL_0282: Unknown result type (might be due to invalid IL or missing references)
		//IL_024e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0258: Unknown result type (might be due to invalid IL or missing references)
		counter += Time.deltaTime;
		if (counter > 0.25f && base.isHeldByMe && !Player.localPlayer.HasLockedInput() && GlobalInputHandler.CanTakeInput() && Player.localPlayer.input.clickWasPressed)
		{
			counter = 0f;
			onOffEntry.on = !onOffEntry.on;
			((ItemDataEntry)onOffEntry).SetDirty();
		}
		if (textInt != -1 && (Object)(object)currentText != (Object)(object)allTexts[textInt])
		{
			((Component)currentText).gameObject.SetActive(false);
			currentText = allTexts[textInt];
			((Component)currentText).gameObject.SetActive(true);
		}
		if (onOffEntry == null || on == onOffEntry.on)
		{
			return;
		}
		((Component)currentText).gameObject.SetActive(false);
		List<TextMeshPro> list = null;
		float value = Random.value;
		if (value < 1f / 6f)
		{
			list = textsFunny;
		}
		else
		{
			value = (value - 1f / 6f) * 1.5f;
			list = ((value < 1f / 3f) ? textsGood : ((!(value < 2f / 3f)) ? textsBad : textsNeutral));
		}
		if (list != null && list.Count > 0)
		{
			int index = Random.Range(0, list.Count);
			TextMeshPro val = list[index];
			while ((Object)(object)currentText == (Object)(object)val)
			{
				index = Random.Range(0, list.Count);
				val = list[index];
			}
			currentText = list[index];
			((Component)currentText).gameObject.SetActive(true);
		}
		Rigidbody component = ((Component)this).GetComponent<Rigidbody>();
		if ((Object)(object)component != (Object)null)
		{
			for (int i = 0; i < 3; i++)
			{
				component.AddForce(Random.insideUnitSphere * 3000f);
			}
		}
		sfx.Play(((Component)this).transform.position, false, 1f, (Transform)null);
		intRangeEntry.selectedValue = allTexts.IndexOf(currentText);
		textInt = intRangeEntry.selectedValue;
		on = onOffEntry.on;
	}

	public override void ConfigItem(ItemInstanceData data, PhotonView playerView)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: 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_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Expected O, but got Unknown
		//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)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Expected O, but got Unknown
		State state = Random.state;
		Random.InitState(GameAPI.seed);
		Random.state = state;
		if (!data.TryGetEntry<OnOffEntry>(ref onOffEntry))
		{
			onOffEntry = new OnOffEntry
			{
				on = false
			};
			data.AddDataEntry((ItemDataEntry)(object)onOffEntry);
		}
		else
		{
			on = onOffEntry.on;
		}
		if (!data.TryGetEntry<IntRangeEntry>(ref intRangeEntry))
		{
			intRangeEntry = new IntRangeEntry
			{
				selectedValue = -1,
				maxValue = allTexts.Count
			};
			data.AddDataEntry((ItemDataEntry)(object)intRangeEntry);
		}
		else
		{
			textInt = intRangeEntry.selectedValue;
		}
	}
}
public class MagicHat : ItemInstanceBehaviour
{
	private OnOffEntry onOffEntry;

	private StashAbleEntry stashAbleEntry;

	public SFX_Instance sfx;

	public List<string> itemNames = new List<string>();

	public List<string> excludeSpawns = new List<string>();

	public List<string> specialSpawns = new List<string>();

	public Transform particlePos;

	[FormerlySerializedAs("explodedGoopPref")]
	public GameObject confetti;

	private bool on;

	private float counter = 1f;

	public bool IsHeld => base.isHeld;

	public bool IsActive => onOffEntry.on;

	private void Update()
	{
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		counter += Time.deltaTime;
		if (counter > 0.25f && base.isHeldByMe && !Player.localPlayer.HasLockedInput() && GlobalInputHandler.CanTakeInput() && Player.localPlayer.input.clickWasPressed)
		{
			counter = 0f;
			onOffEntry.on = !onOffEntry.on;
			((ItemDataEntry)onOffEntry).SetDirty();
		}
		if (onOffEntry == null || on == onOffEntry.on)
		{
			return;
		}
		sfx.Play(((Component)this).transform.position, false, 1f, (Transform)null);
		Object.Instantiate<GameObject>(confetti, particlePos.position, particlePos.rotation);
		((Component)this).gameObject.SetActive(false);
		Item val = null;
		float value = Random.value;
		bool flag = false;
		if (value > 1f / 3f)
		{
			Item[] array = ((DatabaseAsset<ItemDatabase, Item>)(object)SingletonAsset<ItemDatabase>.Instance).Objects.Where((Item item) => !excludeSpawns.Contains(item.persistentID)).ToArray();
			Debug.Log((object)array.Length);
			val = GetRandomItem(array);
		}
		else
		{
			Item val2 = default(Item);
			ItemDatabase.TryGetItemFromPersistentID(new Guid(GetRandomItem(specialSpawns.ToArray())), ref val2);
			flag = true;
			val = val2;
		}
		if (flag)
		{
			flag = false;
			for (int i = 0; i < 3; i++)
			{
				CallForSpawn(val);
			}
		}
		else
		{
			CallForSpawn(val);
		}
		Player componentInParent = ((Component)this).GetComponentInParent<Player>();
		if ((Object)(object)componentInParent != (Object)null)
		{
			PlayerInventory val3 = default(PlayerInventory);
			InventorySlot val4 = default(InventorySlot);
			if (!componentInParent.TryGetInventory(ref val3))
			{
				Debug.LogError((object)"No inventory found");
			}
			else if (!val3.TryGetSlot(componentInParent.data.selectedItemSlot, ref val4))
			{
				Debug.LogError((object)$"Slot not found with index: {componentInParent.data.selectedItemSlot}");
			}
			else
			{
				val4.ClearLocal();
			}
		}
		else
		{
			MonoFunctions.instance.PhotonDestroy(((Component)((Component)this).transform.root).gameObject, 2f);
		}
		on = onOffEntry.on;
	}

	public static T GetRandomItem<T>(T[] items)
	{
		if (items == null || items.Length == 0)
		{
			throw new ArgumentException("The items array must not be null or empty.", "items");
		}
		int num = Random.Range(0, items.Length);
		return items[num];
	}

	public void CallForSpawn(Item itemToSpawn)
	{
		//IL_0017: 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_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: 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_0045: Expected O, but got Unknown
		if (base.isHeldByMe)
		{
			Player.localPlayer.RequestCreatePickup(itemToSpawn, new ItemInstanceData(Guid.NewGuid()), ((Component)this).transform.position + Vector3.up * 0.75f, Quaternion.identity);
		}
	}

	public override void ConfigItem(ItemInstanceData data, PhotonView playerView)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: 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_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Expected O, but got Unknown
		State state = Random.state;
		Random.InitState(GameAPI.seed);
		Random.state = state;
		if (!data.TryGetEntry<OnOffEntry>(ref onOffEntry))
		{
			onOffEntry = new OnOffEntry
			{
				on = false
			};
			data.AddDataEntry((ItemDataEntry)(object)onOffEntry);
		}
		else
		{
			on = onOffEntry.on;
		}
	}
}
public class RubberDucky : ItemInstanceBehaviour
{
	private OnOffEntry onOffEntry;

	private StashAbleEntry stashAbleEntry;

	public SFX_Instance sfx;

	private bool on;

	private float counter = 1f;

	public bool IsHeld => base.isHeld;

	public bool IsActive => onOffEntry.on;

	private void Update()
	{
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		counter += Time.deltaTime;
		if (counter > 0.25f && base.isHeldByMe && !Player.localPlayer.HasLockedInput() && GlobalInputHandler.CanTakeInput() && Player.localPlayer.input.clickWasPressed)
		{
			counter = 0f;
			onOffEntry.on = !onOffEntry.on;
			((ItemDataEntry)onOffEntry).SetDirty();
		}
		if (onOffEntry != null && on != onOffEntry.on)
		{
			sfx.Play(((Component)this).transform.position, false, 1f, (Transform)null);
			on = onOffEntry.on;
		}
	}

	public override void ConfigItem(ItemInstanceData data, PhotonView playerView)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		if (!data.TryGetEntry<OnOffEntry>(ref onOffEntry))
		{
			onOffEntry = new OnOffEntry
			{
				on = false
			};
			data.AddDataEntry((ItemDataEntry)(object)onOffEntry);
		}
		else
		{
			on = onOffEntry.on;
		}
	}
}
public class Woops : ItemInstanceBehaviour
{
	private OnOffEntry onOffEntry;

	private StashAbleEntry stashAbleEntry;

	public SFX_Instance sfx;

	private bool on;

	private bool hitSomething;

	private float counter = 1f;

	public bool IsHeld => base.isHeld;

	public bool IsActive => onOffEntry.on;

	private void Update()
	{
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		counter += Time.deltaTime;
		if (counter > 0.25f && base.isHeldByMe && !Player.localPlayer.HasLockedInput() && GlobalInputHandler.CanTakeInput())
		{
			if (Player.localPlayer.input.clickWasPressed)
			{
				counter = 0f;
				onOffEntry.on = !onOffEntry.on;
				((ItemDataEntry)onOffEntry).SetDirty();
			}
		}
		else if (counter > 3f && hitSomething)
		{
			counter = 0f;
			hitSomething = false;
			onOffEntry.on = !onOffEntry.on;
			((ItemDataEntry)onOffEntry).SetDirty();
		}
		if (onOffEntry != null && on != onOffEntry.on)
		{
			sfx.Play(((Component)this).transform.position, false, 1f, (Transform)null);
			on = onOffEntry.on;
		}
	}

	private void OnTriggerEnter(Collider other)
	{
		if (!base.isHeldByMe && !hitSomething && (Object)(object)((Component)other).GetComponentInParent<Player>() != (Object)null)
		{
			hitSomething = true;
		}
	}

	private void OnTriggerExit(Collider other)
	{
		hitSomething = false;
	}

	public override void ConfigItem(ItemInstanceData data, PhotonView playerView)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		if (!data.TryGetEntry<OnOffEntry>(ref onOffEntry))
		{
			onOffEntry = new OnOffEntry
			{
				on = false
			};
			data.AddDataEntry((ItemDataEntry)(object)onOffEntry);
		}
		else
		{
			on = onOffEntry.on;
		}
	}
}
namespace SillyItems
{
	[BepInPlugin("arargd.bepinex.sillyitems", "sillyitems", "0.5.0")]
	public class Main : BaseUnityPlugin
	{
		public void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("arargdsillyitems");
			val.PatchAll();
		}
	}
	[HarmonyPatch(typeof(GameHandler), "Start")]
	public class LoadLater
	{
		private static void Postfix()
		{
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "sillyitems");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			List<Item> list = val.LoadAllAssets<Item>().ToList();
			ItemDatabase instance = SingletonAsset<ItemDatabase>.Instance;
			List<Item> list2 = ((DatabaseAsset<ItemDatabase, Item>)(object)instance).Objects.ToList();
			List<string> list3 = instance.lastLoadedPersistentIDs.ToList();
			MeshRenderer? obj2 = list2.SelectMany((Item obj) => obj.itemObject.GetComponentsInChildren<MeshRenderer>()).FirstOrDefault((Func<MeshRenderer, bool>)delegate(MeshRenderer meshRenderer)
			{
				Shader shader2 = ((Renderer)meshRenderer).sharedMaterial.shader;
				return ((shader2 != null) ? ((Object)shader2).name : null) == "World";
			});
			Shader shader = ((obj2 != null) ? ((Renderer)obj2).sharedMaterial.shader : null);
			int num = list2.Count;
			foreach (Item item in list)
			{
				MeshRenderer[] componentsInChildren = item.itemObject.GetComponentsInChildren<MeshRenderer>();
				MeshRenderer[] array = componentsInChildren;
				foreach (MeshRenderer val2 in array)
				{
					Material[] sharedMaterials = ((Renderer)val2).sharedMaterials;
					foreach (Material val3 in sharedMaterials)
					{
						if (((Object)val3.shader).name == "World")
						{
							val3.shader = shader;
						}
					}
				}
				if (num > 256)
				{
					Debug.LogError((object)"Maximum Item limit hit (256), Giving up on adding anymore Silly items! Thanks for the byte Landfall Devs!");
					break;
				}
				item.id = (byte)num;
				num++;
				list2.Add(item);
				list3.Add(item.persistentID);
			}
			((DatabaseAsset<ItemDatabase, Item>)(object)instance).Objects = list2.ToArray();
			instance.lastLoadedItems = list2;
			instance.lastLoadedPersistentIDs = list3;
			Debug.Log((object)"Loaded Silly Items, I Hope!");
		}
	}
}