Decompiled source of SillyValuables v2.0.2

SillyValuables.dll

Decompiled 6 hours ago
using System;
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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using UnityEngine.Events;

[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: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Sangrento")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SillyValuables")]
[assembly: AssemblyTitle("SillyValuables")]
[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.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;
		}
	}
}
public class Curar : MonoBehaviour
{
	private void OnDestroy()
	{
		PlayerHealth playerHealth = PlayerAvatar.instance.playerHealth;
		playerHealth.health = Mathf.Min(playerHealth.health + 50, playerHealth.maxHealth);
	}
}
public class Doomsekkar : MonoBehaviour
{
	private bool isItemHeld = false;

	private float holdTime = 0f;

	public float holdThreshold = 2f;

	private bool isSpeaking = false;

	private string GenerateAffectionateSentence()
	{
		string[] array = new string[1] { "Destiny's powerful hand has made the bed of my future, and it's up to me to lie in it." };
		return array[Random.Range(0, array.Length)];
	}

	private void Update()
	{
		if (Input.GetKey((KeyCode)101))
		{
			if (!isItemHeld)
			{
				isItemHeld = true;
			}
			if (isItemHeld)
			{
				holdTime += Time.deltaTime;
				if (!isSpeaking && holdTime >= holdThreshold)
				{
					StartSpeaking();
				}
			}
		}
		else if (isItemHeld)
		{
			isItemHeld = false;
			holdTime = 0f;
			isSpeaking = false;
		}
	}

	public void StartSpeaking()
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		isSpeaking = true;
		string text = GenerateAffectionateSentence();
		Color val = default(Color);
		((Color)(ref val))..ctor(1f, 0.3f, 0.6f, 1f);
		ChatManager.instance.PossessChatScheduleStart(10);
		ChatManager.instance.PossessChat((PossessChatID)1, text, 1f, val, 0f, false, 0, (UnityEvent)null);
		ChatManager.instance.PossessChatScheduleEnd();
	}
}
public class ExplodeOnDestroy : MonoBehaviourPun
{
	public GameObject explosionEffectPrefab;

	public float explosionRadius = 5f;

	public float explosionForce = 500f;

	public int explosionDamage = 30;

	public float damageRadius = 3f;

	public bool beingExtracted = false;

	private void OnDestroy()
	{
		//IL_0050: 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_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		if (beingExtracted)
		{
			return;
		}
		if ((Object)(object)explosionEffectPrefab != (Object)null)
		{
			GameObject val = Object.Instantiate<GameObject>(explosionEffectPrefab, ((Component)this).transform.position, Quaternion.identity);
			Object.Destroy((Object)(object)val, 5f);
		}
		Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, explosionRadius);
		Collider[] array2 = array;
		Ray val4 = default(Ray);
		RaycastHit val5 = default(RaycastHit);
		foreach (Collider val2 in array2)
		{
			float num = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position);
			Rigidbody component = ((Component)val2).GetComponent<Rigidbody>();
			if ((Object)(object)component != (Object)null)
			{
				component.AddExplosionForce(explosionForce, ((Component)this).transform.position, explosionRadius);
			}
			if (!(num <= damageRadius) || !((Component)val2).CompareTag("Player"))
			{
				continue;
			}
			Vector3 val3 = ((Component)val2).transform.position - ((Component)this).transform.position;
			Vector3 normalized = ((Vector3)(ref val3)).normalized;
			((Ray)(ref val4))..ctor(((Component)this).transform.position, normalized);
			if (Physics.Raycast(val4, ref val5, damageRadius) && (Object)(object)((Component)((RaycastHit)(ref val5)).collider).gameObject == (Object)(object)((Component)val2).gameObject)
			{
				PhotonView component2 = ((Component)val2).GetComponent<PhotonView>();
				if (!SemiFunc.IsMultiplayer() || ((Object)(object)component2 != (Object)null && component2.IsMine))
				{
					PlayerHealth playerHealth = PlayerAvatar.instance.playerHealth;
					playerHealth.health -= explosionDamage;
					PlayerAvatar.instance.playerHealth.Hurt(explosionDamage, false, -1);
				}
			}
		}
	}
}
public class TalkingValuable : MonoBehaviour
{
	private bool isItemHeld = false;

	private float holdTime = 0f;

	public float holdThreshold = 2f;

	private bool isSpeaking = false;

	private string GenerateAffectionateSentence()
	{
		string[] array = new string[5] { "STAAN", "STAAAN", "STAAAAAN", "STAAAAAAAN", "STAAAAAAAAAAAN" };
		return array[Random.Range(0, array.Length)];
	}

	public void StartSpeaking()
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		isSpeaking = true;
		string text = GenerateAffectionateSentence();
		Color val = default(Color);
		((Color)(ref val))..ctor(1f, 0.3f, 0.6f, 1f);
		ChatManager.instance.PossessChatScheduleStart(10);
		ChatManager.instance.PossessChat((PossessChatID)1, text, 1f, val, 0f, false, 0, (UnityEvent)null);
		ChatManager.instance.PossessChatScheduleEnd();
	}
}
public class KillPlayer : MonoBehaviourPun
{
	private PhotonView? pv;

	private void Awake()
	{
		pv = ((Component)this).GetComponent<PhotonView>();
	}

	private void OnDestroy()
	{
		if (SemiFunc.IsMultiplayer())
		{
			if ((Object)(object)pv != (Object)null && pv.IsMine && PlayerIsInSight(PlayerAvatar.instance))
			{
				ChatManager.instance.PossessSelfDestruction();
			}
		}
		else if (PlayerIsInSight(PlayerAvatar.instance))
		{
			PlayerAvatar.instance.playerHealth.health = 0;
			PlayerAvatar.instance.playerHealth.Hurt(9999, false, -1);
		}
	}

	private bool PlayerIsInSight(PlayerAvatar playerAvatar)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: 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_0029: 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)
		if ((Object)(object)playerAvatar == (Object)null)
		{
			return false;
		}
		Vector3 position = ((Component)this).transform.position;
		Vector3 position2 = ((Component)playerAvatar).transform.position;
		RaycastHit val = default(RaycastHit);
		if (Physics.Linecast(position, position2, ref val))
		{
			return (Object)(object)((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<PlayerAvatar>() == (Object)(object)playerAvatar;
		}
		return false;
	}
}
namespace SillyValuables
{
	[HarmonyPatch(typeof(PlayerController))]
	internal static class ExamplePlayerControllerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Start")]
		private static void Start_Prefix(PlayerController __instance)
		{
			SillyValuables.Logger.LogDebug((object)$"{__instance} Start Prefix");
		}

		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void Start_Postfix(PlayerController __instance)
		{
			SillyValuables.Logger.LogDebug((object)$"{__instance} Start Postfix");
		}
	}
	[BepInPlugin("Sangrento.SillyValuables", "SillyValuables", "1.5.4")]
	public class SillyValuables : BaseUnityPlugin
	{
		internal static SillyValuables Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		internal void Patch()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0026: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll();
		}

		private void KillPlayer()
		{
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
}