#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.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("DissonanceVoip")]
[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.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.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0+7d25fcd89f413cd30465fdfe07013939ca2cb36b")]
[assembly: AssemblyProduct("SuperEgg")]
[assembly: AssemblyTitle("TestAccount666.SuperEgg")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
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
{
public static bool played;
public static AudioClip? eggAudioClip;
public static IEnumerator AppendSound(AudioSource audioSource)
{
AudioSource audioSource2 = audioSource;
if (!EggConfig.enableSellAudio.Value || eggAudioClip == null || !Object.op_Implicit((Object)(object)eggAudioClip))
{
played = false;
DeskCounterPatch.playAudio = false;
yield break;
}
played = true;
yield return (object)new WaitUntil((Func<bool>)(() => !audioSource2.isPlaying));
yield return (object)new WaitForSeconds(0.5f);
audioSource2.PlayOneShot(eggAudioClip, 1f);
yield return (object)new WaitUntil((Func<bool>)(() => !audioSource2.isPlaying));
played = false;
DeskCounterPatch.playAudio = false;
}
}
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_00d7: 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 != 2 && (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 == 2 && (networkManager.IsClient || networkManager.IsHost))
{
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_02b5: 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))
{
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_0127: 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 != 2 && (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 == 2 && (networkManager.IsClient || networkManager.IsHost))
{
Landmine.SpawnExplosion(explosionPosition, false, killRange, damageRange, nonLethalDamage, physicsForce, (GameObject)null, false);
}
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_EasterEgg()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(3000843006u, new RpcReceiveHandler(__rpc_handler_3000843006));
NetworkManager.__rpc_func_table.Add(3086464309u, new RpcReceiveHandler(__rpc_handler_3086464309));
NetworkManager.__rpc_func_table.Add(3034908750u, new RpcReceiveHandler(__rpc_handler_3034908750));
}
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)2;
((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)2;
((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.2.0")]
public class SuperEgg : BaseUnityPlugin
{
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.2.0", (CompatibilityLevel)2, (VersionStrictness)2);
}
EggConfig.Initialize(((BaseUnityPlugin)this).Config);
Patch();
Netcode.ExecuteNetcodePatcher(Assembly.GetExecutingAssembly());
((MonoBehaviour)this).StartCoroutine(LoadSellAudioClip());
Logger.LogInfo((object)"TestAccount666.SuperEgg v1.2.0 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);
}
}
private static IEnumerator LoadSellAudioClip()
{
string assemblyDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
Logger.LogInfo((object)"Loading Sounds...");
Debug.Assert(assemblyDirectory != null, "assemblyDirectory != null");
string audioPath2 = Path.Combine(assemblyDirectory, "sounds");
audioPath2 = (Directory.Exists(audioPath2) ? audioPath2 : Path.Combine(assemblyDirectory));
LoadSellAudioClip(audioPath2);
yield break;
}
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.2.0";
}
}
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(typeof(DepositItemsDeskPatch))]
public static class SellMyScrapPatch
{
[HarmonyPatch("MicrophoneSpeakPatch")]
[HarmonyPostfix]
private static void AppendEggSounds()
{
if (AudioAppend.played || DeskCounterPatch.playAudio)
{
((MonoBehaviour)StartOfRound.Instance).StartCoroutine(AudioAppend.AppendSound(StartOfRound.Instance.speakerAudioSource));
}
}
[HarmonyPatch("PlaceItemOnCounter")]
[HarmonyPostfix]
private static void CheckForEggs(GrabbableObject grabbableObject)
{
DeskCounterPatch.TestGrabbableObject(grabbableObject);
}
}
[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_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Expected O, but got Unknown
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Expected O, but got Unknown
List<CodeInstruction> list = instructions.ToList();
List<CodeInstruction> list2 = list;
List<CodeInstruction> list3 = new List<CodeInstruction>(list2.Count);
list3.AddRange(list2);
List<CodeInstruction> list4 = list3;
try
{
for (int i = 0; i < list4.Count; i++)
{
CodeInstruction val = list4[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);
list4[i] = new CodeInstruction(OpCodes.Call, (object)methodInfo2);
list4.Insert(i, new CodeInstruction(OpCodes.Ldarg_0, (object)null));
break;
}
}
return list4;
}
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 TestAccount666.SuperEgg.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}