Decompiled source of LethalCompanyVariables v2.7.0
BepInEx/patchers/LCVPreloader.dll
Decompiled 3 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Utils; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LCVPreloader")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+837d6cc274be0d07e6c6647ca04a644dffb46eb0")] [assembly: AssemblyProduct("LCVPreloader")] [assembly: AssemblyTitle("LCVPreloader")] [assembly: AssemblyVersion("1.0.0.0")] namespace LCVPreloader; public static class Preloader { public static IEnumerable<string> TargetDLLs { get; } = new string[1] { "Assembly-CSharp.dll" }; public static void Patch(AssemblyDefinition assemblyDefinition) { if (((AssemblyNameReference)assemblyDefinition.Name).Name != "Assembly-CSharp") { return; } Console.WriteLine("Patching assembly " + assemblyDefinition.MainModule.FileName); ModuleDefinition mainModule = assemblyDefinition.MainModule; foreach (TypeDefinition type in mainModule.GetTypes()) { switch (((MemberReference)type).FullName) { case "EnemyType": AddMethodSafe(type, CreateMethodStub(mainModule, "Awake")); AddMethodSafe(type, CreateMethodStub(mainModule, "OnDestroy")); break; case "SelectableLevel": AddMethodSafe(type, CreateMethodStub(mainModule, "Awake")); break; case "PlayerControllerB": AddMethodSafe(type, CreateMethodStub(mainModule, "Awake")); break; case "GrabbableObject": AddMethodSafe(type, CreateMethodStub(mainModule, "Awake")); break; case "Item": AddMethodSafe(type, CreateMethodStub(mainModule, "Awake")); AddMethodSafe(type, CreateMethodStub(mainModule, "Start")); break; case "TerminalNode": AddMethodSafe(type, CreateMethodStub(mainModule, "Awake")); break; } } } private static void AddMethodSafe(TypeDefinition type, MethodDefinition method) { try { Console.WriteLine("[Lethal Company Variables] Pre-patching " + ((MemberReference)type).FullName + " with method " + ((MemberReference)method).Name); if (Extensions.FindMethod(type, Extensions.GetID((MethodReference)(object)method, (string)null, (string)null, true, false), true) == null) { type.Methods.Add(method); return; } Console.WriteLine("[Lethal Company Variables] Error pre-patching " + ((MemberReference)type).FullName + " with method " + ((MemberReference)method).Name + ": Method with ID " + Extensions.GetID((MethodReference)(object)method, (string)null, (string)null, true, false) + " already exists"); } catch (Exception arg) { Console.WriteLine($"[Lethal Company Variables] Error pre-patching {((MemberReference)type).FullName} with method {((MemberReference)method).Name}: {arg}"); } } private static MethodDefinition CreateMethodStub(ModuleDefinition module, string name) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0046: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_002f: Expected O, but got Unknown MethodDefinition val = new MethodDefinition(name, (MethodAttributes)198, module.TypeSystem.Void); MethodDefinition val2 = val; if (val2.Body == null) { MethodBody val3 = new MethodBody(val); MethodBody val4 = val3; val2.Body = val3; } val.Body.InitLocals = true; val.Body.GetILProcessor().Emit(OpCodes.Ret); return val; } } public static class PluginInfo { public const string PLUGIN_GUID = "LCVPreloader"; public const string PLUGIN_NAME = "LCVPreloader"; public const string PLUGIN_VERSION = "1.0.0"; }
BepInEx/plugins/LCVCompat.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using LCVCompat.Extraction; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LCVCompat")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+837d6cc274be0d07e6c6647ca04a644dffb46eb0")] [assembly: AssemblyProduct("LCVCompat")] [assembly: AssemblyTitle("LCVCompat")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LCVCompat { public static class GameEnemyList { [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_BaboonHawk = GameEnemy.Define(new GameEnemyConfig { InternalName = "BaboonHawk", DisplayName = "Baboon Hawk", MaxCount = 15, Power = 0.5f, SpawnsPerBatch = 2, CanBeStunned = true, CanDie = true, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 0.4f, DoorSpeed = 0.1f, SpawnType = (GameEnemySpawnType)9 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_Blob = GameEnemy.Define(new GameEnemyConfig { InternalName = "Blob", DisplayName = "Hygrodere", MaxCount = 2, Power = 1f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = true, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 4f, DoorSpeed = 0.4f, SpawnType = (GameEnemySpawnType)5 }); [GameVersion(66)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_BushWolf = GameEnemy.Define(new GameEnemyConfig { InternalName = "BushWolf", DisplayName = "Kidnapper Fox", MaxCount = 1, Power = 1f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = true, SpawnFromWeed = true, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 0.45f, DoorSpeed = 0.3f, SpawnType = (GameEnemySpawnType)9 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_Butler = GameEnemy.Define(new GameEnemyConfig { InternalName = "Butler", DisplayName = "Butler", MaxCount = 7, Power = 2f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = true, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 6.7f, PushDistance = 1.8f, StunTimeMultiplier = 0.6f, DoorSpeed = 0.5f, SpawnType = (GameEnemySpawnType)5 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_ButlerBees = GameEnemy.Define(new GameEnemyConfig { InternalName = "ButlerBees", DisplayName = "Mask Hornets", MaxCount = 1, Power = 2f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = false, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.1f, PushDistance = 0.6f, StunTimeMultiplier = 0.6f, DoorSpeed = 0.08f, SpawnType = (GameEnemySpawnType)5 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_CaveDweller = GameEnemy.Define(new GameEnemyConfig { InternalName = "CaveDweller", DisplayName = "Maneater", MaxCount = 1, Power = 2f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = true, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 0.25f, DoorSpeed = 1.25f, SpawnType = (GameEnemySpawnType)5 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_Centipede = GameEnemy.Define(new GameEnemyConfig { InternalName = "Centipede", DisplayName = "Snare Flea", MaxCount = 4, Power = 1f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = true, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 3f, DoorSpeed = 0.23f, SpawnType = (GameEnemySpawnType)5 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_ClaySurgeon = GameEnemy.Define(new GameEnemyConfig { InternalName = "ClaySurgeon", DisplayName = "Barber", MaxCount = 1, Power = 1f, SpawnsPerBatch = 1, CanBeStunned = true, CanDie = false, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 1.35f, DoorSpeed = 0.3f, SpawnType = (GameEnemySpawnType)5 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_Crawler = GameEnemy.Define(new GameEnemyConfig { InternalName = "Crawler", DisplayName = "Thumper", MaxCount = 4, Power = 3f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = true, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 1f, DoorSpeed = 0.3f, SpawnType = (GameEnemySpawnType)5 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_DocileLocustBees = GameEnemy.Define(new GameEnemyConfig { InternalName = "DocileLocustBees", DisplayName = "Roaming Locust", MaxCount = 5, Power = 1f, SpawnsPerBatch = 0, CanBeStunned = false, CanDie = true, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 0.761f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 1f, DoorSpeed = 0.3f, SpawnType = (GameEnemySpawnType)10 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_Doublewing = GameEnemy.Define(new GameEnemyConfig { InternalName = "Doublewing", DisplayName = "Manticoil", MaxCount = 16, Power = 1f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = true, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 0.332f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 1f, DoorSpeed = 0.3f, SpawnType = (GameEnemySpawnType)10 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_DressGirl = GameEnemy.Define(new GameEnemyConfig { InternalName = "DressGirl", DisplayName = "Ghost Girl", MaxCount = 1, Power = 2f, SpawnsPerBatch = 0, CanBeStunned = false, CanDie = false, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 4f, DoorSpeed = 1.5f, SpawnType = (GameEnemySpawnType)5 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_Flowerman = GameEnemy.Define(new GameEnemyConfig { InternalName = "Flowerman", DisplayName = "Bracken", MaxCount = 1, Power = 3f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = true, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 0.25f, DoorSpeed = 1.25f, SpawnType = (GameEnemySpawnType)5 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_FlowerSnake = GameEnemy.Define(new GameEnemyConfig { InternalName = "FlowerSnake", DisplayName = "Tulip Snake", MaxCount = 12, Power = 0.5f, SpawnsPerBatch = 4, CanBeStunned = false, CanDie = true, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 0.52f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 1f, DoorSpeed = 0.3f, SpawnType = (GameEnemySpawnType)10 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_ForestGiant = GameEnemy.Define(new GameEnemyConfig { InternalName = "ForestGiant", DisplayName = "Forest Keeper", MaxCount = 3, Power = 3f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = true, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 1.2f, DoorSpeed = 1f, SpawnType = (GameEnemySpawnType)9 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_HoarderBug = GameEnemy.Define(new GameEnemyConfig { InternalName = "HoarderBug", DisplayName = "Hoarding Bug", MaxCount = 10, Power = 1f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = true, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 0.5f, DoorSpeed = 1.5f, SpawnType = (GameEnemySpawnType)5 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_Jester = GameEnemy.Define(new GameEnemyConfig { InternalName = "Jester", DisplayName = "Jester", MaxCount = 1, Power = 3f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = false, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 0.6f, DoorSpeed = 0.5f, SpawnType = (GameEnemySpawnType)5 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_LassoMan = GameEnemy.Define(new GameEnemyConfig { InternalName = "LassoMan", DisplayName = "Lasso", MaxCount = 2, Power = 2f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = true, SpawnFromWeed = false, CanSpawn = false, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 4f, DoorSpeed = 1.5f, SpawnType = (GameEnemySpawnType)5 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_MaskedPlayerEnemy = GameEnemy.Define(new GameEnemyConfig { InternalName = "MaskedPlayerEnemy", DisplayName = "Masked", MaxCount = 10, Power = 1f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = true, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 0.75f, DoorSpeed = 2f, SpawnType = (GameEnemySpawnType)5 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_MouthDog = GameEnemy.Define(new GameEnemyConfig { InternalName = "MouthDog", DisplayName = "Eyeless Dog", MaxCount = 8, Power = 2f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = true, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 0.7f, DoorSpeed = 0.3f, SpawnType = (GameEnemySpawnType)9 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_Nutcracker = GameEnemy.Define(new GameEnemyConfig { InternalName = "Nutcracker", DisplayName = "Nutcracker", MaxCount = 10, Power = 1f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = true, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 0.5f, DoorSpeed = 2f, SpawnType = (GameEnemySpawnType)5 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_Puffer = GameEnemy.Define(new GameEnemyConfig { InternalName = "Puffer", DisplayName = "Spore Lizard", MaxCount = 2, Power = 1f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = false, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 0.6f, DoorSpeed = 0.3f, SpawnType = (GameEnemySpawnType)5 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_RadMech = GameEnemy.Define(new GameEnemyConfig { InternalName = "RadMech", DisplayName = "Old Bird", MaxCount = 20, Power = 3f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = false, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 1.2f, DoorSpeed = 1f, SpawnType = (GameEnemySpawnType)9 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_RedLocustBees = GameEnemy.Define(new GameEnemyConfig { InternalName = "RedLocustBees", DisplayName = "Circuit Bee", MaxCount = 6, Power = 1f, SpawnsPerBatch = 0, CanBeStunned = false, CanDie = false, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 0.998f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 1f, DoorSpeed = 0.3f, SpawnType = (GameEnemySpawnType)10 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_RedPillEnemyType = GameEnemy.Define(new GameEnemyConfig { InternalName = "RedPillEnemyType", DisplayName = "Obunga", MaxCount = 0, Power = 2f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = true, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 4f, DoorSpeed = 1f, SpawnType = (GameEnemySpawnType)5 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_SandSpider = GameEnemy.Define(new GameEnemyConfig { InternalName = "SandSpider", DisplayName = "Bunker Spider", MaxCount = 1, Power = 2f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = true, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 1f, DoorSpeed = 0.15f, SpawnType = (GameEnemySpawnType)5 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_SandWorm = GameEnemy.Define(new GameEnemyConfig { InternalName = "SandWorm", DisplayName = "Earth Leviathan", MaxCount = 3, Power = 2f, SpawnsPerBatch = 0, CanBeStunned = false, CanDie = false, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 5f, DoorSpeed = 0.5f, SpawnType = (GameEnemySpawnType)9 }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameEnemy Enemy_SpringMan = GameEnemy.Define(new GameEnemyConfig { InternalName = "SpringMan", DisplayName = "Coil Head", MaxCount = 5, Power = 1f, SpawnsPerBatch = 0, CanBeStunned = true, CanDie = false, SpawnFromWeed = false, CanSpawn = true, TimeToLeave = 1f, PushForce = 0.16f, PushDistance = 1.26f, StunTimeMultiplier = 3.25f, DoorSpeed = 0.06f, SpawnType = (GameEnemySpawnType)5 }); public static ICollection<GameEnemy> Enemies => GameEnemy._types.Values; internal static void Init() { } } public sealed class GameEnemy { public delegate void EventGameEnemyDefine(GameEnemy enemy); public delegate void EventGameEnemyAssign(GameEnemy enemy, EnemyType assigned); private static readonly object _lock; internal static readonly Dictionary<string, GameEnemy> _types; private readonly GameEnemyConfig _config; private GameEnemySpawnType _spawnType; private EnemyType _enemyType; public bool Overridable { get { if (!((Object)(object)_enemyType == (Object)null)) { return _config.Overridable; } return true; } } public bool Assigned => (Object)(object)_enemyType != (Object)null; public string InternalName => _config.InternalName; public string DisplayName => _config.DisplayName; public int SpawnsPerBatch { get { return _enemyType?.spawnInGroupsOf ?? _config.SpawnsPerBatch; } set { if (Assigned) { _enemyType.spawnInGroupsOf = value; } } } public int MaxCount { get { return _enemyType?.MaxCount ?? _config.MaxCount; } set { if (Assigned) { _enemyType.MaxCount = value; } } } public float MaxPower { get { return _enemyType?.PowerLevel ?? _config.Power; } set { if (Assigned) { _enemyType.PowerLevel = value; } } } public bool CanBeStunned { get { return _enemyType?.canBeStunned ?? _config.CanBeStunned; } set { if (Assigned) { _enemyType.canBeStunned = value; } } } public bool CanDie { get { return _enemyType?.canDie ?? _config.CanDie; } set { if (Assigned) { _enemyType.canDie = value; } } } public bool SpawnFromWeed { get { return _enemyType?.spawnFromWeeds ?? _config.SpawnFromWeed; } set { if (Assigned) { _enemyType.spawnFromWeeds = value; } } } public bool CanSpawn { get { if (Assigned) { return !_enemyType.spawningDisabled; } return _config.CanSpawn; } set { if (Assigned) { _enemyType.spawningDisabled = !value; } } } public float TimeToLeave { get { return _enemyType?.normalizedTimeInDayToLeave ?? _config.TimeToLeave; } set { if (Assigned) { _enemyType.normalizedTimeInDayToLeave = value; } } } public float PushForce { get { return _enemyType?.pushPlayerForce ?? _config.PushForce; } set { if (Assigned) { _enemyType.pushPlayerForce = value; } } } public float PushDistance { get { return _enemyType?.pushPlayerDistance ?? _config.PushDistance; } set { if (Assigned) { _enemyType.pushPlayerDistance = value; } } } public float StunTimeMultiplier { get { return _enemyType?.stunTimeMultiplier ?? _config.StunTimeMultiplier; } set { if (Assigned) { _enemyType.stunTimeMultiplier = value; } } } public float DoorSpeed { get { return _enemyType?.doorSpeedMultiplier ?? _config.DoorSpeed; } set { if (Assigned) { _enemyType.doorSpeedMultiplier = value; } } } public GameEnemySpawnType SpawnType => _spawnType; public EnemyType EnemyType { get { return _enemyType; } set { if (!Overridable) { Console.WriteLine("[GameEnemy] EnemyType change rejected: Non overridable"); return; } if ((Object)(object)value == (Object)null) { Console.WriteLine("[GameEnemy] EnemyType change rejected: New is null"); return; } _enemyType = value; _spawnType = GameEnemySpawnType.UNKNOWN; if (_enemyType.isOutsideEnemy) { _spawnType = GameEnemySpawnType.OUTSIDE; } else { _spawnType = GameEnemySpawnType.INSIDE; } if (_enemyType.isDaytimeEnemy) { _spawnType |= GameEnemySpawnType.DAYTIME; } else { _spawnType |= GameEnemySpawnType.NIGHTTIME; } GameEnemy.OnAssign?.Invoke(this, _enemyType); } } public static event EventGameEnemyDefine OnDefine; public static event EventGameEnemyAssign OnAssign; public static void Init() { } static GameEnemy() { _lock = new object(); _types = new Dictionary<string, GameEnemy>(); GameEnemyList.Init(); } public static void ForDefined(EventGameEnemyDefine defineAction) { lock (_lock) { foreach (GameEnemy value in _types.Values) { defineAction(value); } } } public static void ForAssigned(EventGameEnemyAssign asignAction) { lock (_lock) { foreach (GameEnemy value in _types.Values) { if (value.Assigned) { asignAction(value, value.EnemyType); } } } } public static bool TryGetAssigned(EnemyType enemyType, out GameEnemy enemy) { if (_types.TryGetValue(((Object)enemyType).name, out enemy)) { return enemy.Assigned; } return false; } public static bool TryGetAssigned(string internalName, out GameEnemy enemy) { if (_types.TryGetValue(internalName, out enemy)) { return enemy.Assigned; } return false; } public static bool TryGetDefined(string internalName, out GameEnemy enemy) { return _types.TryGetValue(internalName, out enemy); } public static GameEnemy Define(GameEnemyConfig config) { if (!TryGetDefined(config.InternalName, out var enemy)) { return new GameEnemy(config); } return enemy; } public static GameEnemy Assign(EnemyType type) { if (TryGetDefined(((Object)type).name, out var enemy)) { if (enemy.Overridable || !enemy.Assigned) { lock (_lock) { enemy.EnemyType = type; } } return enemy; } return new GameEnemy(type); } public static GameEnemy GetDefined(string internalName) { if (TryGetDefined(internalName, out var enemy)) { return enemy; } return null; } public static GameEnemy GetAssigned(EnemyType type, bool createIfMissing = true) { if (TryGetDefined(((Object)type).name, out var enemy)) { if (enemy.Assigned) { return enemy; } return Assign(type); } if (createIfMissing) { return new GameEnemy(type); } return null; } private GameEnemy(EnemyType enemyType) : this(new GameEnemyConfig(enemyType)) { EnemyType = enemyType; } private GameEnemy(GameEnemyConfig config) { _config = config; _spawnType = _config.SpawnType; lock (_lock) { _types[config.InternalName] = this; } GameEnemy.OnDefine?.Invoke(this); } } public struct GameEnemyConfig { public string InternalName; public string DisplayName; public int MaxCount; public float Power; public int SpawnsPerBatch; public bool CanBeStunned; public bool CanDie; public readonly bool Overridable; public bool SpawnFromWeed; public bool CanSpawn; public float TimeToLeave; public float PushForce; public float PushDistance; public float StunTimeMultiplier; public float DoorSpeed; public GameEnemySpawnType SpawnType; public GameEnemyConfig() { InternalName = null; DisplayName = null; MaxCount = 0; Power = 0f; SpawnsPerBatch = 0; CanBeStunned = false; CanDie = false; SpawnFromWeed = false; CanSpawn = false; TimeToLeave = 0f; PushForce = 0f; PushDistance = 0f; StunTimeMultiplier = 0f; DoorSpeed = 0f; SpawnType = GameEnemySpawnType.UNKNOWN; Overridable = true; } public GameEnemyConfig(bool overridable) { InternalName = null; DisplayName = null; MaxCount = 0; Power = 0f; SpawnsPerBatch = 0; CanBeStunned = false; CanDie = false; SpawnFromWeed = false; CanSpawn = false; TimeToLeave = 0f; PushForce = 0f; PushDistance = 0f; StunTimeMultiplier = 0f; DoorSpeed = 0f; SpawnType = GameEnemySpawnType.UNKNOWN; Overridable = overridable; } public GameEnemyConfig(EnemyType enemyType, bool overridable = false) { SpawnType = GameEnemySpawnType.UNKNOWN; InternalName = ((Object)enemyType).name; DisplayName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(enemyType.enemyName); MaxCount = enemyType.MaxCount; Power = enemyType.PowerLevel; SpawnsPerBatch = enemyType.spawnInGroupsOf; CanBeStunned = enemyType.canBeStunned; CanDie = enemyType.canDie; Overridable = overridable; SpawnFromWeed = enemyType.spawnFromWeeds; CanSpawn = !enemyType.spawningDisabled; TimeToLeave = enemyType.normalizedTimeInDayToLeave; PushForce = enemyType.pushPlayerForce; PushDistance = enemyType.pushPlayerDistance; StunTimeMultiplier = enemyType.stunTimeMultiplier; DoorSpeed = enemyType.doorSpeedMultiplier; SpawnType = GameEnemySpawnTypeExtension.FromEnemy(enemyType); } public static implicit operator GameEnemyConfig(EnemyType type) { return new GameEnemyConfig(type); } } public sealed class GameEnemyRarityList : IEnumerable<KeyValuePair<GameEnemy, int?>>, IEnumerable { private readonly Dictionary<GameEnemy, int?> _rarity = new Dictionary<GameEnemy, int?>(); public int? this[EnemyType enemy] { get { if (!GameEnemy.TryGetAssigned(enemy, out var enemy2)) { return null; } return _rarity.GetValueOrDefault(enemy2, null); } set { if (GameEnemy.TryGetAssigned(enemy, out var enemy2)) { if (!value.HasValue) { _rarity.Remove(enemy2); } else { _rarity[enemy2] = value; } } } } public int? this[GameEnemy enemy] { get { return _rarity.GetValueOrDefault(enemy, null); } set { if (!value.HasValue) { _rarity.Remove(enemy); } else { _rarity[enemy] = value; } } } public static GameEnemyRarityList Create(params IEnumerable<SpawnableEnemyWithRarity>[] rarities) { GameEnemyRarityList gameEnemyRarityList = new GameEnemyRarityList(); for (int i = 0; i < rarities.Length; i++) { foreach (SpawnableEnemyWithRarity item in rarities[i]) { gameEnemyRarityList[GameEnemy.GetAssigned(item.enemyType)] = item.rarity; } } return gameEnemyRarityList; } public IEnumerator<KeyValuePair<GameEnemy, int?>> GetEnumerator() { return _rarity.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return _rarity.GetEnumerator(); } } public enum GameEnemySpawnType { UNKNOWN = 0, OUTSIDE = 8, INSIDE = 4, DAYTIME = 2, NIGHTTIME = 1 } public static class GameEnemySpawnTypeExtension { public static GameEnemySpawnType FromEnemy(EnemyType enemyType) { return (enemyType.isOutsideEnemy ? GameEnemySpawnType.OUTSIDE : GameEnemySpawnType.INSIDE) | ((!enemyType.isDaytimeEnemy) ? GameEnemySpawnType.NIGHTTIME : GameEnemySpawnType.DAYTIME); } public static bool IsOutsideEnemy(this GameEnemySpawnType type) { return (type & GameEnemySpawnType.OUTSIDE) != 0; } public static bool IsInsideEnemy(this GameEnemySpawnType type) { return (type & GameEnemySpawnType.INSIDE) != 0; } public static bool IsDaytimeEnemy(this GameEnemySpawnType type) { return (type & GameEnemySpawnType.DAYTIME) != 0; } public static bool IsNighttimeEnemy(this GameEnemySpawnType type) { return (type & GameEnemySpawnType.NIGHTTIME) != 0; } public static bool IsUnknown(this GameEnemySpawnType type) { return type == GameEnemySpawnType.UNKNOWN; } public static string ToStringNatural(this GameEnemySpawnType type) { object obj; if (!type.IsUnknown()) { obj = (type.IsOutsideEnemy() ? ("Outside at " + (type.IsDaytimeEnemy() ? "daytime" : "nighttime")) : "Inside"); if (obj == null) { return ""; } } else { obj = "Unknown"; } return (string)obj; } } public sealed class GameItem { public delegate void EventGameItemDefine(GameItem item); public delegate void EventGameItemAssign(GameItem item, Item assigned); private static readonly object _lock; public static readonly Dictionary<string, GameItem> _types; private readonly GameItemConfig _config; private Item _item; public bool IsVanilla => _config.Vanilla; public bool Assigned => (Object)(object)Item != (Object)null; public string InternalName => _config.InternalName; public string DisplayName => _config.DisplayName; public float Weight { get { return Item?.weight ?? _config.Weight; } set { if (Assigned) { Item.weight = value; } } } public bool IsScrap { get { return Item?.isScrap ?? _config.IsScrap; } set { if (Assigned) { Item.isScrap = value; } } } public bool IsMetal { get { return Item?.isConductiveMetal ?? _config.IsMetal; } set { if (Assigned) { Item.isConductiveMetal = value; } } } public int Value { get { return Item?.creditsWorth ?? _config.Value; } set { if (Assigned) { Item.creditsWorth = value; } } } public (int, int) ValueRange { get { if (Assigned) { return (Item.minValue, Item.maxValue); } return _config.ValueRange; } set { if (Assigned) { Item.minValue = value.Item1; Item.maxValue = value.Item2; } } } public int MaxSale { get { return Item?.highestSalePercentage ?? _config.MaxSale; } set { if (Assigned) { Item.highestSalePercentage = value; } } } public float Battery { get { if (Assigned) { if (!Item.requiresBattery) { return -1f; } return Item.batteryUsage; } return _config.Battery; } set { if (Assigned) { Item.requiresBattery = value != -1f; Item.batteryUsage = value; } } } public bool TwoHanded { get { return Item?.twoHanded ?? _config.TwoHanded; } set { if (Assigned) { Item.twoHanded = value; } } } public Item Item { get { return _item; } private set { if (!((Object)(object)_item != (Object)null) && !((Object)(object)value == (Object)null)) { _item = value; GameItem.OnAssign?.Invoke(this, value); } } } public static event EventGameItemDefine OnDefine; public static event EventGameItemAssign OnAssign; public static void Init() { } static GameItem() { _lock = new object(); _types = new Dictionary<string, GameItem>(); GameItemList.Init(); } public static void ForDefined(EventGameItemDefine defineAction) { lock (_lock) { foreach (GameItem value in _types.Values) { defineAction(value); } } } public static void ForAssigned(EventGameItemAssign asignAction) { lock (_lock) { foreach (GameItem value in _types.Values) { if (value.Assigned) { asignAction(value, value.Item); } } } } public static bool TryGetAssigned(Item item, out GameItem assigned) { return _types.TryGetValue(((Object)item).name, out assigned); } public static bool TryGetAssigned(string internalName, out GameItem item) { if (_types.TryGetValue(internalName, out item)) { return item.Assigned; } return false; } public static bool TryGetDefined(string internalName, out GameItem item) { return _types.TryGetValue(internalName, out item); } public static GameItem Define(GameItemConfig config) { if (TryGetDefined(config.InternalName, out var item)) { return item; } return new GameItem(config); } public static GameItem Assign(Item item) { if (TryGetDefined(((Object)item).name, out var item2)) { if (!item2.Assigned) { lock (_lock) { item2.Item = item; } } return item2; } return new GameItem(item); } public static GameItem GetDefined(string internalName) { if (TryGetDefined(internalName, out var item)) { return item; } return null; } public static GameItem GetAssigned(Item item, bool createIfMissing = true) { if (TryGetDefined(((Object)item).name, out var item2)) { if (item2.Assigned) { return item2; } return Assign(item); } if (createIfMissing) { return new GameItem(item); } return null; } private GameItem(Item item) : this(new GameItemConfig(item)) { Item = item; } private GameItem(GameItemConfig config) { _config = config; lock (_lock) { _types[config.InternalName] = this; } GameItem.OnDefine?.Invoke(this); } } public struct GameItemConfig { public string InternalName; public string DisplayName; public float Weight; public bool IsScrap; public bool IsMetal; public int Value; public (int, int) ValueRange; public int MaxSale; public float Battery; public bool TwoHanded; public readonly bool Vanilla; public GameItemConfig() { InternalName = null; DisplayName = null; Weight = 0f; IsScrap = false; IsMetal = false; Value = 0; ValueRange = default((int, int)); MaxSale = 0; Battery = 0f; TwoHanded = false; Vanilla = true; } public GameItemConfig(bool vanilla) { InternalName = null; DisplayName = null; Weight = 0f; IsScrap = false; IsMetal = false; Value = 0; ValueRange = default((int, int)); MaxSale = 0; Battery = 0f; TwoHanded = false; Vanilla = vanilla; } public GameItemConfig(Item item, bool vanilla = false) { InternalName = ((Object)item).name; DisplayName = item.itemName; Weight = item.weight; IsScrap = item.isScrap; IsMetal = item.isConductiveMetal; Value = item.creditsWorth; ValueRange = (item.minValue, item.maxValue); MaxSale = item.highestSalePercentage; Battery = (item.requiresBattery ? item.batteryUsage : (-1f)); TwoHanded = item.twoHanded; Vanilla = vanilla; } public static implicit operator GameItemConfig(Item item) { return new GameItemConfig(item); } } public static class GameItemList { [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_7Ball = GameItem.Define(new GameItemConfig { InternalName = "7Ball", DisplayName = "Magic 7 ball", Weight = 1.15f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (90, 180), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Airhorn = GameItem.Define(new GameItemConfig { InternalName = "Airhorn", DisplayName = "Airhorn", Weight = 1f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (130, 180), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Bell = GameItem.Define(new GameItemConfig { InternalName = "Bell", DisplayName = "Bell", Weight = 1.23f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (120, 200), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_BeltBag = GameItem.Define(new GameItemConfig { InternalName = "BeltBag", DisplayName = "Belt bag", Weight = 1.15f, IsScrap = false, IsMetal = false, Value = 45, ValueRange = (0, 0), MaxSale = 70, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_BigBolt = GameItem.Define(new GameItemConfig { InternalName = "BigBolt", DisplayName = "Big bolt", Weight = 1.18f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (50, 80), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Binoculars = GameItem.Define(new GameItemConfig { InternalName = "Binoculars", DisplayName = "Binoculars", Weight = 1f, IsScrap = false, IsMetal = false, Value = 0, ValueRange = (0, 0), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Boombox = GameItem.Define(new GameItemConfig { InternalName = "Boombox", DisplayName = "Boombox", Weight = 1.15f, IsScrap = false, IsMetal = false, Value = 60, ValueRange = (0, 0), MaxSale = 80, Battery = 350f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_BottleBin = GameItem.Define(new GameItemConfig { InternalName = "BottleBin", DisplayName = "Bottles", Weight = 1.18f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (110, 140), MaxSale = 80, Battery = -1f, TwoHanded = true }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Brush = GameItem.Define(new GameItemConfig { InternalName = "Brush", DisplayName = "Brush", Weight = 1.1f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (20, 90), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Candy = GameItem.Define(new GameItemConfig { InternalName = "Candy", DisplayName = "Candy", Weight = 1.1f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (15, 90), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(66)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_CardboardBox = GameItem.Define(new GameItemConfig { InternalName = "CardboardBox", DisplayName = "box", Weight = 1f, IsScrap = false, IsMetal = false, Value = 0, ValueRange = (0, 0), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_CashRegister = GameItem.Define(new GameItemConfig { InternalName = "CashRegister", DisplayName = "Cash register", Weight = 1.8f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (200, 400), MaxSale = 80, Battery = -1f, TwoHanded = true }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_CaveDwellerBaby = GameItem.Define(new GameItemConfig { InternalName = "CaveDwellerBaby", DisplayName = "Maneater", Weight = 1.2f, IsScrap = false, IsMetal = true, Value = 0, ValueRange = (90, 140), MaxSale = 80, Battery = -1f, TwoHanded = true }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_ChemicalJug = GameItem.Define(new GameItemConfig { InternalName = "ChemicalJug", DisplayName = "Chemical jug", Weight = 1.3f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (80, 210), MaxSale = 80, Battery = -1f, TwoHanded = true }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Clipboard = GameItem.Define(new GameItemConfig { InternalName = "Clipboard", DisplayName = "clipboard", Weight = 1f, IsScrap = false, IsMetal = false, Value = 5, ValueRange = (0, 0), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Clock = GameItem.Define(new GameItemConfig { InternalName = "Clock", DisplayName = "Clock", Weight = 1.25f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (110, 140), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_ClownHorn = GameItem.Define(new GameItemConfig { InternalName = "ClownHorn", DisplayName = "Clown horn", Weight = 1f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (130, 180), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Cog1 = GameItem.Define(new GameItemConfig { InternalName = "Cog1", DisplayName = "Large axle", Weight = 1.15f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (90, 140), MaxSale = 80, Battery = -1f, TwoHanded = true }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_ComedyMask = GameItem.Define(new GameItemConfig { InternalName = "ComedyMask", DisplayName = "Comedy", Weight = 1.1f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (70, 130), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_ControlPad = GameItem.Define(new GameItemConfig { InternalName = "ControlPad", DisplayName = "Control pad", Weight = 1.15f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (85, 160), MaxSale = 80, Battery = -1f, TwoHanded = true }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Dentures = GameItem.Define(new GameItemConfig { InternalName = "Dentures", DisplayName = "Teeth", Weight = 1f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (150, 210), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_DiyFlashbang = GameItem.Define(new GameItemConfig { InternalName = "DiyFlashbang", DisplayName = "Homemade flashbang", Weight = 1.05f, IsScrap = true, IsMetal = false, Value = 40, ValueRange = (25, 70), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_DustPan = GameItem.Define(new GameItemConfig { InternalName = "DustPan", DisplayName = "Dust pan", Weight = 1f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (30, 80), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_EasterEgg = GameItem.Define(new GameItemConfig { InternalName = "EasterEgg", DisplayName = "Easter egg", Weight = 1.03f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (55, 130), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_EggBeater = GameItem.Define(new GameItemConfig { InternalName = "EggBeater", DisplayName = "Egg beater", Weight = 1.1f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (30, 110), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_EnginePart1 = GameItem.Define(new GameItemConfig { InternalName = "EnginePart1", DisplayName = "V-type engine", Weight = 1.15f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (50, 140), MaxSale = 80, Battery = -1f, TwoHanded = true }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_ExtensionLadder = GameItem.Define(new GameItemConfig { InternalName = "ExtensionLadder", DisplayName = "Extension ladder", Weight = 1f, IsScrap = false, IsMetal = true, Value = 60, ValueRange = (0, 0), MaxSale = 60, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_FancyCup = GameItem.Define(new GameItemConfig { InternalName = "FancyCup", DisplayName = "Golden cup", Weight = 1.15f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (100, 200), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_FancyLamp = GameItem.Define(new GameItemConfig { InternalName = "FancyLamp", DisplayName = "Fancy lamp", Weight = 1.2f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (150, 320), MaxSale = 80, Battery = -1f, TwoHanded = true }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_FancyPainting = GameItem.Define(new GameItemConfig { InternalName = "FancyPainting", DisplayName = "Painting", Weight = 1.3f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (150, 310), MaxSale = 80, Battery = -1f, TwoHanded = true }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_FishTestProp = GameItem.Define(new GameItemConfig { InternalName = "FishTestProp", DisplayName = "Plastic fish", Weight = 1f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (70, 100), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_FlashLaserPointer = GameItem.Define(new GameItemConfig { InternalName = "FlashLaserPointer", DisplayName = "Laser pointer", Weight = 1f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (80, 250), MaxSale = 80, Battery = 300f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Flashlight = GameItem.Define(new GameItemConfig { InternalName = "Flashlight", DisplayName = "Flashlight", Weight = 1f, IsScrap = false, IsMetal = false, Value = 15, ValueRange = (0, 0), MaxSale = 80, Battery = 140f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Flask = GameItem.Define(new GameItemConfig { InternalName = "Flask", DisplayName = "Flask", Weight = 1.18f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (40, 110), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_GarbageLid = GameItem.Define(new GameItemConfig { InternalName = "GarbageLid", DisplayName = "Garbage lid", Weight = 1f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (50, 110), MaxSale = 80, Battery = -1f, TwoHanded = true }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_GiftBox = GameItem.Define(new GameItemConfig { InternalName = "GiftBox", DisplayName = "Gift", Weight = 1.18f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (30, 70), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_GoldBar = GameItem.Define(new GameItemConfig { InternalName = "GoldBar", DisplayName = "Gold bar", Weight = 1.73f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (255, 525), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_GunAmmo = GameItem.Define(new GameItemConfig { InternalName = "GunAmmo", DisplayName = "Ammo", Weight = 1f, IsScrap = false, IsMetal = false, Value = 0, ValueRange = (0, 0), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Hairdryer = GameItem.Define(new GameItemConfig { InternalName = "Hairdryer", DisplayName = "Hairdryer", Weight = 1.07f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (150, 250), MaxSale = 80, Battery = 0.1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Jetpack = GameItem.Define(new GameItemConfig { InternalName = "Jetpack", DisplayName = "Jetpack", Weight = 1.5f, IsScrap = false, IsMetal = true, Value = 900, ValueRange = (0, 0), MaxSale = 80, Battery = 50f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Key = GameItem.Define(new GameItemConfig { InternalName = "Key", DisplayName = "Key", Weight = 1f, IsScrap = false, IsMetal = true, Value = 3, ValueRange = (0, 0), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Knife = GameItem.Define(new GameItemConfig { InternalName = "Knife", DisplayName = "Kitchen knife", Weight = 1f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (70, 210), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_LockPicker = GameItem.Define(new GameItemConfig { InternalName = "LockPicker", DisplayName = "Lockpicker", Weight = 1.1f, IsScrap = false, IsMetal = false, Value = 20, ValueRange = (0, 0), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_LungApparatus = GameItem.Define(new GameItemConfig { InternalName = "LungApparatus", DisplayName = "Apparatus", Weight = 1.3f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (40, 120), MaxSale = 80, Battery = -1f, TwoHanded = true }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_MagnifyingGlass = GameItem.Define(new GameItemConfig { InternalName = "MagnifyingGlass", DisplayName = "Magnifying glass", Weight = 1.1f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (110, 150), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_MapDevice = GameItem.Define(new GameItemConfig { InternalName = "MapDevice", DisplayName = "Mapper", Weight = 1f, IsScrap = false, IsMetal = false, Value = 0, ValueRange = (0, 0), MaxSale = 80, Battery = 0.05f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_MetalSheet = GameItem.Define(new GameItemConfig { InternalName = "MetalSheet", DisplayName = "Metal sheet", Weight = 1.25f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (25, 55), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_MoldPan = GameItem.Define(new GameItemConfig { InternalName = "MoldPan", DisplayName = "Cookie mold pan", Weight = 1.15f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (30, 100), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Mug = GameItem.Define(new GameItemConfig { InternalName = "Mug", DisplayName = "Mug", Weight = 1.05f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (60, 170), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_PerfumeBottle = GameItem.Define(new GameItemConfig { InternalName = "PerfumeBottle", DisplayName = "Perfume bottle", Weight = 1f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (120, 260), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Phone = GameItem.Define(new GameItemConfig { InternalName = "Phone", DisplayName = "Old phone", Weight = 1.05f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (120, 160), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_PickleJar = GameItem.Define(new GameItemConfig { InternalName = "PickleJar", DisplayName = "Jar of pickles", Weight = 1.15f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (80, 150), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_PillBottle = GameItem.Define(new GameItemConfig { InternalName = "PillBottle", DisplayName = "Pill bottle", Weight = 1f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (40, 100), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_PlasticCup = GameItem.Define(new GameItemConfig { InternalName = "PlasticCup", DisplayName = "Plastic cup", Weight = 1f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (30, 90), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_ProFlashlight = GameItem.Define(new GameItemConfig { InternalName = "ProFlashlight", DisplayName = "Pro-flashlight", Weight = 1.05f, IsScrap = false, IsMetal = false, Value = 25, ValueRange = (0, 0), MaxSale = 80, Battery = 300f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_RadarBooster = GameItem.Define(new GameItemConfig { InternalName = "RadarBooster", DisplayName = "Radar-booster", Weight = 1.18f, IsScrap = false, IsMetal = true, Value = 60, ValueRange = (0, 0), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Ragdoll = GameItem.Define(new GameItemConfig { InternalName = "Ragdoll", DisplayName = "Body", Weight = 1.1f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (15, 90), MaxSale = 80, Battery = -1f, TwoHanded = true }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_RedLocustHive = GameItem.Define(new GameItemConfig { InternalName = "RedLocustHive", DisplayName = "Hive", Weight = 1f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (90, 140), MaxSale = 80, Battery = -1f, TwoHanded = true }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Remote = GameItem.Define(new GameItemConfig { InternalName = "Remote", DisplayName = "Remote", Weight = 1f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (50, 120), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Ring = GameItem.Define(new GameItemConfig { InternalName = "Ring", DisplayName = "Ring", Weight = 1.15f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (130, 200), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_RobotToy = GameItem.Define(new GameItemConfig { InternalName = "RobotToy", DisplayName = "Toy robot", Weight = 1.2f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (140, 220), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_RubberDuck = GameItem.Define(new GameItemConfig { InternalName = "RubberDuck", DisplayName = "Rubber Ducky", Weight = 1f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (5, 250), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Shotgun = GameItem.Define(new GameItemConfig { InternalName = "Shotgun", DisplayName = "Shotgun", Weight = 1.15f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (30, 100), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Shovel = GameItem.Define(new GameItemConfig { InternalName = "Shovel", DisplayName = "Shovel", Weight = 1.13f, IsScrap = false, IsMetal = true, Value = 30, ValueRange = (0, 0), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_SoccerBall = GameItem.Define(new GameItemConfig { InternalName = "SoccerBall", DisplayName = "Soccer ball", Weight = 1.18f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (110, 180), MaxSale = 80, Battery = -1f, TwoHanded = true }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_SodaCanRed = GameItem.Define(new GameItemConfig { InternalName = "SodaCanRed", DisplayName = "Red soda", Weight = 1.07f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (45, 225), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_SprayPaint = GameItem.Define(new GameItemConfig { InternalName = "SprayPaint", DisplayName = "Spray paint", Weight = 1f, IsScrap = false, IsMetal = false, Value = 50, ValueRange = (0, 0), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_SteeringWheel = GameItem.Define(new GameItemConfig { InternalName = "SteeringWheel", DisplayName = "Steering wheel", Weight = 1.15f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (40, 80), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_StickyNote = GameItem.Define(new GameItemConfig { InternalName = "StickyNote", DisplayName = "Sticky note", Weight = 1f, IsScrap = false, IsMetal = false, Value = 0, ValueRange = (70, 100), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_StopSign = GameItem.Define(new GameItemConfig { InternalName = "StopSign", DisplayName = "Stop sign", Weight = 1.23f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (50, 130), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_StunGrenade = GameItem.Define(new GameItemConfig { InternalName = "StunGrenade", DisplayName = "Stun grenade", Weight = 1.05f, IsScrap = false, IsMetal = false, Value = 30, ValueRange = (0, 0), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_TeaKettle = GameItem.Define(new GameItemConfig { InternalName = "TeaKettle", DisplayName = "Tea kettle", Weight = 1.2f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (80, 140), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_ToiletPaperRolls = GameItem.Define(new GameItemConfig { InternalName = "ToiletPaperRolls", DisplayName = "Toilet paper", Weight = 1.05f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (150, 220), MaxSale = 80, Battery = -1f, TwoHanded = true }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Toothpaste = GameItem.Define(new GameItemConfig { InternalName = "Toothpaste", DisplayName = "Toothpaste", Weight = 1f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (35, 120), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_ToyCube = GameItem.Define(new GameItemConfig { InternalName = "ToyCube", DisplayName = "Toy cube", Weight = 1f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (60, 110), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_ToyTrain = GameItem.Define(new GameItemConfig { InternalName = "ToyTrain", DisplayName = "Toy train", Weight = 1.2f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (130, 210), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_TragedyMask = GameItem.Define(new GameItemConfig { InternalName = "TragedyMask", DisplayName = "Tragedy", Weight = 1.1f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (70, 130), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_TZPInhalant = GameItem.Define(new GameItemConfig { InternalName = "TZPInhalant", DisplayName = "TZP-Inhalant", Weight = 1f, IsScrap = false, IsMetal = true, Value = 80, ValueRange = (0, 0), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_WalkieTalkie = GameItem.Define(new GameItemConfig { InternalName = "WalkieTalkie", DisplayName = "Walkie-talkie", Weight = 1f, IsScrap = false, IsMetal = false, Value = 12, ValueRange = (0, 0), MaxSale = 80, Battery = 820f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_WeedKillerBottle = GameItem.Define(new GameItemConfig { InternalName = "WeedKillerBottle", DisplayName = "Weed killer", Weight = 1f, IsScrap = false, IsMetal = false, Value = 25, ValueRange = (0, 0), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_WhoopieCushion = GameItem.Define(new GameItemConfig { InternalName = "WhoopieCushion", DisplayName = "Whoopie cushion", Weight = 1f, IsScrap = true, IsMetal = false, Value = 0, ValueRange = (15, 90), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_YieldSign = GameItem.Define(new GameItemConfig { InternalName = "YieldSign", DisplayName = "Yield sign", Weight = 1.4f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (45, 90), MaxSale = 80, Battery = -1f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_ZapGun = GameItem.Define(new GameItemConfig { InternalName = "ZapGun", DisplayName = "Zap gun", Weight = 1.1f, IsScrap = false, IsMetal = true, Value = 400, ValueRange = (0, 0), MaxSale = 80, Battery = 22f, TwoHanded = false }); [GameVersion(65)] [ExtractionDate(27, 10, 2024)] public static readonly GameItem Item_Zeddog = GameItem.Define(new GameItemConfig { InternalName = "Zeddog", DisplayName = "Zed Dog", Weight = 1f, IsScrap = true, IsMetal = true, Value = 0, ValueRange = (1, 500), MaxSale = 80, Battery = -1f, TwoHanded = false }); public static ICollection<GameItem> Items => GameItem._types.Values; internal static void Init() { } } public sealed class GameItemRarityList : IEnumerable<KeyValuePair<GameItem, int?>>, IEnumerable { private readonly Dictionary<GameItem, int?> _rarity = new Dictionary<GameItem, int?>(); public int? this[Item item] { get { if (!GameItem.TryGetAssigned(item, out var assigned)) { return null; } return _rarity.GetValueOrDefault(assigned, null); } set { if (GameItem.TryGetAssigned(item, out var assigned)) { if (!value.HasValue) { _rarity.Remove(assigned); } else { _rarity[assigned] = value; } } } } public int? this[GameItem item] { get { return _rarity.GetValueOrDefault(item, null); } set { if (!value.HasValue) { _rarity.Remove(item); } else { _rarity[item] = value; } } } public static GameItemRarityList Create(params IEnumerable<SpawnableItemWithRarity>[] rarities) { GameItemRarityList gameItemRarityList = new GameItemRarityList(); for (int i = 0; i < rarities.Length; i++) { foreach (SpawnableItemWithRarity item in rarities[i]) { gameItemRarityList[GameItem.GetAssigned(item.spawnableItem)] = item.rarity; } } return gameItemRarityList; } public IEnumerator<KeyValuePair<GameItem, int?>> GetEnumerator() { return _rarity.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return _rarity.GetEnumerator(); } } public sealed class GameLevel { public delegate void EventGameLevelDefine(GameLevel level); public delegate void EventGameLevelAssign(GameLevel level, SelectableLevel assigned); private static readonly object _lock; public static readonly Dictionary<string, GameLevel> _types; private SelectableLevel _level; private GameLevelConfig _config; public bool Ignore => _config.Ignore; public bool Assigned => (Object)(object)Level != (Object)null; public string InternalName => _config.InternalName; public string PlanetName => _config.PlanetName; public int MoldIterations { get { if (!Assigned) { return _config.MoldIterations; } return Level.moldSpreadIterations; } set { if (Assigned) { Level.moldSpreadIterations = value; } } } public (int, int) ScrapAmount { get { if (!Assigned) { return _config.ScrapAmount; } return (Level.minScrap, Level.maxScrap); } set { if (Assigned) { Level.minScrap = value.Item1; Level.maxScrap = value.Item2; } } } public (int, int) ScrapValue { get { if (!Assigned) { return _config.ScrapValue; } return (Level.minTotalScrapValue, Level.maxTotalScrapValue); } set { if (Assigned) { Level.minTotalScrapValue = value.Item1; Level.maxTotalScrapValue = value.Item2; } } } public float FactorySize { get { return Level?.factorySizeMultiplier ?? _config.FactorySize; } set { if (Assigned) { Level.factorySizeMultiplier = value; } } } public int PowerInside { get { return Level?.maxEnemyPowerCount ?? _config.PowerInside; } set { if (Assigned) { Level.maxEnemyPowerCount = value; } } } public int PowerOutsideDay { get { return Level?.maxDaytimeEnemyPowerCount ?? _config.PowerOutsideDay; } set { if (Assigned) { Level.maxDaytimeEnemyPowerCount = value; } } } public int PowerOutsideNight { get { return Level?.maxOutsideEnemyPowerCount ?? _config.PowerOutsideNight; } set { if (Assigned) { Level.maxOutsideEnemyPowerCount = value; } } } public float TimeToArrive { get { return Level?.timeToArrive ?? _config.TimeToArrive; } set { if (Assigned) { Level.timeToArrive = value; } } } public float DaySpeedMultiplier { get { return Level?.DaySpeedMultiplier ?? _config.DaySpeedMultiplier; } set { if (Assigned) { Level.DaySpeedMultiplier = value; } } } public string RiskLevel { get { return Level?.riskLevel ?? _config.RiskLevel; } set { if (Assigned) { Level.riskLevel = value; } } } public GameEnemyRarityList EnemyRarity { get; private set; } public GameItemRarityList ItemRarity { get; private set; } public HashSet<LevelWeatherType> Weathers { get; private set; } public SelectableLevel Level { get { return _level; } private set { if (!((Object)(object)_level != (Object)null) && !((Object)(object)value == (Object)null)) { _level = value; GameLevel.OnAssign?.Invoke(this, _level); } } } public static event EventGameLevelDefine OnDefine; public static event EventGameLevelAssign OnAssign; public static void Init() { } static GameLevel() { _lock = new object(); _types = new Dictionary<string, GameLevel>(); GameLevelList.Init(); } public static void ForDefined(EventGameLevelDefine defineAction) { lock (_lock) { foreach (GameLevel value in _types.Values) { defineAction(value); } } } public static void ForAssigned(EventGameLevelAssign asignAction) { lock (_lock) { foreach (GameLevel value in _types.Values) { if (value.Assigned) { asignAction(value, value.Level); } } } } public static bool TryGetAssigned(SelectableLevel level, out GameLevel assigned) { return _types.TryGetValue(((Object)level).name, out assigned); } public static bool TryGetAssigned(string internalName, out GameLevel level) { if (_types.TryGetValue(internalName, out level)) { return level.Assigned; } return false; } public static bool TryGetDefined(string internalName, out GameLevel level) { return _types.TryGetValue(internalName, out level); } public static GameLevel Define(GameLevelConfig config) { if (TryGetDefined(config.InternalName, out var level)) { return level; } return new GameLevel(config); } public static GameLevel Assign(SelectableLevel level) { if (TryGetDefined(((Object)level).name, out var level2)) { if (!level2.Assigned) { lock (_lock) { level2.Level = level; } } return level2; } return new GameLevel(level); } public static GameLevel GetDefined(string internalName) { if (TryGetDefined(internalName, out var level)) { return level; } return null; } public static GameLevel GetAssigned(SelectableLevel level, bool createIfMissing = true) { if (TryGetDefined(((Object)level).name, out var level2)) { if (level2.Assigned) { return level2; } return Assign(level); } if (createIfMissing) { return new GameLevel(level); } return null; } private GameLevel(SelectableLevel level) : this(new GameLevelConfig(level)) { Level = level; } private GameLevel(GameLevelConfig config) { _config = config; EnemyRarity = config.EnemyRarity; ItemRarity = config.ItemRarity; Weathers = config.Weathers; lock (_lock) { _types[_config.InternalName] = this; } GameLevel.OnDefine?.Invoke(this); } } public struct GameLevelConfig { public string InternalName; public string PlanetName; public (int Min, int Max) ScrapAmount; public (int Min, int Max) ScrapValue; public float FactorySize; public int PowerInside; public int PowerOutsideDay; public int PowerOutsideNight; public GameEnemyRarityList EnemyRarity; public HashSet<LevelWeatherType> Weathers; public float TimeToArrive; public float DaySpeedMultiplier; public GameItemRarityList ItemRarity; public int MoldIterations; public string RiskLevel; public bool Ignore; public GameLevelConfig() { InternalName = null; PlanetName = null; ScrapAmount = default((int, int)); ScrapValue = default((int, int)); FactorySize = 0f; PowerInside = 0; PowerOutsideDay = 0; PowerOutsideNight = 0; EnemyRarity = null; Weathers = null; TimeToArrive = 0f; DaySpeedMultiplier = 0f; ItemRarity = null; MoldIterations = 0; RiskLevel = null; Ignore = false; } public GameLevelConfig(SelectableLevel level) { ScrapValue = default((int, int)); Ignore = false; InternalName = ((Object)level).name; PlanetName = level.PlanetName; ScrapAmount = (level.minScrap, level.maxScrap); FactorySize = level.factorySizeMultiplier; PowerInside = level.maxEnemyPowerCount; PowerOutsideDay = level.maxDaytimeEnemyPowerCount; PowerOutsideNight = level.maxOutsideEnemyPowerCount; EnemyRarity = GameEnemyRarityList.Create(level.Enemies, level.DaytimeEnemies, level.OutsideEnemies); Weathers = new HashSet<LevelWeatherType>(level.randomWeathers.Select((RandomWeatherWithVariables v) => v.weatherType)); TimeToArrive = level.timeToArrive; DaySpeedMultiplier = level.DaySpeedMultiplier; ItemRarity = GameItemRarityList.Create(level.spawnableScrap); MoldIterations = level.moldSpreadIterations; RiskLevel = level.riskLevel; } public static implicit operator GameLevelConfig(SelectableLevel level) { return new GameLevelConfig(level); } } public static class GameLevelList { [GameVersion(66)] [ExtractionDate(27, 10, 2024)] public static readonly GameLevel Level_AdamanceLevel = GameLevel.Define(new GameLevelConfig { Ignore = false, InternalName = "AdamanceLevel", PlanetName = "20 Adamance", Weathers = new HashSet<LevelWeatherType> { (LevelWeatherType)(-1), (LevelWeatherType)1, (LevelWeatherType)2, (LevelWeatherType)3, (LevelWeatherType)4, (LevelWeatherType)5 }, FactorySize = 1.18f, ScrapAmount = (16, 19), ScrapValue = (300, 700), PowerInside = 13, PowerOutsideNight = 13, PowerOutsideDay = 20, DaySpeedMultiplier = 1f, TimeToArrive = 4f, MoldIterations = 0, RiskLevel = "B", EnemyRarity = new GameEnemyRarityList { [GameEnemyList.Enemy_Blob] = 17, [GameEnemyList.Enemy_Butler] = 10, [GameEnemyList.Enemy_CaveDweller] = 43, [GameEnemyList.Enemy_Centipede] = 42, [GameEnemyList.Enemy_ClaySurgeon] = 3, [GameEnemyList.Enemy_Crawler] = 67, [GameEnemyList.Enemy_DressGirl] = 2, [GameEnemyList.Enemy_Flowerman] = 40, [GameEnemyList.Enemy_HoarderBug] = 57, [GameEnemyList.Enemy_Jester] = 7, [GameEnemyList.Enemy_LassoMan] = 0, [GameEnemyList.Enemy_MaskedPlayerEnemy] = 5, [GameEnemyList.Enemy_Nutcracker] = 8, [GameEnemyList.Enemy_Puffer] = 33, [GameEnemyList.Enemy_SandSpider] = 62, [GameEnemyList.Enemy_SpringMan] = 10, [GameEnemyList.Enemy_BaboonHawk] = 52, [GameEnemyList.Enemy_ForestGiant] = 16, [GameEnemyList.Enemy_MouthDog] = 19, [GameEnemyList.Enemy_RadMech] = 2, [GameEnemyList.Enemy_SandWorm] = 6, [GameEnemyList.Enemy_DocileLocustBees] = 30, [GameEnemyList.Enemy_Doublewing] = 63, [GameEnemyList.Enemy_FlowerSnake] = 6, [GameEnemyList.Enemy_RedLocustBees] = 17 }, ItemRarity = new GameItemRarityList { [GameItemList.Item_Airhorn] = 13, [GameItemList.Item_Bell] = 37, [GameItemList.Item_BigBolt] = 31, [GameItemList.Item_BottleBin] = 44, [GameItemList.Item_BottleBin] = 24, [GameItemList.Item_Brush] = 46, [GameItemList.Item_CashRegister] = 7, [GameItemList.Item_ChemicalJug] = 41, [GameItemList.Item_ClownHorn] = 9, [GameItemList.Item_Cog1] = 30, [GameItemList.Item_ControlPad] = 16, [GameItemList.Item_DiyFlashbang] = 21, [GameItemList.Item_EasterEgg] = 50, [GameItemList.Item_EggBeater] = 50, [GameItemList.Item_EnginePart1] = 40, [GameItemList.Item_FishTestProp] = 32, [GameItemList.Item_FlashLaserPointer] = 8, [GameItemList.Item_Flask] = 30, [GameItemList.Item_GarbageLid] = 19, [GameItemList.Item_GiftBox] = 23, [GameItemList.Item_MagnifyingGlass] = 21, [GameItemList.Item_MetalSheet] = 16, [GameItemList.Item_MoldPan] = 40, [GameItemList.Item_Mug] = 12, [GameItemList.Item_Phone] = 4, [GameItemList.Item_PickleJar] = 20, [GameItemList.Item_PlasticCup] = 16, [GameItemList.Item_Remote] = 24, [GameItemList.Item_RobotToy] = 9, [GameItemList.Item_RubberDuck] = 25, [GameItemList.Item_SodaCanRed] = 12, [GameItemList.Item_SteeringWheel] = 12, [GameItemList.Item_StopSign] = 40, [GameItemList.Item_TeaKettle] = 32, [GameItemList.Item_ToiletPaperRolls] = 40, [GameItemList.Item_ToyCube] = 17, [GameItemList.Item_WhoopieCushion] = 20, [GameItemList.Item_YieldSign] = 16 } }); [GameVersion(66)] [ExtractionDate(27, 10, 2024)] public static readonly GameLevel Level_ArtificeLevel = GameLevel.Define(new GameLevelConfig { Ignore = false, InternalName = "ArtificeLevel", PlanetName = "68 Artifice", Weathers = new HashSet<LevelWeatherType> { (LevelWeatherType)(-1), (LevelWeatherType)1, (LevelWeatherType)2, (LevelWeatherType)4, (LevelWeatherType)5 }, FactorySize = 1.8f, ScrapAmount = (26, 31), ScrapValue = (300, 700), PowerInside = 13, PowerOutsideNight = 13, PowerOutsideDay = 15, DaySpeedMultiplier = 1f, TimeToArrive = 4f, MoldIterations = 0, RiskLevel = "S++", EnemyRarity = new GameEnemyRarityList { [GameEnemyList.Enemy_Blob] = 73, [GameEnemyList.Enemy_Butler] = 91, [GameEnemyList.Enemy_CaveDweller] = 42, [GameEnemyList.Enemy_Centipede] = 77, [GameEnemyList.Enemy_ClaySurgeon] = 45, [GameEnemyList.Enemy_Crawler] = 92, [GameEnemyList.Enemy_DressGirl] = 35, [GameEnemyList.Enemy_Flowerman] = 100, [GameEnemyList.Enemy_HoarderBug] = 95, [GameEnemyList.Enemy_Jester] = 92, [GameEnemyList.Enemy_LassoMan] = 0, [GameEnemyList.Enemy_MaskedPlayerEnemy] = 89, [GameEnemyList.Enemy_Nutcracker] = 100, [GameEnemyList.Enemy_Puffer] = 90, [GameEnemyList.Enemy_SandSpider] = 100, [GameEnemyList.Enemy_SpringMan] = 86, [GameEnemyList.Enemy_BaboonHawk] = 7, [GameEnemyList.Enemy_ForestGiant] = 23, [GameEnemyList.Enemy_MouthDog] = 19, [GameEnemyList.Enemy_RadMech] = 45, [GameEnemyList.Enemy_SandWorm] = 6, [GameEnemyList.Enemy_DocileLocustBees] = 67, [GameEnemyList.Enemy_Doublewing] = 90, [GameEnemyList.Enemy_FlowerSnake] = 5, [GameEnemyList.Enemy_RedLocustBees] = 30 }, ItemRarity = new GameItemRarityList { [GameItemList.Item_7Ball] = 30, [GameItemList.Item_Airhorn] = 39, [GameItemList.Item_Bell] = 56, [GameItemList.Item_BigBolt] = 26, [GameItemList.Item_BottleBin] = 16, [GameItemList.Item_Brush] = 16, [GameItemList.Item_CashRegister] = 26, [GameItemList.Item_Clock] = 39, [GameItemList.Item_ClownHorn] = 31, [GameItemList.Item_Cog1] = 31, [GameItemList.Item_ComedyMask] = 51, [GameItemList.Item_Dentures] = 27, [GameItemList.Item_DiyFlashbang] = 13, [GameItemList.Item_EasterEgg] = 19, [GameItemList.Item_EnginePart1] = 30, [GameItemList.Item_FancyCup] = 55, [GameItemList.Item_FancyLamp] = 53, [GameItemList.Item_FancyPainting] = 62, [GameItemList.Item_FishTestProp] = 16, [GameItemList.Item_FlashLaserPointer] = 10, [GameItemList.Item_GarbageLid] = 11, [GameItemList.Item_GiftBox] = 15, [GameItemList.Item_GoldBar] = 32, [GameItemList.Item_Hairdryer] = 55, [GameItemList.Item_MagnifyingGlass] = 42, [GameItemList.Item_Mug] = 10, [GameItemList.Item_PerfumeBottle] = 14, [GameItemList.Item_Phone] = 25, [GameItemList.Item_PickleJar] = 33, [GameItemList.Item_PillBottle] = 15, [GameItemList.Item_Ring] = 42, [GameItemList.Item_RobotToy] = 64, [GameItemList.Item_RubberDuck] = 60, [GameItemList.Item_SoccerBall] = 39, [GameItemList.Item_SodaCanRed] = 20, [GameItemList.Item_TeaKettle] = 30, [GameItemList.Item_ToiletPaperRolls] = 20, [GameItemList.Item_Toothpaste] = 42, [GameItemList.Item_ToyCube] = 20, [GameItemList.Item_ToyTrain] = 22, [GameItemList.Item_TragedyMask] = 53, [GameItemList.Item_WhoopieCushion] = 43, [GameItemList.Item_Zeddog] = 1 } }); [GameVersion(66)] [ExtractionDate(27, 10, 2024)] public static readonly GameLevel Level_AssuranceLevel = GameLevel.Define(new GameLevelConfig { Ignore = false, InternalName = "AssuranceLevel", PlanetName = "220 Assurance", Weathers = new HashSet<LevelWeatherType> { (LevelWeatherType)(-1), (LevelWeatherType)1, (LevelWeatherType)2, (LevelWeatherType)3, (LevelWeatherType)4, (LevelWeatherType)5 }, FactorySize = 1f, ScrapAmount = (13, 16), ScrapValue = (100, 250), PowerInside = 6, PowerOutsideNight = 8, PowerOutsideDay = 7, DaySpeedMultiplier = 1f, TimeToArrive = 1f, MoldIterations = 0, RiskLevel = "D", EnemyRarity = new GameEnemyRarityList { [GameEnemyList.Enemy_Blob] = 28, [GameEnemyList.Enemy_CaveDweller] = 34, [GameEnemyList.Enemy_Centipede] = 93, [GameEnemyList.Enemy_ClaySurgeon] = 3, [GameEnemyList.Enemy_Crawler] = 24, [GameEnemyList.Enemy_DressGirl] = 1, [GameEnemyList.Enemy_Flowerman] = 14, [GameEnemyList.Enemy_HoarderBug] = 78, [GameEnemyList.Enemy_Nutcracker] = 1, [GameEnemyList.Enemy_Puffer] = 14, [GameEnemyList.Enemy_SandSpider] = 69, [GameEnemyList.Enemy_BaboonHawk] = 20, [GameEnemyList.Enemy_ForestGiant] = 1, [GameEnemyList.Enemy_MouthDog] = 78, [GameEnemyList.Enemy_SandWorm] = 95, [GameEnemyList.Enemy_DocileLocustBees] = 46, [GameEnemyList.Enemy_Doublewing] = 100, [GameEnemyList.Enemy_FlowerSnake] = 3, [GameEnemyList.Enemy_RedLocustBees] = 43 }, ItemRarity = new GameItemRarityList { [GameItemList.Item_Airhorn] = 10, [GameItemList.Item_Bell] = 16, [GameItemList.Item_BigBolt] = 59, [GameItemList.Item_BottleBin] = 58, [GameItemList.Item_BottleBin] = 53, [GameItemList.Item_Brush] = 26, [GameItemList.Item_CashRegister] = 3, [GameItemList.Item_ClownHorn] = 10, [GameItemList.Item_Cog1] = 30, [GameItemList.Item_ComedyMask] = 5, [GameItemList.Item_ControlPad] = 15, [GameItemList.Item_DiyFlashbang] = 14, [GameItemList.Item_EasterEgg] = 32, [GameItemList.Item_EggBeater] = 34, [GameItemList.Item_EnginePart1] = 40, [GameItemList.Item_FishTestProp] = 10, [GameItemList.Item_FlashLaserPointer] = 8, [GameItemList.Item_Flask] = 12, [GameItemList.Item_GarbageLid] = 31, [GameItemList.Item_GiftBox] = 13, [GameItemList.Item_Hairdryer] = 4, [GameItemList.Item_MagnifyingGlass] = 17, [GameItemList.Item_MetalSheet] = 23, [GameItemList.Item_MoldPan] = 49, [GameItemList.Item_Mug] = 12, [GameItemList.Item_Phone] = 7, [GameItemList.Item_PickleJar] = 20, [GameItemList.Item_PlasticCup] = 19, [GameItemList.Item_Remote] = 13, [GameItemList.Item_RobotToy] = 6, [GameItemList.Item_SoccerBall] = 23, [GameItemList.Item_SodaCanRed] = 12, [GameItemList.Item_SteeringWheel] = 19, [GameItemList.Item_StopSign] = 34, [GameItemList.Item_TeaKettle] = 32, [GameItemList.Item_ToiletPaperRolls] = 19, [GameItemList.Item_ToyCube] = 31, [GameItemList.Item_TragedyMask] = 3, [GameItemList.Item_WhoopieCushion] = 11, [GameItemList.Item_YieldSign] = 17, [GameItemList.Item_Zeddog] = 1 } }); [GameVersion(66)] [ExtractionDate(27, 10, 2024)] public static readonly GameLevel Level_CompanyBuildingLevel = GameLevel.Define(new GameLevelConfig { Ignore = false, InternalName = "CompanyBuildingLevel", PlanetName = "71 Gordion", Weathers = new HashSet<LevelWeatherType> { (LevelWeatherType)(-1) }, FactorySize = 0.35f, ScrapAmount = (5, 11), ScrapValue = (100, 250), PowerInside = 0, PowerOutsideNight = 0, PowerOutsideDay = 20, DaySpeedMultiplier = 1f, TimeToArrive = 3f, MoldIterations = 0, RiskLevel = "Safe", EnemyRarity = new GameEnemyRarityList(), ItemRarity = new GameItemRarityList() }); [GameVersion(66)] [ExtractionDate(27, 10, 2024)] public static readonly GameLevel Level_DineLevel = GameLevel.Define(new GameLevelConfig { Ignore = false, InternalName = "DineLevel", PlanetName = "7 Dine", Weathers = new HashSet<LevelWeatherType> { (LevelWeatherType)(-1), (LevelWeatherType)1, (LevelWeatherType)4, (LevelWeatherType)5 }, FactorySize = 1.8f, ScrapAmount = (22, 26), ScrapValue = (300, 700), PowerInside = 16, PowerOutsideNight = 7, PowerOutsideDay = 20, DaySpeedMultiplier = 1f, TimeToArrive = 2.7f, MoldIterations = 0, RiskLevel = "S", EnemyRarity = new GameEnemyRarityList { [GameEnemyList.Enemy_Blob] = 2, [GameEnemyList.Enemy_Butler] = 24, [GameEnemyList.Enemy_CaveDweller] = 2, [GameEnemyList.Enemy_Centipede] = 4, [GameEnemyList.Enemy_ClaySurgeon] = 12, [GameEnemyList.Enemy_Crawler] = 3, [GameEnemyList.Enemy_DressGirl] = 3, [GameEnemyList.Enemy_Flowerman] = 5, [GameEnemyList.Enemy_HoarderBug] = 7, [GameEnemyList.Enemy_Jester] = 6, [GameEnemyList.Enemy_LassoMan] = 0, [GameEnemyList.Enemy_Nutcracker] = 6, [GameEnemyList.Enemy_Puffer] = 3, [GameEnemyList.Enemy_SandSpider] = 4, [GameEnemyList.Enemy_SpringMan] = 5, [GameEnemyList.Enemy_ForestGiant] = 100, [GameEnemyList.Enemy_MouthDog] = 50, [GameEnemyList.Enemy_RadMech] = 13, [GameEnemyList.Enemy_SandWorm] = 3 }, ItemRarity = new GameItemRarityList { [GameItemList.Item_7Ball] = 24, [GameItemList.Item_Airhorn] = 15, [GameItemList.Item_Bell] = 21, [GameItemList.Item_BigBolt] = 4, [GameItemList.Item_BottleBin] = 45, [GameItemList.Item_Brush] = 18, [GameItemList.Item_Candy] = 50, [GameItemList.Item_CashRegister] = 14, [GameItemList.Item_ClownHorn] = 12, [GameItemList.Item_Cog1] = 19, [GameItemList.Item_ComedyMask] = 47, [GameItemList.Item_Dentures] = 44, [GameItemList.Item_DiyFlashbang] = 20, [GameItemList.Item_EasterEgg] = 44, [GameItemList.Item_EnginePart1] = 19, [GameItemList.Item_FancyCup] = 36, [GameItemList.Item_FancyLamp] = 29, [GameItemList.Item_FancyPainting] = 44, [GameItemList.Item_FishTestProp] = 5, [GameItemList.Item_FlashLaserPointer] = 5, [GameItemList.Item_GarbageLid] = 22, [GameItemList.Item_GiftBox] = 11, [GameItemList.Item_Hairdryer] = 14, [GameItemList.Item_MagnifyingGlass] = 14, [GameItemList.Item_Mug] = 48, [GameItemList.Item_PerfumeBottle] = 16, [GameItemList.Item_Phone] = 8, [GameItemList.Item_PickleJar] = 30, [GameItemList.Item_PillBottle] = 29, [GameItemList.Item_Ring] = 16, [GameItemList.Item_RobotToy] = 17, [GameItemList.Item_RubberDuck] = 25, [GameItemList.Item_SodaCanRed] = 50, [GameItemList.Item_TeaKettle] = 43, [GameItemList.Item_ToiletPaperRolls] = 28, [GameItemList.Item_Toothpaste] = 41, [GameItemList.Item_ToyCube] = 33, [GameItemList.Item_TragedyMask] = 30, [GameItemList.Item_WhoopieCushion] = 12, [GameItemList.Item_Zeddog] = 1 } }); [GameVersion(66)] [ExtractionDate(27, 10, 2024)] public static readonly GameLevel Level_EmbrionLevel = GameLevel.Define(new GameLevelConfig { Ignore = false, InternalName = "EmbrionLevel", PlanetName = "5 Embrion", Weathers = new HashSet<LevelWeatherType> { (LevelWeatherType)(-1), (LevelWeatherType)3, (LevelWeatherType)5 }, FactorySize = 1.1f, ScrapAmount = (14, 17), ScrapValue = (100, 250), PowerInside = 8, PowerOutsideNight = 70, PowerOutsideDay = 20, DaySpeedMultiplier = 1f, TimeToArrive = 2f, MoldIterations = 0, RiskLevel = "S", EnemyRarity = new GameEnemyRarityList { [GameEnemyList.Enemy_Blob] = 42, [GameEnemyList.Enemy_Centipede] = 15, [GameEnemyList.Enemy_ClaySurgeon] = 36, [GameEnemyList.Enemy_Crawler] = 30, [GameEnemyList.Enemy_Flowerman] = 3, [GameEnemyList.Enemy_HoarderBug] = 86, [GameEnemyList.Enemy_Nutcracker] = 22, [GameEnemyList.Enemy_Puffer] = 35, [GameEnemyList.Enemy_SandSpider] = 23, [GameEnemyList.Enemy_SpringMan] = 25, [GameEnemyList.Enemy_ForestGiant] = 3, [GameEnemyList.Enemy_MouthDog] = 3, [GameEnemyList.Enemy_RadMech] = 100, [GameEnemyList.Enemy_SandWorm] = 9 }, ItemRarity = new GameItemRarityList { [GameItemList.Item_Airhorn] = 23, [GameItemList.Item_BigBolt] = 66, [GameItemList.Item_BottleBin] = 52, [GameItemList.Item_ClownHorn] = 18, [GameItemList.Item_Cog1] = 81, [GameItemList.Item_ControlPad] = 14, [GameItemList.Item_Dentures] = 12, [GameItemList.Item_DiyFlashbang] = 9, [GameItemList.Item_EasterEgg] = 52, [GameItemList.Item_EnginePart1] = 80, [GameItemList.Item_FishTestProp] = 28, [GameItemList.Item_FlashLaserPointer] = 6, [GameItemList.Item_GiftBox] = 17, [GameItemList.Item_MagnifyingGlass] = 14, [GameItemList.Item_MetalSheet] = 100, [GameItemList.Item_MoldPan] = 52, [GameItemList.Item_Phone] = 8, [GameItemList.Item_Remote] = 28, [GameItemList.Item_RobotToy] = 43, [GameItemList.Item_SoccerBall] = 26, [GameItemList.Item_StopSign] = 28, [GameItemList.Item_TeaKettle] = 23, [GameItemList.Item_ToiletPaperRolls] = 45, [GameItemList.Item_ToyCube] = 25, [GameItemList.Item_YieldSign] = 14 } }); [GameVersion(66)] [ExtractionDate(27, 10, 2024)] public static readonly GameLevel Level_ExperimentationLevel = GameLevel.Define(new GameLevelConfig { Ignore = false, InternalName = "ExperimentationLevel", PlanetName = "41 Experimentation", Weathers = new HashSet<LevelWeatherType> { (LevelWeatherType)(-1), (LevelWeatherType)1, (LevelWeatherType)2, (LevelWeatherType)3, (LevelWeatherType)4, (LevelWeatherType)5 }, FactorySize = 1f, ScrapAmount = (8, 12), ScrapValue = (80, 450), PowerInside = 4, PowerOutsideNight = 8, PowerOutsideDay = 5, DaySpeedMultiplier = 1f, TimeToArrive = 1f, MoldIterations = 0, RiskLevel = "B", EnemyRarity = new GameEnemyRarityList { [GameEnemyList.Enemy_Blob] = 31, [GameEnemyList.Enemy_Centipede] = 51, [GameEnemyList.Enemy_Crawler] = 16, [GameEnemyList.Enemy_DressGirl] = 1, [GameEnemyList.Enemy_Flowerman] = 13, [GameEnemyList.Enemy_HoarderBug] = 28, [GameEnemyList.Enemy_Nutcracker] = 1, [GameEnemyList.Enemy_Puffer] = 28, [GameEnemyList.Enemy_SandSpider] = 58, [GameEnemyList.Enemy_ForestGiant] = 1, [GameEnemyList.Enemy_MouthDog] = 75, [GameEnemyList.Enemy_RadMech] = 3, [GameEnemyList.Enemy_SandWorm] = 56, [GameEnemyList.Enemy_DocileLocustBees] = 52, [GameEnemyList.Enemy_Doublewing] = 74, [GameEnemyList.Enemy_RedLocustBees] = 22 }, ItemRarity = new GameItemRarityList { [GameItemList.Item_Airhorn] = 3, [GameItemList.Item_BigBolt] = 80, [GameItemList.Item_BottleBin] = 19, [GameItemList.Item_Candy] = 2, [GameItemList.Item_CashRegister] = 3, [GameItemList.Item_ClownHorn] = 3, [GameItemList.Item_Cog1] = 80, [GameItemList.Item_DiyFlashbang] = 22, [GameItemList.Item_DustPan] = 32, [GameItemList.Item_EasterEgg] = 5, [GameItemList.Item_EggBeater] = 10, [GameItemList.Item_EnginePart1] = 90, [GameItemList.Item_FishTestProp] = 12, [GameItemList.Item_FlashLaserPointer] = 4, [GameItemList.Item_Flask] = 42, [GameItemList.Item_GiftBox] = 17, [GameItemList.Item_GoldBar] = 1, [GameItemList.Item_MetalSheet] = 88, [GameItemList.Item_MoldPan] = 5, [GameItemList.Item_PickleJar] = 10, [GameItemList.Item_Ring] = 3, [GameItemList.Item_SteeringWheel] = 32, [GameItemList.Item_YieldSign] = 6 } }); [GameVersion(66)] [ExtractionDate(27, 10, 2024)] public static readonly GameLevel Level_LiquidationLevel = GameLevel.Define(new GameLevelConfig { Ignore = false, InternalName = "LiquidationLevel", PlanetName = "44 Liquidation", Weathers = new HashSet<LevelWeatherType> { (LevelWeatherType)(-1), (LevelWeatherType)1, (LevelWeatherType)2, (LevelWeatherType)4, (LevelWeatherType)5 }, FactorySize = 1.6f, ScrapAmount = (28, 45), ScrapValue = (300, 700), PowerInside = 13, PowerOutsideNight = 13, PowerOutsideDay = 20, DaySpeedMultiplier = 1f, TimeToArrive = 4f, MoldIterations = 0, RiskLevel = "S++", EnemyRarity = new GameEnemyRarityList { [GameEnemyList.Enemy_Blob] = 20, [GameEnemyList.Enemy_Centipede] = 54, [GameEnemyList.Enemy_Crawler] = 54, [GameEnemyList.Enemy_DressGirl] = 28, [GameEnemyList.Enemy_Flowerman] = 62, [GameEnemyList.Enemy_HoarderBug] = 38, [GameEnemyList.Enemy_Jester] = 56, [GameEnemyList.Enemy_LassoMan] = 0, [GameEnemyList.Enemy_MaskedPlayerEnemy] = 32, [GameEnemyList.Enemy_Nutcracker] = 71, [GameEnemyList.Enemy_Puffer] = 16, [GameEnemyList.Enemy_SandSpider] = 59, [GameEnemyList.Enemy_SpringMan] = 44 }, ItemRarity = new GameItemRarityList { [GameItemList.Item_7Ball] = 30, [GameItemList.Item_Airhorn] = 39, [GameItemList.Item_Bell] = 49, [GameItemList.Item_BigBolt] = 55, [GameItemList.Item_BottleBin] = 42, [GameItemList.Item_Brush] = 16, [GameItemList.Item_ClownHorn] = 31, [GameItemList.Item_Cog1] = 37, [GameItemList.Item_ComedyMask] = 43, [GameItemList.Item_Dentures] = 37, [GameItemList.Item_DiyFlashbang] = 13, [GameItemList.Item_EnginePart1] = 40, [GameItemList.Item_FancyCup] = 27, [GameItemList.Item_FancyLamp] = 27, [GameItemList.Item_FancyPainting] = 14, [GameItemList.Item_FishTestProp] = 16, [GameItemList.Item_FlashLaserPointer] = 10, [GameItemList.Item_GiftBox] = 17, [GameItemList.Item_Hairdryer] = 49, [GameItemList.Item_MagnifyingGlass] = 37, [GameItemList.Item_Mug] = 21, [GameItemList.Item_PerfumeBottle] = 14, [GameItemList.Item_Phone] = 45, [GameItemList.Item_PickleJar] = 8, [GameItemList.Item_PillBottle] = 15, [GameItemList.Item_Ring] = 15, [GameItemList.Item_RobotToy] = 49, [GameItemList.Item_RubberDuck] = 47, [GameItemList.Item_SodaCanRed] = 48, [GameItemList.Item_TeaKettle] = 47, [GameItemList.Item_Toothpaste] = 31, [GameItemList.Item_ToyCube] = 20, [GameItemList.Item_TragedyMask] = 46, [GameItemList.Item_WhoopieCushion] = 43 } }); [GameVersion(66)] [ExtractionDate(27, 10, 2024)] public static readonly GameLevel Level_MarchLevel = GameLevel.Define(new GameLevelConfig { Ignore = false, InternalName = "MarchLevel", PlanetName = "61 March", Weathers = new HashSet<LevelWeatherType> { (LevelWeatherType)(-1), (LevelWeatherType)2, (LevelWeatherType)3, (LevelWeatherType)4, (LevelWeatherType)5 }, FactorySize = 2f, ScrapAmount = (13, 17), ScrapValue = (300, 700), PowerInside = 14, PowerOutsideNight = 12, PowerOutsideDay = 20, DaySpeedMultiplier = 1f, TimeToArrive = 2.75f, MoldIterations = 0, RiskLevel = "B", EnemyRarity = new GameEnemyRarityList { [GameEnemyList.Enemy_Blob] = 15, [GameEnemyList.Enemy_CaveDweller] = 9, [GameEnemyList.Enemy_Centipede] = 38, [GameEnemyList.Enemy_Crawler] = 74, [GameEnemyList.Enemy_Flowerman] = 56, [GameEnemyList.Enemy_HoarderBug] = 36, [GameEnemyList.Enemy_Jester] = 1, [GameEnemyList.Enemy_Nutcracker] = 3, [GameEnemyList.Enemy_Puffer] = 9, [GameEnemyList.Enemy_SandSpider] = 64, [GameEnemyList.Enemy_SpringMan] = 10, [GameEnemyList.Enemy_BaboonHawk] = 85, [GameEnemyList.Enemy_ForestGiant] = 64, [GameEnemyList.Enemy_MouthDog] = 38, [GameEnemyList.Enemy_SandWorm] = 16, [GameEnemyList.Enemy_DocileLocustBees] = 39, [GameEnemyList.Enemy_Doublewing] = 83, [GameEnemyList.Enemy_FlowerSnake] = 4, [GameEnemyList.Enemy_RedLocustBees] = 70 }, ItemRarity = new GameItemRarityList { [GameItemList.Item_Airhorn] = 34, [GameItemList.Item_BigBolt] = 89, [GameItemList.Item_BottleBin] = 67, [GameItemList.Item_Candy] = 3, [GameItemList.Item_CashRegister] = 3, [GameItemList.Item_ClownHorn] = 43, [GameItemList.Item_Cog1] = 77, [GameItemList.Item_ControlPad] = 11, [GameItemList.Item_EasterEgg] = 65, [GameItemList.Item_EnginePart1] = 72, [GameItemList.Item_FishTestProp] = 28, [GameItemList.Item_FlashLaserPointer] = 3, [GameItemList.Item_Flask] = 42, [GameItemList.Item_GarbageLid] = 20, [GameItemList.Item_GiftBox] = 24, [GameItemList.Item_GoldBar] = 4, [GameItemList.Item_MagnifyingGlass] = 4, [GameItemList.Item_MetalSheet] = 83, [GameItemList.Item_MoldPan] = 24, [GameItemList.Item_PlasticCup] = 27, [GameItemList.Item_Remote] = 16, [GameItemList.Item_RobotToy] = 2, [GameItemList.Item_SoccerBall] = 21, [GameItemList.Item_SodaCanRed] = 2, [GameItemList.Item_StopSign] = 29, [GameItemList.Item_TeaKettle] = 24, [GameItemList.Item_ToiletPaperRolls] = 32, [GameItemList.Item_ToyCube] = 18, [GameItemList.Item_YieldSign] = 8, [GameItemList.Item_Zeddog] = 1 } }); [GameVersion(66)] [ExtractionDate(27, 10, 2024)] public static readonly GameLevel Level_OffenseLevel = GameLevel.Define(new GameLevelConfig { Ignore = false, InternalName = "OffenseLevel", PlanetName = "21 Offense", Weathers = new HashSet<LevelWeatherType> { (LevelWeatherType)(-1), (LevelWeatherType)1, (LevelWeatherType)2, (LevelWeatherType)3, (LevelWeatherType)4, (LevelWeatherType)5 }, FactorySize = 1.25f, ScrapAmount = (14, 18), ScrapValue = (100, 250), PowerInside = 12, PowerOutsideNight = 8, PowerOutsideDay = 20, DaySpeedMultiplier = 1f, TimeToArrive = 2f, MoldIterations = 0, RiskLevel = "B", EnemyRarity = new GameEnemyRarityList { [GameEnemyList.Enemy_Blob] = 32, [GameEnemyList.Enemy_CaveDweller] = 17, [GameEnemyList.Enemy_Centipede] = 27, [GameEnemyList.Enemy_Crawler] = 55, [GameEnemyList.Enemy_Flowerman] = 3, [GameEnemyList.Enemy_HoarderBug] = 16, [GameEnemyList.Enemy_Nutcracker] = 2, [GameEnemyList.Enemy_Puffer] = 7, [GameEnemyList.Enemy_SandSpider] = 44, [GameEnemyList.Enemy_SpringMan] = 25, [GameEnemyList.Enemy_BaboonHawk] = 60, [GameEnemyList.Enemy_ForestGiant] = 9, [GameEnemyList.Enemy_MouthDog] = 100, [GameEnemyList.Enemy_RadMech] = 5, [GameEnemyList.Enemy_SandWorm] = 37, [GameEnemyList.Enemy_Doublewing] = 100 }, ItemRarity = new GameItemRarityList { [GameItemList.Item_Airhorn] = 15, [GameItemList.Item_BigBolt] = 89, [GameItemList.Item_BottleBin] = 46, [GameItemList.Item_Clock] = 6, [GameItemList.Item_ClownHorn] = 18, [GameItemList.Item_Cog1] = 94, [GameItemList.Item_ComedyMask] = 10, [GameItemList.Item_ControlPad] = 40, [GameItemList.Item_Dentures] = 11, [GameItemList.Item_DiyFlashbang] = 13, [GameItemList.Item_EasterEgg] = 19, [GameItemList.Item_EnginePart1] = 80, [GameItemList.Item_FishTestProp] = 28, [GameItemList.Item_FlashLaserPointer] = 10, [GameItemList.Item_Flask] = 40, [GameItemList.Item_GarbageLid] = 31, [GameItemList.Item_GiftBox] = 19, [GameItemList.Item_MagnifyingGlass] = 20, [GameItemList.Item_MetalSheet] = 65, [GameItemList.Item_MoldPan] = 6, [GameItemList.Item_Phone] = 8, [GameItemList.Item_PlasticCup] = 19, [GameItemList.Item_Remote] = 15, [GameItemList.Item_RobotToy] = 9, [GameItemList.Item_StopSign] = 27, [GameItemList.Item_TeaKettle] = 24, [GameItemList.Item_ToiletPaperRolls] = 18, [GameItemList.Item_ToyCube] = 18, [GameItemList.Item_ToyTrain] = 6, [GameItemList.Item_YieldSign] = 28, [GameItemList.Item_Zeddog] = 1 } }); [GameVersion(66)] [ExtractionDate(27, 10, 2024)] public static readonly GameLevel Level_RendLevel = GameLevel.Define(new GameLevelConfig { Ignore = false, InternalName = "RendLevel", PlanetName = "85 Rend", Weathers = new HashSet<LevelWeatherType> { (LevelWeatherType)(-1), (LevelWeatherType)2, (LevelWeatherType)5 }, FactorySize = 1.8f, ScrapAmount = (18, 26), ScrapValue = (300, 700), PowerInside = 10, PowerOutsideNight = 6, PowerOutsideDay = 20, DaySpeedMultiplier = 1f, TimeToArrive = 2.7f, MoldIterations = 0, RiskLevel = "A", EnemyRarity = new GameEnemyRarityList { [GameEnemyList.Enemy_Blob] = 6, [GameEnemyList.Enemy_Butler] = 18, [GameEnemyList.Enemy_Centipede] = 31, [GameEnemyList.Enemy_ClaySurgeon] = 11, [GameEnemyList.Enemy_DressGirl] = 20, [GameEnemyList.Enemy_Flowerman] = 51, [GameEnemyList.Enemy_Jester] = 60, [GameEnemyList.Enemy_LassoMan] = 0, [GameEnemyList.Enemy_MaskedPlayerEnemy] = 25, [GameEnemyList.Enemy_Nutcracker] = 100, [GameEnemyList.Enemy_Puffer] = 7, [GameEnemyList.Enemy_SandSpider] = 43, [GameEnemyList.Enemy_SpringMan] = 43, [GameEnemyList.Enemy_ForestGiant] = 60, [GameEnemyList.Enemy_MouthDog] = 74 }, ItemRarity = new GameItemRarity
BepInEx/plugins/Lethal_Company_Variables.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using Amrv.ConfigurableCompany.API; using Amrv.ConfigurableCompany.API.Accesors; using Amrv.ConfigurableCompany.API.Data; using Amrv.ConfigurableCompany.API.Event; using Amrv.ConfigurableCompany.Core; using Amrv.ConfigurableCompany.Core.Net; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LCV; using LCV.Compat; using LCV.Data; using LCV.Module; using LCV.Module.Config; using LCV.Utils; using LCVCompat; using LethalLevelLoader; using LethalLevelLoader.Tools; using Lethal_Company_Variables.IL; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Lethal_Company_Variables")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Some configurations for ConfigurableCompany mod")] [assembly: AssemblyFileVersion("2.7.0.0")] [assembly: AssemblyInformationalVersion("2.7.0+837d6cc274be0d07e6c6647ca04a644dffb46eb0")] [assembly: AssemblyProduct("Lethal_Company_Variables")] [assembly: AssemblyTitle("Lethal_Company_Variables")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.7.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Lethal_Company_Variables.IL { public class ILCode : IEnumerable<CodeInstruction>, IEnumerable { private readonly List<CodeInstruction> Instructions = new List<CodeInstruction>(instructions); public int Count => Instructions.Count; public CodeInstruction this[int i] { get { return Get(i); } set { Set(i, value); } } public ILCode(IEnumerable<CodeInstruction> instructions) { } public void InsertAfter(int index, CodeInstruction instruction) { Instructions.Insert(index + 1, instruction); } public void InsertAfter(int index, OpCode code, object operand = null) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown Instructions.Insert(index + 1, new CodeInstruction(code, operand)); } public void InsertAfter(int index, Delegate @delegate) { InsertBefore(index + 1, @delegate); } public void InsertBefore(int index, CodeInstruction instruction) { Instructions.Insert(index, instruction); } public void InsertBefore(int index, OpCode code, object operand = null) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown Instructions.Insert(index, new CodeInstruction(code, operand)); } public void InsertBefore(int index, Delegate @delegate) { foreach (CodeInstruction item in ILInjector.InjectAny(@delegate)) { InsertBefore(index++, item); } } public void Remove(int index) { Instructions.RemoveAt(index); } public void Remove(int index, int amount) { Instructions.RemoveRange(index, amount); } public void Replace(int index, OpCode code, object operand = null) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown Replace(index, new CodeInstruction(code, operand)); } public void Replace(int index, CodeInstruction instruction) { Instructions.RemoveAt(index); Instructions.Insert(index, instruction); } public ILFinder Find() { return new ILFinder(this); } public ILFinder Find(int index) { return new ILFinder(this).ThenForward(index); } public ILFinder Find(OpCode code) { return new ILFinder(this).Find(code); } public ILFinder Find(OpCode code, object operand) { return new ILFinder(this).Find(code, operand); } public CodeInstruction Get(int index) { return Instructions[index]; } public void Set(int index, CodeInstruction value) { Instructions[index] = value; } public IEnumerator<CodeInstruction> GetEnumerator() { return Instructions.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return Instructions.GetEnumerator(); } internal void InsertAfter(int index, object modifyBonus) { throw new NotImplementedException(); } [Obsolete("ILCode logging should be removed on releases")] internal void Log() { int length = Count.ToString(CultureInfo.InvariantCulture).Length; for (int i = 0; i < Count; i++) { LCVPlugin.Warn(string.Format("[{0}] {1,-9} > {2}", i.ToString().PadLeft(length, '0'), this[i].opcode.Name, this[i].operand ?? "N/A")); } } } public class ILFinder { private readonly ILCode instructions; private bool started; private int pointer; public ILFinder(ILCode code) { instructions = code; base..ctor(); } public ILFinder GoTo(int index) { if (IsInvalidPointer()) { return this; } started = true; pointer = index; return this; } public bool IsInvalidPointer() { if (pointer >= 0) { return pointer >= instructions.Count; } return true; } public bool Valid() { if (started && pointer >= 0) { return pointer < instructions.Count; } return false; } public ILFinder Find(OpCode code, int max = 0) { if (IsInvalidPointer()) { return this; } started = true; if (max >= 0) { int num = ((max == 0) ? instructions.Count : Math.Min(pointer + max, instructions.Count)); for (int i = pointer; i < num; i++) { if (instructions[i].opcode == code) { pointer = i; return this; } } } else { int num2 = Math.Max(0, pointer - max); for (int num3 = pointer; num3 > num2; num3--) { if (instructions[num3].opcode == code) { pointer = num3; return this; } } } pointer = -1; return this; } public ILFinder Find(CodeInstruction instruction, int max = 0) { return Find(instruction.opcode, instruction.operand, max); } public ILFinder Find(OpCode code, object operand, int max = 0) { if (IsInvalidPointer()) { return this; } started = true; if (max >= 0) { int num = ((max == 0) ? instructions.Count : Math.Min(pointer + max, instructions.Count)); for (int i = pointer; i < num; i++) { if (TestEquivalentInstructions(instructions[i], code, operand)) { pointer = i; return this; } } } else { int num2 = Math.Max(0, pointer - max); for (int num3 = pointer; num3 > num2; num3--) { if (TestEquivalentInstructions(instructions[num3], code, operand)) { pointer = num3; return this; } } } pointer = -1; return this; } public ILFinder ThenForward(int amount = 1) { if (IsInvalidPointer()) { return this; } started = true; pointer += amount; return this; } public ILFinder ThenBackwards(int amount = 1) { if (IsInvalidPointer()) { return this; } started = true; pointer -= amount; return this; } public bool FoundIndex(out int index) { index = pointer; if (started) { return pointer >= 0; } return false; } public int FoundIndex() { if (!started) { return -1; } return pointer; } public static implicit operator int(ILFinder finder) { return finder.FoundIndex(); } public static implicit operator bool(ILFinder finder) { int index; return finder.FoundIndex(out index); } public static implicit operator (bool valid, int index)(ILFinder finder) { int index; return (finder.FoundIndex(out index), index); } public static implicit operator CodeInstruction(ILFinder finder) { return finder.instructions.Get(finder.pointer); } internal static bool TestEquivalentInstructions(CodeInstruction instruction, OpCode code, object operand) { if (instruction.opcode != code) { return false; } if (instruction.operand == null) { return operand == null; } if (instruction.operand is LocalBuilder localBuilder && operand is IConvertible value) { return localBuilder.LocalIndex == Convert.ToInt32(value); } if (instruction.operand.ToString().Equals(operand.ToString())) { return true; } return CodeInstructionExtensions.OperandIs(instruction, operand); } } public static class ILInjector { private static readonly Type TYPE_VOID = typeof(void); private static readonly Type TYPE_STRING = typeof(string); public static List<CodeInstruction> InjectAny(Delegate @delegate) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); MethodInfo method = @delegate.Method; if (!method.IsStatic) { throw new Exception("Tried to inject non-static method"); } ParameterInfo[] parameters = method.GetParameters(); foreach (ParameterInfo parameterInfo in parameters) { ILParam customAttribute = parameterInfo.GetCustomAttribute<ILParam>(); if (customAttribute != null) { list.Add(customAttribute.Generate(parameterInfo)); } } list.Add(new CodeInstruction(OpCodes.Call, (object)method)); if (method.ReturnParameter.ParameterType != TYPE_VOID) { ILReturn customAttribute2 = method.ReturnParameter.GetCustomAttribute<ILReturn>(); if (customAttribute2 == null) { customAttribute2 = method.GetCustomAttribute<ILReturn>(); } if (customAttribute2 != null) { list.Add(customAttribute2.Generate(method.ReturnParameter)); } } return list; } } [AttributeUsage(AttributeTargets.Parameter)] public class ILParam : Attribute { public enum ParamType { Argument, Variable, Field } public readonly int Index; public readonly bool IsReference; public readonly ParamType Type; public readonly bool Ignore; public bool IsArgument => Type == ParamType.Argument; public bool IsVariable => Type == ParamType.Variable; public bool IsField => Type == ParamType.Field; public ILParam(int index = 0, bool ignore = false, bool isReference = false, ParamType type = ParamType.Variable) { Index = index; IsReference = isReference; Ignore = ignore; Type = type; } public CodeInstruction Generate(ParameterInfo param) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown if (!Ignore) { OpCode opCode = OpCodes.Nop; object obj = null; switch (Type) { case ParamType.Argument: opCode = (IsReference ? OpCodes.Ldarga_S : OpCodes.Ldarg_S); obj = Index; break; case ParamType.Variable: opCode = (IsReference ? OpCodes.Ldloca_S : OpCodes.Ldloc_S); obj = Index; break; case ParamType.Field: opCode = (IsReference ? OpCodes.Ldflda : OpCodes.Ldfld); obj = Index; break; } return new CodeInstruction(opCode, obj); } return new CodeInstruction(OpCodes.Nop, (object)null); } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.ReturnValue, AllowMultiple = false, Inherited = false)] public class ILReturn : Attribute { public enum ReturnType { Argument, Variable } public readonly int Index; public readonly ReturnType Type; public bool IsArgument => Type == ReturnType.Argument; public bool IsVariable => Type == ReturnType.Variable; public ILReturn(int index = 0, ReturnType type = ReturnType.Variable) { Index = index; Type = type; } public CodeInstruction Generate(ParameterInfo returnParameter) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown OpCode opCode = OpCodes.Nop; object obj = null; switch (Type) { case ReturnType.Argument: opCode = OpCodes.Starg; obj = Index; break; case ReturnType.Variable: opCode = OpCodes.Stloc; obj = Index; break; } return new CodeInstruction(opCode, obj); } } } namespace LCV { public static class LCVConfig { public static class Pages { public static readonly CPage Enemies = InstanceBuilder<CPage>.op_Implicit((InstanceBuilder<CPage>)new CPageBuilder { ID = "lcv_page_enemies", Name = "Enemies", Description = "LCV: Enemy configurations" }); public static readonly CPage Items = InstanceBuilder<CPage>.op_Implicit((InstanceBuilder<CPage>)new CPageBuilder { ID = "lcv_page_items", Name = "Items", Description = "LCV: Item configurations" }); public static readonly CPage Gameplay = InstanceBuilder<CPage>.op_Implicit((InstanceBuilder<CPage>)new CPageBuilder { ID = "lcv_page_gameplay", Name = "Gameplay", Description = "LCV: Gameplay configuration" }); public static CPage Extras = InstanceBuilder<CPage>.op_Implicit((InstanceBuilder<CPage>)new CPageBuilder { ID = "lcv_page_extras", Name = "Extras", Description = "LCV: Extra configuration" }); public static CPage Planets => PerLevelConfig.Page; public static CPage Player => PlayerSettings.Player; } public static class Categories { public static readonly CCategory Items_Battery = InstanceBuilder<CCategory>.op_Implicit((InstanceBuilder<CCategory>)new CCategoryBuilder { ID = "lcv_category_items_battery", CPage = Pages.Items, ColorRGB = (190, 3, 252), Name = "Battery" }); public static readonly CCategory Items_Conductive = InstanceBuilder<CCategory>.op_Implicit((InstanceBuilder<CCategory>)new CCategoryBuilder { ID = "lcv_category_items_metal", CPage = Pages.Items, ColorRGB = (227, 218, 57), Name = "Conductivity" }); public static readonly CCategory Items_Weight = InstanceBuilder<CCategory>.op_Implicit((InstanceBuilder<CCategory>)new CCategoryBuilder { ID = "lcv_category_items_weight", CPage = Pages.Items, ColorRGB = (252, 152, 3), Name = "Weight" }); public static readonly CCategory Items_Price = InstanceBuilder<CCategory>.op_Implicit((InstanceBuilder<CCategory>)new CCategoryBuilder { ID = "lcv_category_items_price", CPage = Pages.Items, ColorRGB = (3, 252, 148), Name = "Shop price" }); public static readonly CCategory Items_Worth = InstanceBuilder<CCategory>.op_Implicit((InstanceBuilder<CCategory>)new CCategoryBuilder { ID = "lcv_category_items_worth", BPage = BuildPage.op_Implicit(Pages.Items), BColor = BuildColor.op_Implicit((ValueTuple<byte, byte, byte>)(56, 119, 201)), Name = "Scrap value" }); public static readonly CCategory GlobalEnemySpawn = InstanceBuilder<CCategory>.op_Implicit((InstanceBuilder<CCategory>)new CCategoryBuilder { ID = "lcv_category_global-enemy-spawn", CPage = Pages.Enemies, ColorRGB = (210, 160, 220), Name = "Global enemy spawning" }); public static readonly CCategory Extras_Player = InstanceBuilder<CCategory>.op_Implicit((InstanceBuilder<CCategory>)new CCategoryBuilder { ID = "lcv_category_extras-player", CPage = Pages.Extras, ColorRGB = (52, 235, 155), Name = "Player" }); public static readonly CCategory Extras_Ship = InstanceBuilder<CCategory>.op_Implicit((InstanceBuilder<CCategory>)new CCategoryBuilder { ID = "lcv_category_extras-ship", CPage = Pages.Extras, ColorRGB = (187, 89, 212), Name = "Ship" }); public static readonly CCategory QuotaSettings = InstanceBuilder<CCategory>.op_Implicit((InstanceBuilder<CCategory>)new CCategoryBuilder { ID = "lcv_category_quota-settings", Name = "Quota settings", CPage = Pages.Gameplay, ColorRGB = (53, 189, 85) }); public static readonly CCategory Gameplay_GameSettings = InstanceBuilder<CCategory>.op_Implicit((InstanceBuilder<CCategory>)new CCategoryBuilder { ID = "lcv_category_game-settings", Name = "Game settings", CPage = Pages.Gameplay, ColorRGB = (190, 190, 180) }); } public static class Sections { } } [BepInPlugin("dev.amrv.lethalCompany.vars", "Configurable Company Variables", "2.7.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class LCVPlugin : BaseUnityPlugin { private const string PLUGIN_GUID = "dev.amrv.lethalCompany.vars"; private const string PLUGIN_NAME = "Configurable Company Variables"; private const string PLUGIN_VERSION = "2.7.0"; private static readonly Harmony Patcher = new Harmony("dev.amrv.lethalCompany.vars"); private static ManualLogSource Log; public static LCVPlugin Instance { get; private set; } protected void Awake() { Log = ((BaseUnityPlugin)this).Logger; Info("Loading configurable variables"); Instance = this; GameEnemy.Init(); GameLevel.Init(); GameItem.Init(); AbstractCompat.CheckCompatibility(Patcher); SafePatch(); foreach (MethodBase patchedMethod in Patcher.GetPatchedMethods()) { Info("Patched >> " + patchedMethod.DeclaringType.Name + "::" + patchedMethod.Name); } InitiateAttribute.InitiateAll(); Info("Plugin Configurable Company Variables is loaded!"); } internal static void SafeApply(Action method, [CallerMemberName] string methodCaller = "Unknown", [CallerLineNumber] int methodLine = -1) { if (method == null) { return; } try { method(); } catch (Exception arg) { Error($"Error executing {methodCaller} Exception is: {arg}"); } } private void SafePatch() { try { Type[] exportedTypes = Assembly.GetAssembly(typeof(LCVPlugin)).GetExportedTypes(); foreach (Type classType in exportedTypes) { SafePatch(classType); } } catch (Exception arg) { Error($"Error creating LCV patches: {arg}"); } } private void SafePatch(Type classType) { try { Patcher.PatchAll(classType); } catch (Exception ex) { Error($"Unable to patch {classType}: {ex.Message}"); } } public static void Info(object message) { Log.LogInfo(message); } public static void Error(object message) { Log.LogError(message); } public static void Warn(object message) { Log.LogWarning(message); } public static void Warn_ModifiedILIndex(int current, int expected, [CallerMemberName] string callerMethod = "Unknown method", [CallerLineNumber] int callerMethodLine = -1) { if (expected != current) { Warn($"Unexpected index for patch {callerMethod}{'#'}{callerMethodLine} Got {current} but was expecting {expected}: A mod (or game update) has patched/modified the same method as LCV and may cause conflicts under certain circumstances"); } } public static void Debug(object message) { Log.LogDebug(message); } } public static class PluginInfo { public const string PLUGIN_GUID = "Lethal_Company_Variables"; public const string PLUGIN_NAME = "Lethal_Company_Variables"; public const string PLUGIN_VERSION = "2.7.0"; } } namespace LCV.Utils { internal static class DebugUtils { public static void PrintData(object item) { Console.WriteLine(item.ToString() + " -- " + typeof(Item).FullName); FieldInfo[] fields = item.GetType().GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo obj in fields) { string text = ""; if (obj.IsPrivate) { text += "private "; } if (obj.IsFamily) { text += "protected "; } if (obj.IsPublic) { text += "public "; } if (obj.IsAssembly) { text += "internal "; } if (obj.IsLiteral) { text += "const "; } if (obj.IsInitOnly) { text += "readonly "; } if (obj.IsStatic) { text += "static "; } _ = obj.FieldType.Name; string name = obj.Name; object value = obj.GetValue(item); Console.WriteLine($"-- {text}{name} = {value}"); } PropertyInfo[] properties = item.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (PropertyInfo arg in properties) { Console.WriteLine($"Property: {arg}"); } MethodInfo[] methods = item.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { string text2 = ""; if (methodInfo.IsPrivate) { text2 += "private "; } if (methodInfo.IsFamily) { text2 += "protected "; } if (methodInfo.IsPublic) { text2 += "public "; } if (methodInfo.IsAssembly) { text2 += "internal "; } if (methodInfo.IsVirtual) { text2 += "virtual "; } if (methodInfo.IsAbstract) { text2 += "abstract "; } if (methodInfo.IsStatic) { text2 += "static "; } string name2 = methodInfo.Name; Console.WriteLine($"-- {text2} {methodInfo.ReturnType.Name} {name2} {methodInfo.GetParameters()}"); } } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true)] internal sealed class InitiateAttribute : Attribute, IComparable<InitiateAttribute> { public enum InitOrder { Module = 1, Cache } public readonly int Order; public InitiateAttribute(InitOrder order) { Order = (int)order; } public InitiateAttribute(int customOrder) { Order = customOrder; } public static void InitiateAll() { List<Type> list = new List<Type>(); Type[] exportedTypes = Assembly.GetAssembly(typeof(InitiateAttribute)).GetExportedTypes(); foreach (Type type in exportedTypes) { if (type.GetCustomAttribute<InitiateAttribute>() != null) { list.Add(type); } } list.Sort((Type t1, Type t2) => t1.GetCustomAttribute<InitiateAttribute>()?.CompareTo(t2.GetCustomAttribute<InitiateAttribute>()) ?? ((t2.GetCustomAttribute<InitiateAttribute>() != null) ? 1 : 0)); foreach (Type item in list) { try { RuntimeHelpers.RunClassConstructor(item.TypeHandle); MethodInfo[] methods = item.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttribute<InitiateAttribute>() != null && !methodInfo.IsAbstract && methodInfo.IsStatic && methodInfo.GetParameters().Length == 0) { try { methodInfo.Invoke(null, null); } catch (Exception ex) { LCVPlugin.Error($"Unable to load method {item}:{methodInfo.Name}: {ex.Message}"); } } } } catch (Exception ex2) { LCVPlugin.Error($"Unable to load type {item}: {ex2.Message}"); } } } public int CompareTo(InitiateAttribute other) { return Order.CompareTo(other.Order); } } public static class LCVMath { public static int Calculate(double number) { return (int)Math.Round(number); } public static double MultiplyPerPlayer(int players, double number, double multiplier) { if (players != 1) { return number * (multiplier * (double)(players - 1)); } return number; } public static double AddPerPlayer(int players, double number, double addition) { if (players != 1) { return number + addition * (double)(players - 1); } return number; } public static (byte, byte, byte) StringToColor(string str) { byte[] bytes = Encoding.UTF8.GetBytes(str); int num = 0; byte[] array = bytes; foreach (byte b in array) { num = (num * 31 << 2) ^ b; } Random random = new Random(num); byte[] array2 = new byte[3]; random.NextBytes(array2); return (array2[0], array2[1], array2[2]); } } } namespace LCV.Patch { [HarmonyPatch(typeof(EnemyType))] public static class EnemyTypePatch { public static bool Enable_Awake_Postfix = true; public static bool Enable_OnDestroy_Prefix = true; [HarmonyPatch("Awake")] [HarmonyPostfix] internal static void Awake_Postfix(EnemyType __instance) { if (Enable_Awake_Postfix) { object[] obj = new object[5] { ((Object)__instance).name, ((Object)__instance).name, null, null, null }; GameObject enemyPrefab = __instance.enemyPrefab; obj[2] = ((enemyPrefab != null) ? ((Object)enemyPrefab).name : null) ?? "no prefab"; obj[3] = ((object)__instance).GetHashCode(); obj[4] = __instance.enemyPrefab; LCVPlugin.Debug(string.Format("EnemyType::Awake (Postfix) | enemy: {0} | gameObject: {1} | prefab: {2} | hash: {3} | fullPrefab: {4}", obj)); EnemyPool.Add(__instance); } } [HarmonyPatch("OnDestroy")] [HarmonyPrefix] internal static void OnDestroy_Prefix(EnemyType __instance) { if (Enable_OnDestroy_Prefix) { object[] obj = new object[4] { ((Object)__instance).name, ((Object)__instance).name, null, null }; GameObject enemyPrefab = __instance.enemyPrefab; obj[2] = ((enemyPrefab != null) ? ((Object)enemyPrefab).name : null) ?? "no prefab"; obj[3] = ((object)__instance).GetHashCode(); LCVPlugin.Debug(string.Format("EnemyType::OnDestroy (Postfix) | enemy: {0} | gameObject: {1} | prefab: {2} | hash: {3}", obj)); EnemyPool.Remove(__instance); } } } [HarmonyPatch(typeof(GrabbableObject))] public static class GrabbableObjectPatch { [HarmonyPatch("Start")] [HarmonyPostfix] [HarmonyPriority(100)] private static void Start_Postfix(GrabbableObject __instance) { LCVPlugin.Debug("GrabbableObject::Start [Postfix] | name: " + ((Object)__instance).name); ScrapModifier.UpdateGrabbableObjectValue(__instance); } } [HarmonyPatch(typeof(HangarShipDoor))] public static class HangarShipDoorPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start_Postfix(HangarShipDoor __instance) { LCVPlugin.Debug("HangarShipDoor::Start [Postfix]"); ShipDoorPower.AdjustPower(__instance); } } [HarmonyPatch(typeof(HUDManager))] public static class HUDManagerPatch { [HarmonyPatch("ApplyPenalty")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> ApplyPenalty_Transpiler(IEnumerable<CodeInstruction> instructions) { ILCode iLCode = new ILCode(instructions); iLCode.Remove(0, 2); iLCode.InsertBefore(0, (Delegate)new Func<float>(DeathPenalty.GetPenalty)); return iLCode; } [HarmonyPatch("SetPlayerLevel")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> SetPlayerLevel_Transpiler(IEnumerable<CodeInstruction> instructions) { ILCode iLCode = new ILCode(instructions); if (iLCode.Find(OpCodes.Mul).Find(OpCodes.Stloc_0).FoundIndex(out var index)) { LCVPlugin.Warn_ModifiedILIndex(index, 57, "SetPlayerLevel_Transpiler", 32); iLCode.InsertBefore(index + 1, (Delegate)new Func<int, int>(ExperienceMultiplier.MultiplyExperience)); } else { LCVPlugin.Error("[HUDManager:SetPlayerLevel (Transpiler)] failed to inject [ExperienceMultiplier:MultiplyExperience]"); } return iLCode; } [HarmonyPatch("SetClockVisible")] [HarmonyPrefix] private static void SetClockVisible_Prefix(HUDManager __instance, ref bool visible) { if (ClockDisplay.AlwaysDisplayClock.Get<bool>()) { visible = true; } } } [HarmonyPatch(typeof(Item))] public static class ItemPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] internal static void Awake_Postfix(Item __instance) { GameItem.Assign(__instance); } } [Initiate(InitiateAttribute.InitOrder.Cache)] public static class OnSynchronizePatch { static OnSynchronizePatch() { IOSEvents.Synchronize.AddListener((CEventHandler<CEventSynchronize>)GlobalSync); } private static void GlobalSync(CEventSynchronize @event) { if (@event.IsReceiver) { if (NetSynchronizer.IsServer) { LCVPlugin.Debug("[Synchronization] Ignoring synchronization request from clients"); return; } LCVPlugin.Debug("Synchronization with host in progress"); LCVPlugin.SafeApply(EnemyPool.NotifyPool, "GlobalSync", 33); LCVPlugin.SafeApply(AllowItemGrabbing.ApplyConfig, "GlobalSync", 34); LCVPlugin.SafeApply(LevelScrapAmountRange.ApplyConfig, "GlobalSync", 35); LCVPlugin.SafeApply(LevelFactorySize.ApplyConfig, "GlobalSync", 36); LCVPlugin.SafeApply(LevelRiskInformation.ApplyConfig, "GlobalSync", 37); LCVPlugin.SafeApply(LevelMoldIterations.ApplyConfig, "GlobalSync", 38); LCVPlugin.SafeApply(LevelPower.ApplyConfig, "GlobalSync", 39); LCVPlugin.SafeApply(EnemyCapacity.ApplyConfig, "GlobalSync", 40); LCVPlugin.SafeApply(EnemyPower.ApplyConfig, "GlobalSync", 41); LCVPlugin.SafeApply(MoonRoutePrice.ApplyConfig, "GlobalSync", 42); LCVPlugin.SafeApply(ItemWeights.ApplyConfig, "GlobalSync", 43); LCVPlugin.SafeApply(ItemShopPrice.ApplyConfig, "GlobalSync", 44); LCVPlugin.SafeApply(ItemScrapWorth.ApplyConfig, "GlobalSync", 45); LCVPlugin.SafeApply(ItemBattery.ApplyConfig, "GlobalSync", 46); LCVPlugin.Debug("Synchronization with host completed"); } } } [HarmonyPatch(typeof(PlayerControllerB))] public static class PlayerControllerBPatch { [HarmonyPatch("ConnectClientToPlayerObject")] [HarmonyPostfix] private static void ConnectClientToPlayerObject_Postfix(PlayerControllerB __instance) { LCVPlugin.Debug("Player name: " + __instance.playerUsername); LCVPlugin.Debug($"Player speed: {__instance.movementSpeed}"); LCVPlugin.Debug($"Player health: {__instance.health}"); LCVPlugin.Debug($"Player jump: {__instance.jumpForce}"); LCVPlugin.Debug($"Player sprint: {__instance.sprintMeter}/{__instance.sprintTime}"); PlayerSettings.Init(__instance); } [HarmonyPatch("DamagePlayer")] [HarmonyPrefix] private static void DamagePlayer_Prefix(PlayerControllerB __instance, ref int damageNumber, bool hasDamageSFX, bool callRPC, CauseOfDeath causeOfDeath, int deathAnimation, bool fallDamage, Vector3 force) { damageNumber = PlayerSettings.ReduceDamage(damageNumber); } [HarmonyPatch("DamagePlayer")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> DamagePlayer_Transpiler(IEnumerable<CodeInstruction> instructions) { ILCode iLCode = new ILCode(instructions); if (iLCode.Find(OpCodes.Ldc_I4_S, 100).FoundIndex(out var index)) { LCVPlugin.Warn_ModifiedILIndex(index, 34, "DamagePlayer_Transpiler", 48); iLCode.Remove(index); iLCode.InsertBefore(index, (Delegate)new Func<int>(PlayerSettings.MaxHealth)); } else { LCVPlugin.Error("Unable to inject [PlayerControllerB:ModifyDaytimeSpawns] in [PlayerControllerB:DamagePlayer]"); } return iLCode; } } [HarmonyPatch(typeof(QuotaSettings))] public static class QuotaSettingsPatch { [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] private static void Constructor_Postfix(QuotaSettings __instance) { LCVPlugin.Debug($"QuotaSettings::Constructor (Prefix) | hash: {((object)__instance).GetHashCode()}"); GameQuota.Assign(__instance); } } [HarmonyPatch(typeof(RoundManager))] public static class RoundManagerPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void Awake_Postfix(RoundManager __instance) { LCVPlugin.Debug("RoundManager::Awake (Postfix) " + (NetSynchronizer.IsServer ? "as host" : "as client")); if (!NetSynchronizer.IsServer) { LCVPlugin.Debug("[Synchronization] Waiting for synchronization to apply configurations"); return; } LCVPlugin.SafeApply(EnemyPool.NotifyPool, "Awake_Postfix", 41); LCVPlugin.SafeApply(AllowItemGrabbing.ApplyConfig, "Awake_Postfix", 42); LCVPlugin.SafeApply(LevelScrapAmountRange.ApplyConfig, "Awake_Postfix", 43); LCVPlugin.SafeApply(LevelFactorySize.ApplyConfig, "Awake_Postfix", 44); LCVPlugin.SafeApply(LevelRiskInformation.ApplyConfig, "Awake_Postfix", 45); LCVPlugin.SafeApply(LevelMoldIterations.ApplyConfig, "Awake_Postfix", 46); LCVPlugin.SafeApply(LevelPower.ApplyConfig, "Awake_Postfix", 47); LCVPlugin.SafeApply(EnemyCapacity.ApplyConfig, "Awake_Postfix", 48); LCVPlugin.SafeApply(EnemyPower.ApplyConfig, "Awake_Postfix", 49); LCVPlugin.SafeApply(MoonRoutePrice.ApplyConfig, "Awake_Postfix", 50); LCVPlugin.SafeApply(ItemWeights.ApplyConfig, "Awake_Postfix", 51); LCVPlugin.SafeApply(ItemShopPrice.ApplyConfig, "Awake_Postfix", 52); LCVPlugin.SafeApply(ItemScrapWorth.ApplyConfig, "Awake_Postfix", 53); LCVPlugin.SafeApply(ItemBattery.ApplyConfig, "Awake_Postfix", 54); } [HarmonyPatch("Start")] [HarmonyPriority(90)] [HarmonyPostfix] private static void Start_Postfix(RoundManager __instance) { LCVPlugin.Debug("RoundManager::Start (Postfix)"); ((MonoBehaviour)__instance).StartCoroutine(LevelItems.ApplyConfig()); ((MonoBehaviour)__instance).StartCoroutine(LevelEnemies.ApplyConfig()); } [HarmonyPatch("RefreshEnemiesList")] [HarmonyPostfix] private static void RefreshEnemiesList_Postfix() { LCVPlugin.Debug("RoundManager::RefreshEnemiesList (Postfix)"); GlobalEnemyStartingCount.ResetVariables(); } [HarmonyPatch("SpawnDaytimeEnemiesOutside")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> SpawnDaytimeEnemiesOutside_Transpiler(IEnumerable<CodeInstruction> instructions) { ILCode iLCode = new ILCode(instructions); if (iLCode.Find(OpCodes.Stloc_2).FoundIndex(out var index)) { LCVPlugin.Warn_ModifiedILIndex(index, 55, "SpawnDaytimeEnemiesOutside_Transpiler", 103); iLCode.InsertBefore(index + 1, (Delegate)new Func<int, int>(GlobalSpawnModificator.ModifyDaytimeSpawns)); } else { LCVPlugin.Error("Unable to inject [GlobalSpawnModificator:ModifyDaytimeSpawns] in [RoundManager:SpawnDaytimeEnemiesOutside]"); } return iLCode; } [HarmonyPatch("PlotOutEnemiesForNextHour")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> PlotOutEnemiesForNextHour_Transpiler(IEnumerable<CodeInstruction> instructions) { ILCode iLCode = new ILCode(instructions); if (iLCode.Find(OpCodes.Stloc_3).FoundIndex(out var index)) { LCVPlugin.Warn_ModifiedILIndex(index, 83, "PlotOutEnemiesForNextHour_Transpiler", 158); iLCode.InsertBefore(index + 1, (Delegate)new Func<int, int>(GlobalSpawnModificator.ModifyInsideSpawns)); } else { LCVPlugin.Error("Unable to inject [GlobalSpawnModificator:ModifyDaytimeSpawns] in [RoundManager:SpawnDaytimeEnemiesOutside]"); } return iLCode; } [HarmonyPatch("SpawnEnemiesOutside")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> SpawnEnemiesOutside_Transpiler(IEnumerable<CodeInstruction> instructions) { ILCode iLCode = new ILCode(instructions); if (iLCode.Find(OpCodes.Stloc_3).FoundIndex(out var index)) { LCVPlugin.Warn_ModifiedILIndex(index, 65, "SpawnEnemiesOutside_Transpiler", 185); iLCode.InsertBefore(index + 1, (Delegate)new Func<int, int>(GlobalSpawnModificator.ModifyOutsideSpawns)); } else { LCVPlugin.Error("Unable to inject [GlobalSpawnModificator::ModifyOutsideSpawns] in method [RoundManager::SpawnEnemiesOutside]"); } return iLCode; } [HarmonyPatch("SpawnMapObjects")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> SpawnMapObjects_Transpiler(IEnumerable<CodeInstruction> instructions) { ILCode iLCode = new ILCode(instructions); if (iLCode.Find(OpCodes.Conv_I4).Find(OpCodes.Stloc_S, 4, 0).FoundIndex(out var index)) { LCVPlugin.Warn_ModifiedILIndex(index, 41, "SpawnMapObjects_Transpiler", 212); iLCode.InsertAfter(index, (Delegate)new Func<RoundManager, int, int, int>(ModifyMapSpawnables.ApplyModifications)); } else { LCVPlugin.Error("[RoundManager:SpawnMapObjects (Transpiler)] unable to insert [ModifyMapSpawnables:ApplyModifications]"); } return iLCode; } [HarmonyPatch("PredictAllOutsideEnemies")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> PredictAllOutsideEnemies_Transpiler(IEnumerable<CodeInstruction> instructions) { ILCode iLCode = new ILCode(instructions); if (iLCode.Find(OpCodes.Ldc_I4_3).FoundIndex(out var index)) { LCVPlugin.Warn_ModifiedILIndex(index, 60, "PredictAllOutsideEnemies_Transpiler", 229); iLCode.Remove(index); iLCode.InsertBefore(index, (Delegate)new Func<int>(GetMaxDeadlineDays)); } else { LCVPlugin.Error("[RoundManager:PredictAllOutsideEnemies (Transpiler)] unable to insert [Patch:GetMaxDeadlineDays #0]"); } if (iLCode.Find(OpCodes.Ldc_R4, "3").FoundIndex(out index)) { LCVPlugin.Warn_ModifiedILIndex(index, 70, "PredictAllOutsideEnemies_Transpiler", 238); iLCode.Remove(index); iLCode.InsertBefore(index, (Delegate)new Func<float>(GetMaxDeadlineDaysFloat)); } else { LCVPlugin.Error("[RoundManager:PredictAllOutsideEnemies (Transpiler)] unable to insert [Patch:GetMaxDeadlineDays #1]"); } if (iLCode.Find(OpCodes.Ldc_R4, "3").FoundIndex(out index)) { LCVPlugin.Warn_ModifiedILIndex(index, 74, "PredictAllOutsideEnemies_Transpiler", 247); iLCode.Remove(index); iLCode.InsertBefore(index, (Delegate)new Func<float>(GetMaxDeadlineDaysFloat)); } else { LCVPlugin.Error("[RoundManager:PredictAllOutsideEnemies (Transpiler)] unable to insert [Patch:GetMaxDeadlineDays #2]"); } return iLCode; } [HarmonyPatch("SpawnScrapInLevel")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> SpawnScrapInLevel_Transpiler(IEnumerable<CodeInstruction> instructions) { ILCode iLCode = new ILCode(instructions); if (iLCode.Find(OpCodes.Ldfld, "System.Single scrapAmountMultiplier").Find(OpCodes.Mul).FoundIndex(out var index)) { LCVPlugin.Warn_ModifiedILIndex(index, 14, "SpawnScrapInLevel_Transpiler", 265); iLCode.InsertAfter(index, (Delegate)new Func<float, float>(ScrapModifier.UpdateScrapAmount)); } else { LCVPlugin.Error("[RoundManager:SpawnScrapInLevel (Transpiler)] unable to insert [ScrapModifier:UpdateScrapAmount]"); } if (iLCode.Find(OpCodes.Ldfld, "System.Single scrapValueMultiplier").Find(OpCodes.Mul).FoundIndex(out index)) { LCVPlugin.Warn_ModifiedILIndex(index, 426, "SpawnScrapInLevel_Transpiler", 273); iLCode.InsertAfter(index, (Delegate)new Func<float, float>(ScrapModifier.UpdateScrapValue)); } else { LCVPlugin.Error("[RoundManager:SpawnScrapInLevel (Transpiler)] unable to insert [ScrapModifier:UpdateScrapValue#1]"); } if (iLCode.Find(index).Find(OpCodes.Ldfld, "System.Single scrapValueMultiplier").Find(OpCodes.Mul) .FoundIndex(out index)) { LCVPlugin.Warn_ModifiedILIndex(index, 455, "SpawnScrapInLevel_Transpiler", 281); iLCode.InsertAfter(index, (Delegate)new Func<float, float>(ScrapModifier.UpdateScrapValue)); } else { LCVPlugin.Error("[RoundManager:SpawnScrapInLevel (Transpiler)] unable to insert [ScrapModifier:UpdateScrapValue#2]"); } return iLCode; } [HarmonyPatch("RefreshEnemyVents")] [HarmonyPrefix] private static void RefreshEnemyVents_Prefix() { VentDuplicator.DuplicateVents(); } private static void GenerateNewFloor_Postfix(RoundManager __instance) { //IL_0102: Unknown result type (might be due to invalid IL or missing references) LCVPlugin.Debug($"Generation >>>>>>>> seed: {__instance.dungeonGenerator.Generator.Seed}"); LCVPlugin.Debug($"Generation >>>>>>>> choosen seed: {__instance.dungeonGenerator.Generator.ChosenSeed}"); LCVPlugin.Debug($"Generation >>>>>>>> random seed: {__instance.dungeonGenerator.Generator.ShouldRandomizeSeed}"); LCVPlugin.Debug($"Generation >>>>>>>> length: {__instance.dungeonGenerator.Generator.LengthMultiplier}"); LCVPlugin.Debug($"Generation >>>>>>>> factory size multiplier: {__instance.currentLevel.factorySizeMultiplier}"); LCVPlugin.Debug($"Generation >>>>>>>> map size multiplier: {__instance.mapSizeMultiplier}"); LCVPlugin.Debug("Generation >>>>>>>> flow: " + ((Object)__instance.dungeonGenerator.Generator.DungeonFlow).name); LCVPlugin.Debug($"Generation >>>>>>>> bounds: {__instance.dungeonGenerator.Generator.CurrentDungeon.Bounds}"); } private static int GetMaxDeadlineDays() { return TimeOfDay.Instance.quotaVariables.deadlineDaysAmount; } private static float GetMaxDeadlineDaysFloat() { return TimeOfDay.Instance.quotaVariables.deadlineDaysAmount; } } [HarmonyPatch(typeof(SelectableLevel))] public static class SelectableLevelPatch { public static bool Enable_Awake_Postfix = true; [HarmonyPatch("Awake")] [HarmonyPostfix] [HarmonyPriority(800)] private static void Awake_Postfix(SelectableLevel __instance) { if (!Enable_Awake_Postfix) { return; } LCVPlugin.Debug($"SelectableLevel::Awake (Postfix) | {__instance.PlanetName} | {((Object)__instance).name} | {((object)__instance).GetHashCode()}"); if (!((Object)__instance).name.Equals("TestAllEnemies")) { if (string.IsNullOrEmpty(__instance.PlanetName)) { LCVPlugin.Error($"Unable to cache moon without planet name {__instance.planetPrefab}"); } else { LCVPlugin.Debug($"GameLevel [{GameLevelList.Levels.Count + 1}]: {GameLevel.Assign(__instance).InternalName}"); } } } } [HarmonyPatch(typeof(StartOfRound))] public static class StartOfRoundPatch { public static bool Enable_Awake_Postfix = true; [HarmonyPatch("Awake")] [HarmonyPostfix] private static void Awake_Postfix(StartOfRound __instance) { if (Enable_Awake_Postfix) { LCVPlugin.Debug("StartOfRound::Awake (Postfix)"); ShipItemLimit.ModifyLimit(__instance); } } [HarmonyPatch("StartGame")] [HarmonyPostfix] private static void StartGame_Prefix(StartOfRound __instance) { LCVPlugin.Debug("StartOfRound::StartGame [Postfix]"); DaytimeSpeed.WhenLevelLoad(); } [HarmonyPatch("SetMapScreenInfoToCurrentLevel")] [HarmonyPostfix] private static void SetMapScreenInfoToCurrentLevel_Postfix(StartOfRound __instance) { HideWeather.ModifyPlanetInfo(__instance); } [HarmonyPatch("OnShipLandedMiscEvents")] [HarmonyPostfix] private static void OnShipLandedMiscEvents_Postfix(StartOfRound __instance) { LCVPlugin.Debug("StartOfRound::OnShipLandedMiscEvents [Postfix]"); DaytimeSpeed.WhenShipLand(); } [HarmonyPatch("ShipHasLeft")] [HarmonyPostfix] private static void ShipHasLeft_Postfix(StartOfRound __instance) { LCVPlugin.Debug("StartOfRound::ShipHasLeft [Postfix]"); DaytimeSpeed.WhenShipLeave(); } [HarmonyPatch("SetPlanetsWeather")] [HarmonyPriority(100)] [HarmonyPrefix] private static bool SetPlanetsWeather_Prefix(StartOfRound __instance, int connectedPlayersOnServer) { GameSeed.ModifyGameplaySeed(__instance, ref __instance.randomMapSeed); LCVPlugin.Debug($"StartOfRound::SetPlanetsWeather [Prefix] (seed: {__instance.randomMapSeed})"); return WeatherChances.ModifyWeather(__instance, connectedPlayersOnServer); } [HarmonyPatch("ReviveDeadPlayers")] [HarmonyPostfix] private static void ReviveDeadPlayers_Postfix(StartOfRound __instance) { LCVPlugin.Debug("StartOfRound::ReviveDeadPlayers [Postfix]"); for (int i = 0; i < __instance.allPlayerScripts.Length; i++) { PlayerSettings.Revive(__instance.allPlayerScripts[i]); } PlayerSettings.Revive(GameNetworkManager.Instance.localPlayerController); } [HarmonyPatch("ChooseNewRandomMapSeed")] [HarmonyPostfix] private static void ChooseNewRandomMapSeed_Postfix(StartOfRound __instance) { LCVPlugin.Debug("StartOfRound::ChooseNewRandomMapSeed [Postfix]"); GameSeed.ModifyGameplaySeed(__instance, ref __instance.randomMapSeed); } } [HarmonyPatch(typeof(TerminalNode))] public static class TerminalNodePatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void Awake_Postfix(TerminalNode __instance) { if (__instance.displayPlanetInfo > 0) { LCVPlugin.Debug($"Found route node {((Object)__instance).name} (levelID: {__instance.displayPlanetInfo} | cost: {__instance.itemCost})"); MoonRoutePrice.BindRouteNode(__instance); } else if (__instance.buyRerouteToMoon > 0) { LCVPlugin.Debug($"Found confirm node {((Object)__instance).name} (levelID: {__instance.buyRerouteToMoon} | cost: {__instance.itemCost})"); MoonRoutePrice.BindConfirmNode(__instance); } } } [HarmonyPatch(typeof(Terminal))] public static class TerminalPatch { [HarmonyPatch("TextPostProcess")] [HarmonyPrefix] private static void TextPostProcess_Patch(Terminal __instance, ref string modifiedDisplayText, ref TerminalNode node) { HideWeather.ModifyTerminal(__instance, ref modifiedDisplayText, ref node); } [HarmonyPatch("LoadNewNode")] [HarmonyPrefix] private static void LoadNewNode_Prefix(Terminal __instance, TerminalNode node) { LCVPlugin.Debug($"LOADED TERMINAL NODE ({((Object)node).name}[{((object)node).GetHashCode()}]) [LoadNewNode]:\n" + $"buyRerouteToMoon: {node.buyRerouteToMoon}\n" + $"buyItemIndex: {node.buyItemIndex}\n" + $"buyUnlockable: {node.buyUnlockable}\n" + $"buyVehicleIndex: {node.buyVehicleIndex}\n" + $"displayPlanetInfo: {node.displayPlanetInfo}\n" + $"creatureFileID: {node.creatureFileID}\n" + $"acceptAnything: {node.acceptAnything}\n" + $"isConfirmationNode: {node.isConfirmationNode}\n" + $"itemCost: {node.itemCost}\n" + $"returnFromStorage: {node.returnFromStorage}\n" + $"shipUnlockableID: {node.shipUnlockableID}\n" + $"storyLogFileID: {node.storyLogFileID}\n" + "=========== TEXT START ===========\n" + node.displayText + "============ TEXT END ============\n"); } [HarmonyPatch("ParsePlayerSentence")] [HarmonyPostfix] [HarmonyPriority(10)] private static void ParsePlayerSentence_Postfix(TerminalNode __result) { if (__result.buyRerouteToMoon == -2 && __result.displayPlanetInfo >= 0) { MoonRoutePrice.ValidateRouteNode(__result); } if (__result.buyRerouteToMoon >= 0) { MoonRoutePrice.ValidateConfirmNode(__result); } } } [HarmonyPatch(typeof(TimeOfDay))] public static class TimeOfDayPatch { [HarmonyPatch("SetNewProfitQuota")] [HarmonyPostfix] private static void SetNewProfitQuota_Postfix(TimeOfDay __instance) { LCVPlugin.Debug("TimeOfDay::SetNewProfitQuota (Postfix)"); QuotaConfig.Apply(); } [HarmonyPatch("SetNewProfitQuota")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> SetNewProfitQuota_Transpiler(IEnumerable<CodeInstruction> instructions) { ILCode iLCode = new ILCode(instructions); if (iLCode.Find(OpCodes.Stloc_2).FoundIndex(out var index)) { LCVPlugin.Warn_ModifiedILIndex(index, 106, "SetNewProfitQuota_Transpiler", 29); iLCode.InsertAfter(index, (Delegate)new Func<int, int>(OvertimeBonusMultiplier.ModifyBonus)); } else { LCVPlugin.Error("Unable to inject [OvertimeBonusMultiplier:ModifyBonus] in [TimeOfDay:SetNewProfitQuota]"); } return iLCode; } [HarmonyPatch("Awake")] [HarmonyPostfix] private static void Awake_Postfix(TimeOfDay __instance) { LCVPlugin.Debug("TimeOfDay::Awake (Postfix)"); QuotaConfig.Apply(); DaytimeSpeed.SetInstance(__instance); } } } namespace LCV.Module { [Initiate(InitiateAttribute.InitOrder.Module)] public static class AllowItemGrabbing { public static CBind<bool> AllowItemPickup = CBind<bool>.op_Implicit(new CConfigBuilder { ID = "lcv_config_extra-item-grabbing", Name = "Allow item pickup before game", Tooltip = "If you set this to true, you will be able to pickup any item in the ship before the game starts", Value = false, BCategory = BuildCategory.op_Implicit(LCVConfig.Categories.Extras_Ship), Synchronized = false }); public static void ApplyConfig() { foreach (GameItem item in GameItemList.Items) { if (item.Assigned) { LCVPlugin.Debug($"Item grabbable {item.InternalName} {item.Item.canBeGrabbedBeforeGameStart} = {AllowItemPickup.Value}"); item.Item.canBeGrabbedBeforeGameStart = CBind<bool>.op_Implicit(AllowItemPickup); } } } } [Initiate(InitiateAttribute.InitOrder.Module)] public static class ClockDisplay { public static CConfig AlwaysDisplayClock = InstanceBuilder<CConfig>.op_Implicit((InstanceBuilder<CConfig>)new CConfigBuilder { ID = "lcv_config_extra-display-clock", Name = "Always display clock", Tooltip = "Makes the clock always be displayed", Value = false, BCategory = BuildCategory.op_Implicit(LCVConfig.Categories.Extras_Ship), Synchronized = true }); } [Initiate(InitiateAttribute.InitOrder.Module)] public static class DaytimeSpeed { public enum ElapseMode { FIXED, BALANCED, DISABLED } public static readonly CBind<ElapseMode> Mode; public static readonly CBind<float> Speed; private static TimeOfDay _timeInstance; private static float TimeSpeed; public static float ModifiedTimeScale; private static TimeOfDay TimeInstance { get { return _timeInstance; } set { if (!((Object)(object)_timeInstance == (Object)(object)value)) { _timeInstance = value; TimeSpeed = value.globalTimeSpeedMultiplier; } } } static DaytimeSpeed() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown CConfigBuilder val = new CConfigBuilder(); val.ID = "lcv_config_time-speed-mode"; val.Value = ElapseMode.BALANCED; val.CCategory = LCVConfig.Categories.Gameplay_GameSettings; val.Synchronized = true; val.Type = CTypes.EnumSinlgeOption<ElapseMode>(); val.Name = "Time speed mode"; val.Tooltips = new string[4] { "Modifies the algorithm used to calculate the moon's time", "", "BALANCED: Vanilla behavior, time starts when the level loads", "FIXED: Custom behavior, time starts when the ship finishes landing" }; Mode = CBind<ElapseMode>.op_Implicit(((InstanceBuilder<CConfig>)(object)val).Build()); val = new CConfigBuilder(); val.ID = "lcv_config_time-speed-val"; val.Value = 1f; val.Type = CTypes.DecimalNumberPositive(); val.CCategory = LCVConfig.Categories.Gameplay_GameSettings; val.Name = "Time speed"; val.Tooltips = new string[3] { "Modifies the speed (duration) of the day", "", "Higher values mean the day will elapse faster" }; val.Synchronized = true; Speed = CBind<float>.op_Implicit(((InstanceBuilder<CConfig>)(object)val).Build()); ConfigEvents.ConfigChangeSingle[Speed.Config].AddListener((CEventHandler<CEventChangeConfig>)OnSpeedReceive); } private static void OnSpeedReceive(CEventChangeConfig @event) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (@event.Success && (int)@event.Reason != 4 && (Object)(object)TimeInstance != (Object)null) { LCVPlugin.Debug($"Received new daytime speed value {@event.NewValue} [{@event.Reason}]"); ModifiedTimeScale = TimeSpeed * CBind<float>.op_Implicit(Speed); LCVPlugin.Debug($"Daytime speed base:{TimeSpeed} updated to ({TimeInstance.globalTimeSpeedMultiplier}) {ModifiedTimeScale}[{Speed.Value}] in mode {Mode.Value} {{{((object)TimeInstance).GetHashCode()}}}"); } } public static void SetInstance(TimeOfDay timeOfDay) { if ((Object)(object)TimeInstance != (Object)null) { TimeInstance.globalTimeSpeedMultiplier = TimeSpeed; } TimeInstance = timeOfDay; ModifiedTimeScale = TimeSpeed * CBind<float>.op_Implicit(Speed); LCVPlugin.Debug($"Daytime speed base:{TimeSpeed} updated to ({TimeInstance.globalTimeSpeedMultiplier}) {ModifiedTimeScale}[{Speed.Value}] in mode {Mode.Value} {{{((object)TimeInstance).GetHashCode()}}}"); } public static void WhenLevelLoad() { LCVPlugin.Debug($"When level load: {TimeInstance} {Mode.Value} - 0/{ModifiedTimeScale}"); if (!((Object)(object)TimeInstance == (Object)null)) { switch (Mode.Value) { case ElapseMode.FIXED: TimeInstance.globalTimeSpeedMultiplier = 0f; break; case ElapseMode.BALANCED: TimeInstance.globalTimeSpeedMultiplier = ModifiedTimeScale; break; } } } public static void WhenShipLand() { LCVPlugin.Debug($"When ship land: {TimeInstance} {Mode.Value} - 0/{ModifiedTimeScale}"); if (!((Object)(object)TimeInstance == (Object)null)) { if (Mode.Value != 0) { _ = 1; } else { TimeInstance.globalTimeSpeedMultiplier = ModifiedTimeScale; } } } public static void WhenShipLeave() { LCVPlugin.Debug($"When ship leaves: {TimeInstance} {Mode.Value} - 0/{ModifiedTimeScale}"); if (!((Object)(object)TimeInstance == (Object)null)) { if (Mode.Value != 0) { _ = 1; } else { TimeInstance.globalTimeSpeedMultiplier = 0f; } } } } [Initiate(InitiateAttribute.InitOrder.Module)] public static class DeathPenalty { public static readonly CBind<float> Penalty; static DeathPenalty() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown CConfigBuilder val = new CConfigBuilder(); val.ID = "lcv_config_death-penalty"; val.Synchronized = true; val.Name = "Death penalty percent"; val.Value = 20f; val.Type = CTypes.DecimalPercent(); val.CCategory = LCVConfig.Categories.Gameplay_GameSettings; val.Tooltips = new string[1] { "Modifies the percent of credits you lose for each dead player whose body is not recovered" }; Penalty = CBind<float>.op_Implicit(((InstanceBuilder<CConfig>)(object)val).Build()); CustomSeeds.Hardcore.Set(Penalty.Config, (object)30f); } [ILReturn(0, ILReturn.ReturnType.Variable)] public static float GetPenalty() { return (float)Math.Round(Penalty.Value, 2) / 100f; } } [Initiate(InitiateAttribute.InitOrder.Module)] public static class EnemyCapacity { [CompilerGenerated] private static class <>O { public static Randomize <0>__EnemyCapacityRandomizer; } public static readonly CCategory Category; private static readonly Dictionary<GameEnemy, CBind<int>> Configs; static EnemyCapacity() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_002f: 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_0046: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown Category = InstanceBuilder<CCategory>.op_Implicit((InstanceBuilder<CCategory>)new CCategoryBuilder { ID = "lcv_category_enemy-capacity", CPage = LCVConfig.Pages.Enemies, ColorRGB = (200, 80, 80), Name = "Capacity", HideIfEmpty = true }); Configs = new Dictionary<GameEnemy, CBind<int>>(); GameEnemy.OnDefine += new EventGameEnemyDefine(CreateEnemyConfig); GameEnemy.ForDefined(new EventGameEnemyDefine(CreateEnemyConfig)); } private static void CreateEnemyConfig(GameEnemy enemy) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown try { CConfigBuilder val = new CConfigBuilder(); val.ID = "lcv_config_cap-" + enemy.InternalName; val.CCategory = Category; val.Name = enemy.DisplayName; val.Value = enemy.MaxCount; val.Type = CTypes.WholeNumberPositive(); val.Tooltips = new string[3] { "Changes the maximum amount of '" + enemy.DisplayName + "' that can spawn", "", "This enemy spawns: " + (enemy.CanSpawn ? ("<color=#70d2d4>" + GameEnemySpawnTypeExtension.ToStringNatural(enemy.SpawnType)) : "<color=#d47070>Never") }; object obj = <>O.<0>__EnemyCapacityRandomizer; if (obj == null) { Randomize val2 = EnemyCapacityRandomizer; <>O.<0>__EnemyCapacityRandomizer = val2; obj = (object)val2; } val.Randomizer = CRandomizer.Create((Randomize)obj); CConfig val3 = ((InstanceBuilder<CConfig>)(object)val).Build(); CustomSeeds.Chill.Set(val3, (object)0); CustomSeeds.Cooljs.Set(val3, (object)(enemy.MaxCount * 5)); CustomSeeds.Hardcore.Set(val3, (object)(enemy.MaxCount * 5)); CustomSeeds.Challenge.Set(val3, (object)35); Configs[enemy] = CBind<int>.op_Implicit(val3); } catch (Exception ex) { LCVPlugin.Error("Unable to create capacity config for enemy " + enemy.InternalName + ": " + ex.Message); } } private static object EnemyCapacityRandomizer(RNGProvider provider, CConfig config, InfoProvider info) { if (info.UseDefault) { return config.Default; } int @default = config.GetDefault<int>(); return (int)Math.Clamp(provider.DistributionBiased(0.0, 15.0, (double)@default, 7.0), 0.0, 15.0); } public static void ApplyConfig() { foreach (KeyValuePair<GameEnemy, CBind<int>> config in Configs) { LCVPlugin.Debug($"Enemy capacity {config.Key.DisplayName}: [{config.Key.MaxCount} -> {config.Value.Value}]"); config.Key.MaxCount = CBind<int>.op_Implicit(config.Value); } } public static void RevertConfig() { foreach (KeyValuePair<GameEnemy, CBind<int>> config in Configs) { config.Key.MaxCount = config.Value.Default; } } } [Initiate(InitiateAttribute.InitOrder.Module)] public static class EnemyPower { [CompilerGenerated] private static class <>O { public static Randomize <0>__EnemyPowerRandomizer; } public static readonly CCategory Category; private static readonly Dictionary<GameEnemy, CBind<int>> Configs; static EnemyPower() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown Category = InstanceBuilder<CCategory>.op_Implicit((InstanceBuilder<CCategory>)new CCategoryBuilder { ID = "lcv_category_enemy-power", CPage = LCVConfig.Pages.Enemies, ColorRGB = (200, 150, 180), Name = "Enemy power", HideIfEmpty = true }); Configs = new Dictionary<GameEnemy, CBind<int>>(); GameEnemy.OnDefine += new EventGameEnemyDefine(CreateEnemyConfig); GameEnemy.ForDefined(new EventGameEnemyDefine(CreateEnemyConfig)); } private static void CreateEnemyConfig(GameEnemy enemy) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00d8: Expected O, but got Unknown try { Dictionary<GameEnemy, CBind<int>> configs = Configs; CConfigBuilder val = new CConfigBuilder(); val.ID = "lcv_config_power-" + enemy.InternalName; val.BCategory = BuildCategory.op_Implicit(Category); val.Name = enemy.DisplayName; val.Value = enemy.MaxPower; val.Type = CTypes.DecimalNumberPositive(); val.BTooltip = BuildTooltip.op_Implicit(new string[5] { "Changes the power of the enemy", "", "The power determines the 'slots' it uses upon spawning, the higher the power, the less enemies that could spawn", "", "This enemy spawns: " + (enemy.CanSpawn ? ("<color=#70d2d4>" + GameEnemySpawnTypeExtension.ToStringNatural(enemy.SpawnType)) : "<color=#d47070>Never") }); object obj = <>O.<0>__EnemyPowerRandomizer; if (obj == null) { Randomize val2 = EnemyPowerRandomizer; <>O.<0>__EnemyPowerRandomizer = val2; obj = (object)val2; } val.Randomizer = CRandomizer.Create((Randomize)obj); configs[enemy] = CBind<int>.op_Implicit(((InstanceBuilder<CConfig>)(object)val).Build()); } catch (Exception ex) { LCVPlugin.Error("Unable to create power config for enemy " + enemy.InternalName + ": " + ex.Message); } } private static object EnemyPowerRandomizer(RNGProvider provider, CConfig config, InfoProvider info) { if (info.UseDefault) { return config.Default; } float num = Math.Clamp(config.GetDefault<float>() - 3f, 0f, 8f); float num2 = Math.Clamp(config.GetDefault<float>() + 3f, 0f, 8f); return Math.Clamp(provider.DistributionBiased((double)num, (double)num2, (double)config.GetDefault<float>(), 7.0), 0.0, 8.0) + (double)((float)provider.Int(0, 4) * 0.25f); } public static void ApplyConfig() { foreach (KeyValuePair<GameEnemy, CBind<int>> config in Configs) { LCVPlugin.Debug($"Enemy power {config.Key.DisplayName}: [{config.Key.MaxPower} -> {config.Value.Value}]"); config.Key.MaxPower = CBind<int>.op_Implicit(config.Value); } } public static void RevertConfig() { foreach (KeyValuePair<GameEnemy, CBind<int>> config in Configs) { config.Key.MaxPower = config.Value.Default; } } } [Initiate(InitiateAttribute.InitOrder.Module)] public static class ExperienceMultiplier { public static readonly CBind<float> Config; [ILReturn(0, ILReturn.ReturnType.Variable)] public static int MultiplyExperience([ILParam(0, false, false, ILParam.ParamType.Variable)] int initial) { return (int)Math.Round((float)initial * Config.Value); } static ExperienceMultiplier() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown CConfigBuilder val = new CConfigBuilder(); val.ID = "lcv_config_xp-multi"; val.Name = "Experience multiplier"; val.Value = 1f; val.Synchronized = true; val.Tooltips = new string[3] { "Multiplies the amount of experience you gain or lose at the end of the day", "", "Keep in mind your experience will be multiplied if you fail and lose (skill issue)" }; val.CCategory = LCVConfig.Categories.Extras_Player; Config = CBind<float>.op_Implicit(((InstanceBuilder<CConfig>)(object)val).Build()); } } [Initiate(InitiateAttribute.InitOrder.Module)] public static class GameSeed { public static readonly CConfig Config; private static object RandomSeedProvider(RNGProvider rng, CConfig config, InfoProvider info) { object result = default(object); if (info.IsSpecialSeed && info.SpecialSeed.TryGet(config, ref result)) { return result; } if (info.UseDefault) { return config.Default; } return rng.Int(); } public static void ModifyGameplaySeed(StartOfRound sor, ref int currentSeed) { if (Config.Enabled) { Random random = new Random(Config.Get<int>(currentSeed)); int num = sor.gameStats.daysSpent + 1; for (int i = 0; i < num; i++) { random.Next(); } int num2 = random.Next(); LCVPlugin.Debug($"Gameplay seed set to {num2} with {num} iterations of {Config.Get<int>(currentSeed)}"); currentSeed = num2; } } static GameSeed() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown CConfigBuilder val = new CConfigBuilder(); val.ID = "lcv_config_game-seed"; val.Name = "Custom seed"; val.CCategory = LCVConfig.Categories.Gameplay_GameSettings; val.Enabled = false; val.DefaultValue = 0; val.Randomizer = CRandomizer.Create(new Randomize(RandomSeedProvider)); val.Tooltips = new string[4] { "Sets a predefined seed for the game", "", "When enabled, your game will become deterministic, all seeds will be generated according to this setting", "Keep in mind if you game has already started, some settings using previous seeds may change" }; val.Toggleable = true; val.Value = 0; val.Type = CTypes.WholeNumberPositive(); Config = InstanceBuilder<CConfig>.op_Implicit((InstanceBuilder<CConfig>)(object)val); } } [Initiate(InitiateAttribute.InitOrder.Module)] public static class GlobalEnemySpawnMultiplicator { public static readonly CBind<float> NormalMultiplicator; public static readonly CBind<float> PerPlayerMultiplicator; static GlobalEnemySpawnMultiplicator() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown CConfigBuilder val = new CConfigBuilder(); val.ID = "lcv_config_enemy-spawn-multi-n"; val.Value = 1f; val.Type = CTypes.DecimalNumberPositive(); val.CCategory = LCVConfig.Categories.GlobalEnemySpawn; val.Name = "Spawn multiplier"; val.Tooltips = new string[3] { "Multiplies the vanilla enemy spawns by the choosen value", "", "The value will still follow the other configuration rules and vanilla rules" }; NormalMultiplicator = CBind<float>.op_Implicit(((InstanceBuilder<CConfig>)(object)val).Build()); val = new CConfigBuilder(); val.ID = "lcv_config_enemy-spawn-multi-p"; val.Value = 1f; val.Type = CTypes.DecimalNumberPositive(); val.CCategory = LCVConfig.Categories.GlobalEnemySpawn; val.Name = "Spawn multiplier per player"; val.Tooltips = new string[3] { "For each extra player in the game, the spawns will be multiplied by this value", "", "This only works when there is more than one player in the lobby" }; PerPlayerMultiplicator = CBind<float>.op_Implicit(((InstanceBuilder<CConfig>)(object)val).Build()); CustomSeeds.Cooljs.Set(NormalMultiplicator.Config, (object)7f); } public static void MultiplySpawns(ref int initial) { initial = LCVMath.Calculate(LCVMath.MultiplyPerPlayer(GameNetworkManager.Instance?.connectedPlayers ?? 1, (float)initial * NormalMultiplicator.Value, PerPlayerMultiplicator.Value)); } } [Initiate(InitiateAttribute.InitOrder.Module)] public static class GlobalEnemySpawnRange { private static readonly CBind<(int min, int max)> BindInside; private static readonly CBind<(int min, int max)> BindOutside; private static readonly CBind<(int min, int max)> BindDaytime; private static object Randomizer(RNGProvider rng, CConfig config, InfoProvider info) { if (info.UseDefault) { return config.Default; } return (Math.Clamp(rng.DistributionBiased(0.0, 5.0, 0.0, 3.0), 0.0, 6.0), rng.Int(6, 14)); } public static void ClampSpawnsOutside(ref int amount) { (int, int) value = BindOutside.Value; int item = value.Item1; int item2 = value.Item2; amount = Math.Clamp(amount, item, item2); } public static void ClampSpawnsDaytime(ref int amount) { (int, int) value = BindDaytime.Value; int item = value.Item1; int item2 = value.Item2; amount = Math.Clamp(amount, item, item2); } public static void ClampSpawnsInside(ref int amount) { (int, int) value = BindInside.Value; int item = value.Item1; int item2 = value.Item2; amount = Math.Clamp(amount, item, item2); } static GlobalEnemySpawnRange() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown CConfigBuilder val = new CConfigBuilder(); val.ID = "lcv_config_enemy-spawn-range-i"; val.CCategory = LCVConfig.Categories.GlobalEnemySpawn; val.Name = "Enemy spawn range (Inside)"; val.Tooltips = new string[3] { "Clamps the enemy spawns to fit this minimum and maximum", "", "Vanilla rules are respected, if the game does not allow that many enemies, they will not spawn" }; val.Type = CustomCTypes.IntegerRange_0_Inf; val.Value = (0, 10); val.Randomizer = CRandomizer.Create(new Randomize(Randomizer)); BindInside = CBind<(int, int)>.op_Implicit(((InstanceBuilder<CConfig>)(object)val).Build()); val = new CConfigBuilder(); val.ID = "lcv_config_enemy-spawn-range-n"; val.CCategory = LCVConfig.Categories.GlobalEnemySpawn; val.Name = "Enemy spawn range (Night)"; val.Tooltips = new string[3] { "Clamps the enemy spawns to fit this minimum and maximum", "", "Vanilla rules are respected, if the game does not allow that many enemies, they will not spawn" }; val.Type = CustomCTypes.IntegerRange_0_Inf; val.Value = (0, 10); val.Randomizer = CRandomizer.Create(new Randomize(Randomizer)); BindOutside = CBind<(int, int)>.op_Implicit(((InstanceBuilder<CConfig>)(object)val).Build()); val = new CConfigBuilder(); val.ID = "lcv_config_enemy-spawn-range-d"; val.CCategory = LCVConfig.Categories.GlobalEnemySpawn; val.Name = "Enemy spawn range (Outside)"; val.Tooltips = new string[3] { "Clamps the enemy spawns to fit this minimum and maximum", "", "Vanilla rules are respected, if the game does not allow that many enemies, they will not spawn" }; val.Type = CustomCTypes.IntegerRange_0_Inf; val.Value = (0, 10); val.Randomizer = CRandomizer.Create(new Randomize(Randomizer)); BindDaytime = CBind<(int, int)>.op_Implicit(((InstanceBuilder<CConfig>)(object)val).Build()); } } [Initiate(InitiateAttribute.InitOrder.Module)] public static class GlobalEnemyStartingCount { public static readonly CBind<int> Outside; public static readonly CBind<int> Inside; public static bool FirstSpawnOutside { get; internal set; } public static bool FirstSpawnInside { get; internal set; } public static void ModifySpawnsOutside(ref int initial) { LCVPlugin.Debug($"GlobalEnemyStartingCount::ModifySpawnsOutside ({FirstSpawnOutside})"); if (FirstSpawnOutside) { initial += CBind<int>.op_Implicit(Outside); FirstSpawnOutside = false; } } public static void ModifySpawnsInside(ref int initial) { LCVPlugin.Debug($"GlobalEnemyStartingCount::ModifySpawnsInside ({FirstSpawnInside})"); if (FirstSpawnInside) { initial += CBind<int>.op_Implicit(Inside); FirstSpawnInside = false; } } public static void ResetVariables() { FirstSpawnInside = true; FirstSpawnOutside = true; } static GlobalEnemyStartingCount() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown CConfigBuilder val = new CConfigBuilder(); val.ID = "lcv_config_enemy-start-o"; val.Value = 0; val.Type = CTypes.WholeNumberPositive(); val.CCategory = LCVConfig.Categories.GlobalEnemySpawn; val.Name = "Starting enemies (Outside)"; val.Tooltips = new string[4] { "Tries to spawn this many enemies right when you land on a planet", "", "This value only modifies the amount of enemies when landing, not afterwards and the spawning follows the vanilla rules", "Starting enemies from eclipsed planets or other sources are not overriden" }; Outside = CBind<int>.op_Implicit(((InstanceBuilder<CConfig>)(object)val).Build()); val = new CConfigBuilder(); val.ID = "lcv_config_enemy-start-i"; val.Value = 0; val.Type = CTypes.WholeNumberPositive(); val.CCategory = LCVConfig.Categories.GlobalEnemySpawn; val.Name = "Starting enemies (Inside)"; val.Tooltips = new string[4] { "Tries to spawn this many enemies right when you land on a planet", "", "This value only modifies the amount of enemies when landing, not afterwards and the spawning follows the vanilla rules", "Starting enemies from eclipsed planets or other sources are not overriden" }; Inside = CBind<int>.op_Implicit(((InstanceBuilder<CConfig>)(object)val).Build()); FirstSpawnOutside = true; FirstSpawnInside = true; } } [Initiate(InitiateAttribute.InitOrder.Module)] public static class GlobalScrapValueNAmount { public static readonly CBind<float> ValueMultiplier = CBind<float>.op_Implicit(((InstanceBuilder<CConfig>)new CConfigBuilder { ID = "lcv_config_scrap-value-multiplier", Value = 1f, CCategory = PerLevelConfig.GlobalCategory, Name = "Scrap value multiplier", Tooltip = "Modify the value of the scrap globally on every level" }).Build()); public static readonly CBind<float> AmountMultiplier = CBind<float>.op_Implicit(((InstanceBuilder<CConfig>)new CConfigBuilder { ID = "lcv_config_scrap-amount-multiplier", Value = 1f, CCategory = PerLevelConfig.GlobalCategory, Name = "Scrap amount multiplier", Tooltip = "Modify the amount of the scrap globally on every level" }).Build()); } [Initiate(InitiateAttribute.InitOrder.Module)] public static class HideWeather { public const string WEATHER_KEYWORD = "Weather"; public const string WEATHER_STRING_PLACEHOLDER = "[planetTime]"; public const string WEATHER_STRING_UNKNOWN = "(Unknown)"; public static readonly CBind<bool> Enabled; static HideWeather() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown CConfigBuilder val = new CConfigBuilder(); val.ID = "lcv_config_hide-weather"; val.Value = false; val.Name = "Hide weather"; val.BTooltip = BuildTooltip.op_Implicit(new string[3] { "Hides the weather of the planets", "", "If enabled, all planets will have a \"Unknown\" weather mark" }); val.Synchronized = true; val.BCategory = BuildCategory.op_Implicit(LCVConfig.Categories.Gameplay_GameSettings); Enabled = CBind<bool>.op_Implicit(val); CustomSeeds.Hardcore.Set(Enabled.Config, (object)true); } public static void ModifyPlanetInfo(StartOfRound round) { if (CBind<bool>.op_Implicit(Enabled)) { string text = ((TMP_Text)round.screenLevelDescription).text; text = ((!text.Contains("Weather")) ? (text + "Weather: (Unknown)") : text.Replace(((object)(LevelWeatherType)(ref round.currentLevel.currentWeather)).ToString(), "(Unknown)")); ((TMP_Text)round.screenLevelDescription).text = text; } } public static void ModifyTerminal(Terminal terminal, ref string screenText, ref TerminalNode node) { if (CBind<bool>.op_Implicit(Enabled)) { screenText = screenText.Replace("[planetTime]", "(Unknown)"); } } } [Initiate(InitiateAttribute.InitOrder.Module)] public static class ItemBattery { private static readonly Dictionary<GameItem, CBind<float>> _battery; static ItemBattery() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown _battery = new Dictionary<GameItem, CBind<float>>(); GameItem.OnDefine += new EventGameItemDefine(CreateItemConfig); GameItem.ForDefined(new EventGameItemDefine(CreateItemConfig)); } private static void CreateItemConfig(GameItem item) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown if (item.Battery == -1f) { return; } try { CConfigBuilder val = new CConfigBuilder(); val.ID = "lcv_config_item-battery_" + item.InternalName; val.CCategory = LCVConfig.Categories.Items_Battery; val.Name = item.DisplayName; val.Value = item.Battery; val.Synchronized = true; val.Type = CTypes.DecimalNumberPositive(); val.Tooltips = new string[4] { "Changes the battery duration of '" + item.DisplayName + "' items", "", "Internally it does not modify the battery size but the consumption rate. The higher the value, the lower is the consumption", "This is a " + (item.TwoHanded ? "<color=#fcad03>two handed</color>" : "<color=#a9fc03>one handed</color>") + " item" }; val.Toggleable = true; val.Enabled = item.IsVanilla; CConfig val2 = ((InstanceBuilder<CConfig>)(object)val).Build(); _battery[item] = CBind<float>.op_Implicit(val2); } catch (Exception ex) { LCVPlugin.Error("Unable to create battery config for item " + item.InternalName + ": " + ex.Message); } } public static void ApplyConfig() { foreach (KeyValuePair<GameItem, CBind<float>> item in _battery) { if (item.Value.Active) { LCVPlugin.Debug($"Item battery {item.Key.DisplayName}: [{item.Key.Battery} -> {item.Value.Value}]"); item.Key.Battery = CBind<float>.op_Implicit(item.Value); } else { LCVPlugin.Debug($"Item battery {item.Key.DisplayName}: [{item.Key.Battery} -> {item.Key.Battery} (disabled)]"); } } } public static void RevertConfig() { foreach (KeyValuePair<GameItem, CBind<float>> item in _battery) { item.Key.Battery = item.Value.Default; } } } [Initiate(InitiateAttribute.InitOrder.Module)] public static class ItemConductivity { [CompilerGenerated] private static class <>O { public static Randomize <0>__ItemConductivityRandomizer; } private static readonly Dictionary<GameItem, CBind<bool>> _conductive; static ItemConductivity() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown _conductive = new Dictionary<GameItem, CBind<bool>>(); GameItem.OnDefine += new EventGameItemDefine(CreateItemConfig); GameItem.ForDefined(new EventGameItemDefine(CreateItemConfig)); } private static void CreateItemConfig(GameItem item) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_00cd: 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_00d8: Expected O, but got Unknown try { CConfigBuilder val = new CConfigBuilder(); val.ID = "lcv_config_item-metal_" + item.InternalName; val.CCategory = LCVConfig.Categories.Items_Conductive; val.Name = item.DisplayName; val.Value = item.IsMetal; val.Type = CTypes.Boolean(); val.Tooltips = new string[4] { "Changes the conductivity of the item '" + item.DisplayName + "'", "", "Conductive items will atract lighting", "This is a " + (item.TwoHanded ? "<color=#fcad03>two handed</color>" : "<color=#a9fc03>one handed</color>") + " item" }; val.Toggleable = true; val.Enabled = item.IsVanilla; object obj = <>O.<0>__ItemConductivityRandomizer; if (obj == null) { Randomize val2 = ItemConductivityRandomizer; <>O.<0>__ItemConductivityRandomizer = val2; obj = (object)val2; } val.Randomizer = CRandomizer.Create((Randomize)obj); CConfig val3 = ((InstanceBuilder<CConfig>)(object)val).Build(); _conductive[item] = CBind<bool>.op_Implicit(val3); } catch (Exception ex) { LCVPlugin.Error("Unable to create conductive config for item " + item.InternalName + ": " + ex.Message); } } private static object ItemConductivityRandomizer(RNGProvider provider, CConfig config, InfoProvider info) { if (info.UseDefault) { return config.Default; } return provider.Bool(60, 40); } public static void ApplyConfig() { foreach (KeyValuePair<GameItem, CBind<bool>> item in _conductive) { if (item.Value.Active) { LCVPlugin.Debug($"Item conductive {item.Key.DisplayName}: [{item.Key.Weight} -> {item.Value.Value}]"); item.Key.IsMetal = CBind<bool>.op_Implicit(item.Value); } else { LCVPlugin.Debug($"Item conductive {item.Key.DisplayName}: [{item.Key.Weight} -> {item.Key.Weight} (disabled)]"); } } } public static void RevertConfig() { foreach (KeyValuePair<GameItem, CBind<bool>> item in _conductive) { item.Key.IsMetal = item.Value.Default; } } } [Initiate(InitiateAttribute.InitOrder.Module)] public static class ItemScrapWorth { [CompilerGenerated] private static class <>O { public static Randomize <0>__ScrapValueRandomizer; } private static readonly Dictionary<GameItem, CBind<(int min, int max)>> _worth; static ItemScrapWorth() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown _worth = new Dictionary<GameItem, CBind<(int, int)>>(); GameItem.OnDefine += new EventGameItemDefine(CreateItemConfig); GameItem.ForDefined(new EventGameItemDefine(CreateItemConfig)); } private static void CreateItemConfig(GameItem item) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown if (!item.IsScrap) { return; } try { Dictionary<GameItem, CBind<(int min, int max)>> worth = _worth; CConfigBuilder val = new CConfigBuilder(); val.ID = "lcv_config_item-scrap-worth_" + item.InternalName; val.BCategory = BuildCategory.op_Implicit(LCVConfig.Categories.Items_Worth); val.Name = item.DisplayName; val.Value = valueToDisplay(item.ValueRange); val.Type = CTypes.WholeNumberRange(0L, 9000L); val.Tooltips = new string[5] { "Changes the value range of how worth are the '" + item.DisplayName + "' scraps that you can find in some moons", "", "This configuration does only affect scrap worth range, if an item can somehow be bought, it will not be affected", "You should consider that the left is the minimum value and the right is the maximum value", "This is a " + (item.TwoHanded ? "<color=#fcad03>two handed</color>" : "<color=#a9fc03>one handed</color>") + " item" }; val.Toggleable = true; val.Enabled = item.IsVanilla; object obj = <>O.<0>__ScrapValueRandomizer; if (obj == null) { Randomize val2 = ScrapValueRandomizer; <>O.<0>__ScrapValueRandomizer = val2; obj = (object)val2; } val.Randomizer = CRandomizer.Create((Randomize)obj); worth[item] = CBind<(int, int)>.op_Implicit(((InstanceBuilder<CConfig>)(object)val).Build()); } catch (Exception ex) { LCVPlugin.Error("Unable to create scrap value range config for item " + item.InternalName + ": " + ex.Message); } } private static object ScrapValueRandomizer(RNGProvider provider, CConfig config, InfoProvider info) { if (info.UseDefault) { return config.Default; } (int, int) @default = config.GetDefault<(int, int)>(); int item = @default.Item1; int item2 = @default.Item2; int num = (int)Math.Round((float)item * 0.75f); int num2 = (int)Math.Round((float)item * 1.25f); int num3 = (int)Math.Round((float)item2 * 0.75f); int num4 = (int)Math.Round((float)item2 * 1.25f); return (Math.Max(provider.Int(num, num2), 0), Math.Min(provider.Int(num3, num4), 1300)); } public static void ApplyConfig() { foreach (KeyValuePair<GameItem, CBind<(int, int)>> item in _worth) { if (item.Value.Active) { LCVPlugin.Debug($"Item worth {item.Key.DisplayName}: [({item.Key.ValueRange.Item1},{item.Key.ValueRange.Item2}) -> ({item.Value.Value.Item1},{item.Value.Value.Item2})]"); item.Key.ValueRange = displayToValue(item.Value.Value); } else { LCVPlugin.Debug($"Item worth {item.Key.DisplayName}: [({item.Key.ValueRange.Item1},{item.Key.ValueRange.Item2}) -> ({item.Key.ValueRange.Item1},{item.Key.ValueRange.Item2}) (disabled)]"); } } } public static void RevertConfig() { foreach (KeyValuePair<GameItem, CBind<(int, int)>> item in _worth) { item.Key.ValueRange = item.Value.Default; } } private static (int, int) valueToDisplay((int, int) value) { return ((int)Math.Round((float)value.Item1 * 0.4f), (int)Math.Round((float)value.Item2 * 0.4f)); } private static (int, int) displayToValue((int, int) value) { return ((int)Math.Round((float)value.Item1 / 0.4f), (int)Math.Round((float)value.Item2 / 0.4f)); } } [Initiate(InitiateAttribute.InitOrder.Module)] public static class ItemShopPrice { [CompilerGenerated] private static class <>O { public static Randomize <0>__ItemPriceRandomizer; } private static readonly Dictionary<GameItem, CBind<int>> _prices; static ItemShopPrice() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown _prices = new Dictionary<GameItem, CBind<int>>(); GameItem.OnDefine += new EventGameItemDefine(CreateItemConfig); GameItem.ForDefined(new EventGameItemDefine(CreateItemConfig)); } private static void CreateItemConfig(GameItem item) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown if (item.IsScrap) { return; } try { Dictionary<GameItem, CBind<int>> prices = _prices; CConfigBuilder val = new CConfigBuilder(); val.ID = "lcv_config_item-shop-price_" + item.InternalName; val.CCategory = LCVConfig.Categories.Items_Price; val.Name = item.DisplayName; val.Value = item.Value; val.Type = CTypes.WholeNumberPositive(); val.Synchronized = true; val.Tooltips = new string[4] { "Changes the cost to buy the item '" + item.DisplayName + "'", "", "This configuration does only affect shop price, scrap value it not affected", "This is a " + (item.TwoHanded ? "<color=#fcad03>two handed</color>" : "<color=#a9fc03>one handed</color>") + " item" }; val.Toggleable = true; val.Enabled = item.IsVanilla; object obj = <>O.<0>__ItemPriceRandomizer; if (obj == null) { Randomize val2 = ItemPriceRandomizer; <>O.<0>__ItemPriceRandomizer = val2; obj = (object)val2; } val.Randomizer = CRandomizer.Create((Randomize)obj); prices[item] = CBind<int>.op_Implicit(((InstanceBuilder<CConfig>)(object)val).Build()); } catch (Exception ex) { LCVPlugin.Error("Unable to create item shop price config for item " + item.InternalName + ": " + ex.Message); } } private static object ItemPriceRandomizer(RNGProvider provider, CConfig config, InfoProvider info) { if (info.UseDefault) { return config.Default; } int num = (provider.Bool(65, 35) ? 2 : 5); float num2 = (float)provider.Int(-10, 10) * provider.Float(1f, 4f) * (float)num; return Math.Clamp((int)((float)config.GetDefault<int>() + num2), 0, 1300); } public static void ApplyConfig() { foreach (KeyValuePair<GameItem, CBind<int>> price in _prices) { if (price.Value.Active) { LCVPlugin.Debug($"Item price {price.Key.DisplayName}: [{price.Key.Value} -> {price.Value.Value}]"); price.Key.Value = CBind<int>.op_Implicit(price.Value); } else { LCVPlugin.Debug($"Item price {price.Key.DisplayName}: [{price.Key.Value} -> {price.Key.Value} (disabled)]"); } } } public static void RevertConfig() { foreach (KeyValuePair<GameItem, CBind<int>> price in _prices) { price.Key.Value = price.Value.Default; } } } [Initiate(InitiateAttribute.InitOrder.Module)] public static class ItemWeights { private static readonly Dictionary<GameItem, CBind<float>> _weights; static ItemWeights() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown _weights = new Dictionary<GameItem, CBind<float>>(); GameItem.OnDefine += new EventGameItemDefine(CreateItemConfig); GameItem.ForDefined(new EventGameItemDefine(CreateItemConfig)); IOSEvents.Synchronize.AddListener((CEventHandler<CEventSynchronize>)OnSynchronize); } private static void OnSynchronize(CEventSynchronize @event) { if (!@event.IsSender) { ApplyConfig(); } } private static void CreateItemConfig(GameItem item) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown try { CConfigBuilder val = new CConfigBuilder(); val.ID = "lcv_config_item-weight_" + item.InternalName; val.CCategory = LCVConfig.Categories.Items_Weight; val.Name = item.DisplayName; val.Value = valueToDisplay(item.Weight); val.Type = CTypes.DecimalNumberPositive(); val.Synchronized = true; val.Tooltips = new string[5] { "Changes the weight of the item '" + item.DisplayName + "'", "", "This weight is directly represented in game rounding up the decimals", "Although rounded up, decimals still make an effect internally", "This is a " + (item.TwoHanded ? "<color=#fcad03>two handed</color>" : "<color=#a9fc03>one handed</color>") + " item" }; val.Toggleable = true; val.Enabled = item.IsVanilla; CConfig val2 = ((InstanceBuilder<CConfig>)(object)val).Build(); _weights[item] = CBind<float>.op_Implicit(val2); } catch (Exception ex) { LCVPlugin.Error("Unable to create weight config for item " + item.InternalName + ": " + ex.Message); } } public static void ApplyConfig() { foreach (KeyValuePair<GameItem, CBind<float>> weight in _weights) { if (weight.Value.Active) { LCVPlugin.Debug($"Item weight {weight.Key.DisplayName}: [{weight.Key.Weight} -> {weight.Value.Value}]"); weight.Key.Weight = displayToValue(CBind<float>.op_Implicit(weight.Value)); } else { LCVPlugin.Debug($"Item weight {weight.Key.DisplayName}: [{weight.Key.Weight} -> {weight.Key.Weight} (disabled)]"); } } } public static void RevertConfig() { foreach (KeyValuePair<GameItem, CBind<float>> weight in _weights) { weight.Key.Weight = weight.Value.Default; } } private static float valueToDisplay(float value) { return Convert.ToSingle((Convert.ToDecimal(value) - 1m) * 105m); } private static float displayToValue(float value) { return Convert.ToSingle(Convert.ToDecimal(value) / 105m + 1m); } } [Initiate(InitiateAttribute.InitOrder.Module)] public static class LandmineSpawn { public static readonly CBind<float> GlobalMultiplier; static LandmineSpawn() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown CConfigBuilder val = new CConfigBuilder(); val.ID = "lcv_config_landmine-spawn-global"; val.CSection = PerLevelConfig.GlobalSection_MapSpawnables; val.Value = 1f; val.Type = CTypes.DecimalNumberPositive(); val.Name = "Landmine spawn multiplier"; val.Tooltips = new string[3] { "Multiplies the amount of landmines in the level", "", "High values will force a minimum amount of landmines to always spawn" }; GlobalMultiplier = CBind<float>.op_Implicit(((InstanceBuilder<CConfig>)(object)val).Build()); CustomSeeds.Challenge.Set(GlobalMultiplier.Config, (object)8f); } public static void Apply(RoundManager _, ref int initial) { initial = (int)Math.Round(CBind<float>.op_Implicit(GlobalMultiplier) * (float)initial + Math.Max(0f, GlobalMultiplier.Value / 4f)); } } [Initiate(InitiateAttribute.InitOrder.Module)] public static class LevelEnemies { private static readonly CType Slider; private static readonly Dictionary<GameLevel, Dictionary<GameEnemy, CBind<int>>> Entries; private static readonly Dictionary<GameEnemy, CBind<float>> GlobalMultipliers; private static readonly Dictionary<SpawnableEnemyWithRarity, float> Originals; static LevelEnemies() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown Slider = CTypes.WholeSlider(0, 100); Entries = new Dictionary<GameLevel, Dictionary<GameEnemy, CBind<int>>>(); GlobalMultipliers = new Dictionary<GameEnemy, CBind<float>>(); Originals = new Dictionary<SpawnableEnemyWithRarity, float>(); GameEnemy.OnDefine += new EventGameEnemyDefine(AddEnemyToLevels); GameEnemy.OnDefine += new EventGameEnemyDefine(AddGlobalEnemy); GameEnemy.ForDefined(new EventGameEnemyDefine(AddEnemyToLevels)); GameEnemy.ForDefined(new EventGameEnemyDefine(AddGlobalEnemy)); GameLevel.OnDefine += new EventGameLevelDefine(AddEnemiesToLevel); GameLevel.ForDefined(new EventGameLevelDefine(AddEnemiesToLevel)); } private static void AddGlobalEnemy(GameEnemy enemy) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Dictionary<GameEnemy, CBind<float>> globalMultipliers = GlobalMultipliers; CConfigBuilder val = new CConfigBuilder(); val.ID = "lcv_conifg-global-esp-" + enemy.InternalName; val.CSection = PerLevelConfig.GlobalSection_EnemyProbabilities; val.Value = 1f; val.Name = enemy.DisplayName; val.Tooltips = new string[3] { "Modify the probability for this enemy to spawn", "", "This probability affects globally, the probability of the enemy in a planet will be multiplied by this value" }; globalMultipliers[enemy] = CBind<float>.op_Implicit(((InstanceBuilder<CConfig>)(object)val).Build()); } private static void AddEnemiesToLevel(GameLevel level) { foreach (GameEnemy enemy in GameEnemyList.Enemies) { AddEnemyToLevel(enemy, level); } } private static void AddEnemyToLevels(GameEnemy enemy) { foreach (GameLevel level in GameLevelList.Levels) { AddEnemyToLevel(enemy, level); } } private static void AddEnemyToLevel(GameEnemy enemy, GameLevel level) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown if (!level.Ignore) { if (!Entries.TryGetValue(level, out var value)) { value = new Dictionary<GameEnemy, CBind<int>>(); Entries.Add(level, value); } if (!value.ContainsKey(enemy)) { string text = (enemy.CanSpawn ? ("<color=#70d2d4>" + (enemy.SpawnFromWeed ? "On bushes" : GameEnemySpawnTypeExtension.ToStringNatural(enemy.SpawnType))) : "<color=#d47070>Never"); Dictionary<GameEnemy, CBind<int>> dictionary = value; CConfigBuilder val = new CConfigBuilder(); val.ID = "lcv_conifg-" + level.InternalName + "-esp-" + enemy.InternalName; val.CSection = PerLevelConfig.GetConfig(level).EnemiesSection; val.Value = level.EnemyRarity[enemy].GetValueOrDefault(); val.Type = Slider; val.Name = enemy.DisplayName; val.Toggleable = true; val.Enabled = level.EnemyRarity[enemy].HasValue; val.Tooltips = new string[6] { "Change the probability for the enemy to spawn", "", "If the option is disabled, the setting is ignored and vanilla settings are used", "By default, this setting will be disabled for enemies that LCV could not check", "", "This enemy spawns: " + text }; dictionary[enemy] = CBind<int>.op_Implicit(((InstanceBuilder<CConfig>)(object)val).Build()); CustomSeeds.Challenge.Set(value[enemy].Config, (object)50f); LCVPlugin.Debug("Adding [" + enemy.InternalName + "|" + enemy.DisplayName + "] to level [" + level.InternalName + "|" + level.PlanetName + "]"); } } } public static IEnumerator ApplyConfig() { foreach (GameLevel level in GameLevelList.Levels) { if (level.Ignore) { continue; } LCVPlugin.Debug("Updating enemy rarities of level " + level.PlanetName + " [" + level.InternalName + "]"); if (!Entries.TryGetValue(level, out var value)) { LCVPlugin.Debug("> End: Level entry was not found"); continue; } Dictionary<GameEnemy, byte> used = new Dictionary<GameEnemy, byte>(value.Count); foreach (KeyValuePair<GameEnemy, CBind<int>> item in value) { used[item.Key] = 0; } LCVPlugin.Debug("> Modifying inside enemies:"); foreach (SpawnableEnemyWithRarity enemy in level.Level.Enemies) { UpdateEnemyList(enemy, level, value, ref used); } LCVPlugin.Debug("> Modifying outside night enemies:"); foreach (SpawnableEnemyWithRarity outsideEnemy in level.Level.OutsideEnemies) { UpdateEnemyList(outsideEnemy, level, value, ref used); } LCVPlugin.Debug("> Modifying outside day enemies:"); foreach (SpawnableEnemyWithRarity daytimeEnemy in level.Level.DaytimeEnemies) { UpdateEnemyList(daytimeEnemy, level, value, ref used); } LCVPlugin.Debug("> Adding custom enemies:"); foreach (KeyValuePair<GameEnemy, CBind<int>> item2 in value) { if ((!used.TryGetValue(item2.Key, out var value2) || value2 <= 0) && CBind<int>.op_Implicit(item2.Value) > 0 && item2.Value.Active) { ((!item2.Key.EnemyType.isOutsideEnemy) ? level.Level.Enemies : (item2.Key.EnemyType.isDaytimeEnemy ? level.Level.DaytimeEnemies : level.Level.OutsideEnemies)).Add(new SpawnableEnemyWithRarity { enemyType = item2.Key.EnemyType, rarity = CBind<int>.op_Implicit(item2.Value) }); LCVPlugin.Debug(string.Format(">> {0} [nil -> {1}] (Inserted) ({2}) ({3})", item2.Key.InternalName, item2.Value.Value, item2.Key.EnemyType.isOutsideEnemy ? "Outside" : "Inside", item2.Key.EnemyType.isDaytimeEnemy ? "Daytime" : "Nighttime")); } } yield return null; } } private static void UpdateEnemyList(SpawnableEnemyWithRarity chance, GameLevel gameLevel, Dictionary<GameEnemy, CBind<int>> levelEntry, ref Dictionary<GameEnemy, byte> used) { if (chance == null || (Object)(object)chance.enemyType == (Object)null) { LCVPlugin.Error(string.Fo