Decompiled source of Parches 2027Pack v1.2.0

BepInEx/plugins/CompatibilidadInventario.dll

Decompiled 9 hours ago
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Bootstrap;
using GameNetcodeStuff;
using HarmonyLib;

[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace CompatibilidadInventario;

[BepInPlugin("lethalpack.compatibilidadinventario", "Compatibilidad del inventario", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public sealed class Plugin : BaseUnityPlugin
{
	private const string Dawn = "com.github.teamxiaolan.dawnlib";

	private const string Jacob = "JacobG5.DestroyItemInSlotFix";

	private void Awake()
	{
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		if (!Chainloader.PluginInfos["com.github.teamxiaolan.dawnlib"].Metadata.Version.Equals(new Version(0, 9, 27)) || !Chainloader.PluginInfos["JacobG5.DestroyItemInSlotFix"].Metadata.Version.Equals(new Version(1, 0, 0)))
		{
			return;
		}
		MethodInfo methodInfo = AccessTools.Method(typeof(PlayerControllerB), "DestroyItemInSlot", new Type[1] { typeof(int) }, (Type[])null);
		Patches patchInfo = Harmony.GetPatchInfo((MethodBase)methodInfo);
		if (patchInfo == null)
		{
			return;
		}
		foreach (Patch transpiler in patchInfo.Transpilers)
		{
			if (!(transpiler.owner != "JacobG5.DestroyItemInSlotFix") && !(transpiler.PatchMethod.Name != "FindObjectTranspiler"))
			{
				new Harmony("lethalpack.compatibilidadinventario").Unpatch((MethodBase)methodInfo, transpiler.PatchMethod);
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Inventario preparado con la corrección de DawnLib y sin la sustitución duplicada de JacobG5.");
				break;
			}
		}
	}
}

BepInEx/plugins/OroEnEmpra.dll

Decompiled 9 hours ago
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace OroEnEmpra;

[BepInDependency("LCGoldScrapMod", "2.2.7")]
[BepInPlugin("lethalpack.oroenempra", "Oro en Empra", "1.0.0")]
public sealed class Plugin : BaseUnityPlugin
{
	internal const int PesoBase = 5;

	private void Awake()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		new Harmony("lethalpack.oroenempra").PatchAll(typeof(Plugin).Assembly);
	}

	internal static bool EsEmpra(SelectableLevel luna)
	{
		if ((Object)(object)luna != (Object)null)
		{
			if (!string.Equals(luna.PlanetName, "555 Empra", StringComparison.OrdinalIgnoreCase))
			{
				return string.Equals(luna.sceneName, "EmpraScene", StringComparison.OrdinalIgnoreCase);
			}
			return true;
		}
		return false;
	}
}
[HarmonyPatch(typeof(RegisterGoldScrap), "RegisterGoldScrapModded")]
internal static class Registro
{
	private static void Postfix()
	{
		HashSet<Item> hashSet = new HashSet<Item>();
		ItemData[] allGoldGrabbableObjects = GoldScrapPlugin.allGoldGrabbableObjects;
		foreach (ItemData val in allGoldGrabbableObjects)
		{
			if ((Object)(object)val != (Object)null && !val.isStoreItem && (Object)(object)val.itemProperties != (Object)null)
			{
				hashSet.Add(val.itemProperties);
			}
		}
		SelectableLevel[] levels = StartOfRound.Instance.levels;
		foreach (SelectableLevel val2 in levels)
		{
			if (!Plugin.EsEmpra(val2) || val2.spawnableScrap == null)
			{
				continue;
			}
			foreach (SpawnableItemWithRarity item in val2.spawnableScrap)
			{
				if (item != null && hashSet.Contains(item.spawnableItem))
				{
					item.rarity = 5;
				}
			}
		}
	}
}
[HarmonyPatch(typeof(RarityManager), "CalculateRarity")]
internal static class Recalculo
{
	private static void Postfix(SelectableLevel __1, ref int __result)
	{
		if (Plugin.EsEmpra(__1))
		{
			__result *= 5;
		}
	}
}

BepInEx/plugins/RutasInicialesWesley.dll

Decompiled 9 hours ago
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using HarmonyLib;
using LethalLevelLoader;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace RutasInicialesWesley;

[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("lethalpack.rutasinicialeswesley", "Rutas iniciales de Wesley", "1.0.0")]
public sealed class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		new Harmony("lethalpack.rutasinicialeswesley").PatchAll(typeof(Plugin).Assembly);
	}

	internal static void AbrirRutaInicial(ExtendedLevel destino)
	{
		if (!((Object)(object)destino == (Object)null) && !((Object)(object)destino.SelectableLevel == (Object)null))
		{
			switch (destino.SelectableLevel.sceneName)
			{
			case "Asteroid13Scene":
			case "InfernisScene":
			case "MotraScene":
				destino.IsRouteHidden = false;
				destino.IsRouteLocked = false;
				break;
			}
		}
	}
}
[HarmonyPatch(typeof(PatchedContent), "PopulateContentDictionaries")]
internal static class RutasDelCatalogo
{
	[HarmonyPostfix]
	[HarmonyAfter(new string[] { "JacobG5.WesleyMoonScripts" })]
	private static void Postfix()
	{
		foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels)
		{
			Plugin.AbrirRutaInicial(extendedLevel);
		}
	}
}
[HarmonyPatch(typeof(ExtendedLevelData), "ApplySavedValues")]
internal static class RutasDelGuardado
{
	[HarmonyPostfix]
	private static void Postfix(ExtendedLevel extendedLevel)
	{
		Plugin.AbrirRutaInicial(extendedLevel);
	}
}

BepInEx/plugins/PolaroidInventario.dll

Decompiled 9 hours ago
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace PolaroidInventario;

[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("lethalpack.polaroidinventario", "Compatibilidad de la Polaroid", "1.0.0")]
public sealed class Plugin : BaseUnityPlugin
{
	private static Type cameraType;

	private static ManualLogSource log;

	private static readonly ConditionalWeakTable<GrabbableObject, object> started = new ConditionalWeakTable<GrabbableObject, object>();

	private static readonly MethodInfo transfer = AccessTools.Method(typeof(NetworkObject), "ChangeOwnership", new Type[1] { typeof(ulong) }, (Type[])null);

	private static readonly MethodInfo setEnabled = AccessTools.PropertySetter(typeof(Renderer), "enabled");

	private void Awake()
	{
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Expected O, but got Unknown
		PluginInfo val = Chainloader.PluginInfos["LethalSnapReborn"];
		if (val.Metadata.Version.Equals(new Version(1, 0, 1)))
		{
			log = ((BaseUnityPlugin)this).Logger;
			cameraType = ((object)val.Instance).GetType().Assembly.GetType("LethalSnapProject.Behaviour.PolaroidItem", throwOnError: true);
			Harmony val2 = new Harmony("lethalpack.polaroidinventario");
			val2.Patch((MethodBase)AccessTools.DeclaredMethod(cameraType, "Start", (Type[])null, (Type[])null), Patch("BeforeStart"), Patch("AfterStart"), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			val2.Patch((MethodBase)AccessTools.DeclaredMethod(cameraType, "SetScreenColor", (Type[])null, (Type[])null), Patch("ScreenExists"), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			val2.Patch((MethodBase)AccessTools.DeclaredMethod(cameraType, "PocketItem", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, Patch("GuardBatteryIndicator"), (HarmonyMethod)null, (HarmonyMethod)null);
			val2.Patch((MethodBase)AccessTools.Method(typeof(PlayerControllerB), "GrabObjectServerRpc", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, Patch("PrepareAcceptedGrab"), (HarmonyMethod)null, (HarmonyMethod)null);
			val2.Patch((MethodBase)AccessTools.Method(typeof(PlayerControllerB), "SwitchToItemSlot", (Type[])null, (Type[])null), Patch("PrepareReceivedItem"), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Compatibilidad de la Polaroid instalada para LethalSnapReborn 1.0.1.");
		}
	}

	private static HarmonyMethod Patch(string name)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		return new HarmonyMethod(typeof(Plugin), name, (Type[])null);
	}

	private static bool BeforeStart(GrabbableObject __instance)
	{
		object value;
		return !started.TryGetValue(__instance, out value);
	}

	private static void AfterStart(GrabbableObject __instance, bool __runOriginal)
	{
		if (__runOriginal)
		{
			started.GetOrCreateValue(__instance);
		}
	}

	private static IEnumerable<CodeInstruction> PrepareAcceptedGrab(IEnumerable<CodeInstruction> instructions)
	{
		int matches = 0;
		foreach (CodeInstruction instruction in instructions)
		{
			if (CodeInstructionExtensions.Calls(instruction, transfer))
			{
				matches++;
				yield return CodeInstructionExtensions.MoveLabelsFrom(new CodeInstruction(OpCodes.Ldarg_0, (object)null), instruction);
				yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Plugin), "TransferAcceptedItem", (Type[])null, (Type[])null));
			}
			else
			{
				yield return instruction;
			}
		}
		if (matches != 1)
		{
			throw new InvalidOperationException("Unexpected ownership transfer in GrabObjectServerRpc.");
		}
	}

	private static void TransferAcceptedItem(NetworkObject networkObject, ulong clientId, PlayerControllerB player)
	{
		Component component = ((Component)networkObject).GetComponent(cameraType);
		GrabbableObject val = (GrabbableObject)(object)((component is GrabbableObject) ? component : null);
		if (Object.op_Implicit((Object)(object)val))
		{
			PrepareCamera(player, val);
		}
		networkObject.ChangeOwnership(clientId);
	}

	private static void PrepareReceivedItem(PlayerControllerB __instance, GrabbableObject fillSlotWithItem)
	{
		if (Object.op_Implicit((Object)(object)fillSlotWithItem) && ((object)fillSlotWithItem).GetType() == cameraType)
		{
			PrepareCamera(__instance, fillSlotWithItem);
		}
	}

	private static void PrepareCamera(PlayerControllerB player, GrabbableObject item)
	{
		if (!((NetworkBehaviour)item).IsSpawned)
		{
			return;
		}
		GameObject gameObject = ((Component)item).gameObject;
		Transform parent = gameObject.transform.parent;
		if (!gameObject.activeInHierarchy && Object.op_Implicit((Object)(object)parent) && !((Component)parent).gameObject.activeInHierarchy && Object.op_Implicit((Object)(object)player.playersManager))
		{
			Transform val = (player.isInElevator ? player.playersManager.elevatorTransform : player.playersManager.propsContainer);
			if (Object.op_Implicit((Object)(object)val) && ((Component)val).gameObject.activeInHierarchy)
			{
				gameObject.transform.SetParent(val, true);
			}
		}
		if (!gameObject.activeSelf)
		{
			gameObject.SetActive(true);
		}
		if (!((Behaviour)item).isActiveAndEnabled || !BeforeStart(item))
		{
			return;
		}
		try
		{
			item.Start();
		}
		catch (Exception ex)
		{
			log.LogWarning((object)("La Polaroid no pudo inicializarse al recogerla: " + ex));
		}
	}

	private static bool ScreenExists(Material ___screenMat)
	{
		return Object.op_Implicit((Object)(object)___screenMat);
	}

	private static IEnumerable<CodeInstruction> GuardBatteryIndicator(IEnumerable<CodeInstruction> instructions)
	{
		int matches = 0;
		foreach (CodeInstruction instruction in instructions)
		{
			if (CodeInstructionExtensions.Calls(instruction, setEnabled))
			{
				matches++;
				instruction.opcode = OpCodes.Call;
				instruction.operand = AccessTools.Method(typeof(Plugin), "SetIndicator", (Type[])null, (Type[])null);
			}
			yield return instruction;
		}
		if (matches != 1)
		{
			throw new InvalidOperationException("Unexpected battery indicator in PolaroidItem.PocketItem.");
		}
	}

	private static void SetIndicator(Renderer indicator, bool enabled)
	{
		if (Object.op_Implicit((Object)(object)indicator))
		{
			indicator.enabled = enabled;
		}
	}
}

BepInEx/plugins/ListaEspectadores.dll

Decompiled 9 hours ago
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace ListaEspectadores;

[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("lethalpack.listaespectadores", "Lista de espectadores", "0.1.0")]
public sealed class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		new Harmony("lethalpack.listaespectadores").PatchAll(typeof(Distribucion));
	}
}
[HarmonyPatch(typeof(HUDManager), "UpdateBoxesSpectateUI")]
internal static class Distribucion
{
	private const int FilasPorColumna = 4;

	private const int OrigenX = -64;

	private const int AnchoColumna = 230;

	private const int AltoFila = 70;

	[HarmonyPostfix]
	[HarmonyPriority(0)]
	[HarmonyAfter(new string[] { "me.swipez.melonloader.morecompany", "Emil.UsualScrap" })]
	private static void Postfix(Dictionary<Animator, PlayerControllerB> ___spectatingPlayerBoxes)
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Expected O, but got Unknown
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		int num = 0;
		Vector2 val2 = default(Vector2);
		foreach (Animator key in ___spectatingPlayerBoxes.Keys)
		{
			if (!((Object)(object)key == (Object)null) && ((Component)key).gameObject.activeSelf)
			{
				RectTransform val = (RectTransform)((Component)key).transform;
				((Vector2)(ref val2))..ctor((float)(-64 + num / 4 * 230), (float)(-(num % 4) * 70));
				if (val.anchoredPosition != val2)
				{
					val.anchoredPosition = val2;
				}
				num++;
			}
		}
	}
}

BepInEx/plugins/BalanceWesley.dll

Decompiled 9 hours ago
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using BepInEx;
using HarmonyLib;
using LethalLevelLoader;
using UnityEngine;

[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace BalanceWesley;

[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("lethalpack.balancewesley", "Botín y grabaciones de Wesley", "0.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public sealed class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		new Harmony("lethalpack.balancewesley").PatchAll(typeof(Plugin).Assembly);
	}
}
[HarmonyPatch(typeof(PatchedContent), "PopulateContentDictionaries")]
internal static class Catalogo
{
	internal static readonly HashSet<SelectableLevel> Lunas = new HashSet<SelectableLevel>();

	internal static readonly HashSet<Item> Grabaciones = new HashSet<Item>();

	private static readonly HashSet<string> Opcionales = new HashSet<string>(StringComparer.Ordinal)
	{
		"AcidirTapeExtendedItem", "AtlanticaTapeExtendedItem", "EternTapeExtendedItem", "FilitriosTapeExtendedItem", "GloomTapeExtendedItem", "GratarTapeExtendedItem", "HyveTapeExtendedItem", "JunicTapeExtendedItem", "MotraTapeExtendedItem", "OldredTapeExtendedItem",
		"UtrilTapeExtendedItem", "VindictTapeExtendedItem", "HalloweenTapeBExtendedItem", "HalloweenTapeCExtendedItem", "HalloweenTapeDExtendedItem", "HalloweenTapeEExtendedItem", "HalloweenTapeFExtendedItem", "FloppyDiskExtendedItem"
	};

	[HarmonyPostfix]
	private static void Postfix()
	{
		Lunas.Clear();
		Grabaciones.Clear();
		foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels)
		{
			if (((ExtendedContent)extendedLevel).ContentTags.Exists((ContentTag t) => (Object)(object)t != (Object)null && t.contentTagName == "Wesleys Moons Tag"))
			{
				SelectableLevel selectableLevel = extendedLevel.SelectableLevel;
				if (selectableLevel.sceneName != "RepressScene")
				{
					Lunas.Add(selectableLevel);
				}
				switch (selectableLevel.sceneName)
				{
				case "Asteroid13Scene":
					selectableLevel.minScrap = 21;
					selectableLevel.maxScrap = 24;
					break;
				case "JunicScene":
					selectableLevel.minScrap = 23;
					selectableLevel.maxScrap = 28;
					break;
				}
			}
		}
		foreach (ExtendedItem extendedItem in PatchedContent.ExtendedItems)
		{
			if (!Opcionales.Contains(((Object)extendedItem).name) || (Object)(object)((ExtendedContent)extendedItem).ExtendedMod == (Object)null || ((ExtendedContent)extendedItem).AuthorName != "MagicWesley")
			{
				continue;
			}
			Grabaciones.Add(extendedItem.Item);
			if (!(((Object)extendedItem).name == "HyveTapeExtendedItem") && !(((Object)extendedItem).name == "FloppyDiskExtendedItem"))
			{
				continue;
			}
			foreach (StringWithRarity planetName in extendedItem.LevelMatchingProperties.planetNames)
			{
				if (planetName.Name == "Asteroid")
				{
					planetName.Name = "Asteroid-13";
				}
			}
		}
	}
}
[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
internal static class Sorteo
{
	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
	{
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Expected O, but got Unknown
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Expected O, but got Unknown
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Expected O, but got Unknown
		List<CodeInstruction> list = new List<CodeInstruction>(instructions);
		MethodInfo sortear = AccessTools.Method(typeof(RoundManager), "GetRandomWeightedIndex", new Type[2]
		{
			typeof(int[]),
			typeof(Random)
		}, (Type[])null);
		MethodInfo tabla = AccessTools.Method(typeof(List<int>), "ToArray", (Type[])null, (Type[])null);
		int num = list.FindIndex((CodeInstruction i) => CodeInstructionExtensions.Calls(i, sortear));
		int num2 = ((num < 0) ? (-1) : list.FindLastIndex(num, (CodeInstruction i) => CodeInstructionExtensions.Calls(i, tabla)));
		FieldInfo multiplicador = AccessTools.Field(typeof(RoundManager), "scrapAmountMultiplier");
		int num3 = list.FindIndex((CodeInstruction i) => CodeInstructionExtensions.LoadsField(i, multiplicador, false));
		if (num2 < 0 || num3 < 0 || num3 + 3 >= num2 || list[num3 + 3].opcode != OpCodes.Stloc_1)
		{
			throw new InvalidOperationException("No se reconoce el sorteo de chatarra de Lethal Company v81.");
		}
		list.InsertRange(num2 + 1, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[3]
		{
			new CodeInstruction(OpCodes.Ldarg_0, (object)null),
			new CodeInstruction(OpCodes.Ldloc_1, (object)null),
			new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Sorteo), "AjustarPesos", (Type[])null, (Type[])null))
		});
		return list;
	}

	private static int[] AjustarPesos(int[] pesos, RoundManager ronda, int piezas)
	{
		SelectableLevel currentLevel = ronda.currentLevel;
		if (piezas <= 0 || !Catalogo.Lunas.Contains(currentLevel))
		{
			return pesos;
		}
		List<SpawnableItemWithRarity> spawnableScrap = currentLevel.spawnableScrap;
		if (spawnableScrap.Count != pesos.Length)
		{
			return pesos;
		}
		long num = 0L;
		long num2 = 0L;
		for (int i = 0; i < pesos.Length; i++)
		{
			if (pesos[i] < 0)
			{
				return pesos;
			}
			num += pesos[i];
			if (Catalogo.Grabaciones.Contains(spawnableScrap[i].spawnableItem))
			{
				num2 += pesos[i];
			}
		}
		if (num2 == 0)
		{
			return pesos;
		}
		long num3 = num - num2;
		long num4 = (long)Math.Ceiling((double)num3 * (Math.Pow(1.5, 1.0 / (double)piezas) - 1.0));
		if (num4 <= num2 || num3 + num4 > int.MaxValue / num2)
		{
			return pesos;
		}
		for (int j = 0; j < pesos.Length; j++)
		{
			long num5 = (Catalogo.Grabaciones.Contains(spawnableScrap[j].spawnableItem) ? num4 : num2);
			pesos[j] = (int)(pesos[j] * num5);
		}
		return pesos;
	}
}