using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using Ganimedes.Configuration;
using Ganimedes.NetcodePatcher;
using Ganimedes.Patches;
using HarmonyLib;
using LethalLib;
using LethalLib.Modules;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Ganimedes")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Ganimedes")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9c26ac22-c3d0-4403-a753-4338b8909d96")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: NetcodePatchedAssembly]
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace Ganimedes
{
[Serializable]
public class Config : SyncedInstance<Config>
{
public int routeCost;
public float mp3Volume;
public bool mp3CustomSongs;
public bool mp3CustomSongsDirectory;
public bool mp3DefaultSongsChanges;
public bool mp3BoomboxVanilla;
public bool mp3song1;
public bool mp3song2;
public bool mp3song3;
public bool mp3song4;
public bool mp3song5;
public bool mp3song6;
public bool mp3song7;
public bool mp3song8;
public bool mp3song9;
public bool mp3song10;
public Config(ConfigFile cfg)
{
InitInstance(this);
routeCost = cfg.Bind<int>("General", "RouteCost", 2000, "Price to go to Ganimedes").Value;
mp3Volume = (float)(cfg.Bind<double>("Mp3 player", "Volume", 70.0, "Change the volume of the Mp3 Player (0-100)").Value / 100.0);
if (mp3Volume > 1f)
{
mp3Volume = 1f;
}
if (mp3Volume < 0f)
{
mp3Volume = 0f;
}
mp3CustomSongs = cfg.Bind<bool>("Mp3 player", "CustomSongs", true, "Enable it to search songs to add to the Mp3 player (the default folder is 'BepInEx\\Plugins\\Ganimedes\\CustomSongs')").Value;
mp3CustomSongsDirectory = cfg.Bind<bool>("Mp3 player", "CustomSongsBoomboxDirectory", false, "Enable it to use the same directory that Custom Boombox Music for custom songs ('BepInEx\\Custom Songs\\Boombox Music')").Value;
mp3DefaultSongsChanges = cfg.Bind<bool>("Mp3 player", "DefaultSongsChanges", true, "Enable it to eliminate the default songs marked as false").Value;
mp3BoomboxVanilla = cfg.Bind<bool>("Mp3 player", "BoomboxVanilla", false, "Enable it to add the vanilla boombox music to the Mp3 player (automatically true if the mp3 player is empty)").Value;
mp3song1 = cfg.Bind<bool>("Mp3 player", "Enable Super Battle Train - Waterflame song", true, "Desactivate it to eliminate 'Super Battle Train - Waterflame' song of the Mp3 player").Value;
mp3song2 = cfg.Bind<bool>("Mp3 player", "Enable Payphone - Maroon 5 song", true, "Desactivate it to eliminate 'Payphone - Maroon 5' song of the Mp3 player").Value;
mp3song3 = cfg.Bind<bool>("Mp3 player", "Enable Im good (Blue) - David Guetta, Bebe Rexha song", true, "Desactivate it to eliminate 'I'm good (Blue) - David Guetta, Bebe Rexha' song of the Mp3 player").Value;
mp3song4 = cfg.Bind<bool>("Mp3 player", "Enable Pandoras Music Box - Nox Arcana song", true, "Desactivate it to eliminate 'Pandora's Music Box - Nox Arcana' song of the Mp3 player").Value;
mp3song5 = cfg.Bind<bool>("Mp3 player", "Enable Lovumba - Daddy Yankee song", true, "Desactivate it to eliminate 'Lovumba - Daddy Yankee' song of the Mp3 player").Value;
mp3song6 = cfg.Bind<bool>("Mp3 player", "Enable Splashing Around - The Green Orbs song", true, "Desactivate it to eliminate 'Splashing Around - The Green Orbs' song of the Mp3 player").Value;
mp3song7 = cfg.Bind<bool>("Mp3 player", "Enable Rosas - La Oreja de Van Gogh song", true, "Desactivate it to eliminate 'Rosas - La Oreja de Van Gogh' song of the Mp3 player").Value;
mp3song8 = cfg.Bind<bool>("Mp3 player", "Enable Hikaru Nara - Goose House song", true, "Desactivate it to eliminate 'Hikaru Nara - Goose House' song of the Mp3 player").Value;
mp3song9 = cfg.Bind<bool>("Mp3 player", "Enable Quevedo - Bizarrap Music Sessions #52 song", true, "Desactivate it to eliminate 'Quevedo - Bizarrap Music Sessions #52' song of the Mp3 player").Value;
mp3song10 = cfg.Bind<bool>("Mp3 player", "Enable Numb - Linkin Park song", true, "Desactivate it to eliminate 'Numb - Linkin Park' song of the Mp3 player").Value;
}
public static void RequestSync()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
if (!SyncedInstance<Config>.IsClient)
{
return;
}
FastBufferWriter val = default(FastBufferWriter);
((FastBufferWriter)(ref val))..ctor(SyncedInstance<Config>.IntSize, (Allocator)2, -1);
try
{
SyncedInstance<Config>.MessageManager.SendNamedMessage("Ganimedes_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3);
}
finally
{
((IDisposable)(FastBufferWriter)(ref val)).Dispose();
}
}
public static void OnRequestSync(ulong clientId, FastBufferReader _)
{
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
if (!SyncedInstance<Config>.IsHost)
{
return;
}
Plugin.logger.LogInfo((object)$"Config sync request received from client: {clientId}");
byte[] array = SyncedInstance<Config>.SerializeToBytes(SyncedInstance<Config>.Instance);
int num = array.Length;
FastBufferWriter val = default(FastBufferWriter);
((FastBufferWriter)(ref val))..ctor(num + SyncedInstance<Config>.IntSize, (Allocator)2, -1);
try
{
((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives));
((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0);
SyncedInstance<Config>.MessageManager.SendNamedMessage("Ganimedes_OnReceiveConfigSync", clientId, val, (NetworkDelivery)3);
}
catch (Exception arg)
{
Plugin.logger.LogInfo((object)$"Error occurred syncing config with client: {clientId}\n{arg}");
}
finally
{
((IDisposable)(FastBufferWriter)(ref val)).Dispose();
}
}
public static void OnReceiveSync(ulong _, FastBufferReader reader)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
if (!((FastBufferReader)(ref reader)).TryBeginRead(SyncedInstance<Config>.IntSize))
{
Plugin.logger.LogError((object)"Config sync error: Could not begin reading buffer.");
return;
}
int num = default(int);
((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives));
if (!((FastBufferReader)(ref reader)).TryBeginRead(num))
{
Plugin.logger.LogError((object)"Config sync error: Host could not sync.");
return;
}
byte[] data = new byte[num];
((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0);
SyncedInstance<Config>.SyncInstance(data);
Plugin.logger.LogInfo((object)"Successfully synced config with host.");
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
public static void InitializeLocalPlayer()
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Expected O, but got Unknown
if (SyncedInstance<Config>.IsHost)
{
SyncedInstance<Config>.MessageManager.RegisterNamedMessageHandler("Ganimedes_OnRequestConfigSync", new HandleNamedMessageDelegate(OnRequestSync));
SyncedInstance<Config>.Synced = true;
}
else
{
SyncedInstance<Config>.Synced = false;
SyncedInstance<Config>.MessageManager.RegisterNamedMessageHandler("Ganimedes_OnReceiveConfigSync", new HandleNamedMessageDelegate(OnReceiveSync));
RequestSync();
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")]
public static void PlayerLeave()
{
SyncedInstance<Config>.RevertSync();
}
}
internal class PickableItem : GrabbableObject, IHittable
{
private GameObject objectInPresent;
public ParticleSystem PoofParticle;
public AudioSource presentAudio;
public AudioClip openGiftAudio;
public List<SpawnableItemWithRarity> spawnableItems;
private PlayerControllerB previousPlayerHeldBy;
private bool hasUsedGift;
private int objectInPresentValue;
public override void Start()
{
((GrabbableObject)this).Start();
Random random = new Random(StartOfRound.Instance.randomMapSeed + (int)base.targetFloorPosition.x + (int)base.targetFloorPosition.y + (int)((NetworkBehaviour)this).NetworkObjectId);
if (!((NetworkBehaviour)this).IsServer)
{
return;
}
int num = 0;
for (int i = 0; i < spawnableItems.Count; i++)
{
num += spawnableItems[i].rarity;
}
int num2 = random.Next(1, num + 1);
int num3 = 0;
for (int j = 0; j < spawnableItems.Count; j++)
{
num3 += spawnableItems[j].rarity;
if (num3 >= num2)
{
Item val = ((!spawnableItems[j].spawnableItem.itemName.Equals("Gold bar")) ? spawnableItems[j].spawnableItem : StartOfRound.Instance.allItemsList.itemsList.ElementAt(35));
objectInPresent = val.spawnPrefab;
objectInPresentValue = (int)((float)random.Next(val.minValue, val.maxValue + 1) * RoundManager.Instance.scrapValueMultiplier);
break;
}
}
}
public override void EquipItem()
{
((GrabbableObject)this).EquipItem();
previousPlayerHeldBy = base.playerHeldBy;
}
[ServerRpc(RequireOwnership = false)]
public void OpenGiftBoxServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: 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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2018229708u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2018229708u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
{
return;
}
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
GameObject val3 = null;
int num = 0;
Vector3 val4 = Vector3.zero;
if ((Object)(object)objectInPresent == (Object)null)
{
Debug.LogError((object)"Error: There is no object in gift box!");
}
else
{
Transform val5 = ((((!((Object)(object)base.playerHeldBy != (Object)null) || !base.playerHeldBy.isInElevator) && !StartOfRound.Instance.inShipPhase) || !((Object)(object)RoundManager.Instance.spawnedScrapContainer != (Object)null)) ? StartOfRound.Instance.elevatorTransform : RoundManager.Instance.spawnedScrapContainer);
val4 = ((Component)this).transform.position + Vector3.up * 0.25f;
val3 = Object.Instantiate<GameObject>(objectInPresent, val4, Quaternion.identity, val5);
GrabbableObject component = val3.GetComponent<GrabbableObject>();
component.startFallingPosition = val4;
((MonoBehaviour)this).StartCoroutine(SetObjectToHitGroundSFX(component));
component.targetFloorPosition = component.GetItemFloorPosition(((Component)this).transform.position);
if ((Object)(object)previousPlayerHeldBy != (Object)null && previousPlayerHeldBy.isInHangarShipRoom)
{
previousPlayerHeldBy.SetItemInElevator(true, true, component);
}
num = objectInPresentValue;
component.SetScrapValue(num);
((NetworkBehaviour)component).NetworkObject.Spawn(false);
}
if ((Object)(object)val3 != (Object)null)
{
OpenGiftBoxClientRpc(NetworkObjectReference.op_Implicit(val3.GetComponent<NetworkObject>()), num, val4);
}
OpenGiftBoxNoPresentClientRpc();
}
private IEnumerator SetObjectToHitGroundSFX(GrabbableObject gObject)
{
yield return (object)new WaitForEndOfFrame();
Debug.Log((object)("Setting " + gObject.itemProperties.itemName + " hit ground to false"));
gObject.reachedFloorTarget = false;
gObject.hasHitGround = false;
gObject.fallTime = 0f;
}
[ClientRpc]
public void OpenGiftBoxNoPresentClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1094256915u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1094256915u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
PoofParticle.Play();
presentAudio.PlayOneShot(openGiftAudio);
WalkieTalkie.TransmitOneShotAudio(presentAudio, openGiftAudio, 1f);
RoundManager.Instance.PlayAudibleNoise(((Component)presentAudio).transform.position, 8f, 0.5f, 0, base.isInShipRoom && StartOfRound.Instance.hangarDoorsClosed, 0);
DestroyObject();
}
}
}
[ClientRpc]
public void OpenGiftBoxClientRpc(NetworkObjectReference netObjectRef, int presentValue, Vector3 startFallingPos)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: 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_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: 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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(463077100u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjectRef, default(ForNetworkSerializable));
BytePacker.WriteValueBitPacked(val2, presentValue);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref startFallingPos);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 463077100u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
PoofParticle.Play();
presentAudio.PlayOneShot(openGiftAudio);
WalkieTalkie.TransmitOneShotAudio(presentAudio, openGiftAudio, 1f);
RoundManager.Instance.PlayAudibleNoise(((Component)presentAudio).transform.position, 8f, 0.5f, 0, base.isInShipRoom && StartOfRound.Instance.hangarDoorsClosed, 0);
DestroyObject();
if (!((NetworkBehaviour)this).IsServer)
{
((MonoBehaviour)this).StartCoroutine(waitForGiftPresentToSpawnOnClient(netObjectRef, presentValue, startFallingPos));
}
}
}
private IEnumerator waitForGiftPresentToSpawnOnClient(NetworkObjectReference netObjectRef, int presentValue, Vector3 startFallingPos)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: 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)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
NetworkObject netObject = null;
float startTime = Time.realtimeSinceStartup;
while (Time.realtimeSinceStartup - startTime < 8f && !((NetworkObjectReference)(ref netObjectRef)).TryGet(ref netObject, (NetworkManager)null))
{
yield return (object)new WaitForSeconds(0.03f);
}
if ((Object)(object)netObject == (Object)null)
{
Debug.Log((object)"No network object found");
yield break;
}
yield return (object)new WaitForEndOfFrame();
GrabbableObject component = ((Component)netObject).GetComponent<GrabbableObject>();
RoundManager instance = RoundManager.Instance;
instance.totalScrapValueInLevel -= (float)base.scrapValue;
RoundManager instance2 = RoundManager.Instance;
instance2.totalScrapValueInLevel += (float)component.scrapValue;
component.SetScrapValue(presentValue);
component.startFallingPosition = startFallingPos;
component.fallTime = 0f;
component.hasHitGround = false;
component.reachedFloorTarget = false;
if ((Object)(object)previousPlayerHeldBy != (Object)null && previousPlayerHeldBy.isInHangarShipRoom)
{
previousPlayerHeldBy.SetItemInElevator(true, true, component);
}
if (!netObject.IsSpawned)
{
netObject.Spawn(false);
}
}
public override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
protected internal string __getTypeName()
{
return "PickableItem";
}
public bool Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
{
if (force > 1)
{
hasUsedGift = true;
OpenGiftBoxServerRpc();
}
return true;
}
public virtual void DestroyObject()
{
base.grabbable = false;
base.grabbableToEnemies = false;
base.deactivated = true;
if ((Object)(object)base.radarIcon != (Object)null)
{
Object.Destroy((Object)(object)((Component)base.radarIcon).gameObject);
}
MeshRenderer[] componentsInChildren = ((Component)this).gameObject.GetComponentsInChildren<MeshRenderer>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
Object.Destroy((Object)(object)componentsInChildren[i]);
}
Collider[] componentsInChildren2 = ((Component)this).gameObject.GetComponentsInChildren<Collider>();
for (int j = 0; j < componentsInChildren2.Length; j++)
{
Object.Destroy((Object)(object)componentsInChildren2[j]);
}
}
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(2018229708u, new RpcReceiveHandler(__rpc_handler_2018229708), "OpenGiftBoxServerRpc");
((NetworkBehaviour)this).__registerRpc(1094256915u, new RpcReceiveHandler(__rpc_handler_1094256915), "OpenGiftBoxNoPresentClientRpc");
((NetworkBehaviour)this).__registerRpc(463077100u, new RpcReceiveHandler(__rpc_handler_463077100), "OpenGiftBoxClientRpc");
((GrabbableObject)this).__initializeRpcs();
}
private static void __rpc_handler_2018229708(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((PickableItem)(object)target).OpenGiftBoxServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1094256915(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((PickableItem)(object)target).OpenGiftBoxNoPresentClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_463077100(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_003e: 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)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
NetworkObjectReference netObjectRef = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjectRef, default(ForNetworkSerializable));
int presentValue = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref presentValue);
Vector3 startFallingPos = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref startFallingPos);
target.__rpc_exec_stage = (__RpcExecStage)1;
((PickableItem)(object)target).OpenGiftBoxClientRpc(netObjectRef, presentValue, startFallingPos);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "PickableItem";
}
}
internal class CustomGiftBoxItem : GrabbableObject
{
private GameObject objectInPresent;
public ParticleSystem PoofParticle;
public AudioSource presentAudio;
public AudioClip openGiftAudio;
public List<SpawnableItemWithRarity> spawnableItems;
public InteractTrigger trigger;
public DoorLock doorLock;
private PlayerControllerB previousPlayerHeldBy;
private bool hasUsedGift;
private int objectInPresentValue;
public override void Start()
{
((GrabbableObject)this).Start();
Random random = new Random(StartOfRound.Instance.randomMapSeed + (int)base.targetFloorPosition.x + (int)base.targetFloorPosition.y + (int)((NetworkBehaviour)this).NetworkObjectId);
if (!((NetworkBehaviour)this).IsServer)
{
return;
}
int num = 0;
for (int i = 0; i < spawnableItems.Count; i++)
{
num += spawnableItems[i].rarity;
}
int num2 = random.Next(1, num + 1);
int num3 = 0;
for (int j = 0; j < spawnableItems.Count; j++)
{
num3 += spawnableItems[j].rarity;
if (num3 >= num2)
{
Item val = ((!spawnableItems[j].spawnableItem.itemName.Equals("Gold bar")) ? spawnableItems[j].spawnableItem : StartOfRound.Instance.allItemsList.itemsList.ElementAt(35));
objectInPresent = val.spawnPrefab;
objectInPresentValue = (int)((float)random.Next(val.minValue + 25, val.maxValue + 35) * RoundManager.Instance.scrapValueMultiplier);
break;
}
}
}
public override void EquipItem()
{
((GrabbableObject)this).EquipItem();
previousPlayerHeldBy = base.playerHeldBy;
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
if (Object.op_Implicit((Object)(object)doorLock))
{
if (!doorLock.isLocked)
{
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (!((Object)(object)base.playerHeldBy == (Object)null) && !hasUsedGift)
{
hasUsedGift = true;
base.playerHeldBy.activatingItem = true;
OpenGiftBoxServerRpc();
}
}
}
else
{
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (!((Object)(object)base.playerHeldBy == (Object)null) && !hasUsedGift)
{
hasUsedGift = true;
base.playerHeldBy.activatingItem = true;
OpenGiftBoxServerRpc();
}
}
}
public override void PocketItem()
{
((GrabbableObject)this).PocketItem();
base.playerHeldBy.activatingItem = false;
}
[ServerRpc(RequireOwnership = false)]
public void OpenGiftBoxServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: 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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3074326675u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3074326675u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
{
return;
}
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
GameObject val3 = null;
int num = 0;
Vector3 val4 = Vector3.zero;
if ((Object)(object)objectInPresent == (Object)null)
{
Debug.LogError((object)"Error: There is no object in gift box!");
}
else
{
Transform val5 = ((((!((Object)(object)base.playerHeldBy != (Object)null) || !base.playerHeldBy.isInElevator) && !StartOfRound.Instance.inShipPhase) || !((Object)(object)RoundManager.Instance.spawnedScrapContainer != (Object)null)) ? StartOfRound.Instance.elevatorTransform : RoundManager.Instance.spawnedScrapContainer);
val4 = ((Component)this).transform.position + Vector3.up * 0.25f;
val3 = Object.Instantiate<GameObject>(objectInPresent, val4, Quaternion.identity, val5);
GrabbableObject component = val3.GetComponent<GrabbableObject>();
component.startFallingPosition = val4;
((MonoBehaviour)this).StartCoroutine(SetObjectToHitGroundSFX(component));
component.targetFloorPosition = component.GetItemFloorPosition(((Component)this).transform.position);
if ((Object)(object)previousPlayerHeldBy != (Object)null && previousPlayerHeldBy.isInHangarShipRoom)
{
previousPlayerHeldBy.SetItemInElevator(true, true, component);
}
num = objectInPresentValue;
component.SetScrapValue(num);
((NetworkBehaviour)component).NetworkObject.Spawn(false);
}
if ((Object)(object)val3 != (Object)null)
{
OpenGiftBoxClientRpc(NetworkObjectReference.op_Implicit(val3.GetComponent<NetworkObject>()), num, val4);
}
OpenGiftBoxNoPresentClientRpc();
}
private IEnumerator SetObjectToHitGroundSFX(GrabbableObject gObject)
{
yield return (object)new WaitForEndOfFrame();
Debug.Log((object)("Setting " + gObject.itemProperties.itemName + " hit ground to false"));
gObject.reachedFloorTarget = false;
gObject.hasHitGround = false;
gObject.fallTime = 0f;
}
[ClientRpc]
public void OpenGiftBoxNoPresentClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: 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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2409335217u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2409335217u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
PoofParticle.Play();
presentAudio.PlayOneShot(openGiftAudio);
WalkieTalkie.TransmitOneShotAudio(presentAudio, openGiftAudio, 1f);
RoundManager.Instance.PlayAudibleNoise(((Component)presentAudio).transform.position, 8f, 0.5f, 0, base.isInShipRoom && StartOfRound.Instance.hangarDoorsClosed, 0);
if ((Object)(object)base.playerHeldBy != (Object)null)
{
base.playerHeldBy.activatingItem = false;
((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy);
}
}
}
[ClientRpc]
public void OpenGiftBoxClientRpc(NetworkObjectReference netObjectRef, int presentValue, Vector3 startFallingPos)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: 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_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: 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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2346037595u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjectRef, default(ForNetworkSerializable));
BytePacker.WriteValueBitPacked(val2, presentValue);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref startFallingPos);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2346037595u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
PoofParticle.Play();
presentAudio.PlayOneShot(openGiftAudio);
WalkieTalkie.TransmitOneShotAudio(presentAudio, openGiftAudio, 1f);
RoundManager.Instance.PlayAudibleNoise(((Component)presentAudio).transform.position, 8f, 0.5f, 0, base.isInShipRoom && StartOfRound.Instance.hangarDoorsClosed, 0);
if ((Object)(object)base.playerHeldBy != (Object)null)
{
base.playerHeldBy.activatingItem = false;
((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy);
}
if (!((NetworkBehaviour)this).IsServer)
{
((MonoBehaviour)this).StartCoroutine(waitForGiftPresentToSpawnOnClient(netObjectRef, presentValue, startFallingPos));
}
}
}
private IEnumerator waitForGiftPresentToSpawnOnClient(NetworkObjectReference netObjectRef, int presentValue, Vector3 startFallingPos)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: 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)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
NetworkObject netObject = null;
float startTime = Time.realtimeSinceStartup;
while (Time.realtimeSinceStartup - startTime < 8f && !((NetworkObjectReference)(ref netObjectRef)).TryGet(ref netObject, (NetworkManager)null))
{
yield return (object)new WaitForSeconds(0.03f);
}
if ((Object)(object)netObject == (Object)null)
{
Debug.Log((object)"No network object found");
yield break;
}
yield return (object)new WaitForEndOfFrame();
GrabbableObject component = ((Component)netObject).GetComponent<GrabbableObject>();
RoundManager instance = RoundManager.Instance;
instance.totalScrapValueInLevel -= (float)base.scrapValue;
RoundManager instance2 = RoundManager.Instance;
instance2.totalScrapValueInLevel += (float)component.scrapValue;
component.SetScrapValue(presentValue);
component.startFallingPosition = startFallingPos;
component.fallTime = 0f;
component.hasHitGround = false;
component.reachedFloorTarget = false;
if ((Object)(object)previousPlayerHeldBy != (Object)null && previousPlayerHeldBy.isInHangarShipRoom)
{
previousPlayerHeldBy.SetItemInElevator(true, true, component);
}
if (!netObject.IsSpawned)
{
netObject.Spawn(false);
}
}
public override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
protected internal string __getTypeName()
{
return "CustomGiftBoxItem";
}
public override void Update()
{
((GrabbableObject)this).Update();
if (!Object.op_Implicit((Object)(object)doorLock) || !doorLock.isLocked)
{
return;
}
if (!doorLock.isPickingLock)
{
if (Object.op_Implicit((Object)(object)trigger))
{
GrabbableObject currentlyHeldObjectServer = GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer;
KeyItem val = null;
if ((Object)(object)base.playerHeldBy != (Object)null)
{
bool flag = (Object)(object)currentlyHeldObjectServer != (Object)null && ((Component)currentlyHeldObjectServer).TryGetComponent<KeyItem>(ref val);
trigger.disabledHoverTip = (flag ? "Unlock chest : [ LMB ]" : "Locked");
return;
}
LockPicker val2 = null;
bool flag2 = (Object)(object)currentlyHeldObjectServer != (Object)null && (((Component)currentlyHeldObjectServer).TryGetComponent<KeyItem>(ref val) || ((Component)currentlyHeldObjectServer).TryGetComponent<LockPicker>(ref val2));
trigger.disabledHoverTip = (flag2 ? "Unlock chest : [ LMB ]" : "Locked");
base.grabbable = true;
base.grabbableToEnemies = true;
}
}
else
{
if (doorLock.playersPickingDoor > 0)
{
doorLock.playerPickingLockProgress = Mathf.Clamp(doorLock.playerPickingLockProgress + (float)doorLock.playersPickingDoor * 0.85f * Time.deltaTime, 1f, 3.5f);
}
trigger.timeToHoldSpeedMultiplier = Mathf.Clamp((float)doorLock.playersPickingDoor * 0.85f, 1f, 3.5f);
DoorLock obj = doorLock;
obj.lockPickTimeLeft -= Time.deltaTime;
trigger.disabledHoverTip = $"Picking lock: {(int)doorLock.lockPickTimeLeft} sec.";
if (((NetworkBehaviour)this).IsServer && doorLock.lockPickTimeLeft < 0f)
{
UnlockChest();
UnlockChestServerRpc();
}
}
}
public void UnlockChest()
{
doorLock.doorLockSFX.Stop();
doorLock.doorLockSFX.PlayOneShot(doorLock.unlockSFX);
if (doorLock.isLocked)
{
((Component)trigger).gameObject.SetActive(false);
doorLock.isPickingLock = false;
base.grabbable = true;
base.grabbableToEnemies = true;
doorLock.isLocked = false;
Debug.Log((object)"Unlocking chest");
}
}
public void UnlockChestSyncWithServer()
{
if (doorLock.isLocked)
{
UnlockChest();
UnlockChestServerRpc();
}
}
[ServerRpc(RequireOwnership = false)]
public void UnlockChestServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1509870645u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1509870645u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
UnlockChestClientRpc();
}
}
}
[ClientRpc]
public void UnlockChestClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3101790943u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3101790943u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
UnlockChest();
}
}
}
public void TryPickingLock()
{
if (doorLock.isLocked)
{
HUDManager.Instance.holdFillAmount = doorLock.playerPickingLockProgress;
if (!doorLock.localPlayerPickingLock)
{
doorLock.localPlayerPickingLock = true;
PlayerPickLockServerRpc();
}
}
}
public void StopPickingLock()
{
if (doorLock.localPlayerPickingLock)
{
doorLock.localPlayerPickingLock = false;
if (doorLock.playersPickingDoor == 1)
{
doorLock.playerPickingLockProgress = Mathf.Clamp(doorLock.playerPickingLockProgress - 1f, 0f, 45f);
}
PlayerStopPickingLockServerRpc();
}
}
[ServerRpc(RequireOwnership = false)]
public void PlayerStopPickingLockServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(990236973u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 990236973u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
PlayerStopPickingLockClientRpc();
}
}
}
[ClientRpc]
public void PlayerStopPickingLockClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2465752461u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2465752461u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
doorLock.doorLockSFX.Stop();
doorLock.playersPickingDoor = Mathf.Clamp(doorLock.playersPickingDoor - 1, 0, 4);
}
}
}
[ServerRpc(RequireOwnership = false)]
public void PlayerPickLockServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2530714241u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2530714241u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
PlayerPickLockClientRpc();
}
}
}
[ClientRpc]
public void PlayerPickLockClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(928987699u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 928987699u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
doorLock.doorLockSFX.clip = doorLock.pickingLockSFX;
doorLock.doorLockSFX.Play();
doorLock.playersPickingDoor = Mathf.Clamp(doorLock.playersPickingDoor + 1, 0, 4);
}
}
}
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
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Expected O, but got Unknown
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Expected O, but got Unknown
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Expected O, but got Unknown
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(3074326675u, new RpcReceiveHandler(__rpc_handler_3074326675), "OpenGiftBoxServerRpc");
((NetworkBehaviour)this).__registerRpc(2409335217u, new RpcReceiveHandler(__rpc_handler_2409335217), "OpenGiftBoxNoPresentClientRpc");
((NetworkBehaviour)this).__registerRpc(2346037595u, new RpcReceiveHandler(__rpc_handler_2346037595), "OpenGiftBoxClientRpc");
((NetworkBehaviour)this).__registerRpc(1509870645u, new RpcReceiveHandler(__rpc_handler_1509870645), "UnlockChestServerRpc");
((NetworkBehaviour)this).__registerRpc(3101790943u, new RpcReceiveHandler(__rpc_handler_3101790943), "UnlockChestClientRpc");
((NetworkBehaviour)this).__registerRpc(990236973u, new RpcReceiveHandler(__rpc_handler_990236973), "PlayerStopPickingLockServerRpc");
((NetworkBehaviour)this).__registerRpc(2465752461u, new RpcReceiveHandler(__rpc_handler_2465752461), "PlayerStopPickingLockClientRpc");
((NetworkBehaviour)this).__registerRpc(2530714241u, new RpcReceiveHandler(__rpc_handler_2530714241), "PlayerPickLockServerRpc");
((NetworkBehaviour)this).__registerRpc(928987699u, new RpcReceiveHandler(__rpc_handler_928987699), "PlayerPickLockClientRpc");
((GrabbableObject)this).__initializeRpcs();
}
private static void __rpc_handler_3074326675(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((CustomGiftBoxItem)(object)target).OpenGiftBoxServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2409335217(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((CustomGiftBoxItem)(object)target).OpenGiftBoxNoPresentClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2346037595(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_003e: 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)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
NetworkObjectReference netObjectRef = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjectRef, default(ForNetworkSerializable));
int presentValue = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref presentValue);
Vector3 startFallingPos = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref startFallingPos);
target.__rpc_exec_stage = (__RpcExecStage)1;
((CustomGiftBoxItem)(object)target).OpenGiftBoxClientRpc(netObjectRef, presentValue, startFallingPos);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1509870645(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((CustomGiftBoxItem)(object)target).UnlockChestServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3101790943(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((CustomGiftBoxItem)(object)target).UnlockChestClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_990236973(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((CustomGiftBoxItem)(object)target).PlayerStopPickingLockServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2465752461(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((CustomGiftBoxItem)(object)target).PlayerStopPickingLockClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2530714241(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((CustomGiftBoxItem)(object)target).PlayerPickLockServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_928987699(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((CustomGiftBoxItem)(object)target).PlayerPickLockClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "CustomGiftBoxItem";
}
}
[BepInPlugin("Boniato.Ganimedes", "Ganimedes", "2.7.0")]
public class GanimedesBase : BaseUnityPlugin
{
private const string modGUID = "Boniato.Ganimedes";
private const string modName = "Ganimedes";
private const string modVersion = "2.7.0";
private readonly Harmony harmony = new Harmony("Boniato.Ganimedes");
internal static GanimedesBase instance;
internal static ManualLogSource mls;
public static Config cfg { get; internal set; }
private void Awake()
{
if ((Object)(object)instance == (Object)null)
{
instance = this;
}
mls = Logger.CreateLogSource("Boniato.Ganimedes");
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
cfg = new Config(((BaseUnityPlugin)this).Config);
harmony.PatchAll(typeof(Config));
harmony.PatchAll(typeof(RouteCostPatch));
harmony.PatchAll(typeof(BoomboxPatches));
harmony.PatchAll(typeof(LockPickerPatch));
harmony.PatchAll(typeof(DoorLockPatch));
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ganimedesscrap");
AssetBundle val = AssetBundle.LoadFromFile(text);
List<Item> list = new List<Item>
{
val.LoadAsset<Item>("Assets/Scenes/Ganimedes/items/scraps/bronzebar/BronzeBar.asset"),
val.LoadAsset<Item>("Assets/Scenes/Ganimedes/items/scraps/silverbar/SilverBar.asset"),
val.LoadAsset<Item>("Assets/Scenes/Ganimedes/items/scraps/sapphire/Sapphire.asset"),
val.LoadAsset<Item>("Assets/Scenes/Ganimedes/items/scraps/emerald/Emerald.asset"),
val.LoadAsset<Item>("Assets/Scenes/Ganimedes/items/scraps/ruby/Ruby.asset"),
val.LoadAsset<Item>("Assets/Scenes/Ganimedes/items/scraps/diamond/Diamond.asset"),
val.LoadAsset<Item>("Assets/Scenes/Ganimedes/items/scraps/ganimediteore/GanimediteOre.asset"),
val.LoadAsset<Item>("Assets/Scenes/Ganimedes/items/scraps/ganimedite/Ganimedite.asset"),
val.LoadAsset<Item>("Assets/Scenes/Ganimedes/items/scraps/ganimedite/PureGanimedite.asset"),
val.LoadAsset<Item>("Assets/Scenes/Ganimedes/items/scraps/pickaxe/Pickaxe.asset"),
val.LoadAsset<Item>("Assets/Scenes/Ganimedes/items/scraps/chest/Chest.asset"),
val.LoadAsset<Item>("Assets/Scenes/Ganimedes/items/scraps/greatchest/GreatChest.asset"),
val.LoadAsset<Item>("Assets/Scenes/Ganimedes/items/scraps/cursedgoldbar/CursedGoldBar.asset")
};
Item val2 = val.LoadAsset<Item>("Assets/Scenes/Ganimedes/items/scraps/mp3/MP3.asset");
GameObject spawnPrefab = val2.spawnPrefab;
Utilities.FixMixerGroups(spawnPrefab);
spawnPrefab.GetComponent<AudioSource>().volume = cfg.mp3Volume;
List<AudioClip> list2 = new List<AudioClip>();
if (cfg.mp3CustomSongs)
{
CustomSongs(list2);
}
AudioClip[] musicAudios = spawnPrefab.GetComponent<BoomboxItem>().musicAudios;
if (cfg.mp3DefaultSongsChanges)
{
if (cfg.mp3song1)
{
list2.Add(musicAudios[0]);
}
if (cfg.mp3song2)
{
list2.Add(musicAudios[1]);
}
if (cfg.mp3song3)
{
list2.Add(musicAudios[2]);
}
if (cfg.mp3song4)
{
list2.Add(musicAudios[3]);
}
if (cfg.mp3song5)
{
list2.Add(musicAudios[4]);
}
if (cfg.mp3song6)
{
list2.Add(musicAudios[5]);
}
if (cfg.mp3song7)
{
list2.Add(musicAudios[6]);
}
if (cfg.mp3song8)
{
list2.Add(musicAudios[7]);
}
if (cfg.mp3song9)
{
list2.Add(musicAudios[8]);
}
if (cfg.mp3song10)
{
list2.Add(musicAudios[9]);
}
}
else
{
for (int k = 0; k < musicAudios.Count(); k++)
{
list2.Add(musicAudios[k]);
}
}
if (list2.Count == 0 || cfg.mp3BoomboxVanilla)
{
list2.Add(val.LoadAsset<AudioClip>("Assets/Scenes/Ganimedes/items/scraps/mp3/boomboxmusic/BoomboxMusic1.ogg"));
list2.Add(val.LoadAsset<AudioClip>("Assets/Scenes/Ganimedes/items/scraps/mp3/boomboxmusic/BoomboxMusic2.ogg"));
list2.Add(val.LoadAsset<AudioClip>("Assets/Scenes/Ganimedes/items/scraps/mp3/boomboxmusic/BoomboxMusic3.ogg"));
list2.Add(val.LoadAsset<AudioClip>("Assets/Scenes/Ganimedes/items/scraps/mp3/boomboxmusic/BoomboxMusic4.ogg"));
list2.Add(val.LoadAsset<AudioClip>("Assets/Scenes/Ganimedes/items/scraps/mp3/boomboxmusic/BoomboxMusic5Zedfox.ogg"));
}
spawnPrefab.GetComponent<BoomboxItem>().musicAudios = list2.ToArray();
NetworkPrefabs.RegisterNetworkPrefab(spawnPrefab);
Items.RegisterScrap(val2, 0, (LevelTypes)1);
foreach (Item item in list)
{
NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab);
Utilities.FixMixerGroups(item.spawnPrefab);
Items.RegisterScrap(item, 0, (LevelTypes)1);
}
mls.LogInfo((object)"------- Ganimedes plugin loaded -------");
}
public static void CustomSongs(List<AudioClip> songsList)
{
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Invalid comparison between Unknown and I4
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
string text = (cfg.mp3CustomSongsDirectory ? Path.Combine(Paths.BepInExRootPath, "Custom Songs", "Boombox Music") : Path.Combine(Paths.BepInExRootPath, "plugins", "Ganimedes", "CustomSongs"));
if (!Directory.Exists(text))
{
Directory.CreateDirectory(text);
mls.LogInfo((object)("Created directory at " + text));
}
string[] files = Directory.GetFiles(text);
if (files.Length == 0)
{
mls.LogWarning((object)"No songs found");
return;
}
for (int i = 0; i < files.Length; i++)
{
AudioType audioType = GetAudioType(files[i]);
if ((int)audioType > 0)
{
UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(files[i], audioType);
audioClip.SendWebRequest();
while (!audioClip.isDone && audioClip.error == null)
{
Thread.Sleep(50);
}
if (audioClip.error != null)
{
mls.LogWarning((object)("Error loading song: " + text));
}
else
{
songsList.Add(DownloadHandlerAudioClip.GetContent(audioClip));
}
}
}
}
public static AudioType GetAudioType(string path)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: 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_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
string text = Path.GetExtension(path).ToLower();
switch (text)
{
case ".wav":
return (AudioType)20;
case ".ogg":
return (AudioType)14;
case ".mp3":
return (AudioType)13;
default:
mls.LogError((object)("Error loading song. Unsupported extension type: " + text));
return (AudioType)0;
}
}
}
[Serializable]
public class SyncedInstance<T>
{
[NonSerialized]
protected static int IntSize = 4;
internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager;
internal static bool IsClient => NetworkManager.Singleton.IsClient;
internal static bool IsHost => NetworkManager.Singleton.IsHost;
public static T Default { get; private set; }
public static T Instance { get; private set; }
public static bool Synced { get; internal set; }
protected void InitInstance(T instance)
{
Default = instance;
Instance = instance;
IntSize = 4;
}
internal static void SyncInstance(byte[] data)
{
Instance = DeserializeFromBytes(data);
Synced = true;
}
internal static void RevertSync()
{
Instance = Default;
Synced = false;
}
public static byte[] SerializeToBytes(T val)
{
BinaryFormatter binaryFormatter = new BinaryFormatter();
using MemoryStream memoryStream = new MemoryStream();
try
{
binaryFormatter.Serialize(memoryStream, val);
return memoryStream.ToArray();
}
catch (Exception arg)
{
Plugin.logger.LogError((object)$"Error serializing instance: {arg}");
return null;
}
}
public static T DeserializeFromBytes(byte[] data)
{
BinaryFormatter binaryFormatter = new BinaryFormatter();
using MemoryStream serializationStream = new MemoryStream(data);
try
{
return (T)binaryFormatter.Deserialize(serializationStream);
}
catch (Exception arg)
{
Plugin.logger.LogError((object)$"Error deserializing instance: {arg}");
return default(T);
}
}
}
}
namespace Ganimedes.Patches
{
[HarmonyPatch]
public class BoomboxPatches
{
private static Dictionary<BoomboxItem, bool> seedSyncDictionary = new Dictionary<BoomboxItem, bool>();
private static FieldInfo playersManagerField = AccessTools.Field(typeof(BoomboxItem), "playersManager");
[HarmonyPatch(typeof(BoomboxItem), "StartMusic")]
[HarmonyPrefix]
public static void StartMusicPatch(BoomboxItem __instance)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
StartOfRound val = (StartOfRound)playersManagerField.GetValue(__instance);
if ((!seedSyncDictionary.TryGetValue(__instance, out var value) || !value) && val != null && val.randomMapSeed > 0)
{
int seed = val.randomMapSeed - 10;
__instance.musicRandomizer = new Random(seed);
seedSyncDictionary[__instance] = true;
}
}
[HarmonyPatch(typeof(StartOfRound), "OnPlayerConnectedClientRpc")]
[HarmonyPrefix]
public static void OnPlayerConnectedPatch(StartOfRound __instance)
{
forceReinitialize(seedSyncDictionary);
}
[HarmonyPatch(typeof(StartOfRound), "openingDoorsSequence")]
[HarmonyPrefix]
public static void openingDoorsSequencePatch(StartOfRound __instance)
{
forceReinitialize(seedSyncDictionary);
}
private static void forceReinitialize(Dictionary<BoomboxItem, bool> seedSyncDictionary)
{
foreach (BoomboxItem item in seedSyncDictionary.Keys.ToList())
{
seedSyncDictionary[item] = false;
}
}
}
[HarmonyPatch(typeof(DoorLock))]
internal class DoorLockPatch
{
[HarmonyPatch("Update")]
[HarmonyPrefix]
public static bool UpdatePatched(DoorLock __instance)
{
CustomGiftBoxItem componentInParent = ((Component)__instance).gameObject.GetComponentInParent<CustomGiftBoxItem>();
if ((Object)(object)componentInParent != (Object)null)
{
return false;
}
return true;
}
[HarmonyPatch("UnlockDoorSyncWithServer")]
[HarmonyPrefix]
public static bool UnlockDoorSyncWithServerPatched(DoorLock __instance)
{
CustomGiftBoxItem componentInParent = ((Component)__instance).gameObject.GetComponentInParent<CustomGiftBoxItem>();
if ((Object)(object)componentInParent != (Object)null)
{
componentInParent.UnlockChestSyncWithServer();
return false;
}
return true;
}
[HarmonyPatch("LockDoor")]
[HarmonyPrefix]
public static bool LockDoorPatched(DoorLock __instance)
{
CustomGiftBoxItem componentInParent = ((Component)__instance).gameObject.GetComponentInParent<CustomGiftBoxItem>();
if ((Object)(object)componentInParent != (Object)null)
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(LockPicker))]
internal class LockPickerPatch
{
[HarmonyPatch("ItemActivate")]
[HarmonyPrefix]
public static bool ItemActivatePatched(LockPicker __instance)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
__instance.ray = new Ray(((Component)((GrabbableObject)__instance).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)__instance).playerHeldBy.gameplayCamera).transform.forward);
if (Physics.Raycast(__instance.ray, ref __instance.hit, 3f, 2816))
{
DoorLock component = ((Component)((RaycastHit)(ref __instance.hit)).transform).GetComponent<DoorLock>();
CustomGiftBoxItem componentInParent = ((Component)component).gameObject.GetComponentInParent<CustomGiftBoxItem>();
if (Object.op_Implicit((Object)(object)componentInParent) && Object.op_Implicit((Object)(object)((GrabbableObject)componentInParent).playerHeldBy))
{
return false;
}
}
return true;
}
[HarmonyPatch("GetLockPickerDoorPosition")]
[HarmonyPrefix]
public static bool GetLockPickerDoorPositionPatched(ref Vector3 __result, DoorLock doorScript, LockPicker __instance)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
CustomGiftBoxItem componentInParent = ((Component)doorScript).gameObject.GetComponentInParent<CustomGiftBoxItem>();
if ((Object)(object)componentInParent != (Object)null)
{
__instance.placeOnLockPicker1 = true;
__result = doorScript.lockPickerPosition.localPosition;
return false;
}
return true;
}
[HarmonyPatch("PlaceOnDoor")]
[HarmonyPrefix]
public static bool PlaceOnDoorPatched(DoorLock doorScript, LockPicker __instance)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
if (!__instance.isOnDoor)
{
CustomGiftBoxItem componentInParent = ((Component)doorScript).gameObject.GetComponentInParent<CustomGiftBoxItem>();
if (Object.op_Implicit((Object)(object)componentInParent))
{
((GrabbableObject)componentInParent).grabbable = false;
((GrabbableObject)componentInParent).grabbableToEnemies = false;
((Component)__instance).transform.localScale = componentInParent.doorLock.lockPickerPosition.localScale;
}
}
return true;
}
}
}
namespace Ganimedes.Custom
{
internal class CursedItem : GrabbableObject
{
private bool spawned = false;
private NetworkManager networkManager;
public override void Start()
{
((GrabbableObject)this).Start();
networkManager = ((NetworkBehaviour)this).NetworkManager;
}
public override void Update()
{
((GrabbableObject)this).Update();
if (!((Object)(object)base.playerHeldBy != (Object)null) || spawned)
{
return;
}
spawned = true;
if (base.playerHeldBy.isInsideFactory)
{
if (networkManager.IsServer || networkManager.IsHost)
{
spawnDressGirl();
}
else if ((Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
((MonoBehaviour)this).StartCoroutine(HauntClient());
}
}
}
private void spawnDressGirl()
{
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
DressGirlAI val = RoundManager.Instance.SpawnedEnemies.OfType<DressGirlAI>().FirstOrDefault();
if ((Object)(object)val == (Object)null)
{
int num = -1;
List<SpawnableEnemyWithRarity> enemies = StartOfRound.Instance.currentLevel.Enemies;
for (int i = 0; i < enemies.Count; i++)
{
if (enemies[i].enemyType.enemyName == "Girl")
{
num = i;
break;
}
}
RoundManager.Instance.SpawnEnemyOnServer(((Component)this).transform.position, 0f, num);
}
((MonoBehaviour)this).StartCoroutine(HauntPlayer());
}
private IEnumerator HauntPlayer()
{
yield return (object)new WaitForSeconds(0.1f);
DressGirlAI dressGirl = RoundManager.Instance.SpawnedEnemies.OfType<DressGirlAI>().FirstOrDefault();
if ((Object)(object)dressGirl != (Object)null)
{
dressGirl.hauntingPlayer = base.playerHeldBy;
((EnemyAI)dressGirl).ChangeOwnershipOfEnemy(dressGirl.hauntingPlayer.actualClientId);
dressGirl.hauntingLocalPlayer = (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)dressGirl.hauntingPlayer;
if (dressGirl.switchHauntedPlayerCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(dressGirl.switchHauntedPlayerCoroutine);
}
dressGirl.switchHauntedPlayerCoroutine = ((MonoBehaviour)this).StartCoroutine(dressGirl.setSwitchingHauntingPlayer());
if (dressGirl.hauntingLocalPlayer)
{
HauntClient();
}
}
}
private IEnumerator HauntClient()
{
yield return (object)new WaitForSeconds(0.2f);
DressGirlAI dressGirl = RoundManager.Instance.SpawnedEnemies.OfType<DressGirlAI>().FirstOrDefault();
if ((Object)(object)dressGirl != (Object)null)
{
dressGirl.timesStared = 3;
dressGirl.TryFindingHauntPosition(true, true);
}
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
((GrabbableObject)this).__initializeRpcs();
}
protected internal override string __getTypeName()
{
return "CursedItem";
}
}
internal class OutsideScrapManager : NetworkBehaviour
{
public List<OutsideScrapSpawn> spawns;
public int MIN_NUM_OF_SCRAPS;
public int MAX_NUM_OF_SCRAPS;
private void Start()
{
if (((NetworkBehaviour)this).NetworkManager.IsHost || ((NetworkBehaviour)this).NetworkManager.IsServer)
{
selectSpawns();
}
}
public void selectSpawns()
{
Random random = new Random(StartOfRound.Instance.randomMapSeed);
ArrayList arrayList = new ArrayList();
for (int i = 0; i < random.Next(MIN_NUM_OF_SCRAPS, MAX_NUM_OF_SCRAPS + 1); i++)
{
int num = random.Next(0, spawns.Count);
while (arrayList.Contains(num))
{
num = random.Next(0, spawns.Count);
}
arrayList.Add(num);
spawns[num].spawnSyncWithServer();
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
((NetworkBehaviour)this).__initializeRpcs();
}
protected internal override string __getTypeName()
{
return "OutsideScrapManager";
}
}
internal class OutsideScrapSpawn : NetworkBehaviour
{
public List<SpawnableItemWithRarity> spawnableItems;
private Random random;
private int value;
private Vector3 vector;
private NetworkObject ItemNet;
public void Start()
{
NetworkObject component = ((Component)this).GetComponent<NetworkObject>();
if (!component.IsSpawned)
{
component.Spawn(false);
}
}
private void spawn()
{
//IL_099e: Unknown result type (might be due to invalid IL or missing references)
//IL_09a3: Unknown result type (might be due to invalid IL or missing references)
//IL_09ab: Unknown result type (might be due to invalid IL or missing references)
//IL_09b0: Unknown result type (might be due to invalid IL or missing references)
//IL_09d1: Unknown result type (might be due to invalid IL or missing references)
//IL_09d6: Unknown result type (might be due to invalid IL or missing references)
random = new Random(StartOfRound.Instance.randomMapSeed + (int)((NetworkBehaviour)this).NetworkObjectId);
int num = 0;
for (int i = 0; i < spawnableItems.Count; i++)
{
num += spawnableItems[i].rarity;
}
int num2 = random.Next(1, num + 1);
int num3 = 0;
for (int j = 0; j < spawnableItems.Count; j++)
{
num3 += spawnableItems[j].rarity;
if (num3 >= num2)
{
bool flag = false;
bool flag2 = true;
Item val;
switch (spawnableItems[j].spawnableItem.itemName)
{
case "Homemade flashbang":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(61);
break;
case "Gold bar":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(35);
break;
case "Gift":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(62);
break;
case "Rubber Ducky":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(48);
break;
case "Pill bottle":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(44);
break;
case "Mug":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(40);
break;
case "Plastic fish":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(33);
break;
case "Jar of pickles":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(43);
break;
case "Laser pointer":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(34);
break;
case "Magnifying glass":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(37);
break;
case "Airhorn":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(16);
break;
case "Painting":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(32);
break;
case "Cash register":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(22);
break;
case "Jetpack":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(3);
break;
case "Key":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(4);
flag = true;
flag2 = false;
break;
case "Pro-flashlight":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(8);
flag2 = false;
break;
case "Kitchen knife":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(67);
break;
case "Ammo":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(59);
break;
case "Shotgun":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(58);
break;
case "Shovel":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(9);
flag2 = false;
break;
case "TZP-Inhalant":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(12);
flag2 = false;
break;
case "Zap gun":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(14);
flag2 = false;
break;
case "Extension ladder":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(11);
flag2 = false;
break;
case "Radar-booster":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(56);
flag2 = false;
break;
case "Easter egg":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(68);
break;
case "Perfume bottle":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(41);
break;
case "Red soda":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(49);
break;
case "Spray paint":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(60);
flag2 = false;
break;
case "Toy train":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(76);
break;
case "Soccer ball":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(70);
break;
case "Toilet paper":
val = StartOfRound.Instance.allItemsList.itemsList.ElementAt(74);
break;
default:
val = spawnableItems[j].spawnableItem;
break;
}
GameObject spawnPrefab = val.spawnPrefab;
if (flag)
{
value = 3;
}
else
{
value = (int)((float)random.Next(val.minValue + 25, val.maxValue + 35) * RoundManager.Instance.scrapValueMultiplier);
}
Transform val2 = ((!flag2) ? RoundManager.Instance.playersManager.propsContainer : RoundManager.Instance.spawnedScrapContainer);
vector = ((Component)this).transform.position;
GameObject val3 = Object.Instantiate<GameObject>(spawnPrefab, vector, Quaternion.identity, val2);
GrabbableObject component = val3.GetComponent<GrabbableObject>();
((Component)component).transform.position = component.GetItemFloorPosition(vector);
component.SetScrapValue(value);
ItemNet = ((NetworkBehaviour)component).NetworkObject;
ItemNet.Spawn(false);
break;
}
}
}
public void spawnSyncWithServer()
{
spawn();
spawnServerRpc();
}
[ServerRpc(RequireOwnership = false)]
public void spawnServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: 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_00da: 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.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(729199340u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 729199340u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
spawnClientRpc(NetworkObjectReference.op_Implicit(ItemNet), value, vector);
}
}
}
[ClientRpc]
public void spawnClientRpc(NetworkObjectReference netObjectRef, int value, Vector3 pos)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: 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_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: 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(1070657723u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjectRef, default(ForNetworkSerializable));
BytePacker.WriteValueBitPacked(val2, value);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1070657723u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
((MonoBehaviour)this).StartCoroutine(waitForScrapToSpawnOnClient(netObjectRef, value, pos));
}
}
}
private IEnumerator waitForScrapToSpawnOnClient(NetworkObjectReference netObjectRef, int value, Vector3 pos)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: 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)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
NetworkObject netObject = null;
float startTime = Time.realtimeSinceStartup;
while (Time.realtimeSinceStartup - startTime < 8f && !((NetworkObjectReference)(ref netObjectRef)).TryGet(ref netObject, (NetworkManager)null))
{
yield return (object)new WaitForSeconds(0.03f);
}
if ((Object)(object)netObject == (Object)null)
{
Debug.Log((object)"No network object found");
yield break;
}
yield return (object)new WaitForEndOfFrame();
GrabbableObject component = ((Component)netObject).GetComponent<GrabbableObject>();
RoundManager instance = RoundManager.Instance;
instance.totalScrapValueInLevel += (float)value;
component.SetScrapValue(value);
((Component)component).transform.position = pos;
if (!netObject.IsSpawned)
{
netObject.Spawn(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
((NetworkBehaviour)this).__registerRpc(729199340u, new RpcReceiveHandler(__rpc_handler_729199340), "spawnServerRpc");
((NetworkBehaviour)this).__registerRpc(1070657723u, new RpcReceiveHandler(__rpc_handler_1070657723), "spawnClientRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_729199340(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((OutsideScrapSpawn)(object)target).spawnServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1070657723(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_003e: 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)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
NetworkObjectReference netObjectRef = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjectRef, default(ForNetworkSerializable));
int num = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref num);
Vector3 pos = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref pos);
target.__rpc_exec_stage = (__RpcExecStage)1;
((OutsideScrapSpawn)(object)target).spawnClientRpc(netObjectRef, num, pos);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "OutsideScrapSpawn";
}
}
}
namespace Ganimedes.Configuration
{
[HarmonyPatch(typeof(Terminal))]
public class RouteCostPatch
{
[HarmonyPatch("LoadNewNode")]
[HarmonyPrefix]
private static void LoadNewNodePatchBefore(ref TerminalNode node)
{
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
if (SyncedInstance<Config>.Instance.routeCost == 2000)
{
return;
}
Terminal val = Object.FindObjectOfType<Terminal>();
CompatibleNoun[] compatibleNouns = val.terminalNodes.allKeywords.First((TerminalKeyword terminalKeyword) => terminalKeyword.word == "route").compatibleNouns;
CompatibleNoun[] array = compatibleNouns;
foreach (CompatibleNoun val2 in array)
{
if (!((Object)val2.result == (Object)null) && ((Object)val2.result).name == "ganimedesRoute")
{
val2.result.itemCost = SyncedInstance<Config>.Instance.routeCost;
}
}
}
[HarmonyPatch("LoadNewNodeIfAffordable")]
[HarmonyPrefix]
private static void LoadNewNodeIfAffordablePatch(ref TerminalNode node)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
if (SyncedInstance<Config>.Instance.routeCost != 2000 && !((Object)node == (Object)null) && !(((Object)node).name != "ganimedesRouteConfirm"))
{
node.itemCost = Math.Abs(SyncedInstance<Config>.Instance.routeCost);
}
}
}
}
namespace __GEN
{
internal class NetworkVariableSerializationHelper
{
[RuntimeInitializeOnLoadMethod]
internal static void InitializeSerialization()
{
}
}
}
namespace Ganimedes.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}