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 PortalCore Valuables v1.0.7
OmniWheat.dll
Decompiled 3 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using Microsoft.CodeAnalysis; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("OmniWheat")] [assembly: AssemblyTitle("OmniWheat")] [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; } } } [BepInPlugin("omniscye.oia_valuable", "OIA Valuable", "1.0.0")] public class OIAValuablePlugin : BaseUnityPlugin { private void Awake() { Debug.Log((object)"[OIA Valuable] Plugin loaded. Rave cat armed."); } } public class ValuableCat : Trap { [CompilerGenerated] private sealed class <SpaceFloatRoutine>d__32 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float duration; public float force; public ValuableCat <>4__this; private bool <g>5__1; private float <d>5__2; private float <t>5__3; private float <f>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SpaceFloatRoutine>d__32(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)<>4__this._rb == (Object)null) { return false; } <g>5__1 = <>4__this._rb.useGravity; <d>5__2 = <>4__this._rb.drag; <>4__this._rb.useGravity = false; <>4__this._rb.drag = <d>5__2 + 2f; <t>5__3 = 0f; break; case 1: <>1__state = -1; break; } if (<t>5__3 < duration) { <t>5__3 += Time.deltaTime; <f>5__4 = force + Mathf.Sin(<t>5__3 * 8f) * force * 0.5f; <>4__this._rb.AddForce(Vector3.up * <f>5__4, (ForceMode)5); <>2__current = null; <>1__state = 1; return true; } <>4__this._rb.useGravity = <g>5__1; <>4__this._rb.drag = <d>5__2; <>4__this._spaceRoutine = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public Animator animator; public string talkTriggerName = "Talk"; public AudioClip[] voiceLines; public bool randomizeVoice = true; public float cooldown = 0.2f; public bool isSpaceCore; public bool isWheatleyCore; public bool isFactCore; public float spaceChance = 0.1f; public float spaceFloatDuration = 2.5f; public float spaceFloatForce = 2.5f; public float wheatleyChance = 1f; public int wheatleyMaxBonus = 100; public float factChance = 0.1f; public float factSize = 1f; public int factDamage = 50; public int factEnemyDamage = 100; private AudioSource _audio; private bool _grabbedPrev; private int _voiceIndex; private float _cooldownTimer; private Rigidbody _rb; private ParticleScriptExplosion _explosion; private Coroutine _spaceRoutine; public override void Start() { ((Trap)this).Start(); if (!Object.op_Implicit((Object)(object)animator)) { animator = ((Component)this).GetComponentInChildren<Animator>(true); } _audio = ((Component)this).GetComponent<AudioSource>(); if (!Object.op_Implicit((Object)(object)_audio)) { _audio = ((Component)this).gameObject.AddComponent<AudioSource>(); } _audio.playOnAwake = false; _audio.loop = false; _audio.spatialBlend = 1f; _audio.rolloffMode = (AudioRolloffMode)0; _audio.minDistance = 4f; _audio.maxDistance = 28f; _voiceIndex = 0; _cooldownTimer = 0f; _rb = ((Component)this).GetComponent<Rigidbody>(); _explosion = ((Component)this).GetComponent<ParticleScriptExplosion>(); if ((Object)(object)_explosion == (Object)null) { _explosion = ((Component)this).GetComponentInChildren<ParticleScriptExplosion>(true); } } public override void Update() { ((Trap)this).Update(); _cooldownTimer -= Time.deltaTime; bool flag = (Object)(object)base.physGrabObject != (Object)null && base.physGrabObject.grabbed; if (flag && !_grabbedPrev) { if (SemiFunc.IsMultiplayer()) { PlayerAvatar val = (((Object)(object)base.physGrabObject != (Object)null) ? base.physGrabObject.lastPlayerGrabbing : null); int num = (((Object)(object)val != (Object)null && (Object)(object)val.photonView != (Object)null) ? val.photonView.ViewID : (-1)); if (PhotonNetwork.IsMasterClient) { HandleGrabServer(num); } else { base.photonView.RPC("RPC_HandleGrabRequest", (RpcTarget)2, new object[1] { num }); } } else { HandleGrabOffline(); } } _grabbedPrev = flag; } [PunRPC] private void RPC_HandleGrabRequest(int playerViewID) { if (PhotonNetwork.IsMasterClient) { HandleGrabServer(playerViewID); } } private void HandleGrabServer(int playerViewID) { if (_cooldownTimer <= 0f) { int num = -1; if (voiceLines != null && voiceLines.Length != 0) { if (randomizeVoice) { num = Random.Range(0, voiceLines.Length); } else { num = _voiceIndex % voiceLines.Length; _voiceIndex = (_voiceIndex + 1) % Mathf.Max(1, voiceLines.Length); } } _cooldownTimer = Mathf.Max(0f, cooldown); base.photonView.RPC("RPC_Talk", (RpcTarget)0, new object[1] { num }); } if (isSpaceCore && Random.value < spaceChance) { base.photonView.RPC("RPC_SpaceFloat", (RpcTarget)0, new object[2] { spaceFloatDuration, spaceFloatForce }); } if (isWheatleyCore && playerViewID > 0 && Random.value < wheatleyChance) { base.photonView.RPC("RPC_WheatleyBuff", (RpcTarget)0, new object[2] { playerViewID, wheatleyMaxBonus }); } if (isFactCore && Random.value < factChance) { base.photonView.RPC("RPC_FactExplode", (RpcTarget)0, new object[3] { factSize, factDamage, factEnemyDamage }); } } private void HandleGrabOffline() { if (_cooldownTimer <= 0f) { int clipIndex = -1; if (voiceLines != null && voiceLines.Length != 0) { if (randomizeVoice) { clipIndex = Random.Range(0, voiceLines.Length); } else { clipIndex = _voiceIndex % voiceLines.Length; _voiceIndex = (_voiceIndex + 1) % Mathf.Max(1, voiceLines.Length); } } _cooldownTimer = Mathf.Max(0f, cooldown); DoTalkLocal(clipIndex); } if (isSpaceCore && Random.value < spaceChance) { RPC_SpaceFloat(spaceFloatDuration, spaceFloatForce); } if (isWheatleyCore) { PlayerAvatar val = (((Object)(object)base.physGrabObject != (Object)null) ? base.physGrabObject.lastPlayerGrabbing : null); if ((Object)(object)val != (Object)null && Random.value < wheatleyChance) { RPC_WheatleyBuff(((Object)(object)val.photonView != (Object)null) ? val.photonView.ViewID : (-1), wheatleyMaxBonus); } } if (isFactCore && Random.value < factChance) { RPC_FactExplode(factSize, factDamage, factEnemyDamage); } } [PunRPC] private void RPC_Talk(int clipIndex) { DoTalkLocal(clipIndex); } private void DoTalkLocal(int clipIndex) { if (Object.op_Implicit((Object)(object)animator) && !string.IsNullOrEmpty(talkTriggerName)) { animator.ResetTrigger(talkTriggerName); animator.SetTrigger(talkTriggerName); } if (clipIndex >= 0 && voiceLines != null && voiceLines.Length > clipIndex && (Object)(object)voiceLines[clipIndex] != (Object)null) { _audio.PlayOneShot(voiceLines[clipIndex]); } } [PunRPC] private void RPC_SpaceFloat(float duration, float force) { if (_spaceRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_spaceRoutine); } _spaceRoutine = ((MonoBehaviour)this).StartCoroutine(SpaceFloatRoutine(duration, force)); } [IteratorStateMachine(typeof(<SpaceFloatRoutine>d__32))] private IEnumerator SpaceFloatRoutine(float duration, float force) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SpaceFloatRoutine>d__32(0) { <>4__this = this, duration = duration, force = force }; } [PunRPC] private void RPC_WheatleyBuff(int playerViewID, int bonusMax) { PhotonView val = PhotonView.Find(playerViewID); if (!((Object)(object)val == (Object)null)) { PlayerAvatar component = ((Component)val).GetComponent<PlayerAvatar>(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.playerHealth == (Object)null)) { string text = SemiFunc.PlayerGetSteamID(component); int num = 100 + StatsManager.instance.GetPlayerMaxHealth(text); int num2 = num + bonusMax; int num3 = num2; component.playerHealth.photonView.RPC("UpdateHealthRPC", (RpcTarget)0, new object[3] { num3, num2, true }); } } } [PunRPC] private void RPC_FactExplode(float size, int damage, int enemyDamage) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_explosion != (Object)null) { _explosion.Spawn(((Component)this).transform.position, size, damage, enemyDamage, 1f, false, false, 1f); } } }