using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LoadCleanShip.NetcodePatcher;
using LoadCleanShip.Patches;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LoadCleanShip")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LoadCleanShip")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3c831da3-82da-4651-b1bb-93ca646d87ff")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: NetcodePatchedAssembly]
namespace LoadCleanShip
{
[BepInPlugin("Ryoryoman_LoadCleanShip", "LoadCleanShip", "1.1.1")]
public class LoadCleanShipBase : BaseUnityPlugin
{
[HarmonyPatch(typeof(GameNetworkManager))]
internal class NetworkHandlerInitPatch
{
public static GameObject networkPrefab;
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void Init()
{
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
if (!((Object)(object)networkPrefab != (Object)null))
{
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string text = Path.Combine(directoryName, "networkbundle");
mainAssetBundle = AssetBundle.LoadFromFile(text);
if ((Object)(object)mainAssetBundle == (Object)null)
{
mls.LogError((object)"Failed to load AssetBundle!");
return;
}
mls.LogInfo((object)"AssetBundle loaded successfully.");
networkPrefab = (GameObject)mainAssetBundle.LoadAsset("NetworkHandler");
networkPrefab.AddComponent<NetworkHandler>();
NetworkManager.Singleton.AddNetworkPrefab(networkPrefab);
}
}
}
[HarmonyPatch(typeof(StartOfRound))]
internal class InstantiatePrefab
{
[HarmonyPatch("Awake")]
[HarmonyPostfix]
private static void SpawnNetworkHandler()
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)NetworkHandlerInitPatch.networkPrefab == (Object)null)
{
mls.LogError((object)"Cannot spawn NetworkHandler: networkPrefab is null!");
}
else if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
{
GameObject val = Object.Instantiate<GameObject>(NetworkHandlerInitPatch.networkPrefab, Vector3.zero, Quaternion.identity);
val.GetComponent<NetworkObject>().Spawn(false);
}
}
}
private const string modGUID = "Ryoryoman_LoadCleanShip";
private const string modName = "LoadCleanShip";
private const string modVersion = "1.1.1";
private readonly Harmony harmony = new Harmony("Ryoryoman_LoadCleanShip");
public ConfigEntry<bool> scrapSync;
private static LoadCleanShipBase Instanse;
public static ManualLogSource mls;
public static AssetBundle mainAssetBundle;
private void Awake()
{
NetcodePatcher();
if ((Object)(object)Instanse == (Object)null)
{
Instanse = this;
}
mls = Logger.CreateLogSource("Ryoryoman_LoadCleanShip");
mls.LogInfo((object)"LoadCleanShip1.1.1loaded.");
scrapSync = ((BaseUnityPlugin)this).Config.Bind<bool>("LoadCleanShipConfig", "同期処理切り替え", false, "true:ターミナルからアイテム整頓・同期処理が可能&このmodを入れている人同士でないとプレイ不可能/false:ロード時のアイテム整理のみ");
harmony.PatchAll(typeof(LoadCleanShipBase));
harmony.PatchAll(typeof(CleanShipPatch));
if (scrapSync.Value)
{
harmony.PatchAll(typeof(ManualCleanPatch));
harmony.PatchAll(typeof(DesyncBoolPatch));
harmony.PatchAll(typeof(EventSubscriber));
harmony.PatchAll(typeof(NetworkHandlerInitPatch));
harmony.PatchAll(typeof(InstantiatePrefab));
}
}
private static void NetcodePatcher()
{
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);
}
}
}
}
}
}
namespace LoadCleanShip.Patches
{
[HarmonyPatch(typeof(StartOfRound))]
internal class CleanShipPatch
{
[HarmonyPatch("LoadShipGrabbableItems")]
[HarmonyPostfix]
private static void LoadItemsPatch()
{
GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
List<Item> list = new List<Item>();
List<GrabbableObject> list2 = new List<GrabbableObject>();
List<GrabbableObject> list3 = new List<GrabbableObject>();
List<GrabbableObject> list4 = new List<GrabbableObject>();
for (int i = 0; i < array.Length; i++)
{
if (!((NetworkBehaviour)array[i]).IsSpawned)
{
continue;
}
if (array[i].itemProperties.isScrap && !array[i].itemProperties.twoHanded)
{
list2.Add(array[i]);
if (!list.Contains(array[i].itemProperties))
{
list.Add(array[i].itemProperties);
}
}
if (array[i].itemProperties.isScrap && array[i].itemProperties.twoHanded)
{
list3.Add(array[i]);
}
if (!array[i].itemProperties.isScrap)
{
list4.Add(array[i]);
}
}
Item[] spawnedArray = list.ToArray();
GrabbableObject[] spawnedArrayG = list2.ToArray();
GrabbableObject[] twoHandedArray = list3.ToArray();
GrabbableObject[] toolArray = list4.ToArray();
CleanScrap(spawnedArray, spawnedArrayG);
CleanTwoHanded(twoHandedArray);
CleanTool(toolArray);
}
public static void CleanScrap(Item[] spawnedArray, GrabbableObject[] spawnedArrayG)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = Vector3.zero;
for (int i = 0; i < spawnedArrayG.Length; i++)
{
for (int j = 0; j < spawnedArray.Length; j++)
{
if ((Object)(object)spawnedArray[j] == (Object)(object)spawnedArrayG[i].itemProperties)
{
val = StartOfRound.Instance.insideShipPositions[10].position;
val.z += 3.3f - (float)(j / 10) * 0.8f;
val.x += (float)(j % 10) * 0.5f;
break;
}
}
val.z += Random.Range(-0.1f, 0.1f);
((Component)spawnedArrayG[i]).transform.position = val;
spawnedArrayG[i].targetFloorPosition = val;
spawnedArrayG[i].startFallingPosition = val;
}
}
public static void CleanTwoHanded(GrabbableObject[] twoHandedArray)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: 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_0034: 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)
for (int i = 0; i < twoHandedArray.Length; i++)
{
Vector3 position = StartOfRound.Instance.insideShipPositions[10].position;
((Component)twoHandedArray[i]).transform.position = position;
twoHandedArray[i].targetFloorPosition = position;
twoHandedArray[i].startFallingPosition = position;
}
}
public static void CleanTool(GrabbableObject[] toolArray)
{
//IL_003d: 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_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: 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_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_025a: Unknown result type (might be due to invalid IL or missing references)
//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0382: Unknown result type (might be due to invalid IL or missing references)
//IL_0387: Unknown result type (might be due to invalid IL or missing references)
//IL_034b: Unknown result type (might be due to invalid IL or missing references)
//IL_0350: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < toolArray.Length; i++)
{
Vector3 position;
if ((Object)(object)toolArray[i].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[10])
{
position = StartOfRound.Instance.insideShipPositions[3].position;
position.z += 1.5f;
}
else if ((Object)(object)toolArray[i].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[14])
{
position = StartOfRound.Instance.insideShipPositions[1].position;
position.x += 0.4f;
position.z -= 0.5f;
}
else if ((Object)(object)toolArray[i].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[79])
{
position = StartOfRound.Instance.insideShipPositions[3].position;
position.z -= 1f;
}
else if ((Object)(object)toolArray[i].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[6])
{
position = StartOfRound.Instance.insideShipPositions[2].position;
position.x -= 0.2f;
position.z -= 0.5f;
}
else if ((Object)(object)toolArray[i].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[11])
{
position = StartOfRound.Instance.insideShipPositions[2].position;
position.x -= 0.2f;
position.z -= 1.5f;
}
else if ((Object)(object)toolArray[i].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[1])
{
position = StartOfRound.Instance.insideShipPositions[5].position;
position.z += 1.5f;
}
else if ((Object)(object)toolArray[i].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[13])
{
position = StartOfRound.Instance.insideShipPositions[2].position;
position.x -= 0.2f;
position.z -= 2.5f;
}
else if ((Object)(object)toolArray[i].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[12])
{
position = StartOfRound.Instance.insideShipPositions[5].position;
}
else if ((Object)(object)toolArray[i].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[61])
{
position = StartOfRound.Instance.insideShipPositions[3].position;
position.z += 0.5f;
}
else if ((Object)(object)toolArray[i].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[70])
{
position = StartOfRound.Instance.insideShipPositions[3].position;
position.z -= 2.5f;
position.x += 1f;
}
else
{
position = StartOfRound.Instance.insideShipPositions[10].position;
position.z += 1.5f;
position.x -= 2.5f;
}
position.x += Random.Range(-0.2f, 0.2f);
position.z += Random.Range(-0.2f, 0.2f);
((Component)toolArray[i]).transform.position = position;
toolArray[i].targetFloorPosition = position;
toolArray[i].startFallingPosition = position;
}
}
}
[HarmonyPatch(typeof(StartOfRound))]
internal class DesyncBoolPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void SyncBoolPatch()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
for (int i = 0; i < array.Length; i++)
{
Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds;
if (((Bounds)(ref bounds)).Contains(((Component)array[i]).transform.position))
{
array[i].isInShipRoom = true;
}
}
}
}
[HarmonyPatch(typeof(StartOfRound))]
internal class EventSubscriber
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void SubscribeToHandler()
{
Debug.Log((object)"[EventSubscriber] SubscribeToHandler 実行");
NetworkHandler.LevelEvent += ReceivedEventFromServer;
GameObject val = GameObject.Find("Systems/UI/Canvas/QuickMenu/MainButtons/Quit");
if ((Object)(object)val == (Object)null)
{
Debug.Log((object)"Quit ボタンが見つかりません!");
}
val.AddComponent<QuitButton>();
}
public static void ReceivedEventFromServer(string eventName)
{
Debug.Log((object)("[EventSubscriber] 受信イベント: " + eventName));
ManualCleanPatch.CleanManager(eventName);
}
public static void SendEventToClients(string eventName)
{
if (NetworkManager.Singleton.IsHost)
{
Debug.Log((object)"HostとしてRPCを送信します");
}
else if (NetworkManager.Singleton.IsServer)
{
Debug.Log((object)"ServerとしてRPCを送信します");
}
else
{
Debug.LogWarning((object)"クライアントからRPCを送信しようとしています");
}
if ((Object)(object)NetworkHandler.Instance == (Object)null)
{
Debug.LogError((object)"[EventSubscriber] NetworkHandler.Instance が null です!");
return;
}
Debug.Log((object)$"[EventSubscriber] SendEventToClients 実行中 (ObjID={((NetworkBehaviour)NetworkHandler.Instance).NetworkObjectId})");
NetworkHandler.Instance.EventClientRpc(eventName);
}
}
[HarmonyPatch(typeof(Terminal))]
internal class ManualCleanPatch
{
public static string s;
[HarmonyPatch("ParsePlayerSentence")]
[HarmonyPrefix]
public static bool ParsePlayerSentencePatch(Terminal __instance)
{
s = __instance.screenText.text.Substring(__instance.screenText.text.Length - __instance.textAdded);
string value = "clean";
string[] array = new string[4] { "all", "-t", "-h", "-p" };
int num = 0;
if (s.Contains(value))
{
for (int i = 0; i < array.Length; i++)
{
if (s.Contains(array[i]))
{
num++;
}
}
if (num > 0)
{
NetworkHandler.Instance.EventServerRpc(s);
__instance.currentText = "\r\n\r\n\r\nLoadCleanShip\r\nItems have been successfully rearranged!\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
__instance.screenText.text = __instance.currentText;
return false;
}
__instance.currentText = "\r\n\r\nEach command rearranges specific qroup of items.\r\n\r\nall\r\n[Group]all items\r\n-t\r\n[Group]all tools(not scrap)\r\n-h\r\n[Group]two-handed scraps\r\n-p\r\n[Group]one-handed scraps\r\n-b\r\nThis command except belt bags and tools in them.\r\n\r\n\r\n\r\n\r\n";
__instance.screenText.text = __instance.currentText;
return false;
}
return true;
}
public static void CleanManager(string s)
{
List<Item> list = new List<Item>();
List<GrabbableObject> list2 = new List<GrabbableObject>();
List<GrabbableObject> list3 = new List<GrabbableObject>();
List<GrabbableObject> list4 = new List<GrabbableObject>();
GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
for (int i = 0; i < array.Length; i++)
{
if (!((NetworkBehaviour)array[i]).IsSpawned || !array[i].isInShipRoom || array[i].isHeld)
{
continue;
}
if (array[i].itemProperties.isScrap && !array[i].itemProperties.twoHanded)
{
list2.Add(array[i]);
if (!list.Contains(array[i].itemProperties))
{
list.Add(array[i].itemProperties);
}
}
if (array[i].itemProperties.isScrap && array[i].itemProperties.twoHanded)
{
list3.Add(array[i]);
}
if (!array[i].itemProperties.isScrap)
{
list4.Add(array[i]);
}
}
if (s.Contains("-b"))
{
List<GrabbableObject> list5 = new List<GrabbableObject>();
List<GrabbableObject> list6 = new List<GrabbableObject>();
if (list4.Count > 0)
{
for (int j = 0; j < list4.Count; j++)
{
if ((Object)(object)list4[j].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[79])
{
list5.Add(list4[j]);
list6.Add(list4[j]);
}
}
}
if (list5.Count > 0)
{
for (int k = 0; k < list5.Count; k++)
{
GrabbableObject obj = list5[k];
BeltBagItem val = (BeltBagItem)(object)((obj is BeltBagItem) ? obj : null);
if (val.objectsInBag.Count > 0)
{
list6.AddRange(val.objectsInBag);
}
}
}
if (list6.Count > 0)
{
for (int l = 0; l < list6.Count; l++)
{
list4.Remove(list6[l]);
}
}
}
if (s.Contains("-t"))
{
GrabbableObject[] toolArray = list4.ToArray();
CleanToolLocal(toolArray);
}
if (s.Contains("-h"))
{
GrabbableObject[] twoHandedArray = list3.ToArray();
CleanTwoHandedLocal(twoHandedArray);
}
if (s.Contains("-p"))
{
GrabbableObject[] spawnedArrayG = list2.ToArray();
Item[] spawnedArray = list.ToArray();
CleanScrapLocal(spawnedArray, spawnedArrayG);
}
if (s.Contains("all"))
{
GrabbableObject[] toolArray2 = list4.ToArray();
CleanToolLocal(toolArray2);
GrabbableObject[] twoHandedArray2 = list3.ToArray();
CleanTwoHandedLocal(twoHandedArray2);
GrabbableObject[] spawnedArrayG2 = list2.ToArray();
Item[] spawnedArray2 = list.ToArray();
CleanScrapLocal(spawnedArray2, spawnedArrayG2);
}
}
public static void CleanScrapLocal(Item[] spawnedArray, GrabbableObject[] spawnedArrayG)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: 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_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
Transform transform = GameObject.Find("/Environment/HangarShip").transform;
Vector3 val = Vector3.zero;
for (int i = 0; i < spawnedArrayG.Length; i++)
{
for (int j = 0; j < spawnedArray.Length; j++)
{
if ((Object)(object)spawnedArray[j] == (Object)(object)spawnedArrayG[i].itemProperties)
{
val = StartOfRound.Instance.insideShipPositions[10].position;
val.z += 3.3f - (float)(j / 10) * 0.8f;
val.x += (float)(j % 10) * 0.5f;
break;
}
}
val.z += Random.Range(-0.1f, 0.1f);
val -= ((Component)transform).transform.position;
((Component)spawnedArrayG[i]).transform.position = val;
spawnedArrayG[i].targetFloorPosition = val;
spawnedArrayG[i].startFallingPosition = val;
spawnedArrayG[i].FallToGround(false, false, default(Vector3));
}
}
public static void CleanTwoHandedLocal(GrabbableObject[] twoHandedArray)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: 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_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: 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_0063: 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)
Transform transform = GameObject.Find("/Environment/HangarShip").transform;
for (int i = 0; i < twoHandedArray.Length; i++)
{
Vector3 position = StartOfRound.Instance.insideShipPositions[10].position;
position -= ((Component)transform).transform.position;
((Component)twoHandedArray[i]).transform.position = position;
twoHandedArray[i].targetFloorPosition = position;
twoHandedArray[i].startFallingPosition = position;
twoHandedArray[i].FallToGround(false, false, default(Vector3));
}
}
public static void CleanToolLocal(GrabbableObject[] toolArray)
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0400: Unknown result type (might be due to invalid IL or missing references)
//IL_0409: Unknown result type (might be due to invalid IL or missing references)
//IL_0413: Unknown result type (might be due to invalid IL or missing references)
//IL_0414: Unknown result type (might be due to invalid IL or missing references)
//IL_041c: Unknown result type (might be due to invalid IL or missing references)
//IL_041d: Unknown result type (might be due to invalid IL or missing references)
//IL_0429: Unknown result type (might be due to invalid IL or missing references)
//IL_042f: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
//IL_0267: Unknown result type (might be due to invalid IL or missing references)
//IL_026c: Unknown result type (might be due to invalid IL or missing references)
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_030b: Unknown result type (might be due to invalid IL or missing references)
//IL_0310: Unknown result type (might be due to invalid IL or missing references)
//IL_0394: Unknown result type (might be due to invalid IL or missing references)
//IL_0399: Unknown result type (might be due to invalid IL or missing references)
//IL_035d: Unknown result type (might be due to invalid IL or missing references)
//IL_0362: Unknown result type (might be due to invalid IL or missing references)
Transform transform = GameObject.Find("/Environment/HangarShip").transform;
for (int i = 0; i < toolArray.Length; i++)
{
Vector3 position;
if ((Object)(object)toolArray[i].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[10])
{
position = StartOfRound.Instance.insideShipPositions[3].position;
position.z += 1.5f;
}
else if ((Object)(object)toolArray[i].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[14])
{
position = StartOfRound.Instance.insideShipPositions[1].position;
position.x += 0.4f;
position.z -= 0.5f;
}
else if ((Object)(object)toolArray[i].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[79])
{
position = StartOfRound.Instance.insideShipPositions[3].position;
position.z -= 1f;
}
else if ((Object)(object)toolArray[i].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[6])
{
position = StartOfRound.Instance.insideShipPositions[2].position;
position.x -= 0.2f;
position.z -= 0.5f;
}
else if ((Object)(object)toolArray[i].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[11])
{
position = StartOfRound.Instance.insideShipPositions[2].position;
position.x -= 0.2f;
position.z -= 1.5f;
}
else if ((Object)(object)toolArray[i].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[1])
{
position = StartOfRound.Instance.insideShipPositions[5].position;
position.z += 1.5f;
}
else if ((Object)(object)toolArray[i].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[13])
{
position = StartOfRound.Instance.insideShipPositions[2].position;
position.x -= 0.2f;
position.z -= 2.5f;
}
else if ((Object)(object)toolArray[i].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[12])
{
position = StartOfRound.Instance.insideShipPositions[5].position;
}
else if ((Object)(object)toolArray[i].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[61])
{
position = StartOfRound.Instance.insideShipPositions[3].position;
position.z += 0.5f;
}
else if ((Object)(object)toolArray[i].itemProperties == (Object)(object)StartOfRound.Instance.allItemsList.itemsList[70])
{
position = StartOfRound.Instance.insideShipPositions[3].position;
position.z -= 2.5f;
position.x += 1f;
}
else
{
position = StartOfRound.Instance.insideShipPositions[10].position;
position.z += 1.5f;
position.x -= 2.5f;
}
position.x += Random.Range(-0.2f, 0.2f);
position.z += Random.Range(-0.2f, 0.2f);
position -= ((Component)transform).transform.position;
((Component)toolArray[i]).transform.position = position;
toolArray[i].targetFloorPosition = position;
toolArray[i].startFallingPosition = position;
toolArray[i].FallToGround(false, false, default(Vector3));
}
}
}
public class NetworkHandler : NetworkBehaviour
{
public static NetworkHandler Instance { get; private set; }
public static event Action<string> LevelEvent;
public override void OnNetworkSpawn()
{
NetworkHandler.LevelEvent = null;
if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
{
NetworkHandler instance = Instance;
if (instance != null)
{
((Component)instance).gameObject.GetComponent<NetworkObject>().Despawn(true);
}
}
Instance = this;
((NetworkBehaviour)this).OnNetworkSpawn();
Debug.Log((object)$"[NetworkHandler] OnNetworkSpawn: ID={((NetworkBehaviour)this).NetworkObjectId}, IsServer={((NetworkBehaviour)this).IsServer}, IsClient={((NetworkBehaviour)this).IsClient}, IsHost={((NetworkBehaviour)this).IsHost}");
Debug.Log((object)"[NetworkHandler] サーバーでスポーン完了");
}
[ServerRpc(RequireOwnership = false)]
public void EventServerRpc(string eventName)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: 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_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: 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(1207313737u, val, (RpcDelivery)0);
bool flag = eventName != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(eventName, false);
}
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1207313737u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
EventSubscriber.SendEventToClients(eventName);
}
}
[ClientRpc]
public void EventClientRpc(string eventName)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: 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_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: 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.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(429627880u, val, (RpcDelivery)0);
bool flag = eventName != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(eventName, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 429627880u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
Debug.Log((object)("[NetworkHandler] ClientRPC受信: " + eventName));
NetworkHandler.LevelEvent?.Invoke(eventName);
}
}
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(1207313737u, new RpcReceiveHandler(__rpc_handler_1207313737), "EventServerRpc");
((NetworkBehaviour)this).__registerRpc(429627880u, new RpcReceiveHandler(__rpc_handler_429627880), "EventClientRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_1207313737(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_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string eventName = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref eventName, false);
}
target.__rpc_exec_stage = (__RpcExecStage)1;
((NetworkHandler)(object)target).EventServerRpc(eventName);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_429627880(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_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string eventName = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref eventName, false);
}
target.__rpc_exec_stage = (__RpcExecStage)1;
((NetworkHandler)(object)target).EventClientRpc(eventName);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "NetworkHandler";
}
}
internal class QuitButton : MonoBehaviour
{
private void Start()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
Button component = ((Component)this).GetComponent<Button>();
((UnityEvent)component.onClick).AddListener(new UnityAction(OnQuitClicked));
}
public static void OnQuitClicked()
{
NetworkHandler.LevelEvent -= EventSubscriber.ReceivedEventFromServer;
Debug.Log((object)"[EventSubscriber] SubscribeToHandler 実行====");
}
}
}
namespace __GEN
{
internal class NetworkVariableSerializationHelper
{
[RuntimeInitializeOnLoadMethod]
internal static void InitializeSerialization()
{
}
}
}
namespace LoadCleanShip.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}