Decompiled source of Blue Items v1.3.2

BluePlugin.dll

Decompiled a day ago
using System;
using System.Collections;
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 GameNetcodeStuff;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Rendering;

[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("BluePlugin")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Blue Plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+675943fd6fd411450cd7a1b6cd907a1c18505247")]
[assembly: AssemblyProduct("BluePlugin")]
[assembly: AssemblyTitle("BluePlugin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class EMF : GrabbableObject
{
	[Space(15f)]
	public AudioSource emfAudio;

	public AudioClip[] emfLevelClips;

	public AudioClip outOfBatteriesClip;

	private const float defaultTimeUpdate = 1f;

	private float timeCounter;

	private int currentLevel;

	private static readonly float[] LevelDistanceDict = new float[6] { 0f, 0f, 20f, 15f, 10f, 5f };

	public MeshRenderer emfPrefab;

	private PlayerControllerB previousPlayerHeldBy;

	public override void Start()
	{
		((GrabbableObject)this).Start();
	}

	public void lightled(int num, bool on)
	{
		((Behaviour)((Component)((Component)this).gameObject.transform.Find("lightled" + num)).GetComponent<Light>()).enabled = on;
	}

	public override void ItemActivate(bool used, bool buttonDown = true)
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		SwitchEmf(used);
		emfAudio.PlayOneShot(emfLevelClips[Random.Range(0, 2)]);
		RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 7f, 0.4f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
	}

	public override void UseUpBatteries()
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		((GrabbableObject)this).UseUpBatteries();
		SwitchEmf(on: false);
		emfAudio.PlayOneShot(outOfBatteriesClip, 1f);
		RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 13f, 0.65f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
	}

	public override void PocketItem()
	{
		if (!((NetworkBehaviour)this).IsOwner)
		{
			((GrabbableObject)this).PocketItem();
			return;
		}
		if ((Object)(object)previousPlayerHeldBy != (Object)null)
		{
			if (!base.isBeingUsed || (!((Object)(object)previousPlayerHeldBy.ItemSlots[previousPlayerHeldBy.currentItemSlot] == (Object)null) && previousPlayerHeldBy.ItemSlots[previousPlayerHeldBy.currentItemSlot].itemProperties.itemId == 1 && previousPlayerHeldBy.ItemSlots[previousPlayerHeldBy.currentItemSlot].itemProperties.itemId == 6))
			{
				base.isBeingUsed = false;
				SwitchEmf(on: false);
			}
		}
		else
		{
			Debug.Log((object)"Could not find what player was holding this EMF item");
		}
		((GrabbableObject)this).PocketItem();
	}

	public override void EquipItem()
	{
		previousPlayerHeldBy = base.playerHeldBy;
		if (base.isBeingUsed)
		{
			SwitchEmf(on: true);
		}
		((GrabbableObject)this).EquipItem();
	}

	public void SwitchEmf(bool on)
	{
		base.isBeingUsed = on;
		SetEmfLevel(on ? 1 : 0);
	}

	public override void Update()
	{
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		((GrabbableObject)this).Update();
		int num = 0;
		if (num < 2)
		{
			_ = 1;
		}
		if (base.isBeingUsed)
		{
			int num2 = 1;
			foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
			{
				if (((Component)spawnedEnemy).transform != null && !spawnedEnemy.isEnemyDead)
				{
					float num3 = Vector3.Distance(((Component)spawnedEnemy).transform.position, ((Component)this).gameObject.transform.position);
					int num4 = 1;
					if (num3 <= LevelDistanceDict[5])
					{
						num4 = 5;
					}
					else if (num3 <= LevelDistanceDict[4])
					{
						num4 = 4;
					}
					else if (num3 <= LevelDistanceDict[3])
					{
						num4 = 3;
					}
					else if (num3 <= LevelDistanceDict[2])
					{
						num4 = 2;
					}
					if (num4 > num2)
					{
						num2 = num4;
					}
				}
			}
			SetEmfLevel(num2);
		}
		else
		{
			currentLevel = 1;
			timeCounter = 1f;
		}
	}

	private void SetEmfLevel(int level)
	{
		for (int i = 1; i < 6; i++)
		{
			lightled(i, level >= i);
		}
		if (level != currentLevel && level > 1)
		{
			emfAudio.Stop();
			emfAudio.loop = true;
			emfAudio.clip = emfLevelClips[level];
			emfAudio.Play();
		}
		else if (level <= 1)
		{
			emfAudio.Stop();
		}
		currentLevel = level;
	}

	public static EMF setupScript(Item item)
	{
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Expected O, but got Unknown
		EMF eMF = item.spawnPrefab.AddComponent<EMF>();
		FlashlightItem component = item.spawnPrefab.GetComponent<FlashlightItem>();
		((GrabbableObject)eMF).grabbable = ((GrabbableObject)component).grabbable;
		((GrabbableObject)eMF).itemProperties = item;
		eMF.outOfBatteriesClip = component.outOfBatteriesClip;
		eMF.emfAudio = component.flashlightAudio;
		eMF.emfPrefab = component.flashlightMesh;
		((GrabbableObject)eMF).grabbableToEnemies = ((GrabbableObject)component).grabbableToEnemies;
		if (((GrabbableObject)component).insertedBattery != null)
		{
			((GrabbableObject)eMF).insertedBattery = new Battery(((GrabbableObject)component).insertedBattery.empty, ((GrabbableObject)component).insertedBattery.charge);
		}
		eMF.emfLevelClips = (AudioClip[])(object)new AudioClip[component.flashlightClips.Length];
		component.flashlightClips.CopyTo(eMF.emfLevelClips, 0);
		Object.Destroy((Object)(object)component);
		return eMF;
	}
}
public class NoiseOnSpotItem : GrabbableObject
{
	public AudioSource noiseAudio;

	public AudioSource noiseAudioFar;

	[Space(3f)]
	public AudioClip[] noiseSFX;

	public AudioClip[] noiseSFXFar;

	[Space(3f)]
	public float noiseRange;

	public float maxLoudness;

	public float minLoudness;

	public float minPitch;

	public float maxPitch;

	private Random noisemakerRandom;

	public Animator triggerAnimator;

	private const float defaultTimeUpdate = 60f;

	private float timeCounter = 60f;

	private bool ready;

	private int soundChance = 5;

	public override void Start()
	{
		((GrabbableObject)this).Start();
		noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
	}

	public override void Update()
	{
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0182: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_018a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
		((GrabbableObject)this).Update();
		if (noiseSFX.Length == 0)
		{
			return;
		}
		if (!ready)
		{
			if (timeCounter >= 0f)
			{
				timeCounter -= Time.deltaTime;
			}
			else
			{
				timeCounter = 60f;
				ready = true;
			}
		}
		if (!ready || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)
		{
			return;
		}
		Transform transform = ((Component)GameNetworkManager.Instance.localPlayerController).transform;
		Transform transform2 = ((Component)this).transform;
		LayerMask val = LayerMask.op_Implicit(~((1 << LayerMask.NameToLayer("TransparentFX")) | (1 << LayerMask.NameToLayer("Ignore Raycast")) | (1 << LayerMask.NameToLayer("Player")) | (1 << LayerMask.NameToLayer("HelmetVisor")) | (1 << LayerMask.NameToLayer("Colliders")) | (1 << LayerMask.NameToLayer("Props")) | (1 << LayerMask.NameToLayer("ScanNode")) | (1 << LayerMask.NameToLayer("Triggers")) | (1 << LayerMask.NameToLayer("NavigationSurface")) | (1 << LayerMask.NameToLayer("LineOfSight")) | (1 << LayerMask.NameToLayer("PlayerRagdoll")) | (1 << LayerMask.NameToLayer("DecalStickableSurface")) | (1 << LayerMask.NameToLayer("PlaceableShipObjects")) | (1 << LayerMask.NameToLayer("PlaceableShipObjects"))));
		Vector3 val2 = transform.position - transform2.position;
		Vector3 normalized = ((Vector3)(ref val2)).normalized;
		float num = Vector3.Distance(transform2.position, transform.position);
		_ = 15f;
		RaycastHit val3 = default(RaycastHit);
		if (!Physics.Raycast(transform2.position, normalized, ref val3, num, LayerMask.op_Implicit(val)))
		{
			ready = false;
			if (noisemakerRandom.Next(0, soundChance) % soundChance == 0)
			{
				int num2 = noisemakerRandom.Next(0, noiseSFX.Length);
				noiseAudio.PlayOneShot(noiseSFX[num2]);
			}
		}
	}

	public static NoiseOnSpotItem setupScript(Item item)
	{
		NoiseOnSpotItem noiseOnSpotItem = item.spawnPrefab.AddComponent<NoiseOnSpotItem>();
		NoisemakerProp component = item.spawnPrefab.GetComponent<NoisemakerProp>();
		((GrabbableObject)noiseOnSpotItem).grabbable = ((GrabbableObject)component).grabbable;
		((GrabbableObject)noiseOnSpotItem).itemProperties = item;
		((GrabbableObject)noiseOnSpotItem).grabbableToEnemies = ((GrabbableObject)component).grabbableToEnemies;
		noiseOnSpotItem.noiseAudio = component.noiseAudio;
		noiseOnSpotItem.noiseAudioFar = component.noiseAudioFar;
		noiseOnSpotItem.noiseAudioFar = component.noiseAudioFar;
		noiseOnSpotItem.noiseRange = component.noiseRange;
		noiseOnSpotItem.maxLoudness = component.maxLoudness;
		noiseOnSpotItem.minLoudness = component.minLoudness;
		noiseOnSpotItem.noisemakerRandom = component.noisemakerRandom;
		noiseOnSpotItem.triggerAnimator = component.triggerAnimator;
		noiseOnSpotItem.noiseSFX = (AudioClip[])(object)new AudioClip[component.noiseSFX.Length];
		component.noiseSFX.CopyTo(noiseOnSpotItem.noiseSFX, 0);
		noiseOnSpotItem.noiseSFXFar = (AudioClip[])(object)new AudioClip[component.noiseSFXFar.Length];
		component.noiseSFXFar.CopyTo(noiseOnSpotItem.noiseSFXFar, 0);
		Object.Destroy((Object)(object)component);
		return noiseOnSpotItem;
	}
}
public class PouicPouic : GrabbableObject
{
	public int shovelHitForce = 1;

	public bool reelingUp;

	public bool isHoldingButton;

	private RaycastHit rayHit;

	private Coroutine reelingUpCoroutine;

	private RaycastHit[] objectsHitByShovel;

	private List<RaycastHit> objectsHitByShovelList = new List<RaycastHit>();

	public AudioClip reelUp;

	public AudioClip swing;

	public AudioClip[] hitSFX;

	public AudioSource shovelAudio;

	private PlayerControllerB previousPlayerHeldBy;

	private int shovelMask = 11012424;

	public override void ItemActivate(bool used, bool buttonDown = true)
	{
		if ((Object)(object)base.playerHeldBy == (Object)null)
		{
			return;
		}
		isHoldingButton = buttonDown;
		if (!reelingUp && buttonDown)
		{
			reelingUp = true;
			previousPlayerHeldBy = base.playerHeldBy;
			if (reelingUpCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(reelingUpCoroutine);
			}
			reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(reelUpShovel());
		}
	}

	private IEnumerator reelUpShovel()
	{
		base.playerHeldBy.activatingItem = true;
		base.playerHeldBy.twoHanded = true;
		base.playerHeldBy.playerBodyAnimator.ResetTrigger("shovelHit");
		base.playerHeldBy.playerBodyAnimator.SetBool("reelingUp", true);
		shovelAudio.PlayOneShot(reelUp);
		ReelUpSFXServerRpc();
		yield return (object)new WaitForSeconds(0.35f);
		yield return (object)new WaitUntil((Func<bool>)(() => !isHoldingButton || !base.isHeld));
		SwingShovel(!base.isHeld);
		yield return (object)new WaitForSeconds(0.13f);
		yield return (object)new WaitForEndOfFrame();
		HitShovel(!base.isHeld);
		yield return (object)new WaitForSeconds(0.3f);
		reelingUp = false;
		reelingUpCoroutine = null;
	}

	[ServerRpc]
	public void ReelUpSFXServerRpc()
	{
		ReelUpSFXClientRpc();
	}

	[ClientRpc]
	public void ReelUpSFXClientRpc()
	{
		if (!((NetworkBehaviour)this).IsOwner)
		{
			shovelAudio.PlayOneShot(reelUp);
		}
	}

	public override void DiscardItem()
	{
		if ((Object)(object)base.playerHeldBy != (Object)null)
		{
			base.playerHeldBy.activatingItem = false;
		}
		((GrabbableObject)this).DiscardItem();
	}

	public void SwingShovel(bool cancel = false)
	{
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false);
		if (!cancel)
		{
			shovelAudio.PlayOneShot(swing);
			previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false);
		}
	}

	public void HitShovel(bool cancel = false)
	{
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_036d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: 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_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: 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_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0216: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)previousPlayerHeldBy == (Object)null)
		{
			Debug.LogError((object)"Previousplayerheldby is null on this client when HitShovel is called.");
			return;
		}
		previousPlayerHeldBy.activatingItem = false;
		bool flag = false;
		bool flag2 = false;
		int num = -1;
		if (!cancel)
		{
			previousPlayerHeldBy.twoHanded = false;
			objectsHitByShovel = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.8f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 1.5f, shovelMask, (QueryTriggerInteraction)2);
			objectsHitByShovelList = objectsHitByShovel.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
			IHittable val2 = default(IHittable);
			RaycastHit val3 = default(RaycastHit);
			for (int i = 0; i < objectsHitByShovelList.Count; i++)
			{
				RaycastHit val = objectsHitByShovelList[i];
				if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8)
				{
					val = objectsHitByShovelList[i];
					if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11)
					{
						val = objectsHitByShovelList[i];
						if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2))
						{
							continue;
						}
						val = objectsHitByShovelList[i];
						if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform)
						{
							continue;
						}
						val = objectsHitByShovelList[i];
						if (!(((RaycastHit)(ref val)).point == Vector3.zero))
						{
							Vector3 position = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position;
							val = objectsHitByShovelList[i];
							if (Physics.Linecast(position, ((RaycastHit)(ref val)).point, ref val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
							{
								continue;
							}
						}
						flag = true;
						Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward;
						try
						{
							int num2 = calculateForce();
							num2 = 0;
							PlayerControllerB val4 = (PlayerControllerB)(object)((val2 is PlayerControllerB) ? val2 : null);
							if ((Object)(object)val4 != (Object)null)
							{
								Debug.Log((object)("=========== =================== Pouic Pouic at " + ((Object)val4).GetInstanceID()));
								TextMeshProUGUI componentInChildren = ((Component)val4).gameObject.GetComponentInChildren<TextMeshProUGUI>();
								if ((Object)(object)componentInChildren != (Object)null)
								{
									num2 = (((TMP_Text)componentInChildren).text.ToLower().Contains("elika") ? 20 : 0);
								}
							}
							else if (((object)val2).ToString().ToLower().Contains("hoarderbug"))
							{
								num2 = 20;
							}
							if (num2 > 0)
							{
								val2.Hit(num2, forward, previousPlayerHeldBy, true, 1);
							}
							flag2 = true;
						}
						catch (Exception arg)
						{
							Debug.Log((object)$"Exception caught when hitting object with shovel from player #{previousPlayerHeldBy.playerClientId}: {arg}");
						}
						continue;
					}
				}
				flag = true;
				val = objectsHitByShovelList[i];
				string tag = ((Component)((RaycastHit)(ref val)).collider).gameObject.tag;
				for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++)
				{
					if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag)
					{
						num = j;
						break;
					}
				}
			}
		}
		if (flag)
		{
			RoundManager.PlayRandomClip(shovelAudio, hitSFX, true, 1f, 0, 1000);
			Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0);
			if (!flag2 && num != -1)
			{
				shovelAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX);
				WalkieTalkie.TransmitOneShotAudio(shovelAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX, 1f);
			}
			base.playerHeldBy.playerBodyAnimator.SetTrigger("shovelHit");
		}
	}

	public int calculateForce()
	{
		return 10;
	}

	[ServerRpc]
	public void HitShovelServerRpc(int hitSurfaceID)
	{
		HitShovelClientRpc(hitSurfaceID);
	}

	[ClientRpc]
	public void HitShovelClientRpc(int hitSurfaceID)
	{
		if (!((NetworkBehaviour)this).IsOwner)
		{
			RoundManager.PlayRandomClip(shovelAudio, hitSFX, true, 1f, 0, 1000);
			if (hitSurfaceID != -1)
			{
				HitSurfaceWithShovel(hitSurfaceID);
			}
		}
	}

	private void HitSurfaceWithShovel(int hitSurfaceID)
	{
		shovelAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX);
		WalkieTalkie.TransmitOneShotAudio(shovelAudio, StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX, 1f);
	}

	public static PouicPouic setupScript(Item item)
	{
		PouicPouic pouicPouic = item.spawnPrefab.AddComponent<PouicPouic>();
		Shovel component = item.spawnPrefab.GetComponent<Shovel>();
		((GrabbableObject)pouicPouic).grabbable = ((GrabbableObject)component).grabbable;
		((GrabbableObject)pouicPouic).itemProperties = item;
		pouicPouic.reelUp = component.reelUp;
		pouicPouic.swing = component.swing;
		pouicPouic.shovelAudio = component.shovelAudio;
		pouicPouic.hitSFX = component.hitSFX;
		((GrabbableObject)pouicPouic).isInFactory = ((GrabbableObject)component).isInFactory;
		((GrabbableObject)pouicPouic).grabbableToEnemies = ((GrabbableObject)component).grabbableToEnemies;
		pouicPouic.shovelHitForce = component.shovelHitForce;
		Object.Destroy((Object)(object)component);
		return pouicPouic;
	}
}
public static class Utils
{
	public static void PrintMaterialProperties(Material material)
	{
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: 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)
		Shader shader = material.shader;
		int propertyCount = shader.GetPropertyCount();
		Debug.Log((object)("Material: " + ((Object)material).name + ", Shader: " + ((Object)shader).name));
		Debug.Log((object)$"Property Count: {propertyCount}");
		for (int i = 0; i < propertyCount; i++)
		{
			string propertyName = shader.GetPropertyName(i);
			ShaderPropertyType propertyType = shader.GetPropertyType(i);
			string materialPropertyValue = GetMaterialPropertyValue(material, propertyName, propertyType);
			Debug.Log((object)$"Property {i}: Name = {propertyName}, Type = {propertyType}, Value = {materialPropertyValue}");
		}
	}

	public static string GetMaterialPropertyValue(Material material, string propertyName, ShaderPropertyType propertyType)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Expected I4, but got Unknown
		//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_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		switch ((int)propertyType)
		{
		case 0:
		{
			Color color = material.GetColor(propertyName);
			return ((object)(Color)(ref color)).ToString();
		}
		case 1:
		{
			Vector4 vector = material.GetVector(propertyName);
			return ((object)(Vector4)(ref vector)).ToString();
		}
		case 2:
		case 3:
			return material.GetFloat(propertyName).ToString();
		case 4:
		{
			Texture texture = material.GetTexture(propertyName);
			if (!Object.op_Implicit((Object)(object)texture))
			{
				return "None";
			}
			return ((Object)texture).name;
		}
		default:
			return "Unknown Type";
		}
	}
}
namespace BluePlugin
{
	[BepInPlugin("BluePlugin", "BluePlugin", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static int globalRarity = 30;

		public static Plugin instance;

		private const bool loadFromFile = false;

		private const string LegacyAssetBundleAssemblyLogicalName = "res.mod.bundle.legacy";

		private const string BlueItemsAssetBundleAssemblyLogicalName = "res.mod.bundle.blueitems2";

		private const string AssetBundlePrefabDirectory = "Assets/LethalCompany/Mods/BlueItems/";

		public static Material materialCube2;

		public static GameObject prefabCube;

		public static GameObject prefabCube2;

		public static GameObject prefabCar;

		public static GameObject prefabBigCar;

		private void loadItems()
		{
		}

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			AssetBundle val = null;
			AssetBundle assetBundle = null;
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("res.mod.bundle.legacy");
			val = AssetBundle.LoadFromStream(stream);
			using (Stream stream2 = Assembly.GetExecutingAssembly().GetManifestResourceStream("res.mod.bundle.blueitems2"))
			{
				assetBundle = AssetBundle.LoadFromStream(stream2);
			}
			globalRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "Spawn Rate for all items", globalRarity, "Spawn rate for all items. The higher the value, the more spawns.").Value;
			LoadItemsFromBundle(val);
			LoadItemsFromBundle(assetBundle);
		}

		private void LoadItemsFromBundle(AssetBundle assetBundle)
		{
			string[] allAssetNames = assetBundle.GetAllAssetNames();
			foreach (string text in allAssetNames)
			{
				Item val = assetBundle.LoadAsset<Item>(text);
				if (!((Object)(object)val == (Object)null))
				{
					_ = val.itemName;
					int itemId = val.itemId;
					SetupScripts(val);
					if (val.isScrap)
					{
						int num = ConvertRarity(itemId, globalRarity);
						NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
						Items.RegisterScrap(val, num, (LevelTypes)(-1));
					}
					continue;
				}
				break;
			}
		}

		public static void SetupScripts(Item item)
		{
			switch (item.itemId)
			{
			case 117006:
				PouicPouic.setupScript(item);
				break;
			case 117009:
				EMF.setupScript(item);
				break;
			case 117010:
			case 117011:
				NoiseOnSpotItem.setupScript(item);
				break;
			case 117007:
			case 117008:
				break;
			}
		}

		public static int ConvertRarity(int id, int baseRarity)
		{
			double num = 1.0;
			switch (id)
			{
			case 117000:
				num = 1.3;
				break;
			case 117001:
				num = 1.0;
				break;
			case 117002:
				num = 0.6;
				break;
			case 117003:
				num = 1.6;
				break;
			case 117004:
				num = 0.8;
				break;
			case 117005:
				num = 0.7;
				break;
			case 117006:
				num = 1.0;
				break;
			case 117007:
				num = 0.6;
				break;
			case 117008:
				num = 0.8;
				break;
			case 117009:
				num = 0.8;
				break;
			case 117010:
				num = 0.8;
				break;
			case 117011:
				num = 0.8;
				break;
			}
			return (int)((double)baseRarity * num);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BluePlugin";

		public const string PLUGIN_NAME = "BluePlugin";

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