Decompiled source of Holy Casino Stone v1.0.0

BepInEx/plugins/Krild_Holy_Casino_Stone.dll

Decompiled 3 days ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Photon.Pun;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Krild_Holy_Casino_Stone")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Krild_Holy_Casino_Stone")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("589d8ae7-6314-41dd-89ec-f2c51654ce88")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Krild_Holy_Casino_Stone
{
	[BepInPlugin("KrildHolyCasinoStone", "Holy_Casino_Stone", "1.0.0.0")]
	public class KrildPatcherHolyCasinoStone : BaseUnityPlugin
	{
		private const string modGUID = "KrildHolyCasinoStone";

		private const string modName = "Holy_Casino_Stone";

		private const string modVersion = "1.0.0.0";

		internal Harmony harmony = new Harmony("KrildHolyCasinoStone");

		internal static KrildPatcherHolyCasinoStone current;

		internal ManualLogSource log;

		private void Awake()
		{
			if ((Object)(object)current == (Object)null)
			{
				current = this;
			}
			log = Logger.CreateLogSource("KrildHolyCasinoStone");
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Patch();
			log.LogInfo((object)"Krildig geladen :3");
		}

		internal void Patch()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			if (harmony == null)
			{
				Harmony val = (harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID));
			}
			harmony.PatchAll();
		}
	}
}
namespace Krild_Holy_Casino_Stone.Behaviours
{
	public class Krild_Holy_Casino_Stone : MonoBehaviour
	{
		private PhysGrabObject physgrabObject;

		private ValuableObject valuableObject;

		private PhotonView photonView;

		[SerializeField]
		private Sound winSound;

		[SerializeField]
		private Sound noSound;

		[SerializeField]
		private Sound loopKrild;

		private bool isPlaying = false;

		private float valueDollar = 500f;

		[SerializeField]
		private float winChance = 0.8f;

		private void Start()
		{
			photonView = ((Component)this).GetComponent<PhotonView>();
			physgrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			valuableObject = ((Component)this).GetComponent<ValuableObject>();
		}

		private void Update()
		{
			if (isPlaying)
			{
				if (!physgrabObject.grabbed)
				{
					isPlaying = false;
				}
			}
			else if (physgrabObject.grabbed)
			{
				isPlaying = true;
			}
			loopKrild.PlayLoop(isPlaying, 1f, 1f, 1f);
		}

		public void Impact()
		{
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			if (Random.Range(0f, 1f) < winChance)
			{
				valueDollar *= Random.Range(1f, 2f);
				winSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
			}
			else
			{
				valueDollar = 100f;
				noSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
			}
			SetDollar(valueDollar);
		}

		private void SetDollar(float value)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.IsMultiplayer())
			{
				photonView.RPC("DollarValueSetRPC", (RpcTarget)0, new object[1] { value });
			}
			else
			{
				valuableObject.DollarValueSetRPC(value, default(PhotonMessageInfo));
			}
		}
	}
}