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 SuperEgg v1.3.1
SuperEgg.dll
Decompiled 4 months ago#define DEBUG using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using MonoMod.Utils; using SuperEgg.Patch; using TestAccount666.SuperEgg.NetcodePatcher; using TestAccountCore; using TestAccountCore.Dependencies; using TestAccountCore.Dependencies.Compatibility; using Unity.Mathematics; using Unity.Netcode; using UnityEngine; using UnityEngine.Networking; using com.github.zehsteam.SellMyScrap.Objects; using com.github.zehsteam.SellMyScrap.Patches; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TestAccount666.SuperEgg")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Eggs, but on steroids")] [assembly: AssemblyFileVersion("1.3.1.0")] [assembly: AssemblyInformationalVersion("1.3.1+7d25fcd89f413cd30465fdfe07013939ca2cb36b")] [assembly: AssemblyProduct("SuperEgg")] [assembly: AssemblyTitle("TestAccount666.SuperEgg")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] 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 SuperEgg { public static class AudioAppend { [CompilerGenerated] private sealed class <>c__DisplayClass2_0 { public AudioSource audioSource; internal bool <AppendSound>b__0() { return !audioSource.isPlaying; } internal bool <AppendSound>b__1() { return !audioSource.isPlaying; } } [CompilerGenerated] private sealed class <AppendSound>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public AudioSource audioSource; private <>c__DisplayClass2_0 <>8__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <AppendSound>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass2_0(); <>8__1.audioSource = audioSource; if (!EggConfig.enableSellAudio.Value || eggAudioClip == null || !Object.op_Implicit((Object)(object)eggAudioClip)) { played = false; DeskCounterPatch.playAudio = false; return false; } played = true; <>2__current = (object)new WaitUntil((Func<bool>)(() => !<>8__1.audioSource.isPlaying)); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 2; return true; case 2: <>1__state = -1; <>8__1.audioSource.PlayOneShot(eggAudioClip, 1f); <>2__current = (object)new WaitUntil((Func<bool>)(() => !<>8__1.audioSource.isPlaying)); <>1__state = 3; return true; case 3: <>1__state = -1; played = false; DeskCounterPatch.playAudio = false; 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 static bool played; public static AudioClip? eggAudioClip; [IteratorStateMachine(typeof(<AppendSound>d__2))] public static IEnumerator AppendSound(AudioSource audioSource) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <AppendSound>d__2(0) { audioSource = audioSource }; } } public class DestroyListener : MonoBehaviour { public readonly HashSet<GameObject> destroyWithListener = new HashSet<GameObject>(); public void AddObject(GameObject objectToDestroy) { destroyWithListener.Add(objectToDestroy); } private void OnDestroy() { if ((Object)(object)StartOfRound.Instance == (Object)null) { return; } NetworkObject val = default(NetworkObject); foreach (GameObject item in destroyWithListener) { if (!item.TryGetComponent<NetworkObject>(ref val)) { Object.Destroy((Object)(object)item); continue; } if (((NetworkBehaviour)StartOfRound.Instance).IsHost || ((NetworkBehaviour)StartOfRound.Instance).IsServer) { val.Despawn(true); } Object.Destroy((Object)(object)item); } } } public class EasterEgg : NetworkBehaviour { internal GrabbableObject grabbableObject = null; private bool _isSuperEgg; private Random _random; public override void OnNetworkSpawn() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) ((NetworkBehaviour)this).OnNetworkSpawn(); SuperEgg.LogDebug("Network haz spawned!!"); if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer) { NetworkObject networkObject = ((NetworkBehaviour)grabbableObject).NetworkObject; SetGrabbableObjectClientRpc(NetworkObjectReference.op_Implicit(networkObject)); } } [ClientRpc] private void SetGrabbableObjectClientRpc(NetworkObjectReference networkObjectReference) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3000843006u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref networkObjectReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3000843006u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = NetworkObjectReference.op_Implicit(networkObjectReference); grabbableObject = ((Component)val3).GetComponent<GrabbableObject>(); } } } private void Start() { //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) _random = new Random((uint)(DateTime.Now.Ticks & 0xFFFF)); _isSuperEgg = ((Random)(ref _random)).NextInt(1, 100) <= EggConfig.superEggChance.Value; } private bool DisableExplosion() { if (!EggConfig.disableThrowAndDamageOnDeskCounter.Value) { return false; } DepositItemsDesk depositItemsDesk = DeskCounterPatch.depositItemsDesk; if ((Object)(object)depositItemsDesk == (Object)null || !Object.op_Implicit((Object)(object)depositItemsDesk)) { return false; } return depositItemsDesk.itemsOnCounter.Contains(grabbableObject); } public static void SpawnExplosion(Vector3 explosionPosition, bool spawnExplosionEffect = false, float killRange = 1f, float damageRange = 1f, int nonLethalDamage = 50, float physicsForce = 0f, GameObject? overridePrefab = null, bool goThroughCar = false, StunGrenadeItem? stunGrenadeItem = null) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) if (stunGrenadeItem == null) { Landmine.SpawnExplosion(explosionPosition, spawnExplosionEffect, killRange, damageRange, nonLethalDamage, physicsForce, overridePrefab, goThroughCar); return; } DestroyListener destroyListener = default(DestroyListener); if (!((Component)stunGrenadeItem).TryGetComponent<DestroyListener>(ref destroyListener)) { SuperEgg.Logger.LogDebug((object)"No destroy listener!"); Landmine.SpawnExplosion(explosionPosition, spawnExplosionEffect, killRange, damageRange, nonLethalDamage, physicsForce, overridePrefab, goThroughCar); return; } EasterEgg easterEgg = null; foreach (GameObject item in destroyListener.destroyWithListener) { if (item.TryGetComponent<EasterEgg>(ref easterEgg)) { break; } } if ((Object)(object)easterEgg == (Object)null || !Object.op_Implicit((Object)(object)easterEgg)) { SuperEgg.Logger.LogDebug((object)"No easter egg!"); Landmine.SpawnExplosion(explosionPosition, spawnExplosionEffect, killRange, damageRange, nonLethalDamage, physicsForce, overridePrefab, goThroughCar); } else { SuperEgg.Logger.LogDebug((object)"Executing on my end!"); easterEgg.ExplodeServerRpc(explosionPosition); } } [ServerRpc(RequireOwnership = false)] public void ExplodeServerRpc(Vector3 explosionPosition) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3086464309u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref explosionPosition); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3086464309u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SuperEgg.Logger.LogDebug((object)"DO SOMETHING YOU PIECE OF EGG!"); if (DisableExplosion()) { SuperEgg.LogDebug("Explosion disabled!"); return; } SuperEgg.LogDebug("Explode!"); SuperEgg.LogDebug($"IsSuperEgg? {_isSuperEgg}"); int num = (_isSuperEgg ? ((Random)(ref _random)).NextInt(1, 100) : 101); SuperEgg.LogDebug($"Generated Chance? {num}"); SuperEgg.LogDebug($"Required Chance? {EggConfig.superExplosionChance.Value}"); bool flag = num <= EggConfig.superExplosionChance.Value; SuperEgg.LogDebug($"IsSuperExplosion? {flag}"); float num2 = (flag ? EggConfig.superExplosionKillRange.Value : EggConfig.normalExplosionKillRange.Value); SuperEgg.LogDebug($"KillRange? {num2}"); float num3 = (flag ? EggConfig.superExplosionDamageRange.Value : EggConfig.normalExplosionDamageRange.Value); SuperEgg.LogDebug($"DamageRange? {num3}"); int num4 = (flag ? EggConfig.superExplosionDamage.Value : EggConfig.normalExplosionDamage.Value); SuperEgg.LogDebug($"NonLethalDamage? {num4}"); float num5 = (flag ? EggConfig.superExplosionMinStrength.Value : EggConfig.normalExplosionMinStrength.Value); SuperEgg.LogDebug($"MinPhysicsForce? {num5}"); float num6 = num5 + (flag ? EggConfig.superExplosionAdditionalStrength.Value : EggConfig.normalExplosionAdditionalStrength.Value); SuperEgg.LogDebug($"MaxPhysicsForce? {num6}"); float num7 = ((Random)(ref _random)).NextFloat(num5, num6); SuperEgg.LogDebug($"Generated Physics? {num7}"); ExplodeClientRpc(explosionPosition, num2, num3, num4, num7); } } [ClientRpc] public void ExplodeClientRpc(Vector3 explosionPosition, float killRange, float damageRange, int nonLethalDamage, float physicsForce) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3034908750u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref explosionPosition); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref killRange, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref damageRange, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, nonLethalDamage); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref physicsForce, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3034908750u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; Landmine.SpawnExplosion(explosionPosition, false, killRange, damageRange, nonLethalDamage, physicsForce, (GameObject)null, false); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3000843006u, new RpcReceiveHandler(__rpc_handler_3000843006), "SetGrabbableObjectClientRpc"); ((NetworkBehaviour)this).__registerRpc(3086464309u, new RpcReceiveHandler(__rpc_handler_3086464309), "ExplodeServerRpc"); ((NetworkBehaviour)this).__registerRpc(3034908750u, new RpcReceiveHandler(__rpc_handler_3034908750), "ExplodeClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3000843006(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference grabbableObjectClientRpc = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref grabbableObjectClientRpc, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((EasterEgg)(object)target).SetGrabbableObjectClientRpc(grabbableObjectClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3086464309(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 explosionPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref explosionPosition); target.__rpc_exec_stage = (__RpcExecStage)1; ((EasterEgg)(object)target).ExplodeServerRpc(explosionPosition); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3034908750(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 explosionPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref explosionPosition); float killRange = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref killRange, default(ForPrimitives)); float damageRange = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref damageRange, default(ForPrimitives)); int nonLethalDamage = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref nonLethalDamage); float physicsForce = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref physicsForce, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((EasterEgg)(object)target).ExplodeClientRpc(explosionPosition, killRange, damageRange, nonLethalDamage, physicsForce); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "EasterEgg"; } } public static class EggConfig { public static ConfigEntry<int> superEggChance; public static ConfigEntry<bool> disableThrowAndDamageOnDeskCounter; public static ConfigEntry<int> superExplosionChance; public static ConfigEntry<float> superExplosionMinStrength; public static ConfigEntry<float> superExplosionAdditionalStrength; public static ConfigEntry<float> superExplosionKillRange; public static ConfigEntry<float> superExplosionDamageRange; public static ConfigEntry<int> superExplosionDamage; public static ConfigEntry<float> normalExplosionMinStrength; public static ConfigEntry<float> normalExplosionAdditionalStrength; public static ConfigEntry<float> normalExplosionKillRange; public static ConfigEntry<float> normalExplosionDamageRange; public static ConfigEntry<int> normalExplosionDamage; public static ConfigEntry<string> eggName; public static ConfigEntry<bool> enableDebugLogs; public static ConfigEntry<bool> enableSellAudio; public static void Initialize(ConfigFile configFile) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Expected O, but got Unknown //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Expected O, but got Unknown //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Expected O, but got Unknown //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Expected O, but got Unknown //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Expected O, but got Unknown superEggChance = configFile.Bind<int>("General", "Super Egg Chance", 100, new ConfigDescription("Chance for an egg to be a super egg.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); disableThrowAndDamageOnDeskCounter = configFile.Bind<bool>("General", "Disable Throw And Damage On Desk Counter", false, "If set to true, will disable any throw/damage caused by eggs that you put on the sell counter. This will NOT disable the visual explosion."); superExplosionChance = configFile.Bind<int>("Super Explosion", "Super Explosion Chance", 45, new ConfigDescription("Chance for an super egg explosion to be a super explosion.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); superExplosionMinStrength = configFile.Bind<float>("Super Explosion", "Super Explosion Min Strength", 60f, new ConfigDescription("The minimum strength of a super explosion", (AcceptableValueBase)(object)new AcceptableValueRange<float>(50f, 100f), Array.Empty<object>())); superExplosionAdditionalStrength = configFile.Bind<float>("Super Explosion", "Super Explosion Additional Strength", 400f, new ConfigDescription("The additional strength of a super explosion. This is used to define the max strength value.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 400f), Array.Empty<object>())); superExplosionKillRange = configFile.Bind<float>("Super Explosion", "Super Explosion Kill Range", 0f, new ConfigDescription("The kill range of a super explosion. Vanilla value is 0.3 btw.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); superExplosionDamageRange = configFile.Bind<float>("Super Explosion", "Super Explosion Damage Range", 3f, new ConfigDescription("The damage range of a super explosion. Vanilla value is 3 btw.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 15f), Array.Empty<object>())); superExplosionDamage = configFile.Bind<int>("Super Explosion", "Super Explosion Damage", 40, new ConfigDescription("The damage of a super explosion. Vanilla value is 40 btw.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); normalExplosionMinStrength = configFile.Bind<float>("Normal Explosion", "Normal Explosion Min Strength", 45f, new ConfigDescription("The minimum strength of a normal explosion", (AcceptableValueBase)(object)new AcceptableValueRange<float>(15f, 45f), Array.Empty<object>())); normalExplosionAdditionalStrength = configFile.Bind<float>("Normal Explosion", "Normal Explosion Additional Strength", 0f, new ConfigDescription("The additional strength of a normal explosion. This is used to define the max strength value.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 25f), Array.Empty<object>())); normalExplosionKillRange = configFile.Bind<float>("Normal Explosion", "Normal Explosion Kill Range", 0.3f, new ConfigDescription("The kill range of a normal explosion. Vanilla value is 0.3 btw.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); normalExplosionDamageRange = configFile.Bind<float>("Normal Explosion", "Normal Explosion Damage Range", 3f, new ConfigDescription("The damage range of a normal explosion. Vanilla value is 3 btw.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 15f), Array.Empty<object>())); normalExplosionDamage = configFile.Bind<int>("Normal Explosion", "Normal Explosion Damage", 40, new ConfigDescription("The damage of a normal explosion. Vanilla value is 40 btw.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); eggName = configFile.Bind<string>("Edge Cases", "Egg Name", "Easter egg", "This option exists, because translation mods exist. Enter the translated Easter egg value here to make the mod work."); enableDebugLogs = configFile.Bind<bool>("Debugging", "Enable Debug Log", false, "Enable this, if you really hate your log. Lunx, you probably want to ignore this one!"); enableSellAudio = configFile.Bind<bool>("Selling", "Enable Sell Audio", true, "If set to true, will play a funny audio after selling. Only after selling easter eggs, of course :>"); } } public static class SellMyScrapChecker { public static bool IsSellMyScrapInstalled() { return Chainloader.PluginInfos.Values.Any((PluginInfo metadata) => metadata.Metadata.GUID.Contains("SellMyScrap")); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency("TestAccount666.TestAccountCore", "1.3.0")] [BepInPlugin("TestAccount666.SuperEgg", "SuperEgg", "1.3.1")] public class SuperEgg : BaseUnityPlugin { [CompilerGenerated] private sealed class <LoadSellAudioClip>d__17 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private string <assemblyDirectory>5__1; private string <audioPath>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadSellAudioClip>d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <assemblyDirectory>5__1 = null; <audioPath>5__2 = null; <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; <assemblyDirectory>5__1 = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); Logger.LogInfo((object)"Loading Sounds..."); Debug.Assert(<assemblyDirectory>5__1 != null, "assemblyDirectory != null"); <audioPath>5__2 = Path.Combine(<assemblyDirectory>5__1, "sounds"); <audioPath>5__2 = (Directory.Exists(<audioPath>5__2) ? <audioPath>5__2 : Path.Combine(<assemblyDirectory>5__1)); LoadSellAudioClip(<audioPath>5__2); 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 static GameObject superEggPrefab; public static SuperEgg Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("TestAccount666.SuperEgg"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(typeof(DeskCounterPatch)); Harmony.PatchAll(typeof(NetworkManagerPatch)); Harmony.PatchAll(typeof(StunGrenadeItemPatch)); if (SellMyScrapChecker.IsSellMyScrapInstalled()) { Harmony.PatchAll(typeof(SellMyScrapPatch)); } Logger.LogDebug((object)"Finished patching!"); } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; if (DependencyChecker.IsLobbyCompatibilityInstalled()) { Logger.LogInfo((object)"Found LobbyCompatibility Mod, initializing support :)"); LobbyCompatibilitySupport.Initialize("TestAccount666.SuperEgg", "1.3.1", (CompatibilityLevel)2, (VersionStrictness)2); } EggConfig.Initialize(((BaseUnityPlugin)this).Config); Patch(); Netcode.ExecuteNetcodePatcher(Assembly.GetExecutingAssembly()); ((MonoBehaviour)this).StartCoroutine(LoadSellAudioClip()); Logger.LogInfo((object)"TestAccount666.SuperEgg v1.3.1 has loaded!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } public static void LogDebug(object data) { if (EggConfig.enableDebugLogs.Value) { Logger.LogInfo(data); } } [IteratorStateMachine(typeof(<LoadSellAudioClip>d__17))] private static IEnumerator LoadSellAudioClip() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadSellAudioClip>d__17(0); } private static void LoadSellAudioClip(string audioPath) { Logger.LogInfo((object)"Loading Ghost Hand Sounds..."); string text = Path.Combine(audioPath, "EggSell"); text = (Directory.Exists(text) ? text : Path.Combine(audioPath)); AudioClip val = LoadAudioClipFromFile(new Uri(Path.Combine(text, "EggSell.ogg")), "EggSell"); if (val == null) { Logger.LogInfo((object)"Failed to load clip 'EggSell'!"); return; } AudioAppend.eggAudioClip = val; Logger.LogInfo((object)("Loaded clip '" + ((Object)val).name + "'!")); } private static AudioClip? LoadAudioClipFromFile(Uri filePath, string name) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(filePath, (AudioType)14); try { UnityWebRequestAsyncOperation val = audioClip.SendWebRequest(); while (!((AsyncOperation)val).isDone) { Thread.Sleep(100); } if ((int)audioClip.result != 1) { Logger.LogError((object)("Failed to load AudioClip: " + audioClip.error)); return null; } AudioClip content = DownloadHandlerAudioClip.GetContent(audioClip); ((Object)content).name = name; return content; } finally { ((IDisposable)audioClip)?.Dispose(); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "TestAccount666.SuperEgg"; public const string PLUGIN_NAME = "SuperEgg"; public const string PLUGIN_VERSION = "1.3.1"; } } namespace SuperEgg.Patch { [HarmonyPatch(typeof(DepositItemsDesk))] public static class DeskCounterPatch { public static DepositItemsDesk? depositItemsDesk; public static bool playAudio; [HarmonyPatch("Start")] [HarmonyPostfix] private static void SetDepositItemDesk(DepositItemsDesk __instance) { depositItemsDesk = __instance; } [HarmonyPatch("AddObjectToDeskClientRpc")] [HarmonyPostfix] private static void CheckForEggs(NetworkObjectReference grabbableObjectNetObject) { NetworkObject val = default(NetworkObject); if (!((NetworkObjectReference)(ref grabbableObjectNetObject)).TryGet(ref val, (NetworkManager)null)) { SuperEgg.Logger.LogError((object)"Could not find NetworkObject in the object that was placed on desk."); return; } GrabbableObject componentInChildren = ((Component)val).gameObject.GetComponentInChildren<GrabbableObject>(); TestGrabbableObject(componentInChildren); } internal static void TestGrabbableObject(GrabbableObject grabbableObject) { if ((Object)(object)grabbableObject == (Object)null || !Object.op_Implicit((Object)(object)grabbableObject)) { SuperEgg.Logger.LogError((object)"Could not find GrabbableObject in the object that was placed on desk."); return; } string itemName = grabbableObject.itemProperties.itemName; if (!itemName.Equals(EggConfig.eggName.Value)) { SuperEgg.LogDebug(itemName + " is not " + EggConfig.eggName.Value + "!"); } else { playAudio = true; } } [HarmonyPatch("MicrophoneSpeak")] [HarmonyPostfix] private static void AppendEggSounds(DepositItemsDesk __instance) { if (playAudio) { ((MonoBehaviour)__instance).StartCoroutine(AudioAppend.AppendSound(__instance.speakerAudio)); } } } [HarmonyPatch] public static class NetworkManagerPatch { internal const uint NETWORK_OBJECT_ID_HASH = 666578908u; [HarmonyPatch(typeof(NetworkManager), "SetSingleton")] [HarmonyPostfix] private static void AfterSingleton(NetworkManager __instance) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) SuperEgg.superEggPrefab = new GameObject("SuperEgg", new Type[2] { typeof(NetworkObject), typeof(EasterEgg) }); NetworkObject component = SuperEgg.superEggPrefab.GetComponent<NetworkObject>(); component.AutoObjectParentSync = true; component.DestroyWithScene = false; component.GlobalObjectIdHash = 666578908u; GameObject superEggPrefab = SuperEgg.superEggPrefab; ((Object)superEggPrefab).hideFlags = (HideFlags)(((Object)superEggPrefab).hideFlags | 0x3D); Object.DontDestroyOnLoad((Object)(object)SuperEgg.superEggPrefab); __instance.AddNetworkPrefab(SuperEgg.superEggPrefab); SuperEgg.LogDebug("Added SuperEgg Prefab!"); } } [HarmonyPatch] public static class SellMyScrapPatch { [HarmonyPatch(typeof(DepositItemsDeskPatch), "MicrophoneSpeakPatch")] [HarmonyPostfix] private static void AppendEggSounds() { if (AudioAppend.played || DeskCounterPatch.playAudio) { ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(AudioAppend.AppendSound(StartOfRound.Instance.speakerAudioSource)); } } [HarmonyPatch(typeof(SellCommandRequest), "GetScrapToSell")] [HarmonyPostfix] private static void CheckItems(ref ScrapToSell __result) { __result.GrabbableObjects.ForEach(DeskCounterPatch.TestGrabbableObject); } } [HarmonyPatch(typeof(StunGrenadeItem))] public static class StunGrenadeItemPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void AddEasterEggComponent(StunGrenadeItem __instance) { if (__instance == null || ((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer) { string itemName = ((GrabbableObject)__instance).itemProperties.itemName; if (!itemName.Equals(EggConfig.eggName.Value)) { SuperEgg.LogDebug(itemName + " is not " + EggConfig.eggName.Value + "!"); return; } GameObject val = Object.Instantiate<GameObject>(SuperEgg.superEggPrefab); ((Object)val).name = "SuperEgg"; EasterEgg component = val.GetComponent<EasterEgg>(); component.grabbableObject = (GrabbableObject)(object)__instance; DestroyListener destroyListener = ((Component)__instance).gameObject.AddComponent<DestroyListener>(); destroyListener.AddObject(val); NetworkObject component2 = val.GetComponent<NetworkObject>(); component2.Spawn(false); val.transform.parent = ((Component)__instance).gameObject.transform; } } [HarmonyPatch("ExplodeStunGrenade")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> ModifyEggs(IEnumerable<CodeInstruction> instructions) { //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); List<CodeInstruction> list2 = list.ToList(); try { for (int i = 0; i < list2.Count; i++) { CodeInstruction val = list2[i]; SuperEgg.LogDebug(val); if (!(val.opcode != OpCodes.Call) && val.operand is MethodInfo methodInfo && methodInfo.Name.Contains("SpawnExplosion")) { SuperEgg.LogDebug(string.Format("Injecting {0}.{1}!", typeof(EasterEgg), "SpawnExplosion")); MethodInfo methodInfo2 = AccessTools.Method(typeof(EasterEgg), "SpawnExplosion", new Type[9] { typeof(Vector3), typeof(bool), typeof(float), typeof(float), typeof(int), typeof(float), typeof(GameObject), typeof(bool), typeof(StunGrenadeItem) }, (Type[])null); list2[i] = new CodeInstruction(OpCodes.Call, (object)methodInfo2); list2.Insert(i, new CodeInstruction(OpCodes.Ldarg_0, (object)null)); break; } } return list2; } catch (Exception ex) { SuperEgg.Logger.LogFatal((object)"Error!"); Extensions.LogDetailed(ex, (string)null); return list; } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace TestAccount666.SuperEgg.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }