using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib.BoneMenu;
using BoneLib.Notifications;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.AI;
using Il2CppSLZ.Marrow.Interaction;
using Il2CppSLZ.Marrow.Pool;
using Il2CppSLZ.Marrow.Warehouse;
using LabFusion.Network;
using LabFusion.Utilities;
using MelonLoader;
using UnityEngine;
using scene_janitor;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("it clean the scene")]
[assembly: AssemblyDescription("it clean the scene")]
[assembly: AssemblyCompany("minecart")]
[assembly: AssemblyProduct("Scene Janitor")]
[assembly: AssemblyCopyright("Developed by minecart")]
[assembly: AssemblyTrademark("minecart")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: MelonInfo(typeof(Main), "Scene Janitor", "1.0.0", "minecart", "https://github.com/minecartman/SceneJanitor")]
[assembly: MelonColor(255, 255, 255, 255)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace scene_janitor;
internal class Main : MelonMod
{
internal const string Name = "Scene Janitor";
internal const string Description = "it clean the scene";
internal const string Author = "minecart";
internal const string Company = "minecart";
internal const string Version = "1.0.0";
internal const string DownloadLink = "https://github.com/minecartman/SceneJanitor";
public override void OnInitializeMelon()
{
//IL_002c: 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_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: 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_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
((MelonBase)this).OnInitializeMelon();
MelonLogger.Msg("Scene Janitor Loaded");
Page val = Page.Root.CreatePage("Scene Janitor", new Color(0.486f, 0.871f, 1f), 0, true);
BoolElement val2 = val.CreateBool("Use Fusion Methods", new Color(1f, 1f, 1f), VarSaves.FusionSyncBool, (Action<bool>)delegate(bool value)
{
VarSaves.FusionSyncBool = value;
});
val.CreateFunction("NOTE: Non Fusion Methods are currently extremely buggy.", new Color(1f, 1f, 0.5f), (Action)null);
Page val3 = val.CreatePage("Crate Management", new Color(0.8f, 0.6f, 1f), 0, true);
FunctionElement val4 = val3.CreateFunction("Despawn All Props", new Color(1f, 0.5f, 0.5f), (Action)DespawnProps);
FunctionElement val5 = val3.CreateFunction("Clear & Restore Old Props", new Color(0.5f, 1f, 0.5f), (Action)RestoreCleanup);
FunctionElement val6 = val3.CreateFunction("Spawn All Props", new Color(1f, 1f, 0.5f), (Action)PropSpawn);
Page val7 = val.CreatePage("NPC Cleanup", new Color(0.6f, 1f, 0.6f), 0, true);
FunctionElement val8 = val7.CreateFunction("Clear all NPCs", new Color(1f, 1f, 1f), (Action)AllNPCClear);
FunctionElement val9 = val7.CreateFunction("Clear Fords", new Color(0.6f, 1f, 0.6f), (Action)FordClearVoid);
FunctionElement val10 = val7.CreateFunction("Clear Nullbodies", new Color(1f, 0.8f, 0.6f), (Action)NullClearVoid);
FunctionElement val11 = val7.CreateFunction("Clear Crablets", new Color(1f, 0.6f, 0.6f), (Action)CrabClearVoid);
FunctionElement val12 = val7.CreateFunction("Clear Omnis", new Color(1f, 1f, 0.8f), (Action)OmniClearVoid);
FunctionElement val13 = val7.CreateFunction("Clear Skeletons", new Color(0.9f, 0.9f, 0.9f), (Action)SkeleClearVoid);
FunctionElement val14 = val7.CreateFunction("Clear Peasants", new Color(0.8f, 0.7f, 1f), (Action)PeasantCLearVoid);
FunctionElement val15 = val7.CreateFunction("Clear Early Exits", new Color(0.5f, 0.5f, 1f), (Action)ZombieVoid);
}
public void NotificationVoid(string Message, NotificationType NotifType, float Length, bool ShowTitle)
{
//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_000c: Unknown result type (might be due to invalid IL or missing references)
//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_0018: 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)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: 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_0039: Expected O, but got Unknown
Notification val = new Notification
{
Title = NotificationText.op_Implicit("Scene Janitor"),
Message = NotificationText.op_Implicit(Message),
Type = NotifType,
PopupLength = Length,
ShowTitleOnPopup = ShowTitle
};
Notifier.Send(val);
}
public void PropCleanup(bool Despawning, bool Restoring, string NotifText)
{
bool flag = false;
if (VarSaves.FusionSyncBool)
{
if (!NetworkInfo.IsServer)
{
NotificationVoid("You are not the server host!", (NotificationType)2, 4f, ShowTitle: true);
return;
}
if (Despawning)
{
flag = true;
PooleeUtilities.DespawnAll();
}
}
GameObject[] array = Il2CppArrayBase<GameObject>.op_Implicit(Object.FindObjectsOfType<GameObject>());
if (!VarSaves.FusionSyncBool && Despawning)
{
GameObject[] array2 = Il2CppArrayBase<GameObject>.op_Implicit(Object.FindObjectsOfType<GameObject>());
GameObject[] array3 = array2;
foreach (GameObject val in array3)
{
if ((Object)(object)val.GetComponent<Poolee>() != (Object)null && (Object)(object)val.GetComponent<MarrowEntity>() != (Object)null && val.layer != LayerMask.NameToLayer("Player") && val.tag == "Untagged" && (Object)(object)val.GetComponentInChildren<Tracker>() != (Object)null && (((Object)(object)val.GetComponent<MarrowBody>() != (Object)null) | ((Object)(object)val.GetComponentInChildren<MarrowBody>() != (Object)null)) && (((Object)(object)val.GetComponentInChildren<InteractableHost>() != (Object)null) | ((Object)(object)val.GetComponent<InteractableHost>() != (Object)null)))
{
flag = true;
val.GetComponent<Poolee>().Despawn();
}
}
}
GameObject[] array4 = array;
foreach (GameObject val2 in array4)
{
if (Restoring && (Object)(object)val2.GetComponent<CrateSpawner>() != (Object)null && val2.layer == LayerMask.NameToLayer("Ignore Raycast") && val2.active && !val2.GetComponent<CrateSpawner>().manualMode)
{
flag = true;
val2.GetComponent<CrateSpawner>().SpawnSpawnable();
}
}
if (flag)
{
MelonLogger.Msg(NotifText);
NotificationVoid(NotifText, (NotificationType)3, 1f, ShowTitle: true);
}
}
private void RestoreCleanup()
{
PropCleanup(Despawning: true, Restoring: true, "Cleared & Restored Props");
}
private void PropSpawn()
{
PropCleanup(Despawning: false, Restoring: true, "Spawned Props");
}
private void DespawnProps()
{
if (VarSaves.FusionSyncBool)
{
NotificationVoid("There is no reason to use this with fusion installed lol", (NotificationType)2, 5f, ShowTitle: true);
}
else
{
PropCleanup(Despawning: true, Restoring: false, "Despawned Props");
}
}
public void NPCCleanup(string nameLook, string NotifText, bool SpecificNPC)
{
bool flag = false;
if (VarSaves.FusionSyncBool && !NetworkInfo.IsServer)
{
NotificationVoid("You are not the server host!", (NotificationType)2, 4f, ShowTitle: true);
return;
}
GameObject[] array = Il2CppArrayBase<GameObject>.op_Implicit(Object.FindObjectsOfType<GameObject>());
GameObject[] array2 = array;
foreach (GameObject val in array2)
{
if (!((Object)(object)val.GetComponent<Poolee>() != (Object)null) || !((Object)(object)val.GetComponent<MarrowEntity>() != (Object)null) || val.layer == LayerMask.NameToLayer("Player") || !(val.tag == "Untagged") || !((Object)(object)val.GetComponentInChildren<Tracker>() != (Object)null) || !(((Object)(object)val.GetComponent<MarrowBody>() != (Object)null) | ((Object)(object)val.GetComponentInChildren<MarrowBody>() != (Object)null)) || !(((Object)(object)val.GetComponentInChildren<InteractableHost>() != (Object)null) | ((Object)(object)val.GetComponent<InteractableHost>() != (Object)null)) || !Object.op_Implicit((Object)(object)val.GetComponent<AIBrain>()))
{
continue;
}
if (SpecificNPC)
{
if (((Object)val).name.Contains(nameLook))
{
flag = true;
val.GetComponent<Poolee>().Despawn();
}
}
else
{
flag = true;
val.GetComponent<Poolee>().Despawn();
}
}
if (flag && NotifText != null)
{
MelonLogger.Msg(NotifText);
NotificationVoid(NotifText, (NotificationType)3, 1f, ShowTitle: true);
}
}
private void AllNPCClear()
{
NPCCleanup(null, "Cleared all NPCs", SpecificNPC: false);
}
private void FordClearVoid()
{
NPCCleanup("NPC_Ford_BWOrig", "Cleared all Fords", SpecificNPC: true);
}
private void NullClearVoid()
{
NPCCleanup("Null", "Cleared all Nullbodies", SpecificNPC: true);
}
private void CrabClearVoid()
{
NPCCleanup("Crablet", "I HATE THOSE STUPID CRABS GAHHHHHHH", SpecificNPC: true);
}
private void OmniClearVoid()
{
NPCCleanup("omniProjector_hazmat", "Cleared all Omni Projectors", SpecificNPC: true);
}
private void SkeleClearVoid()
{
NPCCleanup("Skeleton", "Cleared all Skeletons", SpecificNPC: true);
}
private void PeasantCLearVoid()
{
NPCCleanup("NPC_Peasant", "Cleared all Peasants", SpecificNPC: true);
}
private void ZombieVoid()
{
NPCCleanup("Ford_EarlyExit", "Cleared all Early Exits", SpecificNPC: true);
}
}
public static class VarSaves
{
public static bool FusionSyncBool = true;
}