using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MassEditor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MassEditor")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("209116BB-AF2B-4562-A63F-4BF48FB51C7E")]
[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")]
namespace MassEditor;
public class Cloner : MonoBehaviour
{
public static GameObject CloneGameObject(GameObject g)
{
return Object.Instantiate<GameObject>(g);
}
public static void DestroyGameObject(GameObject g)
{
Object.Destroy((Object)(object)g);
}
}
[HarmonyPatch]
public class MassController
{
private static MassController instance;
internal List<MassInstance> massInstances = new List<MassInstance>();
private MassController()
{
}
public static MassController GetMassController()
{
if (instance == null)
{
instance = new MassController();
}
return instance;
}
public MassInstance GetInstanceFromDeathFloor(DEN_DeathFloor deathFloor)
{
foreach (MassInstance massInstance in massInstances)
{
if ((Object)(object)massInstance.DeathFloorInstance == (Object)(object)deathFloor)
{
return massInstance;
}
}
return null;
}
}
public class SpawnRequirementEventArgs
{
public bool? AllowSpawn = null;
}
[HarmonyPatch]
public class MassInstance
{
public class SpawnSettings
{
public List<M_Level> SpawnLevels = new List<M_Level>();
public List<M_Region> SpawnRegions = new List<M_Region>();
public List<M_Subregion> SpawnSubregions = new List<M_Subregion>();
public List<M_Gamemode> SpawnGamemodes = new List<M_Gamemode>();
}
public enum DeathFloorType
{
Normal,
Holiday,
Training
}
private float _height = 0f;
public Vector3 MoveDirection = Vector3.up;
public bool EntityMoves = true;
public SpawnSettings spawnSettings;
public float Height
{
get
{
return _height;
}
set
{
//IL_000d: 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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: 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_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
Transform transform = ((Component)DeathFloorInstance).transform;
transform.position += ((Vector3)(ref MoveDirection)).normalized * (value - _height);
Transform transform2 = ((Component)DeathFloorInstance).transform;
Plane planeInstance = PlaneInstance;
transform2.position = ((Plane)(ref planeInstance)).ClosestPointOnPlane(((Component)ENT_Player.playerObject).transform.position);
_height = value;
}
}
public Vector3 UpDirection
{
get
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
return ((Component)DeathFloorInstance).gameObject.transform.up;
}
set
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
((Component)DeathFloorInstance).gameObject.transform.up = value;
}
}
public Plane PlaneInstance => new Plane(((Component)DeathFloorInstance).transform.up, ((Component)DeathFloorInstance).transform.position);
public DEN_DeathFloor DeathFloorInstance { get; }
public event EventHandler<SpawnRequirementEventArgs> DeathFloorAttemptingSpawn;
private bool? OnDeathFloorAttemptingSpawn(SpawnRequirementEventArgs e)
{
this.DeathFloorAttemptingSpawn?.Invoke(this, e);
return e.AllowSpawn;
}
public float GetPlayerDistance()
{
//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_0013: Unknown result type (might be due to invalid IL or missing references)
Plane planeInstance = PlaneInstance;
return ((Plane)(ref planeInstance)).GetDistanceToPoint(((Component)ENT_Player.playerObject).transform.position);
}
public float GetHeight()
{
return Height;
}
public float GetRelativeHeight()
{
return 0f - GetPlayerDistance();
}
public void CheckIfCanSpawn()
{
try
{
bool flag = false;
foreach (M_Level spawnLevel in spawnSettings.SpawnLevels)
{
if (((Object)spawnLevel).name == ((Object)CL_EventManager.currentLevel).name || flag)
{
flag = true;
break;
}
}
foreach (M_Region spawnRegion in spawnSettings.SpawnRegions)
{
if (((Object)spawnRegion).name == ((Object)CL_EventManager.currentRegion).name || flag)
{
flag = true;
break;
}
}
foreach (M_Subregion spawnSubregion in spawnSettings.SpawnSubregions)
{
if (((Object)spawnSubregion).name == ((Object)CL_EventManager.currentSubregion).name || flag)
{
flag = true;
break;
}
}
bool flag2 = false;
foreach (M_Gamemode spawnGamemode in spawnSettings.SpawnGamemodes)
{
if (((Object)spawnGamemode).name == ((Object)CL_GameManager.GetCurrentGamemode()).name)
{
flag2 = true;
break;
}
}
if (!flag2 && spawnSettings.SpawnGamemodes.Count > 0 && flag)
{
flag = false;
}
else if (spawnSettings.SpawnLevels.Count + spawnSettings.SpawnRegions.Count + spawnSettings.SpawnSubregions.Count == 0 && flag2)
{
flag = true;
}
if (spawnSettings.SpawnGamemodes.Count > 0 && !flag2)
{
Delete();
return;
}
SpawnRequirementEventArgs e = new SpawnRequirementEventArgs();
bool? flag3 = OnDeathFloorAttemptingSpawn(e);
if (flag3.HasValue)
{
flag = flag3.Value;
}
((Component)DeathFloorInstance).gameObject.SetActive(flag);
Debug.Log((object)flag);
}
catch (Exception ex)
{
Debug.LogWarning((object)("Checking for spawn plausibility has failed. Exception: " + ex.GetType().Name + " Message: " + ex.Message));
}
}
public static MassInstance Create(Vector3 up, float distanceAtStart = 16f, DeathFloorType type = DeathFloorType.Normal)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return Create(up, up, distanceAtStart, type);
}
public static MassInstance Create(Vector3 up, Vector3 moveDirection, float distanceAtStart = 16f, DeathFloorType type = DeathFloorType.Normal)
{
//IL_0009: 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_0012: 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_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: 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)
MassInstance massInstance = Create(type);
massInstance.UpDirection = up;
massInstance.MoveDirection = moveDirection;
((Component)massInstance.DeathFloorInstance).transform.position = ((Component)ENT_Player.playerObject).transform.position - ((Vector3)(ref moveDirection)).normalized * distanceAtStart;
return massInstance;
}
private static MassInstance Create(DeathFloorType type)
{
List<GameObject> entityPrefabs = CL_AssetManager.GetFullCombinedAssetDatabase().entityPrefabs;
string text = "Denizen_Death_Floor";
switch (type)
{
case DeathFloorType.Holiday:
text += "_Holiday";
break;
case DeathFloorType.Training:
text += "_Training";
break;
}
GameObject val = null;
foreach (GameObject item in entityPrefabs)
{
if (((Object)item).name.Equals(text))
{
val = Cloner.CloneGameObject(item);
}
}
if ((Object)(object)val == (Object)null)
{
throw new KeyNotFoundException("The stated type has not been found!");
}
val.SetActive(true);
MassController massController = MassController.GetMassController();
MassInstance massInstance = new MassInstance(val.GetComponent<DEN_DeathFloor>());
massController.massInstances.Add(massInstance);
if (massController.massInstances.Count > 1)
{
massInstance.DeathFloorInstance.setCorruptionHeight = false;
}
return massInstance;
}
public void Delete()
{
MassController.GetMassController().massInstances.Remove(this);
Cloner.DestroyGameObject(((Component)DeathFloorInstance).gameObject);
}
private MassInstance(DEN_DeathFloor deathFloor)
{
//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)
DeathFloorInstance = deathFloor;
spawnSettings = new SpawnSettings();
}
public void MoveToHeightSequence(float amount)
{
Debug.Log((object)amount);
}
public void RaiseOverTimeRoutine(float amount)
{
Debug.Log((object)amount);
}
public void MoveFloor(float amount)
{
Height += amount;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(DEN_DeathFloor), "Start")]
private static void Edit(DEN_DeathFloor __instance)
{
MassInstance instanceFromDeathFloor = MassController.GetMassController().GetInstanceFromDeathFloor(__instance);
if (instanceFromDeathFloor == null)
{
Cloner.DestroyGameObject(((Component)__instance).gameObject);
}
else
{
instanceFromDeathFloor.CheckIfCanSpawn();
}
}
[HarmonyDebug]
[HarmonyTranspiler]
[HarmonyPatch(typeof(DEN_DeathFloor), "Update")]
public static IEnumerable<CodeInstruction> UpdateEditor(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected O, but got Unknown
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Expected O, but got Unknown
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Expected O, but got Unknown
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Expected O, but got Unknown
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Expected O, but got Unknown
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Expected O, but got Unknown
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Expected O, but got Unknown
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Expected O, but got Unknown
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Expected O, but got Unknown
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Expected O, but got Unknown
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Expected O, but got Unknown
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: Expected O, but got Unknown
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02a7: Expected O, but got Unknown
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
//IL_02bb: Expected O, but got Unknown
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
//IL_02cf: Expected O, but got Unknown
//IL_030f: Unknown result type (might be due to invalid IL or missing references)
//IL_0315: Expected O, but got Unknown
//IL_0375: Unknown result type (might be due to invalid IL or missing references)
//IL_037b: Expected O, but got Unknown
//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
//IL_03aa: Expected O, but got Unknown
//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
//IL_03be: Expected O, but got Unknown
//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
//IL_03d2: Expected O, but got Unknown
//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
//IL_03e6: Expected O, but got Unknown
//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
//IL_03fa: Expected O, but got Unknown
//IL_0408: Unknown result type (might be due to invalid IL or missing references)
//IL_040e: Expected O, but got Unknown
//IL_044e: Unknown result type (might be due to invalid IL or missing references)
//IL_0454: Expected O, but got Unknown
CodeMatcher val = new CodeMatcher(instructions, generator);
val.MatchEndForward((CodeMatch[])(object)new CodeMatch[6]
{
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null)
}).ThrowIfInvalid("WHYYYYYY");
val.Advance(-4);
val.RemoveInstructions(11);
val.Insert((CodeInstruction[])(object)new CodeInstruction[4]
{
CodeInstruction.Call(typeof(MassController), "GetMassController", (Type[])null, (Type[])null),
new CodeInstruction(OpCodes.Ldarg_0, (object)null),
CodeInstruction.Call(typeof(MassController), "GetInstanceFromDeathFloor", (Type[])null, (Type[])null),
CodeInstruction.Call(typeof(MassInstance), "GetPlayerDistance", (Type[])null, (Type[])null)
});
val.MatchEndForward((CodeMatch[])(object)new CodeMatch[6]
{
new CodeMatch((OpCode?)OpCodes.Ldloca_S, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null)
}).ThrowIfInvalid("WHYYYYYY");
val.Advance(-5);
int pos = val.Pos;
val.RemoveInstructions(18);
val.Insert((CodeInstruction[])(object)new CodeInstruction[3]
{
CodeInstruction.Call(typeof(MassController), "GetMassController", (Type[])null, (Type[])null),
new CodeInstruction(OpCodes.Ldarg_0, (object)null),
CodeInstruction.Call(typeof(MassController), "GetInstanceFromDeathFloor", (Type[])null, (Type[])null)
});
val.Advance(6);
val.RemoveInstructions(6);
val.Insert((CodeInstruction[])(object)new CodeInstruction[1] { CodeInstruction.Call(typeof(MassInstance), "MoveFloor", (Type[])null, (Type[])null) });
val.Advance(1);
Label label = default(Label);
CodeMatcher val2 = val.CreateLabel(ref label);
val.Advance(pos - 1 - val.Pos);
val.Operand = label;
val.Advance(-val.Pos);
val.MatchEndForward((CodeMatch[])(object)new CodeMatch[4]
{
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null)
}).ThrowIfInvalid("WHYYYYYY");
val.RemoveInstructions(5);
val.Insert((CodeInstruction[])(object)new CodeInstruction[4]
{
CodeInstruction.Call(typeof(MassController), "GetMassController", (Type[])null, (Type[])null),
new CodeInstruction(OpCodes.Ldarg_0, (object)null),
CodeInstruction.Call(typeof(MassController), "GetInstanceFromDeathFloor", (Type[])null, (Type[])null),
CodeInstruction.Call(typeof(MassInstance), "GetPlayerDistance", (Type[])null, (Type[])null)
});
val.Advance(4);
val.RemoveInstructions(6);
val.Insert((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Ldc_R4, (object)(-1f))
});
val.Advance(-val.Pos);
val.MatchEndForward((CodeMatch[])(object)new CodeMatch[6]
{
new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Stloc_0, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Brtrue, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldsfld, (object)null, (string)null)
}).ThrowIfInvalid("Cannot find CL_GameManager.gMan.GetPlayerCorrectedHeight()");
val.RemoveInstructions(2);
val.Insert((CodeInstruction[])(object)new CodeInstruction[4]
{
CodeInstruction.Call(typeof(MassController), "GetMassController", (Type[])null, (Type[])null),
new CodeInstruction(OpCodes.Ldarg_0, (object)null),
CodeInstruction.Call(typeof(MassController), "GetInstanceFromDeathFloor", (Type[])null, (Type[])null),
CodeInstruction.Call(typeof(MassInstance), "GetPlayerDistance", (Type[])null, (Type[])null)
});
return val.InstructionEnumeration();
}
[HarmonyPostfix]
[HarmonyPatch(typeof(DEN_DeathFloor), "Update")]
public static void CancelFX()
{
FXManager.fxMan.corruptionHeight = -10000f;
}
[HarmonyDebug]
[HarmonyTranspiler]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public static IEnumerable<CodeInstruction> GoUpSequence(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected O, but got Unknown
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Expected O, but got Unknown
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Expected O, but got Unknown
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Expected O, but got Unknown
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Expected O, but got Unknown
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Expected O, but got Unknown
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Expected O, but got Unknown
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Expected O, but got Unknown
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Expected O, but got Unknown
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Expected O, but got Unknown
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Expected O, but got Unknown
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Expected O, but got Unknown
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Expected O, but got Unknown
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Expected O, but got Unknown
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Expected O, but got Unknown
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Expected O, but got Unknown
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Expected O, but got Unknown
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_025c: Expected O, but got Unknown
CodeMatcher val = new CodeMatcher(instructions, generator);
val.Start();
val.MatchEndForward((CodeMatch[])(object)new CodeMatch[6]
{
new CodeMatch((OpCode?)OpCodes.Ldloc_1, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null)
}).ThrowIfInvalid("WHYYYYYY0");
object operand = val.Operand;
val.Advance(-val.Pos);
val.MatchEndForward((CodeMatch[])(object)new CodeMatch[6]
{
new CodeMatch((OpCode?)OpCodes.Newobj, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldc_R4, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Mul, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null)
}).ThrowIfInvalid("WHYYYYYY");
val.MatchEndBackwards((CodeMatch[])(object)new CodeMatch[5]
{
new CodeMatch((OpCode?)OpCodes.Ldloc_1, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldloc_1, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null)
}).ThrowIfInvalid("WHYYYYYY2");
val.Advance(-4);
val.RemoveInstructions(21);
val.Insert((CodeInstruction[])(object)new CodeInstruction[7]
{
CodeInstruction.Call(typeof(MassController), "GetMassController", (Type[])null, (Type[])null),
new CodeInstruction(OpCodes.Ldloc_1, (object)null),
CodeInstruction.Call(typeof(MassController), "GetInstanceFromDeathFloor", (Type[])null, (Type[])null),
new CodeInstruction(OpCodes.Ldarg_0, (object)null),
new CodeInstruction(OpCodes.Ldfld, operand),
CodeInstruction.Call(typeof(MassInstance), "MoveToHeightSequence", (Type[])null, (Type[])null),
new CodeInstruction(OpCodes.Nop, (object)null)
});
Label label = default(Label);
val.CreateLabel(ref label);
do
{
val.Advance(1);
}
while (!(val.Opcode == OpCodes.Bgt));
val.Operand = label;
return val.InstructionEnumeration();
}
[HarmonyPostfix]
[HarmonyPatch(typeof(CL_EventManager), "EnterLevel")]
public static void CanSpawnInitializer()
{
MassController massController = MassController.GetMassController();
foreach (MassInstance massInstance in massController.massInstances)
{
massInstance.CheckIfCanSpawn();
}
Debug.Log((object)("Current Level: " + (object)CL_EventManager.currentLevel));
Debug.Log((object)("Current Region: " + (object)CL_EventManager.currentRegion));
Debug.Log((object)("Current Subregion: " + (object)CL_EventManager.currentSubregion));
Debug.Log((object)("Current Gamemode: " + (object)CL_GameManager.gamemode));
}
}
[BepInPlugin("mazknight.whiteknuckle.DeathFloorEditor", "DeathFloorEditor", "0.1.1")]
public class Plugin : BaseUnityPlugin
{
private const string pluginGuid = "mazknight.whiteknuckle.DeathFloorEditor";
public const string pluginName = "DeathFloorEditor";
public const string pluginVersion = "0.1.1";
private Harmony harmony = new Harmony("mazknight.whiteknuckle.DeathFloorEditor");
public void Awake()
{
harmony.PatchAll();
}
}
[HarmonyPatch]
public class Transpilation
{
[HarmonyPrefix]
[HarmonyPatch(typeof(CL_GameManager), "Awake")]
public static void CreateDeathGoo(CL_GameManager __instance)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)CL_GameManager.gamemode == (Object)null))
{
MassInstance massInstance = MassInstance.Create(Vector3.up, 28f);
massInstance.spawnSettings.SpawnRegions.Add(CL_AssetManager.GetRegionAsset("Region_Silos_Campaign", ""));
massInstance.spawnSettings.SpawnRegions.Add(CL_AssetManager.GetRegionAsset("Region_Pipeworks_Campaign", ""));
massInstance.spawnSettings.SpawnRegions.Add(CL_AssetManager.GetRegionAsset("Region_Silos_Endless", ""));
massInstance.spawnSettings.SpawnRegions.Add(CL_AssetManager.GetRegionAsset("Region_Pipeworks_Endless", ""));
massInstance.spawnSettings.SpawnRegions.Add(CL_AssetManager.GetRegionAsset("Region_Habitation_Endless", ""));
__instance.allowScores = false;
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(CL_GameManager), "AreAchievementsAllowed")]
public static void DenyAchievements(ref bool __result)
{
__result = false;
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(DEN_DeathFloor), "Start")]
public static IEnumerable<CodeInstruction> RemoveSingleton(IEnumerable<CodeInstruction> instructions)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected O, but got Unknown
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Expected O, but got Unknown
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Expected O, but got Unknown
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Expected O, but got Unknown
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Expected O, but got Unknown
CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
val.Start().MatchEndForward((CodeMatch[])(object)new CodeMatch[8]
{
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ret, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldc_R4, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Stfld, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null)
}).ThrowIfInvalid("WHYYYYYY");
val.RemoveInstructions(2);
return val.InstructionEnumeration();
}
public static void DebugChildren<T>(GameObject g) where T : Component
{
DebugChildrenInner<T>("", g.transform);
}
private static void DebugChildrenInner<T>(string start, Transform g)
{
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Expected O, but got Unknown
string text = "\n";
text = ((!(start == "")) ? (text + start + "-> " + ((Object)((Component)g).gameObject).name + "\n") : (text + start + ((Object)((Component)g).gameObject).name + "\n"));
for (int i = 0; i < ((Component)g).gameObject.GetComponentCount(); i++)
{
text = text + "\t" + ((object)((Component)g).gameObject.GetComponentAtIndex(i)).GetType().Name + "\n";
Component componentAtIndex = ((Component)g).gameObject.GetComponentAtIndex(i);
ObjectTagger val = (ObjectTagger)(object)((componentAtIndex is ObjectTagger) ? componentAtIndex : null);
if (val != null)
{
string text2 = "";
foreach (string tag in val.tags)
{
text2 = text2 + tag + ", ";
}
text = text + "\t\t" + text2 + "\n";
}
Component componentAtIndex2 = ((Component)g).gameObject.GetComponentAtIndex(i);
CL_Handhold val2 = (CL_Handhold)(object)((componentAtIndex2 is CL_Handhold) ? componentAtIndex2 : null);
if (val2 == null)
{
continue;
}
string text3 = "";
foreach (HandholdModule module in val2.modules)
{
text3 = text3 + ((object)module).GetType().Name + ", ";
}
text = text + "\t\t" + text3 + "\n";
}
text = text + ((Object)((Component)g).gameObject).GetInstanceID() + "\n";
if (((Component)g).gameObject.GetComponent<T>() != null)
{
Debug.Log((object)text);
}
foreach (Transform item in g)
{
Transform g2 = item;
if (start == "")
{
DebugChildrenInner<T>(start + ((Object)((Component)g).gameObject).name + " ", g2);
}
else
{
DebugChildrenInner<T>(start + "-> " + ((Object)((Component)g).gameObject).name + " ", g2);
}
}
}
public static void DebugChildren(GameObject g)
{
DebugChildrenInner(" ", g.transform);
}
private static void DebugChildrenInner(string start, Transform g)
{
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Expected O, but got Unknown
if (start == "")
{
Debug.Log((object)(start + ((Object)((Component)g).gameObject).name));
}
else
{
Debug.Log((object)(start + "-> " + ((Object)((Component)g).gameObject).name));
}
for (int i = 0; i < ((Component)g).gameObject.GetComponentCount(); i++)
{
Debug.Log((object)((object)((Component)g).gameObject.GetComponentAtIndex(i)).GetType().Name);
Component componentAtIndex = ((Component)g).gameObject.GetComponentAtIndex(i);
ObjectTagger val = (ObjectTagger)(object)((componentAtIndex is ObjectTagger) ? componentAtIndex : null);
if (val == null)
{
continue;
}
string text = "";
foreach (string tag in val.tags)
{
text = text + tag + ", ";
}
Debug.Log((object)("\t" + text));
}
foreach (Transform item in g)
{
Transform g2 = item;
if (start == "")
{
DebugChildrenInner(start + ((Object)((Component)g).gameObject).name + " ", g2);
}
else
{
DebugChildrenInner(start + "-> " + ((Object)((Component)g).gameObject).name + " ", g2);
}
}
}
}
public static class TranspilerTools
{
public static void DebugCurrentPosition(CodeMatcher matcher)
{
int pos = matcher.Pos;
int length = matcher.Length;
matcher.Advance(-pos);
for (int i = 0; i < length; i++)
{
int pos2 = matcher.Pos;
OpCode opcode = matcher.Opcode;
object operand = matcher.Operand;
string text = pos2.ToString();
text = ((pos2 != pos) ? (text + ": ") : (text + ":* "));
text = text + opcode.ToString() + " " + operand;
if (operand != null)
{
text = text + " Type: " + operand.GetType();
}
Debug.Log((object)text);
if (pos2 == length)
{
break;
}
matcher.Advance(1);
}
matcher.Advance(pos - length);
}
public static void DebugSurroundingPosition(CodeMatcher matcher, int distance)
{
int pos = matcher.Pos;
int length = matcher.Length;
if (pos < distance)
{
matcher.Advance(-pos);
}
else
{
matcher.Advance(-distance);
}
for (int i = 0; i < 2 * distance; i++)
{
int pos2 = matcher.Pos;
OpCode opcode = matcher.Opcode;
object operand = matcher.Operand;
string text = pos2.ToString();
text = ((pos2 != pos) ? (text + ": ") : (text + ":* "));
text = text + opcode.ToString() + " " + operand;
if (operand != null)
{
text = text + " Type: " + operand.GetType();
}
Debug.Log((object)text);
if (pos2 == length)
{
break;
}
matcher.Advance(1);
}
matcher.Advance(pos - matcher.Pos);
}
}