using System;
using System.Collections;
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.AI;
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("AlternateJake")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CustomScriptPlugin")]
[assembly: AssemblyTitle("CustomScriptPlugin")]
[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;
}
}
}
namespace CustomScriptPlugin
{
[BepInPlugin("AlternateJake.CustomScriptPlugin", "CustomScriptPlugin", "1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class CustomScriptPlugin : BaseUnityPlugin
{
internal static CustomScriptPlugin Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
}
public class PouValuable : ValuableObject
{
private void Awake()
{
base.photonView = ((Component)this).GetComponent<PhotonView>();
}
private void Start()
{
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Invalid comparison between Unknown and I4
base.physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
base.roomVolumeCheck = ((Component)this).GetComponent<RoomVolumeCheck>();
base.navMeshObstacle = ((Component)this).GetComponent<NavMeshObstacle>();
if (Object.op_Implicit((Object)(object)base.navMeshObstacle))
{
Debug.LogError((object)(((Object)((Component)this).gameObject).name + " has a NavMeshObstacle component. Please remove it."));
}
((MonoBehaviour)this).StartCoroutine(DollarValueSet());
base.rigidBodyMass = base.physAttributePreset.mass;
base.rb = ((Component)this).GetComponent<Rigidbody>();
if (Object.op_Implicit((Object)(object)base.rb))
{
base.rb.mass = base.rigidBodyMass;
}
base.physGrabObject.massOriginal = base.rigidBodyMass;
if (!LevelGenerator.Instance.Generated)
{
ValuableDirector instance = ValuableDirector.instance;
instance.valuableSpawnAmount++;
ValuableDirector.instance.valuableList.Add((ValuableObject)(object)this);
}
if ((int)base.volumeType <= 1)
{
base.physGrabObject.clientNonKinematic = true;
}
}
private void AddToDollarHaulList()
{
if (GameManager.instance.gameMode == 1)
{
base.photonView.RPC("AddToDollarHaulListRPC", (RpcTarget)0, Array.Empty<object>());
}
else if (Object.op_Implicit((Object)(object)((Component)this).GetComponent<ValuableObject>()) && !RoundDirector.instance.dollarHaulList.Contains(((Component)this).gameObject))
{
RoundDirector.instance.dollarHaulList.Add(((Component)this).gameObject);
}
}
[PunRPC]
public void AddToDollarHaulListRPC()
{
if (Object.op_Implicit((Object)(object)((Component)this).GetComponent<ValuableObject>()) && !RoundDirector.instance.dollarHaulList.Contains(((Component)this).gameObject))
{
RoundDirector.instance.dollarHaulList.Add(((Component)this).gameObject);
}
}
private void RemoveFromDollarHaulList()
{
if (GameManager.instance.gameMode == 1)
{
base.photonView.RPC("RemoveFromDollarHaulListRPC", (RpcTarget)0, Array.Empty<object>());
}
else if (Object.op_Implicit((Object)(object)((Component)this).GetComponent<ValuableObject>()) && RoundDirector.instance.dollarHaulList.Contains(((Component)this).gameObject))
{
RoundDirector.instance.dollarHaulList.Remove(((Component)this).gameObject);
}
}
[PunRPC]
public void RemoveFromDollarHaulListRPC()
{
if (Object.op_Implicit((Object)(object)((Component)this).GetComponent<ValuableObject>()) && RoundDirector.instance.dollarHaulList.Contains(((Component)this).gameObject))
{
RoundDirector.instance.dollarHaulList.Remove(((Component)this).gameObject);
}
}
private void Update()
{
if (GameManager.instance.gameMode == 0 || PhotonNetwork.IsMasterClient)
{
if (base.inStartRoomCheckTimer > 0f)
{
base.inStartRoomCheckTimer -= Time.deltaTime;
}
else
{
bool flag = false;
foreach (RoomVolume currentRoom in base.roomVolumeCheck.CurrentRooms)
{
if (currentRoom.Extraction)
{
if (!base.inStartRoom)
{
AddToDollarHaulList();
base.inStartRoom = true;
}
flag = true;
}
}
if (!flag && base.inStartRoom)
{
RemoveFromDollarHaulList();
base.inStartRoom = false;
}
base.inStartRoomCheckTimer = 0.5f;
}
}
DiscoverReminderLogic();
}
private IEnumerator DollarValueSet()
{
yield return (object)new WaitForSeconds(0.05f);
while ((int)LevelGenerator.Instance.State <= 11)
{
yield return (object)new WaitForSeconds(0.05f);
}
if (!SemiFunc.IsMultiplayer())
{
DollarValueSetLogic();
}
else if (SemiFunc.IsMasterClient())
{
DollarValueSetLogic();
base.photonView.RPC("DollarValueSetRPC", (RpcTarget)1, new object[1] { base.dollarValueCurrent });
}
if (SemiFunc.IsMasterClientOrSingleplayer())
{
RoundDirector instance = RoundDirector.instance;
instance.haulGoalMax += (int)base.dollarValueCurrent;
}
}
private void DollarValueSetLogic()
{
if (base.dollarValueOverride != 0)
{
base.dollarValueOriginal = base.dollarValueOverride;
base.dollarValueCurrent = base.dollarValueOverride;
}
else
{
base.dollarValueOriginal = Mathf.Round(Random.Range(base.valuePreset.valueMin, base.valuePreset.valueMax));
base.dollarValueOriginal = Mathf.Round(base.dollarValueOriginal / 100f) * 100f;
base.dollarValueCurrent = base.dollarValueOriginal;
}
base.dollarValueSet = true;
}
private void DiscoverReminderLogic()
{
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
if (!base.discovered || base.discoveredReminder)
{
return;
}
if (base.discoveredReminderTimer > 0f)
{
base.discoveredReminderTimer -= Time.deltaTime;
return;
}
base.discoveredReminderTimer = Random.Range(2f, 5f);
if (!base.physGrabObject.impactDetector.inCart && ((Behaviour)PlayerController.instance).isActiveAndEnabled && Vector3.Distance(((Component)this).transform.position, ((Component)PlayerController.instance).transform.position) > 20f)
{
base.discoveredReminder = true;
}
}
public void Discover(State _state)
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
if (!base.discovered)
{
if (!GameManager.Multiplayer())
{
DiscoverRPC();
}
else
{
base.photonView.RPC("DiscoverRPC", (RpcTarget)0, Array.Empty<object>());
}
}
ValuableDiscover.instance.New(base.physGrabObject, _state);
}
[PunRPC]
private void DiscoverRPC()
{
base.discovered = true;
Map.Instance.AddValuable((ValuableObject)(object)this);
}
[PunRPC]
public void DollarValueSetRPC(float value)
{
base.dollarValueOriginal = value;
base.dollarValueCurrent = value;
base.dollarValueSet = true;
}
}
public class ExplodeOnBreak : Trap
{
private ParticleScriptExplosion particleScriptExplosion;
private int HitCount;
private int MaxHitCount = 3;
public Transform Center;
private PhysGrabObject physgrabobject;
public UnityEvent pouTimer;
[Space]
[Header("Sounds")]
public Sound GonnaBlowVO;
public override void Start()
{
((Trap)this).Start();
particleScriptExplosion = ((Component)this).GetComponent<ParticleScriptExplosion>();
physgrabobject = ((Component)this).GetComponent<PhysGrabObject>();
}
public void Explode()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
particleScriptExplosion.Spawn(Center.position, 1f, 50, 100, 1f, false, false, 1f);
}
public void PotentialExplode()
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
if (base.trapTriggered)
{
return;
}
if (!SemiFunc.IsMultiplayer())
{
if (HitCount >= MaxHitCount - 1)
{
base.trapTriggered = true;
GonnaBlowVO.Play(physgrabobject.centerPoint, 1f, 1f, 1f, 1f);
pouTimer.Invoke();
}
else
{
HitCount++;
}
}
else if (HitCount >= MaxHitCount - 1)
{
base.trapTriggered = true;
base.photonView.RPC("PlaySoundRPC", (RpcTarget)0, Array.Empty<object>());
pouTimer.Invoke();
}
else
{
HitCount++;
}
}
[PunRPC]
public void PlaySoundRPC()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
GonnaBlowVO.Play(physgrabobject.centerPoint, 1f, 1f, 1f, 1f);
}
public void TrapTrigger()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
particleScriptExplosion.Spawn(physgrabobject.centerPoint, 1.5f, 100, 300, 1f, false, false, 1f);
physgrabobject.dead = true;
}
}
}