Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of PouValuable v1.1.0
NewRepoMod.dll
Decompiled 5 months agousing System; using System.Collections; using System.Diagnostics; using System.Linq; 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: AssemblyCompany("AlternateJake")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NewRepoMod")] [assembly: AssemblyTitle("NewRepoMod")] [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 { public class ExplodeOnBreak : Trap { private ParticleScriptExplosion particleScriptExplosion; private int HitCount; private int MaxHitCount = 3; public Transform Center; private PhysGrabObject physgrabobject; public UnityEvent pouTimer; private Transform playerTargetTransform; private Enemy enemyTarget; private Rigidbody rb; private Vector3 targetDirection; private Transform targetTransform; private float distanceFromTarget; [Space] [Header("Sounds")] public Sound GonnaBlowVO; public override void Start() { ((Trap)this).Start(); particleScriptExplosion = ((Component)this).GetComponent<ParticleScriptExplosion>(); physgrabobject = ((Component)this).GetComponent<PhysGrabObject>(); rb = ((Component)this).GetComponent<Rigidbody>(); } 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); ((MonoBehaviour)this).StartCoroutine(hopTowardsPlayer(2.2f)); pouTimer.Invoke(); } else { HitCount++; } } else if (HitCount >= MaxHitCount - 1) { base.trapTriggered = true; base.photonView.RPC("PlaySoundRPC", (RpcTarget)0, Array.Empty<object>()); ((MonoBehaviour)this).StartCoroutine(hopTowardsPlayer(2.2f)); pouTimer.Invoke(); } else { HitCount++; } } private IEnumerator hopTowardsPlayer(float waitTime) { yield return (object)new WaitForSeconds(waitTime); playerTargetTransform = SemiFunc.PlayerGetNearestTransformWithinRange(10f, base.physGrabObject.centerPoint, true, LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "Default" }))); enemyTarget = SemiFunc.EnemyGetNearest(rb.position, 10f, true); MonoBehaviour.print((object)enemyTarget); Vector3 val; if (Object.op_Implicit((Object)(object)playerTargetTransform) && Object.op_Implicit((Object)(object)enemyTarget)) { val = rb.position - ((Component)enemyTarget).transform.position; float distanceFromEnemy = ((Vector3)(ref val)).magnitude; val = rb.position - playerTargetTransform.position; float distanceFromPlayer = ((Vector3)(ref val)).magnitude; targetTransform = (Transform)((distanceFromEnemy <= distanceFromPlayer) ? ((object)((Component)enemyTarget).transform) : ((object)playerTargetTransform)); } else if (Object.op_Implicit((Object)(object)playerTargetTransform) || Object.op_Implicit((Object)(object)enemyTarget)) { targetTransform = (Transform)((!Object.op_Implicit((Object)(object)playerTargetTransform)) ? ((object)((Component)enemyTarget).transform) : ((object)playerTargetTransform)); } else { yield return null; } foreach (PhysGrabber item in base.physGrabObject.playerGrabbing.ToList()) { if (!SemiFunc.IsMultiplayer()) { item.ReleaseObjectRPC(true, 1f, ((Object)item).GetInstanceID()); continue; } item.photonView.RPC("ReleaseObjectRPC", (RpcTarget)0, new object[3] { false, 1f, ((Object)item).GetInstanceID() }); } ExplodeOnBreak explodeOnBreak = this; val = rb.position - targetTransform.position; explodeOnBreak.distanceFromTarget = ((Vector3)(ref val)).magnitude; ExplodeOnBreak explodeOnBreak2 = this; val = base.physGrabObject.midPoint - targetTransform.position; explodeOnBreak2.targetDirection = ((Vector3)(ref val)).normalized; rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; rb.AddForce(Vector3.up * (distanceFromTarget / 4f), (ForceMode)1); rb.AddForce(-targetDirection * distanceFromTarget, (ForceMode)1); } [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; } } [BepInPlugin("AlternateJake.NewRepoMod", "NewRepoMod", "1.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class NewRepoMod : BaseUnityPlugin { internal static NewRepoMod 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; } } }