Decompiled source of Astral v0.39.0
BepInEx/patchers/Astral/Astral.GenesisBootstrap.dll
Decompiled 2 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using Mono.Cecil; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyFileVersion("0.36.1.0")] [assembly: AssemblyVersion("0.36.1.0")] namespace Astral.GenesisBootstrap; public static class Loader { public static IEnumerable<string> TargetDLLs => new string[0]; public static void Patch(AssemblyDefinition unused) { } public static void Finish() { if (Directory.Exists(Paths.PluginPath) && Directory.GetFiles(Paths.PluginPath, "ModJoseGenesisTest.dll", SearchOption.AllDirectories).Length == 1) { string[] files = Directory.GetFiles(Paths.PluginPath, "Astral.GenesisBridge.dll", SearchOption.AllDirectories); if (files.Length != 1) { throw new InvalidOperationException("Astral 36A: expected one runtime Genesis bridge in BepInEx/plugins; install the complete package."); } Assembly assembly = Assembly.LoadFrom(files[0]); Type type = assembly.GetType("Astral.GenesisBridge.BridgeBootstrap", throwOnError: true); type.GetMethod("Finish", BindingFlags.Static | BindingFlags.Public).Invoke(null, null); } } }
BepInEx/plugins/Astral/Astral.GenesisBridge.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Logging; using CommonAPI.Systems; using HarmonyLib; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyFileVersion("0.36.5.0")] [assembly: AssemblyVersion("0.36.5.0")] namespace Astral.GenesisBridge; public static class AddVeinPatches { private static readonly FieldInfo PlanetField = AccessTools.Field(typeof(PlanetAlgorithm), "planet"); private static readonly FieldInfo TypesField = AccessTools.Field(typeof(PlanetAlgorithm), "veinVectorTypes"); private static readonly FieldInfo VectorsField = AccessTools.Field(typeof(PlanetAlgorithm), "veinVectors"); internal const int JoseVeinId = 21; internal const int JoseMineralId = 8250; internal const int AuroraVeinId = 22; internal const int AuroraMineralId = 8254; internal const int HorizonVeinId = 23; internal const int NeutronVeinId = 24; internal const sbyte VeinTypeCount = 29; internal static readonly Color32[] VeinColors = (Color32[])(object)new Color32[25] { Color32.op_Implicit(new Color(0.538f, 0.538f, 0.538f)), Color32.op_Implicit(new Color(0.288f, 0.587f, 0.858f)), Color32.op_Implicit(new Color(1f, 0.49f, 0.307f)), Color32.op_Implicit(new Color(0.214f, 0.745f, 0.531f)), Color32.op_Implicit(new Color(1f, 1f, 1f)), Color32.op_Implicit(new Color(0.483f, 0.461f, 0.444f)), Color32.op_Implicit(new Color(0.113f, 0.13f, 0.14f)), Color32.op_Implicit(new Color(0f, 0f, 0f)), Color32.op_Implicit(new Color(1f, 1f, 1f)), Color32.op_Implicit(new Color(0.489f, 0.601f, 0.745f)), Color32.op_Implicit(new Color(0.091f, 0.377f, 0.217f)), Color32.op_Implicit(new Color(0.538f, 0.613f, 0.078f)), Color32.op_Implicit(new Color(0.575f, 0.27f, 0.83f)), Color32.op_Implicit(new Color(0.571f, 0.708f, 0.647f)), Color32.op_Implicit(new Color(0.349f, 0.222f, 0.247f)), Color32.op_Implicit(new Color(0.538f, 0.538f, 0.538f)), Color32.op_Implicit(new Color(0.685f, 0.792f, 0f)), Color32.op_Implicit(new Color(0.113f, 0.13f, 0.14f)), Color32.op_Implicit(new Color(0.965f, 0.867f, 0.352f)), Color32.op_Implicit(new Color(0.941f, 0.941f, 0.941f)), Color32.op_Implicit(new Color(0.745f, 0.231f, 0.11f)), Color32.op_Implicit(new Color(0.6f, 0.88f, 1f)), Color32.op_Implicit(new Color(1f, 0.76f, 0.24f)), Color32.op_Implicit(new Color(0.9f, 0.15f, 0.18f)), Color32.op_Implicit(new Color(0.62f, 0.24f, 0.88f)) }; private static PlanetData Planet(PlanetAlgorithm a) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown return (PlanetData)PlanetField.GetValue(a); } private static EVeinType[] VectorTypes(PlanetAlgorithm a) { return (EVeinType[])TypesField.GetValue(a); } private static Vector3[] Vectors(PlanetAlgorithm a) { return (Vector3[])VectorsField.GetValue(a); } [HarmonyPatch(typeof(UISandboxMenu), "StaticLoad")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> UISandboxMenu_StaticLoad_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[4] { new CodeMatch((OpCode?)OpCodes.Ldloc_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(LDB), "veins"), (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldlen, (object)null, (string)null) }); val.Advance(1).SetInstructionAndAdvance(new CodeInstruction(OpCodes.Ldc_I4_S, (object)(sbyte)14)).SetInstructionAndAdvance(new CodeInstruction(OpCodes.Nop, (object)null)) .SetInstructionAndAdvance(new CodeInstruction(OpCodes.Nop, (object)null)) .SetInstructionAndAdvance(new CodeInstruction(OpCodes.Nop, (object)null)); return val.InstructionEnumeration(); } [HarmonyPatch(typeof(UISandboxMenu), "StaticLoad")] [HarmonyPostfix] public static void UISandboxMenu_StaticLoad_Postfix() { ((VeinProto[,])AccessTools.Field(typeof(UISandboxMenu), "veinProtos").GetValue(null))[1, 7] = ((ProtoSet<VeinProto>)(object)LDB.veins).Select(15); ((VeinProto[,])AccessTools.Field(typeof(UISandboxMenu), "veinProtos").GetValue(null))[1, 8] = ((ProtoSet<VeinProto>)(object)LDB.veins).Select(16); } [HarmonyPatch(typeof(PlanetAlgorithm), "GenerateVeins")] [HarmonyPatch(typeof(PlanetAlgorithm7), "GenerateVeins")] [HarmonyPatch(typeof(PlanetAlgorithm11), "GenerateVeins")] [HarmonyPatch(typeof(PlanetAlgorithm12), "GenerateVeins")] [HarmonyPatch(typeof(PlanetAlgorithm13), "GenerateVeins")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlanetAlgorithm_GenerateVeins_ResizeVeinList_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldc_I4_S, (object)(sbyte)15, (string)null), CodeMatchUtils.Bge }); val.SetOperandAndAdvance((object)(sbyte)25); return AddJoseDistribution(val.InstructionEnumeration()); } private static IEnumerable<CodeInstruction> AddJoseDistribution(IEnumerable<CodeInstruction> instructions) { //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); string[] array = new string[3] { "VeinSpot", "VeinCount", "VeinOpacity" }; List<CodeInstruction> list2 = new List<CodeInstruction>(); int index = -1; string[] array2 = array; foreach (string field in array2) { int num = list.FindIndex((CodeInstruction val3) => CodeInstructionExtensions.LoadsField(val3, AccessTools.Field(typeof(ThemeProto), field), false)); if (num < 0 || num + 5 >= list.Count || (list[num + 1].opcode != OpCodes.Brfalse_S && list[num + 1].opcode != OpCodes.Brfalse)) { throw new InvalidOperationException("JOSE: unexpected theme vein IL for " + field); } int num2 = list.FindIndex(num + 1, (CodeInstruction val3) => CodeInstructionExtensions.Calls(val3, AccessTools.Method(typeof(Array), "Copy", new Type[5] { typeof(Array), typeof(int), typeof(Array), typeof(int), typeof(int) }, (Type[])null))); if (num2 < 0 || !CodeInstructionExtensions.IsLdloc(list[num + 5], (LocalBuilder)null)) { throw new InvalidOperationException("JOSE: missing theme vein array for " + field); } CodeInstruction val = list[num + 5]; list2.Add(new CodeInstruction(val.opcode, val.operand)); index = num2 + 1; } CodeInstruction val2 = new CodeInstruction(OpCodes.Ldarg_0, (object)null); val2.labels.AddRange(list[index].labels); list[index].labels.Clear(); list2.Insert(0, val2); list2.Add(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(AddVeinPatches), "SetJoseVeinDensity", (Type[])null, (Type[])null))); list.InsertRange(index, list2); return list; } internal static bool SelectJoseVein(int vein, int seed, bool birth, EPlanetType planetType, EStarType? starType) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Invalid comparison between Unknown and I4 //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Invalid comparison between Unknown and I4 if (birth || (int)planetType == 5) { return false; } return vein switch { 21 => new DotNet35Random(seed ^ 0x4A4F5345).NextDouble() < 0.25, 22 => new DotNet35Random(seed ^ 0x41555241).NextDouble() < 0.25, 23 => (int)starType.GetValueOrDefault() == 4, 24 => (int)starType.GetValueOrDefault() == 3, _ => false, }; } private static void SetJoseVeinDensity(PlanetAlgorithm algorithm, int[] spots, float[] counts, float[] opacity) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) PlanetData val = Planet(algorithm); bool birth = val.id == val.galaxy.birthPlanetId; bool flag = SelectJoseVein(21, val.seed, birth, val.type, val.star?.type); spots[21] = (flag ? 1 : 0); counts[21] = 0.7f; opacity[21] = 0.7f; bool flag2 = SelectJoseVein(22, val.seed, birth, val.type, val.star?.type); spots[22] = (flag2 ? 1 : 0); counts[22] = 0.7f; opacity[22] = 0.7f; spots[23] = (SelectJoseVein(23, val.seed, birth, val.type, val.star?.type) ? 3 : 0); spots[24] = (SelectJoseVein(24, val.seed, birth, val.type, val.star?.type) ? 3 : 0); counts[23] = (counts[24] = 0.75f); opacity[23] = (opacity[24] = 0.85f); } [HarmonyPatch(typeof(PlanetAlgorithm), "GenerateVeins")] [HarmonyPatch(typeof(PlanetAlgorithm7), "GenerateVeins")] [HarmonyPatch(typeof(PlanetAlgorithm11), "GenerateVeins")] [HarmonyPatch(typeof(PlanetAlgorithm12), "GenerateVeins")] [HarmonyPatch(typeof(PlanetAlgorithm13), "GenerateVeins")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlanetAlgorithm_GenerateVeins_RemoveVeinPositionBias_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[6] { new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_7, (object)null, (string)null), CodeMatchUtils.Beq, new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(Vector3), "op_Addition", (Type[])null, (Type[])null), (string)null) }); val.SetInstructionAndAdvance(new CodeInstruction(OpCodes.Nop, (object)null)).SetInstructionAndAdvance(new CodeInstruction(OpCodes.Nop, (object)null)).SetOpcodeAndAdvance(OpCodes.Br_S); return val.InstructionEnumeration(); } [HarmonyPatch(typeof(PlanetAlgorithm), "GenerateVeins")] [HarmonyPatch(typeof(PlanetAlgorithm11), "GenerateVeins")] [HarmonyPatch(typeof(PlanetAlgorithm12), "GenerateVeins")] [HarmonyPatch(typeof(PlanetAlgorithm13), "GenerateVeins")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlanetAlgorithm_GenerateVeins_RemoveHeightLimit_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Expected O, but got Unknown //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Expected O, but got Unknown //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Expected O, but got Unknown //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Expected O, but got Unknown //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Expected O, but got Unknown //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Expected O, but got Unknown //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Expected O, but got Unknown //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Expected O, but got Unknown //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Expected O, but got Unknown //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(PlanetRawData), "QueryHeight", (Type[])null, (Type[])null), (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction ci) => CodeInstructionExtensions.IsStloc(ci, (LocalBuilder)null)), (string)null) }); CodeMatcher val2 = val.Clone(); val2.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldc_I4_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Stloc_S, (object)null, (string)null) }); Label label = val2.Labels.First(); val2.MatchForward(false, (CodeMatch[])(object)new CodeMatch[12] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(PlanetData), "radius"), (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_R4, (object)1f, (string)null), CodeMatchUtils.Sub, CodeMatchUtils.BgtUn, new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null), CodeMatchUtils.Sub, new CodeMatch((OpCode?)OpCodes.Stloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null), CodeMatchUtils.Add, new CodeMatch((OpCode?)OpCodes.Stloc_S, (object)null, (string)null) }); val.Advance(1); if (val2.IsValid) { CodeInstruction instruction = val.Clone().MatchForward(false, (CodeMatch[])(object)new CodeMatch[3] { CodeMatchUtils.LdLoc, new CodeMatch((OpCode?)OpCodes.Ldc_I4_7, (object)null, (string)null), CodeMatchUtils.BneUn }).Instruction; val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(instruction.opcode, instruction.operand), new CodeInstruction(OpCodes.Ldc_I4_7, (object)null), new CodeInstruction(OpCodes.Bne_Un, (object)label) }); } else { val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Br, (object)label) }); } val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(PlanetData), "waterItemId"), (string)null), CodeMatchUtils.BrFalse }); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Pop, (object)null) }); val.SetOpcodeAndAdvance(OpCodes.Br); return val.InstructionEnumeration(); } [HarmonyPatch(typeof(PlanetAlgorithm), "GenerateVeins")] [HarmonyPatch(typeof(PlanetAlgorithm11), "GenerateVeins")] [HarmonyPatch(typeof(PlanetAlgorithm12), "GenerateVeins")] [HarmonyPatch(typeof(PlanetAlgorithm13), "GenerateVeins")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlanetAlgorithm_InitialVeins_Transpiler(IEnumerable<CodeInstruction> instructions, MethodBase original) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); Type declaringType = original.DeclaringType; val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_2, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Stfld, (object)AccessTools.Field(declaringType, "veinVectorCount"), (string)null) }); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(AddVeinPatches), "InitBirthVeinVectors", (Type[])null, (Type[])null)) }); val.Advance(1).SetOpcodeAndAdvance(OpCodes.Ldc_I4_7); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_2, (object)null, (string)null) }); val.SetOpcodeAndAdvance(OpCodes.Ldc_I4_0); return val.InstructionEnumeration(); } public static void InitBirthVeinVectors(PlanetAlgorithm algorithm) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) VectorTypes(algorithm)[2] = (EVeinType)15; Vectors(algorithm)[2] = Planet(algorithm).birthResourcePoint2; VectorTypes(algorithm)[3] = (EVeinType)6; Vectors(algorithm)[3] = Planet(algorithm).birthResourcePoint3; VectorTypes(algorithm)[4] = (EVeinType)5; Vectors(algorithm)[4] = Planet(algorithm).birthResourcePoint4; VectorTypes(algorithm)[5] = (EVeinType)21; Vectors(algorithm)[5] = FindJoseBirthVector(Planet(algorithm)); VectorTypes(algorithm)[6] = (EVeinType)22; Vectors(algorithm)[6] = FindJoseBirthVector(Planet(algorithm), Vectors(algorithm)[5]); } internal static Vector3 FindJoseBirthVector(PlanetData planet, Vector3 avoid = default(Vector3)) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) Vector3 normalized = ((Vector3)(ref planet.birthPoint)).normalized; Vector3 val = Vector3.Cross(normalized, Vector3.up); Vector3 normalized2 = ((Vector3)(ref val)).normalized; if (((Vector3)(ref normalized2)).sqrMagnitude < 0.01f) { val = Vector3.Cross(normalized, Vector3.right); normalized2 = ((Vector3)(ref val)).normalized; } Vector3 val2 = Vector3.Cross(normalized, normalized2); Vector3 result = Vector3.zero; float num = float.NegativeInfinity; for (int i = 0; i < 24; i++) { float num2 = (float)i * ((float)Math.PI / 12f); val = normalized + 0.25f * (Mathf.Cos(num2) * normalized2 + Mathf.Sin(num2) * val2); Vector3 normalized3 = ((Vector3)(ref val)).normalized; if (((Vector3)(ref avoid)).sqrMagnitude > 0.1f) { val = normalized3 - avoid; if (((Vector3)(ref val)).sqrMagnitude < 0.025f) { continue; } } float num3 = planet.data.QueryHeight(normalized3); if (num3 > num) { result = normalized3; num = num3; } } return result; } internal static Vector2 Rotate(Vector2 v, float angle) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) float num = angle * (float)Math.PI / 180f; return new Vector2(v.x * Mathf.Cos(num) - v.y * Mathf.Sin(num), v.x * Mathf.Sin(num) + v.y * Mathf.Cos(num)); } [HarmonyPatch(typeof(PlanetData), "GenBirthPoints", new Type[] { typeof(PlanetRawData), typeof(int) })] [HarmonyPostfix] public static void PlanetData_GenBirthPoints_Postfix(PlanetData __instance, PlanetRawData rawData, int _birthSeed) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) DotNet35Random val = new DotNet35Random(_birthSeed); Pose val2 = __instance.PredictPose(85.0); Vector3 val3 = VectorLF3.op_Implicit(Maths.QInvRotateLF(val2.rotation, __instance.star.uPosition - VectorLF3.op_Implicit(val2.position) * 40000.0)); ((Vector3)(ref val3)).Normalize(); Vector3 val4 = Vector3.Cross(val3, Vector3.up); Vector3 normalized = ((Vector3)(ref val4)).normalized; val4 = Vector3.Cross(normalized, val3); Vector3 normalized2 = ((Vector3)(ref val4)).normalized; for (int i = 0; i < 512; i++) { float num = (float)(val.NextDouble() * 2.0 - 1.0) * 0.5f; float num2 = (float)(val.NextDouble() * 2.0 - 1.0) * 0.5f; Vector3 val5 = val3 + num * normalized + num2 * normalized2; ((Vector3)(ref val5)).Normalize(); __instance.birthPoint = val5 * (float)((double)__instance.realRadius + 0.20000000298023224 + 1.4500000476837158); Vector3 val6 = Vector3.Cross(val5, Vector3.up); normalized = ((Vector3)(ref val6)).normalized; val6 = Vector3.Cross(normalized, val5); normalized2 = ((Vector3)(ref val6)).normalized; for (int j = 0; j < 10; j++) { Vector2 val7 = new Vector2((float)(val.NextDouble() * 2.0 - 1.0), (float)(val.NextDouble() * 2.0 - 1.0)); Vector2 val8 = ((Vector2)(ref val7)).normalized * 0.1f; Vector2 vector = Rotate(val8, 120f); Modify(val, ref vector); Vector2 vector2 = Rotate(val8, 240f); Modify(val, ref vector2); Vector2 vector3 = Rotate(val8, 60f); Modify(val, ref vector3); val6 = val5 + val8.x * normalized + val8.y * normalized2; __instance.birthResourcePoint0 = ((Vector3)(ref val6)).normalized; val6 = val5 + vector.x * normalized + vector.y * normalized2; __instance.birthResourcePoint1 = ((Vector3)(ref val6)).normalized; val6 = val5 + vector2.x * normalized + vector2.y * normalized2; __instance.birthResourcePoint2 = ((Vector3)(ref val6)).normalized; val6 = val5 + val8.x * -2f * normalized + val8.y * -2f * normalized2; __instance.birthResourcePoint3 = ((Vector3)(ref val6)).normalized; val6 = val5 + vector3.x * 2f * normalized + vector3.y * 2f * normalized2; __instance.birthResourcePoint4 = ((Vector3)(ref val6)).normalized; if (QueryHeightsNear(rawData, normalized, normalized2, __instance.realRadius, val5, __instance.birthResourcePoint0, __instance.birthResourcePoint1, __instance.birthResourcePoint2, __instance.birthResourcePoint3, __instance.birthResourcePoint4)) { return; } } } } private static void Modify(DotNet35Random dotNet35Random, ref Vector2 vector) { vector.x += (float)(dotNet35Random.NextDouble() * 2.0 - 1.0) * 0.006f; vector.y += (float)(dotNet35Random.NextDouble() * 2.0 - 1.0) * 0.006f; } private static bool QueryHeights(PlanetRawData rawData, float radius, params Vector3[] points) { return points.All((Vector3 point) => rawData.QueryHeight(point) > radius); } private static bool QueryHeightsNear(PlanetRawData rawData, Vector3 x_vector, Vector3 y_vector, float radius, params Vector3[] points) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) foreach (Vector3 val in points) { Vector3 val2 = val + x_vector * 0.03f; Vector3 val3 = val - x_vector * 0.03f; Vector3 val4 = val + y_vector * 0.03f; Vector3 val5 = val - y_vector * 0.03f; if (!QueryHeights(rawData, radius, val, val2, val3, val4, val5)) { return false; } } return true; } [HarmonyPatch(typeof(UIPlanetDetail), "OnPlanetDataSet")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> OnPlanetDataSet_ChangeVeinData_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Expected O, but got Unknown //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Expected O, but got Unknown //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Expected O, but got Unknown //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Expected O, but got Unknown //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_6, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Blt, (object)null, (string)null) }); object operand = val.Operand; object operand2 = val.InstructionAt(2).operand; val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[6] { new CodeInstruction(OpCodes.Ldloc_S, operand), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(AddVeinPatches), "OnPlanetDataSet_ChangeVeinData_IndexPatches", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Stloc_S, operand), new CodeInstruction(OpCodes.Ldloc_S, operand), new CodeInstruction(OpCodes.Ldc_I4_S, (object)(sbyte)14), new CodeInstruction(OpCodes.Beq, operand2) }); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_S, (object)(sbyte)15, (string)null), new CodeMatch((OpCode?)OpCodes.Blt, (object)null, (string)null) }); operand = val.Operand; object operand3 = val.Clone().MatchBack(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Bne_Un, (object)null, (string)null) }).Operand; val.Advance(2).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Beq, operand3), new CodeInstruction(OpCodes.Ldloc_S, operand), new CodeInstruction(OpCodes.Ldc_I4_S, (object)(sbyte)29) }); return val.InstructionEnumeration(); } [HarmonyPatch(typeof(UIStarDetail), "OnStarDataSet")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> OnStarDataSet_ChangeVeinData_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Expected O, but got Unknown //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_7, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Bge, (object)null, (string)null) }); val.Advance(1).SetInstructionAndAdvance(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(AddVeinPatches), "OnStarDataSet_ChangeVeinData_HighlightPatches", (Type[])null, (Type[])null))).SetOpcodeAndAdvance(OpCodes.Brfalse); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_7, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Clt, (object)null, (string)null) }); val.Advance(1).SetInstructionAndAdvance(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(AddVeinPatches), "OnStarDataSet_ChangeVeinData_HighlightPatches", (Type[])null, (Type[])null))).SetOpcodeAndAdvance(OpCodes.Nop); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_S, (object)(sbyte)15, (string)null), new CodeMatch((OpCode?)OpCodes.Blt, (object)null, (string)null) }); object operand = val.Operand; val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldloc_S, operand), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(AddVeinPatches), "OnStarDataSet_ChangeVeinData_IndexPatches", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Stloc_S, operand) }); val.Advance(1).SetOperandAndAdvance((object)(sbyte)29); return val.InstructionEnumeration(); } public static bool OnStarDataSet_ChangeVeinData_HighlightPatches(int index) { return index < 7 || index == 15; } public static int OnStarDataSet_ChangeVeinData_IndexPatches(int index) { return index switch { 3 => 15, 16 => 3, 15 => 16, _ => index, }; } public static int OnPlanetDataSet_ChangeVeinData_IndexPatches(int index) { return index switch { 2 => 14, 15 => 2, _ => index, }; } [HarmonyPatch(typeof(UIPlanetDetail), "RefreshDynamicProperties")] [HarmonyPatch(typeof(UIStarDetail), "RefreshDynamicProperties")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> RefreshDynamicProperties_ChangeVeinData_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"未知珍奇信号", (string)null) }); object operand = val.Advance(-2).Operand; CodeInstruction instruction = val.Advance(-2).Instruction; CodeInstruction instruction2 = val.Advance(-1).Instruction; val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[4] { new CodeInstruction(instruction2), new CodeInstruction(instruction), new CodeInstruction(OpCodes.Ldc_I4, (object)15), new CodeInstruction(OpCodes.Beq, operand) }); operand = val.Advance(11).Operand; val.Advance(-3).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[4] { new CodeInstruction(instruction2), new CodeInstruction(instruction), new CodeInstruction(OpCodes.Ldc_I4, (object)15), new CodeInstruction(OpCodes.Beq, operand) }); return val.InstructionEnumeration(); } private static uint ExtraColor(int id) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) Color32 val = Color32.op_Implicit((id == 25) ? new Color(0.94f, 0.34f, 0.68f) : new Color(0.04f, 0.48f, 0.43f)); return (uint)((val.a << 24) | (val.b << 16) | (val.g << 8) | val.r); } [HarmonyPatch(typeof(PlanetModelingManager), "LoadingPlanetFactoryMain")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlanetModelingManager_LoadingPlanetFactoryMain_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(VeinData), "type"), (string)null), new CodeMatch((OpCode?)OpCodes.Stfld, (object)AccessTools.Field(typeof(AnimData), "state"), (string)null) }); val.SetInstructionAndAdvance(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(AddVeinPatches), "RefVeinDataToAnimDataState", (Type[])null, (Type[])null))); return val.InstructionEnumeration(); } [HarmonyPatch(typeof(PlanetFactory), "AddVeinData")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PlanetFactory_AddVeinData_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(VeinData), "type"), (string)null), new CodeMatch((OpCode?)OpCodes.Stfld, (object)AccessTools.Field(typeof(AnimData), "state"), (string)null) }); val.SetInstructionAndAdvance(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(AddVeinPatches), "VeinDataToAnimDataState", (Type[])null, (Type[])null))); return val.InstructionEnumeration(); } public static uint RefVeinDataToAnimDataState(ref VeinData data) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected I4, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected I4, but got Unknown if ((int)data.type >= 25) { return ((int)data.type >= 27) ? 7u : ExtraColor((int)data.type); } if (data.modelIndex > 2) { return (uint)(int)data.type; } Color32 val = VeinColors[data.type]; return (uint)((val.a << 24) | (val.b << 16) | (val.g << 8) | val.r); } public static uint VeinDataToAnimDataState(VeinData data) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected I4, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected I4, but got Unknown if ((int)data.type >= 25) { return ((int)data.type >= 27) ? 7u : ExtraColor((int)data.type); } if (data.modelIndex > 2) { return (uint)(int)data.type; } Color32 val = VeinColors[data.type]; return (uint)((val.a << 24) | (val.b << 16) | (val.g << 8) | val.r); } } public static class BeltFixPatches { private static readonly FieldInfo BeltComponent_Speed_Field = AccessTools.Field(typeof(BeltComponent), "speed"); private static readonly FieldInfo PrefabDesc_beltSpeed_Field = AccessTools.Field(typeof(PrefabDesc), "beltSpeed"); [HarmonyPatch(typeof(ConnGizmoRenderer), "Update")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> ConnGizmoRenderer_Update_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)PrefabDesc_beltSpeed_Field, (string)null) }); val.Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(BeltFixPatches), "BeltSpeed_Patch", (Type[])null, (Type[])null)) }); return val.InstructionEnumeration(); } [HarmonyPatch(typeof(CargoTraffic), "SetBeltSelected")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> CargoTraffic_SetBeltSelected_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)BeltComponent_Speed_Field, (string)null) }); val.Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(BeltFixPatches), "BeltSpeed_Patch", (Type[])null, (Type[])null)) }); return val.InstructionEnumeration(); } [HarmonyPatch(typeof(BuildTool_BlueprintCopy), "UpdatePreviewModels")] [HarmonyPatch(typeof(BuildTool_Path), "UpdateGizmos")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> BuildTool_Path_UpdateGizmos_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)PrefabDesc_beltSpeed_Field, (string)null) }); val.Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(BeltFixPatches), "BeltSpeed_Patch", (Type[])null, (Type[])null)) }); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)PrefabDesc_beltSpeed_Field, (string)null) }); val.Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(BeltFixPatches), "BeltSpeed_Patch", (Type[])null, (Type[])null)) }); return val.InstructionEnumeration(); } [HarmonyPatch(typeof(CargoTraffic), "AlterBeltRenderer")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> CargoTraffic_AlterBeltRenderer_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)BeltComponent_Speed_Field, (string)null) }); val.Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(BeltFixPatches), "BeltSpeed_Patch", (Type[])null, (Type[])null)) }); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)BeltComponent_Speed_Field, (string)null) }); val.Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(BeltFixPatches), "BeltSpeed_Patch", (Type[])null, (Type[])null)) }); return val.InstructionEnumeration(); } [HarmonyPatch(typeof(PathRenderingBatch), "AddNode")] [HarmonyPatch(typeof(PathRenderingBatch), "AddNodeNoRefresh")] [HarmonyPrefix] public static void PathRenderingBatch_AddNode_Prefix(ref int speed) { speed = BeltSpeed_Patch(speed); } public static int BeltSpeed_Patch(int beltSpeed) { return (beltSpeed <= 2) ? 1 : ((beltSpeed <= 5) ? 2 : 5); } } public static class BirthStarPatches { [HarmonyPatch(typeof(StarGen), "CreateStarPlanets")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> StarGen_CreateStarPlanets_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { CodeMatchUtils.Br, new CodeMatch((OpCode?)OpCodes.Ldsfld, (object)AccessTools.Field(typeof(StarGen), "pGas"), (string)null) }); object operand = val.Operand; val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[4] { CodeMatchUtils.Br, new CodeMatch((OpCode?)OpCodes.Ldarg_1, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StarData), "spectr"), (string)null), CodeMatchUtils.BrTrue }); val.Operand = operand; val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[5] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldarg_1, (object)null), new CodeInstruction(OpCodes.Ldarg_2, (object)null), new CodeInstruction(OpCodes.Ldloc_0, (object)null), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(BirthStarPatches), "ModifyBirthStar", (Type[])null, (Type[])null)) }); return val.InstructionEnumeration(); } public static void ModifyBirthStar(GalaxyData galaxy, StarData star, GameDesc gameDesc, DotNet35Random dotNet35Random2) { star.planetCount = 5; star.planets = (PlanetData[])(object)new PlanetData[star.planetCount]; int num = dotNet35Random2.Next(); int num2 = dotNet35Random2.Next(); star.planets[0] = PlanetGen.CreatePlanet(galaxy, star, gameDesc, new int[1] { 9 }, 0, 0, 1, 1, false, num, num2); num = dotNet35Random2.Next(); num2 = dotNet35Random2.Next(); star.planets[1] = PlanetGen.CreatePlanet(galaxy, star, gameDesc, new int[1] { 21 }, 1, 0, 2, 2, true, num, num2); num = dotNet35Random2.Next(); num2 = dotNet35Random2.Next(); star.planets[2] = PlanetGen.CreatePlanet(galaxy, star, gameDesc, new int[1] { 1 }, 2, 2, 1, 1, false, num, num2); num = dotNet35Random2.Next(); num2 = dotNet35Random2.Next(); star.planets[3] = PlanetGen.CreatePlanet(galaxy, star, gameDesc, new int[1] { 7 }, 3, 2, 2, 2, false, num, num2); num = dotNet35Random2.Next(); num2 = dotNet35Random2.Next(); star.planets[4] = PlanetGen.CreatePlanet(galaxy, star, gameDesc, new int[1] { 20 }, 4, 0, 3, 3, false, num, num2); } } public static class BridgeBootstrap { public static bool Active; public static void Finish() { if (!Directory.Exists(Paths.PluginPath) || Directory.GetFiles(Paths.PluginPath, "ModJoseGenesisTest.dll", SearchOption.AllDirectories).Length != 1) { return; } AppDomain.CurrentDomain.AssemblyLoad += Loaded; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if (assembly.GetName().Name == "ProjectGenesis") { BridgeRuntime.Activate(assembly); } } } private static void Loaded(object sender, AssemblyLoadEventArgs e) { if (e.LoadedAssembly.GetName().Name == "ProjectGenesis") { BridgeRuntime.Activate(e.LoadedAssembly); } } } internal static class BridgeRuntime { private static Assembly genesis; private static Harmony harmony; private static readonly Dictionary<Type, Type> Redirect = new Dictionary<Type, Type>(); private static readonly HashSet<MethodInfo> Widened = new HashSet<MethodInfo>(); internal static void Activate(Assembly assembly) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Expected O, but got Unknown //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Expected O, but got Unknown //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Expected O, but got Unknown //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Expected O, but got Unknown if (BridgeBootstrap.Active) { return; } Type type = assembly.GetType("ProjectGenesis.ProjectGenesis"); if (type == null) { return; } CustomAttributeData customAttributeData = CustomAttributeData.GetCustomAttributes(type).FirstOrDefault((CustomAttributeData a) => a.AttributeType.FullName == "BepInEx.BepInPlugin"); if (customAttributeData == null || (string)customAttributeData.ConstructorArguments[2].Value != "3.2.3") { return; } genesis = assembly; harmony = new Harmony("astral.genesis.public323.bridge"); Type[] array = new Type[6] { typeof(AddVeinPatches), typeof(BirthStarPatches), typeof(GridIndexExpandPatches), typeof(UILootFilterPatches), typeof(GammaGeneratorPatches), typeof(BeltFixPatches) }; foreach (Type type2 in array) { Type type3 = assembly.GetType("ProjectGenesis.Patches." + type2.Name); if (type3 == null) { throw new InvalidOperationException("Astral bridge: missing Genesis type " + type2.Name); } Redirect.Add(type3, type2); } harmony.Patch((MethodBase)AccessTools.Method(typeof(Harmony), "PatchAll", new Type[1] { typeof(Type) }, (Type[])null), new HarmonyMethod(typeof(BridgeRuntime), "PatchType", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(assembly.GetType("ProjectGenesis.Patches.AddVeinPatches"), "ModifyVeinData", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(BridgeRuntime), "RegisterVeins", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(assembly.GetType("ProjectGenesis.Utils.JsonDataUtils"), "ImportJson", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(BridgeRuntime), "AfterJson", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(assembly.GetType("ProjectGenesis.Patches.MegaAssemblerPatches"), "ContainsRecipeType", (Type[])null, (Type[])null), new HarmonyMethod(typeof(BridgeRuntime), "ContainsRecipe", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Type type4 = assembly.GetType("ProjectGenesis.Patches.UIOptionWindowPatches"); harmony.Patch((MethodBase)AccessTools.Method(type4, "UIOptionWindow_OnRevertButtonClick_Postfix", (Type[])null, (Type[])null), new HarmonyMethod(typeof(BridgeRuntime), "RevertOptions", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.PatchAll(typeof(SectorModelPatches)); BridgeBootstrap.Active = true; Logger.CreateLogSource("Astral.GenesisBridge").LogInfo((object)"ASTRAL36A | bridge active for public GenesisBook 3.2.3; original DLL unchanged"); } private static void WidenGS(ref IEnumerable<CodeInstruction> __result) { __result = Widen(__result); } private static IEnumerable<CodeInstruction> Widen(IEnumerable<CodeInstruction> code) { foreach (CodeInstruction i in code) { if (CodeInstructionExtensions.LoadsConstant(i, 21L)) { i.opcode = OpCodes.Ldc_I4; i.operand = 29; } yield return i; } } private static bool PatchType(Harmony __instance, Type __0) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown if (__0 != null && __0.Assembly == genesis && __0.FullName == "ProjectGenesis.Compatibility.GalacticScale") { foreach (MethodInfo item in from m in AccessTools.GetDeclaredMethods(__0) where m.ReturnType == typeof(IEnumerable<CodeInstruction>) select m) { if (Widened.Add(item)) { harmony.Patch((MethodBase)item, (HarmonyMethod)null, new HarmonyMethod(typeof(BridgeRuntime), "WidenGS", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } } if (__0 == null || !Redirect.TryGetValue(__0, out var value)) { return true; } __instance.PatchAll(value); return false; } private static void RegisterVeins() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown VeinProtoSet veins = LDB.veins; List<VeinProto> list = new List<VeinProto>(); int[] array = new int[4] { 21, 22, 23, 24 }; for (int i = 0; i < array.Length; i++) { int num = array[i]; if (((ProtoSet<VeinProto>)(object)veins).Exist(num)) { throw new InvalidOperationException("Astral: vein ID already occupied " + num); } VeinProto obj = ((ProtoSet<VeinProto>)(object)veins).Select((num == 23) ? 6 : 2); VeinProto val = new VeinProto(); FieldInfo[] fields = typeof(VeinProto).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (!fieldInfo.IsInitOnly) { fieldInfo.SetValue(val, fieldInfo.GetValue(obj)); } } ((Proto)val).ID = num; ((Proto)val).Name = num switch { 23 => "Horizontita", 22 => "Aurita", 21 => "Nebulita", _ => "Neutronita", }; val.Description = ((Proto)val).Name; val.IconTag = "astral-native-vein-" + num; val.MiningItem = num switch { 23 => 8276, 22 => 8254, 21 => 8250, _ => 8277, }; list.Add(val); } ((ProtoSet<VeinProto>)(object)veins).dataArray = ((ProtoSet<VeinProto>)(object)veins).dataArray.Concat(list).ToArray(); ((ProtoSet<VeinProto>)(object)veins).OnAfterDeserialize(); } private static void AfterJson(int[] __0) { if (((ProtoSet<ItemProto>)(object)LDB.items).Exist(2207)) { ((ProtoSet<ItemProto>)(object)LDB.items).Select(2207).GridIndex = 2115; } int[] array = new int[1] { 1211 }; foreach (int num in array) { if (((ProtoSet<ItemProto>)(object)LDB.items).Exist(num)) { ((ProtoSet<ItemProto>)(object)LDB.items).Select(num).GridIndex = (__0[1] - 4) * 1000 + 4717; } } if (((ProtoSet<RecipeProto>)(object)LDB.recipes).Exist(162)) { ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(162).GridIndex = (__0[1] - 4) * 1000 + 4717; } } private static bool RevertOptions(int __0) { if (__0 == 4 || __0 == -1) { AccessTools.Method(genesis.GetType("ProjectGenesis.Patches.UIOptionWindowPatches"), "Reset", (Type[])null, (Type[])null).Invoke(null, null); } return false; } private static bool ContainsRecipe(ERecipeType __0, ERecipeType __1, ref bool __result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Expected I4, but got Unknown //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Expected I4, but got Unknown int num = (int)__0; int num2 = (int)__1; switch (num) { case 17: __result = num2 == 2 || num2 == 3 || num2 == 16; break; case 19: __result = num2 == 1 || num2 == 11 || num2 == 13; break; case 18: __result = num2 == 4 || num2 == 9 || num2 == 10; break; case 12: __result = new int[8] { 2, 3, 4, 5, 9, 10, 15, 16 }.Contains(num2); break; default: __result = num == num2; break; } return false; } } public static class CodeMatchUtils { public static CodeMatch BrTrue => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Brtrue || i.opcode == OpCodes.Brtrue_S), (string)null); public static CodeMatch BrFalse => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Brfalse || i.opcode == OpCodes.Brfalse_S), (string)null); public static CodeMatch Beq => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Beq || i.opcode == OpCodes.Beq_S), (string)null); public static CodeMatch BneUn => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Bne_Un || i.opcode == OpCodes.Bne_Un_S), (string)null); public static CodeMatch Bge => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Bge || i.opcode == OpCodes.Bge_S), (string)null); public static CodeMatch BgeUn => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Bge_Un || i.opcode == OpCodes.Bge_Un_S), (string)null); public static CodeMatch Bgt => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Bgt || i.opcode == OpCodes.Bgt_S), (string)null); public static CodeMatch BgtUn => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Bgt_Un || i.opcode == OpCodes.Bgt_Un_S), (string)null); public static CodeMatch Ble => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ble || i.opcode == OpCodes.Ble_S), (string)null); public static CodeMatch BleUn => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ble_Un || i.opcode == OpCodes.Ble_Un_S), (string)null); public static CodeMatch Blt => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Blt || i.opcode == OpCodes.Blt_S), (string)null); public static CodeMatch BltUn => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Blt_Un || i.opcode == OpCodes.Blt_Un_S), (string)null); public static CodeMatch Br => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Br || i.opcode == OpCodes.Br_S), (string)null); public static CodeMatch Leave => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Leave || i.opcode == OpCodes.Leave_S), (string)null); public static CodeMatch Cgt => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Cgt || i.opcode == OpCodes.Cgt_Un), (string)null); public static CodeMatch Clt => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Clt || i.opcode == OpCodes.Clt_Un), (string)null); public static CodeMatch LdArgA => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldarga || i.opcode == OpCodes.Ldarga_S), (string)null); public static CodeMatch StArg => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Starg || i.opcode == OpCodes.Starg_S), (string)null); public static CodeMatch LdLoc => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldloc || i.opcode == OpCodes.Ldloc_S), (string)null); public static CodeMatch LdLocA => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldloca || i.opcode == OpCodes.Ldloca_S), (string)null); public static CodeMatch Add => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Add || i.opcode == OpCodes.Add_Ovf || i.opcode == OpCodes.Add_Ovf_Un), (string)null); public static CodeMatch Sub => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Sub || i.opcode == OpCodes.Sub_Ovf || i.opcode == OpCodes.Sub_Ovf_Un), (string)null); public static CodeMatch Mul => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Mul || i.opcode == OpCodes.Mul_Ovf || i.opcode == OpCodes.Mul_Ovf_Un), (string)null); public static CodeMatch Div => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Div || i.opcode == OpCodes.Div_Un), (string)null); public static CodeMatch Rem => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Rem || i.opcode == OpCodes.Rem_Un), (string)null); public static CodeMatch Shr => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Shr || i.opcode == OpCodes.Shr_Un), (string)null); public static CodeMatch ConvI1 => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Conv_I1 || i.opcode == OpCodes.Conv_Ovf_I1 || i.opcode == OpCodes.Conv_Ovf_I1_Un), (string)null); public static CodeMatch ConvI2 => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Conv_I2 || i.opcode == OpCodes.Conv_Ovf_I2 || i.opcode == OpCodes.Conv_Ovf_I2_Un), (string)null); public static CodeMatch ConvI4 => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Conv_I4 || i.opcode == OpCodes.Conv_Ovf_I4 || i.opcode == OpCodes.Conv_Ovf_I4_Un), (string)null); public static CodeMatch ConvI8 => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Conv_I8 || i.opcode == OpCodes.Conv_Ovf_I8 || i.opcode == OpCodes.Conv_Ovf_I8_Un), (string)null); public static CodeMatch ConvR4 => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Conv_R4 || i.opcode == OpCodes.Conv_R_Un), (string)null); public static CodeMatch ConvU1 => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Conv_U1 || i.opcode == OpCodes.Conv_Ovf_U1 || i.opcode == OpCodes.Conv_Ovf_U1_Un), (string)null); public static CodeMatch ConvU2 => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Conv_U2 || i.opcode == OpCodes.Conv_Ovf_U2 || i.opcode == OpCodes.Conv_Ovf_U2_Un), (string)null); public static CodeMatch ConvU4 => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Conv_U4 || i.opcode == OpCodes.Conv_Ovf_U4 || i.opcode == OpCodes.Conv_Ovf_U4_Un), (string)null); public static CodeMatch ConvU8 => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Conv_U8 || i.opcode == OpCodes.Conv_Ovf_U8 || i.opcode == OpCodes.Conv_Ovf_U8_Un), (string)null); public static CodeMatch ConvI => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Conv_I || i.opcode == OpCodes.Conv_Ovf_I || i.opcode == OpCodes.Conv_Ovf_I_Un), (string)null); public static CodeMatch ConvU => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Conv_U || i.opcode == OpCodes.Conv_Ovf_U || i.opcode == OpCodes.Conv_Ovf_U_Un), (string)null); public static CodeMatch UnBox => new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Unbox || i.opcode == OpCodes.Unbox_Any), (string)null); } public static class GammaGeneratorPatches { [HarmonyPatch(typeof(PowerGeneratorComponent), "GameTick_Gamma")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PowerGeneratorComponent_GameTick_Gamma_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(PowerGeneratorComponent), "catalystPoint"), (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Sub, (object)null, (string)null) }); val.Advance(1).SetAndAdvance(OpCodes.Ldc_I4_S, (object)(sbyte)10); return val.InstructionEnumeration(); } [HarmonyPatch(typeof(UIPowerGeneratorWindow), "_OnUpdate")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> UIPowerGeneratorWindow_OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"0.100 / min", (string)null) }); val.SetOperandAndAdvance((object)"1 / min"); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"0.100 / min", (string)null) }); val.SetOperandAndAdvance((object)"1 / min"); return val.InstructionEnumeration(); } } internal static class GridIndexExpandPatches { [HarmonyPatch(typeof(UIReplicatorWindow), "_OnInit")] [HarmonyPostfix] public static void UIReplicatorWindow_OnInit_Postfix(UIReplicatorWindow __instance) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) __instance.windowRect.sizeDelta = new Vector2(900f, 857f); __instance.recipeGroup.sizeDelta = new Vector2(782f, 368f); ((Component)__instance.queueGroup).GetComponentInChildren<RectTransform>().sizeDelta = new Vector2(782f, 46f); ((Component)((Transform)__instance.recipeGroup).GetChild(0).GetChild(9)).gameObject.SetActive(false); FieldInfo fieldInfo = AccessTools.Field(typeof(UIReplicatorWindow), "queueNumTexts"); Text[] array = (Text[])fieldInfo.GetValue(__instance); Array.Resize(ref array, 17); fieldInfo.SetValue(__instance, array); for (int i = 14; i < 17; i++) { AccessTools.Method(typeof(UIReplicatorWindow), "CreateQueueText", (Type[])null, (Type[])null).Invoke(__instance, new object[1] { i }); } } [HarmonyPatch(typeof(UIGame), "_OnInit")] [HarmonyPostfix] [HarmonyPriority(0)] public static void UIGame_OnInit_Postfix(UIGame __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) __instance.assemblerWindow.recipeGroup.sizeDelta = new Vector2(190f, 100f); __instance.recipePicker.pickerTrans.sizeDelta = new Vector2(830f, 522f); __instance.itemPicker.pickerTrans.sizeDelta = new Vector2(830f, 522f); __instance.signalPicker.pickerTrans.sizeDelta = new Vector2(830f, 522f); __instance.lootFilter.filterTrans.sizeDelta = new Vector2(830f, 522f); } [HarmonyPatch(typeof(UISignalTagPicker), "_OnCreate")] [HarmonyPostfix] [HarmonyPriority(0)] public static void UISignalTagPicker_OnCreate_Postfix(ManualBehaviour __instance) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) ((RectTransform)((Component)__instance).transform).sizeDelta = new Vector2(512f, 388f); ((Component)((Component)__instance).transform.Find("content")).GetComponent<RectTransform>().sizeDelta = new Vector2(442f, 182f); } [HarmonyPatch(typeof(UIRecipePicker), "_OnCreate")] [HarmonyPatch(typeof(UISignalPicker), "_OnCreate")] [HarmonyPatch(typeof(UIItemPicker), "_OnCreate")] [HarmonyPatch(typeof(UILootFilter), "_OnCreate")] [HarmonyPostfix] [HarmonyPriority(0)] public static void UIRecipePicker_OnOpen_Postfix(ManualBehaviour __instance) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) ((Component)((Component)__instance).transform.Find("content")).GetComponent<RectTransform>().sizeDelta = new Vector2(782f, 368f); } [HarmonyPatch(typeof(UIReplicatorWindow), "TestMouseRecipeIndex")] [HarmonyPatch(typeof(UIReplicatorWindow), "SetSelectedRecipeIndex")] [HarmonyPatch(typeof(UIReplicatorWindow), "SetSelectedRecipe")] [HarmonyPatch(typeof(UIReplicatorWindow), "_OnUpdate")] [HarmonyPatch(typeof(UIReplicatorWindow), "RepositionQueueText")] [HarmonyPatch(typeof(UIReplicatorWindow), "RefreshQueueIcons")] [HarmonyPatch(typeof(UIReplicatorWindow), "TestMouseQueueIndex")] [HarmonyPatch(typeof(UIRecipePicker), "_OnUpdate")] [HarmonyPatch(typeof(UIRecipePicker), "RefreshIcons")] [HarmonyPatch(typeof(UIRecipePicker), "TestMouseIndex")] [HarmonyPatch(typeof(UIItemPicker), "_OnUpdate")] [HarmonyPatch(typeof(UIItemPicker), "RefreshIcons")] [HarmonyPatch(typeof(UIItemPicker), "TestMouseIndex")] [HarmonyTranspiler] [HarmonyPriority(0)] public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { foreach (CodeInstruction ci in instructions) { if (ci.opcode == OpCodes.Ldc_I4_S && (sbyte)ci.operand == 14) { ci.operand = (sbyte)17; } yield return ci; } } [HarmonyPatch(typeof(UIReplicatorWindow), "RefreshRecipeIcons")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> RefreshRecipeIcons_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldc_I4_8, (object)null, (string)null) }); val.SetOpcodeAndAdvance(OpCodes.Ldc_I4_8); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldc_I4_S, (object)(sbyte)14, (string)null) }); val.SetOperandAndAdvance((object)(sbyte)17); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldc_I4_S, (object)(sbyte)14, (string)null) }); val.SetOperandAndAdvance((object)(sbyte)17); return val.InstructionEnumeration(); } [HarmonyPatch(typeof(UIReplicatorWindow), "SetMaterialProps")] [HarmonyPatch(typeof(UIRecipePicker), "SetMaterialProps")] [HarmonyPatch(typeof(UIItemPicker), "SetMaterialProps")] [HarmonyTranspiler] [HarmonyPriority(0)] public static IEnumerable<CodeInstruction> SetMaterialProps_Transpiler(IEnumerable<CodeInstruction> instructions) { foreach (CodeInstruction ci in instructions) { if (ci.opcode == OpCodes.Ldc_R4) { float operand = (float)ci.operand; if (operand == 14f) { ci.operand = 17f; } } yield return ci; } } [HarmonyPatch(typeof(UIStationStorage), "OnSelectItemButtonClick")] [HarmonyTranspiler] [HarmonyPriority(0)] public static IEnumerable<CodeInstruction> UIStationStorage_OnSelectItemButtonClick_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldc_R4, (object)(-300f), (string)null) }); val.SetOperandAndAdvance((object)(-600f)); return val.InstructionEnumeration(); } } public static class SectorModelPatches { [HarmonyPatch(typeof(SectorModel), "OnCameraPostRender")] [HarmonyPrefix] public static bool SectorModel_OnCameraPostRender_Prefix() { Player mainPlayer = GameMain.mainPlayer; return mainPlayer != null && (Object)(object)mainPlayer.controller != (Object)null && mainPlayer.controller.actionBuild != null; } } public static class UILootFilterPatches { private const int DropType = 2; private static readonly FieldInfo DropOnlyField = AccessTools.Field(typeof(UILootFilter), "showDropOnly"); private static List<UITabButton> _tabs; private static readonly FieldInfo currentTypeField = AccessTools.Field(typeof(UILootFilter), "currentType"); public static int GridColumns(UILootFilter filter) { return (Current(filter) == 2) ? 14 : 17; } public static float GridColumnsFloat(UILootFilter filter) { return (Current(filter) == 2) ? 14f : 17f; } private static int Current(UILootFilter f) { return (int)currentTypeField.GetValue(f); } [HarmonyPatch(typeof(UILootFilter), "_OnCreate")] [HarmonyPostfix] public static void Create(UILootFilter __instance) { //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) TabData[] allTabs = TabSystem.GetAllTabs(); _tabs = new List<UITabButton>(); int num = 2; TabData[] array = allTabs; foreach (TabData val in array) { if (val != null) { num = val.tabIndex; GameObject val
BepInEx/plugins/Astral/ModJoseGenesisTest.dll
Decompiled 2 days 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.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Runtime.Serialization.Json; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using CommonAPI; using CommonAPI.Systems; using CommonAPI.Systems.ModLocalization; using HarmonyLib; using NebulaAPI; using NebulaAPI.GameState; using NebulaAPI.Interfaces; using NebulaAPI.Networking; using NebulaAPI.Packets; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; using crecheng.DSPModSave; using xiaoye97; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyFileVersion("0.39.0.0")] [assembly: AssemblyVersion("0.39.0.0")] namespace ModJoseGenesisTest; [BepInPlugin("com.jose.modjose.genesistest", "Astral", "0.39.0")] [BepInDependency("org.LoShin.GenesisBook", "3.2.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [CommonAPISubmoduleDependency(new string[] { "TabSystem", "LocalizationModule", "ProtoRegistry" })] [ModSaveSettings(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin, IModCanSave, IMultiplayerModWithSettings, IMultiplayerMod { internal static readonly HashSet<int> RetiredRecipes = new HashSet<int> { 9252, 9253, 9255, 9285, 9300, 9273, 9274, 9383, 9445, 9446, 9447, 9448, 9449, 9450, 9451 }; internal static readonly HashSet<int> RetiredItems = new HashSet<int> { 2318, 2319, 6230, 8275, 6264, 6265 }; internal static readonly HashSet<int> RetiredTechs = new HashSet<int>(); private static readonly Dictionary<int, int> RecipeOwners = new Dictionary<int, int>(); internal static readonly int[][] MachineLines = new int[4][] { new int[5] { 2303, 8269, 2304, 8270, 2305 }, new int[5] { 2302, 8253, 2315, 8271, 8272 }, new int[5] { 2001, 2002, 2003, 8273, 8274 }, new int[4] { 2011, 2012, 2013, 2014 } }; private static readonly int[] BaseAlternatives = new int[11] { 60, 37, 31, 33, 714, 28, 68, 99, 51, 74, 78 }; private static readonly int[] RareAlternatives = new int[11] { 61, 62, 32, 35, 709, 29, 69, 100, 519, 541, 79 }; private static readonly string[] AlternativeNames = new string[11] { "Diamante", "Silicio cristalino", "Grafeno", "Nanotubos de carbono", "Cristal de titanio", "Cristal de Casimir", "Combinador de fotones", "Contenedor de particulas", "Procesador", "Almacenamiento masa-energia", "Distorsionador espacial" }; private readonly List<RecipeProto> changedRecipes = new List<RecipeProto>(); private readonly List<RecipeProto> stellarRecipes = new List<RecipeProto>(); internal int matrixTab; internal const int DriveMigration20 = 1948318020; private const int PreviousDriveMigration19 = 1948318019; private const int PreviousDriveMigration18 = 1948318018; internal const int Aurorite = 8254; internal const int Photon = 8267; internal const int Gravity = 8268; internal const int Assembler = 8269; internal static readonly int[] JoseMatrices = new int[3] { 8252, 8267, 8268 }; private readonly List<TechProto> extraTechs = new List<TechProto>(); private static readonly Dictionary<int, string> IconNames = new Dictionary<int, string> { { 8298, "fotonica-eclipsada.png" }, { 8299, "gravitonica-sobrecargada.png" }, { 8287, "prisma.png" }, { 8288, "argon.png" }, { 8289, "neon.png" }, { 8290, "xenon.png" }, { 8291, "sustrato-kimberlita.png" }, { 8292, "malla-organica.png" }, { 8293, "anillo-unipolar.png" }, { 8294, "blindaje-horizonte.png" }, { 8295, "superconductor-neutronico.png" }, { 8296, "celda-noble.png" }, { 8297, "ensamble-confinamiento.png" }, { 8278, "horizontita-procesada.png" }, { 8279, "neutronita-refinada.png" }, { 8280, "anillo-horizonte.png" }, { 8281, "bobina-neutrones.png" }, { 8286, "nucleo-estelar.png" }, { 8276, "horizontita.png" }, { 8277, "neutronita.png" }, { 8282, "singularidad.png" }, { 8250, "mineral.png" }, { 8251, "aleacion.png" }, { 8252, "matriz.png" }, { 8254, "aurorita.png" }, { 8255, "concentrado.png" }, { 8256, "lingote.png" }, { 8257, "placa.png" }, { 8258, "hilo.png" }, { 8259, "bobina.png" }, { 8260, "ceramica.png" }, { 8261, "lente.png" }, { 8262, "fibra.png" }, { 8263, "circuito.png" }, { 8264, "resonador.png" }, { 8265, "nucleo.png" }, { 8266, "modulo.png" }, { 8267, "fotonica.png" }, { 8268, "gravitonica.png" } }; private readonly Dictionary<int, Dictionary<string, object>> genesisTree13 = new Dictionary<int, Dictionary<string, object>>(); private readonly Dictionary<int, int> defenseItems13 = new Dictionary<int, int>(); private readonly Dictionary<int, int> defenseRecipes13 = new Dictionary<int, int>(); private readonly Dictionary<int, int> nativeItemOverrides13 = new Dictionary<int, int>(); private const int JoseRoot13 = 1964; private static readonly string[] TreeFields13 = new string[28] { "Name", "Desc", "Conclusion", "IconPath", "IconTag", "Position", "Published", "IsHiddenTech", "IsLabTech", "PreTechs", "PreTechsImplicit", "PreTechsMax", "PreItem", "Items", "ItemPoints", "HashNeeded", "UnlockRecipes", "UnlockFunctions", "UnlockValues", "AddItems", "AddItemCounts", "Level", "MaxLevel", "LevelCoef1", "LevelCoef2", "PropertyOverrideItems", "PropertyItemCounts", "PropertyOverrideItemArray" }; internal const int HorizonOre = 8276; internal const int NeutronOre = 8277; internal const int Singularity = 8282; internal static readonly int[] ExtendedMatrices = new int[7] { 8252, 8267, 8268, 8282, 8298, 8299, 8370 }; private const int StellarTech = 1997; private const int SingularityTech = 1998; private const int EquipmentTech = 1999; private const int SailRecipe = 9301; private const int UniversalRecipe = 9308; private static readonly int[] AdvancedEquipment = new int[3] { 8283, 8284, 8285 }; private static readonly string[] TierNames = new string[5] { "básico", "aurórico", "estándar", "nebulítico", "preciso" }; private static readonly string[] FamilyNames = new string[4] { "Ensamblador", "Horno", "Cinta", "Brazo" }; private static readonly Color32[] TierColors = (Color32[])(object)new Color32[5] { new Color32((byte)237, (byte)146, (byte)41, byte.MaxValue), new Color32((byte)115, (byte)125, (byte)140, byte.MaxValue), new Color32((byte)243, (byte)139, (byte)139, byte.MaxValue), new Color32((byte)91, (byte)211, (byte)213, byte.MaxValue), new Color32((byte)108, (byte)171, (byte)242, byte.MaxValue) }; internal const int EclipsedPhoton25 = 8298; internal const int OverchargedGravity25 = 8299; private const string MegaGuid21 = "Gnimaerd.DSP.plugin.MoreMegaStructure"; private bool mega21; private readonly List<RecipeProto> megaRecipes21 = new List<RecipeProto>(); internal static readonly int[] MegaTargets21 = new int[7] { 9488, 9491, 9492, 1503, 9489, 9490, 9510 }; internal static readonly int[] MegaRecipeIds21 = new int[7] { 9340, 9341, 9342, 9343, 9452, 9453, 9454 }; internal static readonly Dictionary<int, int> StellarOriginals37C = new Dictionary<int, int>(); public const string Guid = "com.jose.modjose.genesistest"; internal const int Mineral = 8250; internal const int Alloy = 8251; internal const int Matrix = 8252; internal const int Research = 1991; internal const int InitialTech = 1941; private const int Foundry = 8253; private const int FoundryRecipe = 9256; private const int FoundryModel = 850; internal static Plugin Instance; internal static volatile bool Ready; internal static long MatrixProduced; internal static long ResearchPointsConsumed; private int tab; private bool failed; private GameData observed; private Harmony harmony; private TechProto technology; private readonly List<RecipeProto> recipes = new List<RecipeProto>(); private readonly List<ItemProto> items = new List<ItemProto>(); private readonly KeyboardShortcut kit = new KeyboardShortcut((KeyCode)289, Array.Empty<KeyCode>()); private readonly KeyboardShortcut report = new KeyboardShortcut((KeyCode)290, Array.Empty<KeyCode>()); private readonly KeyboardShortcut queue = new KeyboardShortcut((KeyCode)288, Array.Empty<KeyCode>()); private readonly KeyboardShortcut industryKit = new KeyboardShortcut((KeyCode)287, Array.Empty<KeyCode>()); private readonly Dictionary<int, int> uiStates = new Dictionary<int, int>(); private int fuelTab; private bool diagnosticLabCounters; private const int PrecisionTech = 1988; private const int UniversalEfficiencyTech = 1989; private const int Prism = 8287; private const int Argon = 8288; private const int Neon = 8289; private const int Xenon = 8290; private const int Diamond = 8291; private const int Lattice = 8292; private const int Magnet = 8293; private const int Armor = 8294; private const int Superconductor = 8295; private const int GasCell = 8296; private const int Containment = 8297; internal static readonly double[] MainSpeeds = new double[5] { 2.0, 3.0, 4.5, 7.0, 10.0 }; private static readonly Color[] EquipmentColors = (Color[])(object)new Color[3] { new Color(0.86f, 0.23f, 0.24f), new Color(1f, 0.53f, 0.7f), new Color(0.98f, 0.62f, 0.59f) }; internal const int Salts29 = 8300; internal const int PetroCrystal29 = 8301; internal const int NebCon29 = 8350; internal const int Insulator29 = 8351; internal const int Additive29 = 8352; internal const int Glass29 = 8353; internal const int HorizonMetal29 = 8354; internal const int NeutronMetal29 = 8355; private static readonly Dictionary<int, int> TimeBases29 = new Dictionary<int, int>(); internal static readonly int[] SlowRecipes29 = new int[61] { 26, 27, 28, 29, 33, 35, 51, 55, 65, 68, 69, 99, 100, 101, 102, 104, 105, 106, 111, 112, 113, 121, 714, 772, 9254, 9266, 9267, 9268, 9269, 9271, 9280, 9281, 9282, 9283, 9284, 9290, 9291, 9292, 9293, 9294, 9295, 9296, 9297, 9298, 9304, 9305, 9306, 9307, 9308, 9309, 9310, 9311, 9316, 9317, 9318, 9319, 9320, 9321, 9322, 9333, 9334 }; internal const int ThoriumCeramic29A = 8356; internal const int ActinicGlass29A = 8357; internal const int IrradiationCell29A = 8358; internal const int RadiometricCircuit29A = 8359; internal const int GermaniumOre29B = 8360; internal const int ZirconOre29B = 8361; internal const int Germanium29B = 8362; internal const int Zirconium29B = 8363; internal const int Wafer29B = 8364; internal const int Controller29B = 8365; internal const int Refractory29B = 8366; internal const int Mercury29B = 8367; internal const int Magma29B = 8368; internal const int ZirconAlloy29B = 8369; internal const int CyberMatrix29B = 8370; internal const int NeuroChip29B = 8371; internal const int Electro31 = 8374; internal const int ThermalGlass31 = 8375; internal const int GeCircuit31 = 8376; internal const int ZrCoat31 = 8377; internal const int Tritium31 = 8378; internal static readonly int[] RemovedAlternatives32 = new int[10] { 9273, 9274, 9383, 9445, 9446, 9447, 9448, 9449, 9450, 9451 }; internal static readonly HashSet<int> HiddenNodes32 = new HashSet<int> { 1993, 1979, 1203, 1987, 2910, 2911, 1503, 1504 }; internal const int DriveMigration32 = 1948318032; internal static readonly int[] AdvancedChemistry37H = new int[6] { 9313, 9314, 9315, 9317, 9405, 9440 }; internal static string IconFolder => Path.Combine(Path.GetDirectoryName(typeof(Plugin).Assembly.Location), "icons"); internal int AstralTab29 => tab; internal int FuelTab29 => fuelTab; public string Version => "0.39.0"; private void ArrangeItems11b(HashSet<int> alternatives) { int chemistry = TabSystem.GetTabId("org.LoShin.GenesisBook:org.LoShin.GenesisBookTab2"); int[] array = new int[10] { 1801, 1802, 1803, 6216, 6217, 6244, 6245, 6241, 6242, 6243 }; for (int i = 0; i < array.Length; i++) { int num = array[i]; if (RetiredItems.Contains(num)) { continue; } ItemProto val = ((ProtoSet<ItemProto>)(object)LDB.items).Select(num); if (val == null) { continue; } val.GridIndex = fuelTab * 1000 + 101 + i; foreach (RecipeProto item3 in VisibleRecipes(num)) { item3.GridIndex = val.GridIndex; } } HashSet<int> chemUsed = new HashSet<int>(((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray.Select((RecipeProto x) => x.GridIndex).Concat(((ProtoSet<ItemProto>)(object)LDB.items).dataArray.Select((ItemProto x) => x.GridIndex))); foreach (RecipeProto item4 in from x in ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray where x.GridIndex / 1000 == 1 && (((Proto)x).ID == 34 || ((Proto)x).ID == 773 || (x.Results.Contains(7101) && x.Explicit)) orderby ((Proto)x).ID select x) { item4.GridIndex = Enumerable.Range(1, 9).SelectMany((int num10) => from col in Enumerable.Range(1, 17) select chemistry * 1000 + num10 * 100 + col).First((int g) => !chemUsed.Contains(g)); chemUsed.Add(item4.GridIndex); } RecipeProto[] ordinary = ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray.Where((RecipeProto x) => !x.Results.Any((int value) => new int[4] { 1121, 6234, 6235, 1117 }.Contains(value)) && x.GridIndex / 1000 == 1 && !alternatives.Contains(((Proto)x).ID) && ((Proto)x).ID != 70 && ((Proto)x).ID != 9301 && ((Proto)x).ID != 81 && ((Proto)x).ID != 9330).ToArray(); ItemProto[] source = ((ProtoSet<ItemProto>)(object)LDB.items).dataArray.Where((ItemProto x) => !new int[4] { 1121, 6234, 6235, 1117 }.Contains(((Proto)x).ID) && x.GridIndex / 1000 == 1 && !x.CanBuild && !alternatives.Any((int num10) => ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(num10).Results.Contains(((Proto)x).ID)) && ((Proto)x).ID != 1501 && ((Proto)x).ID != 1502).ToArray(); int[][] array2 = new int[5][] { new int[15] { 1101, 1103, 1107, 1104, 6203, 6204, 1105, 1106, 7705, 7707, 7706, 1108, 1202, 1301, 1302 }, new int[14] { 1203, 1204, 1205, 1407, 1405, 1406, 5003, 5001, 5002, 1120, 6220, 7019, 7018, 1000 }, new int[12] { 6501, 6502, 6503, 7501, 7504, 7803, 1304, 1305, 7805, 7806, 1401, 1402 }, new int[13] { 1110, 1111, 1119, 1007, 1011, 1012, 1013, 1014, 1015, 1016, 1117, 6271, 6263 }, new int[9] { 1208, 1122, 1127, 1209, 1403, 1125, 1503, 1131, 1143 } }; HashSet<int> reserved = new HashSet<int>(new int[8] { 1612, 1712, 1613, 1713, 1215, 1216, 1217, 1417 }); int[] source2 = (from g in Enumerable.Range(1, 9).SelectMany((int num10) => from col in Enumerable.Range(1, 17) where num10 < 6 || col > 11 select 1000 + num10 * 100 + col) where !reserved.Contains(g) select g).ToArray(); HashSet<int> occupied = new HashSet<int>(); HashSet<int> moved = new HashSet<int>(); HashSet<int> movedItems = new HashSet<int>(); for (int row = 0; row < array2.Length; row++) { int[] array3 = array2[row]; foreach (int id in array3) { RecipeProto[] array4 = (from x in ordinary where x.Results.Contains(id) && !moved.Contains(((Proto)x).ID) orderby x.Explicit, ((Proto)x).ID select x).ToArray(); ItemProto val2 = ((IEnumerable<ItemProto>)source).FirstOrDefault((Func<ItemProto, bool>)((ItemProto x) => ((Proto)x).ID == id)); if (array4.Length == 0) { continue; } int num3 = source2.FirstOrDefault((int g) => g / 100 % 10 == row + 1 && !occupied.Contains(g)); if (num3 == 0) { num3 = source2.First((int g) => !occupied.Contains(g)); } int num4 = num3; RecipeProto[] array5 = array4; foreach (RecipeProto val3 in array5) { int item = (val3.GridIndex = (occupied.Contains(num3) ? source2.First((int g) => !occupied.Contains(g)) : num3)); occupied.Add(item); moved.Add(((Proto)val3).ID); } if (val2 != null) { val2.GridIndex = num4; movedItems.Add(id); occupied.Add(num4); } } } foreach (RecipeProto item5 in from x in ordinary where !moved.Contains(((Proto)x).ID) orderby x.Results.FirstOrDefault(), ((Proto)x).ID select x) { item5.GridIndex = source2.First((int g) => !occupied.Contains(g)); occupied.Add(item5.GridIndex); } foreach (ItemProto item2 in from x in source where !movedItems.Contains(((Proto)x).ID) orderby ((Proto)x).ID select x) { RecipeProto val4 = ((IEnumerable<RecipeProto>)ordinary).FirstOrDefault((Func<RecipeProto, bool>)((RecipeProto x) => x.Results.Contains(((Proto)item2).ID))); item2.GridIndex = val4?.GridIndex ?? 0; } for (int num6 = 0; num6 < BaseAlternatives.Length; num6++) { RecipeProto val5 = ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(BaseAlternatives[num6]); ((ProtoSet<ItemProto>)(object)LDB.items).Select(val5.Results[0]).GridIndex = (val5.GridIndex = 1601 + num6); ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(RareAlternatives[num6]).GridIndex = 1701 + num6; stellarRecipes[num6].GridIndex = ((!RetiredRecipes.Contains(((Proto)stellarRecipes[num6]).ID)) ? (1801 + num6) : 0); } ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(70).GridIndex = 1612; ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(9301).GridIndex = 1712; ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(81).GridIndex = 1613; ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(9330).GridIndex = 1713; ((ProtoSet<ItemProto>)(object)LDB.items).Select(1501).GridIndex = 1612; ((ProtoSet<ItemProto>)(object)LDB.items).Select(1502).GridIndex = 1613; int[] array6 = new int[3] { 1121, 6234, 6235 }; for (int num7 = 0; num7 < array6.Length; num7++) { int num8 = array6[num7]; ((ProtoSet<ItemProto>)(object)LDB.items).Select(num8).GridIndex = 1215 + num7; foreach (RecipeProto item6 in VisibleRecipes(num8)) { item6.GridIndex = 1215 + num7; } } ((ProtoSet<ItemProto>)(object)LDB.items).Select(1117).GridIndex = 1417; foreach (RecipeProto item7 in VisibleRecipes(1117)) { if (item7.GridIndex / 1000 == 1) { item7.GridIndex = 1417; } } ItemProto[] array7 = (from x in source where !ordinary.Any((RecipeProto rec) => rec.Results.Contains(((Proto)x).ID)) orderby ((Proto)x).ID select x).ToArray(); HashSet<int> naturalIds = new HashSet<int>(array7.Select((ItemProto x) => ((Proto)x).ID)); HashSet<int> itemCells = new HashSet<int>(from x in ((ProtoSet<ItemProto>)(object)LDB.items).dataArray where !naturalIds.Contains(((Proto)x).ID) select x.GridIndex); ItemProto[] array8 = array7; foreach (ItemProto val6 in array8) { val6.GridIndex = Enumerable.Range(1, 9).Reverse().SelectMany((int num10) => from col in Enumerable.Range(1, 17).Reverse() select 1000 + num10 * 100 + col) .First((int g) => !itemCells.Contains(g)); itemCells.Add(val6.GridIndex); } ((Proto)((ProtoSet<ItemProto>)(object)LDB.items).Select(8282)).Name = Text("Matriz de convergencia estelar JOSE"); ((Proto)((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(9306)).Name = Text("Matriz de convergencia estelar JOSE"); } private void EnforceFuelTab20() { int[] array = new int[10] { 1801, 1802, 1803, 6216, 6217, 6244, 6245, 6241, 6242, 6243 }; HashSet<int> occupied = new HashSet<int>((from r in ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray where r.GridIndex / 1000 == fuelTab && !RetiredRecipes.Contains(((Proto)r).ID) select r.GridIndex).Concat(from i in ((ProtoSet<ItemProto>)(object)LDB.items).dataArray where i.GridIndex / 1000 == fuelTab && !RetiredItems.Contains(((Proto)i).ID) select i.GridIndex)); int[] array2 = array; foreach (int num2 in array2) { ItemProto val = ((ProtoSet<ItemProto>)(object)LDB.items).Select(num2); if (val == null || RetiredItems.Contains(num2)) { continue; } RecipeProto[] array3 = VisibleRecipes(num2).ToArray(); foreach (RecipeProto item2 in array3.Where((RecipeProto r) => r.GridIndex / 1000 != fuelTab)) { int item = (item2.GridIndex = Enumerable.Range(1, 9).SelectMany((int row) => from col in Enumerable.Range(1, 17) select fuelTab * 1000 + row * 100 + col).First((int grid) => !occupied.Contains(grid))); occupied.Add(item); } if (val.GridIndex / 1000 != fuelTab && array3.Length != 0) { val.GridIndex = array3[0].GridIndex; } } } private void RegisterIndustry() { for (int i = 8270; i <= 8275; i++) { if (((ProtoSet<ItemProto>)(object)LDB.items).Exist(i)) { throw new InvalidOperationException("Item industrial ocupado " + i); } } for (int j = 852; j <= 857; j++) { if (((ProtoSet<ModelProto>)(object)LDB.models).Exist(j)) { throw new InvalidOperationException("Modelo industrial ocupado " + j); } } for (int k = 9280; k <= 9300; k++) { if (((ProtoSet<RecipeProto>)(object)LDB.recipes).Exist(k)) { throw new InvalidOperationException("Receta industrial ocupada " + k); } } for (int l = 1994; l <= 1996; l++) { if (((ProtoSet<TechProto>)(object)LDB.techs).Exist(l)) { throw new InvalidOperationException("Tecnologia industrial ocupada " + l); } } AddMachine(8270, 852, 2303, "Ensamblador nebulitico", 404, 9280, new int[3] { 2304, 8250, 8266 }, new int[3] { 1, 20, 8 }, 1995, 1, 2304); AddMachine(8271, 853, 2302, "Horno nebulitico", 504, 9281, new int[3] { 2315, 8250, 8265 }, new int[3] { 1, 20, 8 }, 1995, 1, 2302); AddMachine(8272, 854, 2315, "Horno preciso", 505, 9282, new int[4] { 8271, 8266, 1303, 1126 }, new int[4] { 1, 12, 12, 6 }, 1996, 1, 2319); AddMachine(8273, 855, 2003, "Cinta nebulitica", 604, 9283, new int[3] { 2003, 8250, 8262 }, new int[3] { 3, 2, 1 }, 1995, 3, 2002); AddMachine(8274, 856, 2003, "Cinta precisa", 605, 9284, new int[3] { 8273, 8266, 1124 }, new int[3] { 3, 1, 2 }, 1996, 3); AddMachine(8275, 857, 2014, "Brazo supremo", 705, 9285, new int[4] { 2014, 8266, 8265, 1303 }, new int[4] { 1, 4, 2, 4 }, 1996); for (int m = 0; m < BaseAlternatives.Length; m++) { AddRecipe(9290 + m, AlternativeNames[m] + " - Pro", 801 + m, 4, hand: false, new int[1] { 8250 }, new int[1] { 1 }, 8250, 1, 180); RecipeProto val = recipes[recipes.Count - 1]; val.Explicit = true; stellarRecipes.Add(val); RecipeOwners[((Proto)val).ID] = 1994; } RegisterTech(1994, "Industria estandar JOSE", new int[1] { 1992 }, new int[1] { 8267 }, new int[2] { 46, 116 }.Concat(stellarRecipes.Select((RecipeProto x) => ((Proto)x).ID)).ToArray()); RegisterTech(1995, "Industria nebulitica JOSE", new int[2] { 1994, 1991 }, new int[2] { 8267, 8268 }, new int[3] { 9280, 9281, 9283 }); RegisterTech(1996, "Industria precisa JOSE", new int[2] { 1995, 1993 }, JoseMatrices, new int[4] { 47, 9282, 9284, 9285 }); extraTechs[extraTechs.Count - 3].HashNeeded = 2400L; extraTechs[extraTechs.Count - 2].HashNeeded = 3600L; extraTechs[extraTechs.Count - 1].HashNeeded = 4800L; foreach (TechProto item in extraTechs.Where((TechProto x) => ((Proto)x).ID >= 1994)) { item.Desc = Text("Desbloquea el siguiente escalon industrial JOSE. Coste: " + item.HashNeeded / 60 + " unidades de cada matriz indicada."); item.PropertyItemCounts = new int[1] { (int)(item.HashNeeded / 60) }; } RecipeOwners[46] = 1994; RecipeOwners[116] = 1994; RecipeOwners[47] = 1996; RecipeOwners[153] = 1901; } private void AddMachine(int id, int modelId, int template, string name, int slot, int recipeId, int[] input, int[] counts, int tech, int output = 1, int appearanceTemplate = 0) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) ItemProto val = ((ProtoSet<ItemProto>)(object)LDB.items).Select(template); ItemProto val2 = ((appearanceTemplate == 0) ? val : ((ProtoSet<ItemProto>)(object)LDB.items).Select(appearanceTemplate)); ModelProto val3 = ((ProtoSet<ModelProto>)(object)LDB.models).Select(val2.ModelIndex); AddItem(id, name, "Familia industrial JOSE. Mejora con U; consulta VALORES.md.", val2.IconPath, slot, 6, new Color(0.6f, 0.85f, 1f)); ItemProto val4 = items[items.Count - 1]; val4.HpMax = val.HpMax; val4.StackSize = val.StackSize; val4.PreTechOverride = tech; ModelProto val5 = ProtoRegistry.RegisterModel(modelId, val4, val3.PrefabPath, (Material[])null, val.DescFields, 0, 0, new int[0], val3.RendererType); val4.BuildMode = val.BuildMode; if (((Proto)val5).ID != modelId) { throw new InvalidOperationException("Modelo remapeado " + modelId); } AddRecipe(recipeId, name, slot, 4, hand: true, input, counts, id, output, 360); RecipeOwners[recipeId] = tech; } private void ChangeRecipe(int id, int[] input, int[] counts, int ticks = 0) { RecipeProto val = ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(id); if (val == null) { throw new InvalidOperationException("Falta receta " + id); } val.Items = input; val.ItemCounts = counts; if (ticks > 0) { val.TimeSpend = ticks; } changedRecipes.Add(val); } private void ApplyIndustryPolicy() { //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) ApplyPeacefulCatalog(); RecipeOwners.Remove(9285); RecipeProto[] dataArray = ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray; foreach (RecipeProto val in dataArray) { if (val.Results.Any(RetiredItems.Contains)) { RetiredRecipes.Add(((Proto)val).ID); } } foreach (int retiredItem in RetiredItems) { ItemProto val2 = ((ProtoSet<ItemProto>)(object)LDB.items).Select(retiredItem); if (val2 != null) { val2.GridIndex = 0; val2.BuildIndex = 0; val2.Upgrades = new int[0]; val2.Grade = 0; } } foreach (int retiredRecipe in RetiredRecipes) { RecipeProto val3 = ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(retiredRecipe); if (val3 != null) { val3.GridIndex = 0; val3.Handcraft = false; val3.Explicit = true; } } TechProto val4 = ((ProtoSet<TechProto>)(object)LDB.techs).Select(1901); val4.PreTechs = new int[1] { 1996 }; val4.PreTechsImplicit = new int[0]; val4.PreItem = new int[0]; val4.IsHiddenTech = false; val4.Published = true; val4.Desc = Text("Laboratorio de autoevolucion con componentes industriales, sin botin enemigo. Requiere 80 unidades de cada matriz JOSE."); val4.Items = JoseMatrices; val4.ItemPoints = new int[3] { 60, 60, 60 }; val4.HashNeeded = 4800L; val4.IsLabTech = true; val4.Position = new Vector2(37f, 65f); val4.PropertyOverrideItems = new int[1] { 6001 }; val4.PropertyItemCounts = new int[1] { 80 }; val4.PropertyOverrideItemArray = (IDCNT[])(object)new IDCNT[0]; ChangeRecipe(153, new int[6] { 2901, 6503, 8266, 8265, 1126, 1303 }, new int[6] { 4, 20, 20, 12, 20, 40 }, 3600); ((ProtoSet<ItemProto>)(object)LDB.items).Select(2304).PreTechOverride = 1994; ((ProtoSet<ItemProto>)(object)LDB.items).Select(2315).PreTechOverride = 1994; ((ProtoSet<ItemProto>)(object)LDB.items).Select(2305).PreTechOverride = 1996; ((ProtoSet<ItemProto>)(object)LDB.items).Select(2902).PreTechOverride = 1901; ChangeRecipe(46, new int[3] { 8269, 6502, 8263 }, new int[3] { 1, 6, 6 }, 600); ChangeRecipe(47, new int[4] { 8270, 6503, 8266, 1126 }, new int[4] { 1, 10, 12, 6 }, 900); ChangeRecipe(116, new int[4] { 8253, 6502, 8260, 8265 }, new int[4] { 1, 6, 12, 4 }, 600); for (int j = 0; j < MachineLines.Length; j++) { for (int k = 0; k < MachineLines[j].Length; k++) { ItemProto item = ((ProtoSet<ItemProto>)(object)LDB.items).Select(MachineLines[j][k]); int gridIndex = tab * 1000 + (j + 4) * 100 + k + 1; item.GridIndex = gridIndex; foreach (RecipeProto item2 in ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray.Where((RecipeProto x) => x.Results.Contains(((Proto)item).ID) && (CatalogGrid21a(x.GridIndex) || recipes.Contains(x)) && !RetiredRecipes.Contains(((Proto)x).ID))) { item2.GridIndex = gridIndex; } } } ((Proto)((ProtoSet<ItemProto>)(object)LDB.items).Select(8269)).Name = Text("Ensamblador aurorico"); ((Proto)((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(9272)).Name = Text("Ensamblador aurorico"); ((Proto)((ProtoSet<ItemProto>)(object)LDB.items).Select(8253)).Name = Text("Horno aurorico"); ((Proto)((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(9256)).Name = Text("Horno aurorico"); ApplyAlternatives15(); ApplyOrbitalProgression(); ApplySession10Recipes(); ApplyBalance11(); ApplyRecipes14(); ApplyAstral25Recipes(); ApplyIndustry29Recipes(); ApplyIndustry29D(); ApplyRecipes31(); ApplyRecipes32(); ApplyRecipes33(); ApplyRecipes34(); ApplyRecipes35B(); ApplyRecipes35C(); ApplyRecipes37(); ApplyUnitMatrices37B(); ApplyRecipes37C(); ApplyConstruction38A(); OrganizePresentation(); TechProto[] dataArray2 = ((ProtoSet<TechProto>)(object)LDB.techs).dataArray; foreach (TechProto tech in dataArray2) { tech.UnlockRecipes = (tech.UnlockRecipes ?? new int[0]).Where((int id) => !RetiredRecipes.Contains(id) && (!RecipeOwners.ContainsKey(id) || RecipeOwners[id] == ((Proto)tech).ID)).Concat(from x in RecipeOwners where x.Value == ((Proto)tech).ID select x.Key).Distinct() .ToArray(); if (!RetiredTechs.Contains(((Proto)tech).ID)) { tech.PreTechs = (tech.PreTechs ?? new int[0]).Where((int x) => !RetiredTechs.Contains(x)).ToArray(); tech.PreTechsImplicit = (tech.PreTechsImplicit ?? new int[0]).Where((int x) => !RetiredTechs.Contains(x)).ToArray(); } tech.postTechArray = null; tech.Preload(); } TechProto[] dataArray3 = ((ProtoSet<TechProto>)(object)LDB.techs).dataArray; foreach (TechProto val5 in dataArray3) { val5.Preload2(); } RecipeProto[] dataArray4 = ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray; foreach (RecipeProto val6 in dataArray4) { val6.Preload(Array.IndexOf(((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray, val6)); if (RecipeOwners.ContainsKey(((Proto)val6).ID)) { val6.preTech = ((ProtoSet<TechProto>)(object)LDB.techs).Select(RecipeOwners[((Proto)val6).ID]); } } foreach (ItemProto item3 in ((ProtoSet<ItemProto>)(object)LDB.items).dataArray.Where((ItemProto x) => !items.Contains(x))) { Sprite iconSprite = item3.iconSprite; item3.recipes = null; item3.rawMats = null; item3.Preload(Array.IndexOf(((ProtoSet<ItemProto>)(object)LDB.items).dataArray, item3)); if ((Object)(object)iconSprite != (Object)null) { AccessTools.Field(typeof(ItemProto), "_iconSprite").SetValue(item3, iconSprite); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("JOSE08 POLICY | retiredRecipes=" + string.Join(",", RetiredRecipes) + " | retiredTechs=" + string.Join(",", RetiredTechs))); } internal static void SetUpgradeChain(int[] line) { for (int i = 0; i < line.Length; i++) { ItemProto val = ((ProtoSet<ItemProto>)(object)LDB.items).Select(line[i]); val.Grade = i + 1; val.Upgrades = (int[])line.Clone(); } } private void ConfigureIndustryModels() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) int[][] machineLines = MachineLines; foreach (int[] upgradeChain in machineLines) { SetUpgradeChain(upgradeChain); } long[] array = new long[5] { 12000L, 32000L, 60000L, 96000L, 140000L }; long[] array2 = new long[5] { 12000L, 32000L, 60000L, 96000L, 140000L }; for (int j = 0; j < 5; j++) { PrefabDesc prefabDesc = ((ProtoSet<ItemProto>)(object)LDB.items).Select(MachineLines[0][j]).prefabDesc; PrefabDesc prefabDesc2 = ((ProtoSet<ItemProto>)(object)LDB.items).Select(MachineLines[1][j]).prefabDesc; prefabDesc.assemblerRecipeType = (ERecipeType)18; prefabDesc2.assemblerRecipeType = (ERecipeType)19; prefabDesc.assemblerSpeed = (prefabDesc2.assemblerSpeed = (int)Math.Round(MainSpeeds[j] * 10000.0)); prefabDesc.workEnergyPerTick = array[j]; prefabDesc2.workEnergyPerTick = array2[j]; prefabDesc.idleEnergyPerTick = (prefabDesc2.idleEnergyPerTick = 400 * (j + 1)); } int[] array3 = new int[5] { 2, 5, 10, 15, 20 }; for (int k = 0; k < 5; k++) { ((ProtoSet<ItemProto>)(object)LDB.items).Select(MachineLines[2][k]).prefabDesc.beltSpeed = array3[k]; } PrefabDesc prefabDesc3 = ((ProtoSet<ItemProto>)(object)LDB.items).Select(8275).prefabDesc; PrefabDesc prefabDesc4 = ((ProtoSet<ItemProto>)(object)LDB.items).Select(2014).prefabDesc; prefabDesc3.inserterSTT = 5000; prefabDesc3.workEnergyPerTick = 12000L; prefabDesc3.idleEnergyPerTick = 150L; prefabDesc3.inserterGrade = prefabDesc4.inserterGrade; prefabDesc3.inserterCanStack = prefabDesc4.inserterCanStack; prefabDesc3.inserterStackSize = prefabDesc4.inserterStackSize; } private void TintMachine(int id, Color tint) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) PrefabDesc prefabDesc = ((ProtoSet<ItemProto>)(object)LDB.items).Select(id).prefabDesc; Dictionary<Material, Material> palette = new Dictionary<Material, Material>(); if (prefabDesc.lodMaterials != null) { prefabDesc.lodMaterials = prefabDesc.lodMaterials.Select(CloneTinted).ToArray(); } prefabDesc.materials = CloneTinted(prefabDesc.materials); Material[] CloneTinted(Material[] source) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if (source == null) { return null; } Material[] array = (Material[])source.Clone(); for (int i = 0; i < array.Length; i++) { Material val = array[i]; if (!((Object)(object)val == (Object)null) && val.HasProperty("_Color")) { if (!palette.TryGetValue(val, out var value)) { value = new Material(val); Color val2 = tint; val2.a = val.GetColor("_Color").a; value.SetColor("_Color", val2); palette.Add(val, value); } array[i] = value; } } return array; } } private void ValidateIndustry() { foreach (RecipeProto recipe in recipes) { if (recipe.GridIndex > 0 && !CatalogGrid21a(recipe.GridIndex)) { throw new InvalidOperationException("JOSE21a: casilla propia inválida " + ((Proto)recipe).ID); } } int[][] machineLines = MachineLines; foreach (int[] array in machineLines) { for (int j = 0; j < array.Length; j++) { ItemProto val = ((ProtoSet<ItemProto>)(object)LDB.items).Select(array[j]); if (((Proto)val.GetUpgradeItem(1)).ID != array[Math.Min(j + 1, array.Length - 1)]) { throw new InvalidOperationException("Cadena U incorrecta " + ((Proto)val).ID); } } } HashSet<int> hashSet = new HashSet<int>(); foreach (RecipeProto item in ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray.Where((RecipeProto x) => CatalogGrid21a(x.GridIndex))) { if (item.GridIndex % 100 > 17 || item.GridIndex / 100 % 10 > 9) { throw new InvalidOperationException("Grid fuera de limites " + ((Proto)item).ID); } if (!hashSet.Add(item.GridIndex)) { throw new InvalidOperationException("Colision de recetas " + item.GridIndex); } if (item.Items.Any(RetiredItems.Contains)) { throw new InvalidOperationException("Receta activa depende de item retirado " + ((Proto)item).ID); } } if (((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(153).Items.Any((int x) => x >= 5201 && x <= 5206)) { throw new InvalidOperationException("Laboratorio requiere enemigos."); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("JOSE09 INDUSTRY READY | 5 ensambladores,5 hornos,5 cintas,4 brazos | Matrix tab=" + matrixTab)); } internal static TechProto CloneDriveStage20(TechProto template, int level) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown TechProto val = (TechProto)typeof(object).GetMethod("MemberwiseClone", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(template, null); FieldInfo[] fields = typeof(TechProto).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { object value = fieldInfo.GetValue(val); if (value is Array && !fieldInfo.IsInitOnly) { fieldInfo.SetValue(val, ((Array)value).Clone()); } } ((Proto)val).ID = 2900 + level; val.Level = level; val.MaxLevel = ((level == 11) ? 10000 : level); val.IconTag = "jose-drive-" + level; val.PreTechs = new int[1] { 2899 + level }; val.PreTechsImplicit = new int[0]; val.PreItem = new int[0]; val.PreTechsMax = false; val.UnlockRecipes = new int[0]; val.UnlockFunctions = new int[0]; val.UnlockValues = new double[0]; val.AddItems = new int[0]; val.AddItemCounts = new int[0]; val.Published = true; val.IsHiddenTech = false; val.postTechArray = null; return val; } private void RegisterDriveUpgrades20() { TechProto val = ((ProtoSet<TechProto>)(object)LDB.techs).Select(2906); if (val == null) { throw new InvalidOperationException("JOSE20: falta Drive Engine 6 original (2906)."); } for (int i = 7; i <= 11; i++) { if (((ProtoSet<TechProto>)(object)LDB.techs).Exist(2900 + i)) { TechProto val2 = ((ProtoSet<TechProto>)(object)LDB.techs).Select(2900 + i); if (!IsNativeDriveStage20(val2, val, i)) { throw new InvalidOperationException("JOSE20: ID de motor ajeno ocupado: " + (2900 + i)); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("JOSE20 DRIVE | reutiliza escalón original " + ((Proto)val2).ID)); } else { TechProto val3 = CloneDriveStage20(val, i); LDBTool.PreAddProto((Proto)(object)val3); if (((Proto)val3).ID != 2900 + i) { throw new InvalidOperationException("JOSE20: ID de motor remapeado " + i); } } } } internal static bool IsNativeDriveStage20(TechProto existing, TechProto template, int level) { return existing != null && template != null && existing.Level == level && (((Proto)existing).Name == ((Proto)template).Name || existing.IconPath == template.IconPath); } private static int MapNativeDrive20(int id) { return id switch { 2906 => 2910, 2905 => 2909, 2904 => 2908, _ => id, }; } private void ApplyDriveUpgrades20() { //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_05dd: Unknown result type (might be due to invalid IL or missing references) //IL_05e3: Unknown result type (might be due to invalid IL or missing references) //IL_05e8: Unknown result type (might be due to invalid IL or missing references) Dictionary<string, object> dictionary = genesisTree13[2904]; int[] array = (int[])dictionary["UnlockFunctions"]; double[] values = (double[])dictionary["UnlockValues"]; if (array == null || values == null || array.Length != values.Length || !array.Where((int id, int index) => id == 4 && values[index] >= 3.0).Any()) { throw new InvalidOperationException("JOSE20: la plantilla Drive Engine 4 no desbloquea warp como se esperaba."); } foreach (TechProto item in ((ProtoSet<TechProto>)(object)LDB.techs).dataArray.Where((TechProto t) => ((Proto)t).ID < 2901 || ((Proto)t).ID > 2911)) { item.PreTechs = (item.PreTechs ?? new int[0]).Select(MapNativeDrive20).Distinct().ToArray(); item.PreTechsImplicit = (item.PreTechsImplicit ?? new int[0]).Select(MapNativeDrive20).Distinct().ToArray(); item.postTechArray = null; } Vector2 position = ((ProtoSet<TechProto>)(object)LDB.techs).Select(2903).Position; int[][] array2 = new int[9][] { new int[2] { 6278, 6003 }, new int[2] { 6003, 8267 }, new int[3] { 6003, 8268, 8252 }, new int[2] { 6004, 8252 }, new int[2] { 6279, 8252 }, new int[2] { 6278, 6279 }, new int[2] { 6005, 8252 }, new int[2] { 6280, 8252 }, new int[1] { 6006 } }; int[][] array3 = new int[9][] { new int[2] { 200, 200 }, new int[2] { 300, 250 }, new int[3] { 500, 400, 200 }, new int[2] { 800, 600 }, new int[2] { 1200, 1200 }, new int[2] { 2000, 2000 }, new int[2] { 1500, 1500 }, new int[2] { 2000, 2000 }, new int[1] { 2000 } }; for (int num = 3; num <= 11; num++) { TechProto val = ((ProtoSet<TechProto>)(object)LDB.techs).Select(2900 + num); ((Proto)val).Name = Text("Motor de impulso " + num); val.Level = num; val.MaxLevel = ((num == 11) ? 10000 : num); val.PreTechs = new int[1] { 2899 + num }; int num2; switch (num) { default: num2 = 0; break; case 11: num2 = 1507; break; case 9: case 10: num2 = 1705; break; case 7: num2 = 1312; break; case 6: num2 = 1312; break; case 5: num2 = 1991; break; case 4: num2 = 1964; break; case 3: num2 = 1124; break; } int num3 = num2; if (num3 > 0) { val.PreTechs = val.PreTechs.Concat(new int[1] { num3 }).ToArray(); } if (num == 8) { val.PreTechs = val.PreTechs.Concat((((int[])dictionary["PreTechs"]) ?? new int[0]).Where((int id) => id < 2901 || id > 2906)).Distinct().ToArray(); } val.PreTechsImplicit = ((num == 8) ? (((int[])dictionary["PreTechsImplicit"]) ?? new int[0]).Where((int id) => id < 2901 || id > 2906).ToArray() : new int[0]); val.PreTechsMax = false; val.PreItem = ((num == 8) ? ((int[])(((int[])dictionary["PreItem"]) ?? new int[0]).Clone()) : new int[0]); val.Items = array2[num - 3]; val.ItemPoints = array3[num - 3]; val.HashNeeded = ((num == 11) ? 7956 : 3600); val.LevelCoef1 = ((num == 11) ? (-792) : 0); val.LevelCoef2 = ((num == 11) ? 36 : 0); val.PropertyOverrideItems = (int[])val.Items.Clone(); val.PropertyItemCounts = (int[])val.ItemPoints.Clone(); val.PropertyOverrideItemArray = (IDCNT[])(object)new IDCNT[0]; val.Published = true; val.IsHiddenTech = false; val.IsLabTech = true; val.Position = new Vector2(position.x + (float)(4 * (num - 3)), position.y); val.UnlockRecipes = new int[0]; if (num < 8) { val.UnlockFunctions = new int[1] { 11 }; val.UnlockValues = new double[1] { (num == 3) ? 1000.0 : 2000.0 }; } else if (num == 8) { val.UnlockFunctions = (int[])array.Clone(); val.UnlockValues = (double[])values.Clone(); } else { val.UnlockFunctions = new int[1] { 27 }; val.UnlockValues = new double[1] { 3.0 }; } val.AddItems = new int[0]; val.AddItemCounts = new int[0]; val.IconPath = ((num < 8) ? ((ProtoSet<TechProto>)(object)LDB.techs).Select(2903).IconPath : ((string)dictionary["IconPath"])); string s = ((num < 8) ? ("Aumenta el crucero normal en " + ((num == 3) ? 1000 : 2000) + " m/s. Máximo de esta etapa: " + ((num == 3) ? 2000 : (2000 * (num - 2))) + " m/s. No desbloquea warp.") : (num switch { 11 => "Aumenta la velocidad warp en 3 AU/s por nivel. Empieza con 2000 matrices blancas y su coste crece; el crucero permanece limitado a 10000 m/s.", 8 => "Desbloquea la distorsión del mecha con las funciones originales de Genesis. Coste: 2000 matrices naranjas y 2000 rosas.", _ => "Aumenta la velocidad warp en 3 AU/s. El crucero no supera 10000 m/s.", })); val.Desc = Text(s); val.Conclusion = val.Desc; val.postTechArray = null; } ApplyDrive31(); } private static bool CompletedDrive20(Dictionary<int, TechState> states, int id) { //IL_0018: 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) TechProto val = ((ProtoSet<TechProto>)(object)LDB.techs).Select(id); TechState value; return states.TryGetValue(id, out value) && (value.unlocked || (val != null && value.curLevel > val.Level)); } private static TechState DriveState20(int level, bool completed, TechState? previous = null) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) TechProto val = ((ProtoSet<TechProto>)(object)LDB.techs).Select(2900 + level); TechState val2 = default(TechState); ((TechState)(ref val2))..ctor(completed, level, val.MaxLevel, 0L, val.GetHashNeeded(level), 0); val2.uPointPerHash = ((val.Items.Length != 0 && val.Items[0] == 6006) ? val.ItemPoints[0] : 0); if (previous.HasValue) { TechState value = previous.Value; val2.unlockTick = value.unlockTick; if (!completed && value.hashNeeded > 0) { val2.hashUploaded = (long)(Math.Max(0.0, Math.Min(1.0, (double)value.hashUploaded / (double)value.hashNeeded)) * (double)val2.hashNeeded); } } if (completed) { val2.hashUploaded = val2.hashNeeded; } return val2; } private static TechState RepeatState20(TechState source, int current) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) TechState val = DriveState20(11, completed: false); val.curLevel = Math.Min(10000, Math.Max(11, current)); val.hashNeeded = ((ProtoSet<TechProto>)(object)LDB.techs).Select(2911).GetHashNeeded(val.curLevel); val.unlockTick = source.unlockTick; if (source.hashNeeded > 0) { val.hashUploaded = (long)(Math.Max(0.0, Math.Min(1.0, (double)source.hashUploaded / (double)source.hashNeeded)) * (double)val.hashNeeded); } return val; } internal static void SyncDriveStates20(GameHistoryData history, Mecha mecha) { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) if (history == null || mecha == null) { return; } if (history.HasFeatureKey(1948318020)) { mecha.maxSailSpeed = CruiseFromHistory20(history); return; } Dictionary<int, TechState> old = new Dictionary<int, TechState>(history.techStates); TechState value6; Func<int, bool> done = (int id) => old.TryGetValue(id, out value6) && (value6.unlocked || value6.curLevel > id - 2900); bool from19 = history.HasFeatureKey(1948318019); bool from20 = !from19 && history.HasFeatureKey(1948318018); TechState value; bool version17 = !from19 && !from20 && old.TryGetValue(2910, out value) && value.maxLevel == 10000; if (from19 || from20) { for (int num = 3; num <= 10; num++) { history.techStates[2900 + num] = DriveState20(num, done(2900 + num), old.TryGetValue(2900 + num, out var value2) ? new TechState?(value2) : ((TechState?)null)); } TechState value3; if (from19) { old.TryGetValue(2910, out value3); history.techStates[2911] = (done(2910) ? RepeatState20(value3, Math.Max(11, value3.curLevel)) : DriveState20(11, completed: false)); } else if (old.TryGetValue(2911, out value3)) { history.techStates[2911] = RepeatState20(value3, value3.curLevel); } else { history.techStates[2911] = DriveState20(11, completed: false); } } else { int num2 = (version17 ? Enumerable.Range(2907, 4).Count((int id) => done(id)) : 0); for (int num3 = 3; num3 <= 10; num3++) { int num4 = ((num3 == 3) ? 2903 : ((num3 < 8) ? (version17 ? (num3 + 2903) : 0) : (num3 switch { 9 => 2905, 8 => 2904, _ => 2906, }))); bool completed = ((num3 == 3) ? done(2903) : ((num3 < 8) ? (num3 - 4 < num2) : (num3 switch { 9 => done(2905), 8 => done(2904) || mecha.thrusterLevel >= 3, _ => done(2906), }))); history.techStates[2900 + num3] = DriveState20(num3, completed, (num4 > 0 && old.TryGetValue(num4, out var value4)) ? new TechState?(value4) : ((TechState?)null)); } old.TryGetValue(2906, out var value5); int current = 11 + ((!version17) ? Math.Max(0, value5.curLevel - 7) : 0); TechState source = (TechState)((done(2906) && !value5.unlocked) ? value5 : default(TechState)); history.techStates[2911] = RepeatState20(source, current); } mecha.maxSailSpeed = CruiseFromHistory20(history); if (history.techQueue != null) { int[] array = (from id in history.techQueue where id != 0 select (!from19) ? (from20 ? id : (id switch { 2906 => done(2906) ? 2911 : 2910, 2905 => 2909, 2904 => 2908, _ => (version17 && id >= 2907 && id <= 2910) ? (id - 3) : id, })) : ((id == 2910 && done(2910)) ? 2911 : id) into id where id < 2903 || id > 2910 || !CompletedDrive20(history.techStates, id) select id).ToArray(); Array.Clear(history.techQueue, 0, history.techQueue.Length); Array.Copy(array, history.techQueue, Math.Min(array.Length, history.techQueue.Length)); typeof(GameHistoryData).GetProperty("currentTech", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).GetSetMethod(nonPublic: true).Invoke(history, new object[1] { 0 }); } history.RegFeatureKey(1948318020); } private void ValidateDrive20() { for (int i = 3; i <= 5; i++) { TechProto val = ((ProtoSet<TechProto>)(object)LDB.techs).Select(2900 + i); if (!val.UnlockFunctions.SequenceEqual(new int[1] { 11 }) || !val.UnlockValues.SequenceEqual(new double[1] { 1000.0 })) { throw new InvalidOperationException("Astral31: crucero sobrescrito"); } } if (((ProtoSet<TechProto>)(object)LDB.techs).Select(2906).IsHiddenTech || !((ProtoSet<TechProto>)(object)LDB.techs).Select(2906).UnlockFunctions.Contains(4) || ((ProtoSet<TechProto>)(object)LDB.techs).Select(2909).MaxLevel != 10000) { throw new InvalidOperationException("Astral31: rama warp inválida"); } } internal static float CruiseFromHistory20(GameHistoryData history) { float num = (CompletedDrive20(history.techStates, 2902) ? 2000 : 1000); for (int i = 3; i <= 5; i++) { if (CompletedDrive20(history.techStates, 2900 + i)) { num += 1000f; } } return Math.Min(5000f, num); } internal static bool CatalogGrid21a(int grid) { return grid / 1000 > 0 && grid % 1000 / 100 >= 1 && grid % 1000 / 100 <= 9 && grid % 100 >= 1 && grid % 100 <= 17; } internal void HideExternalTowers21a() { HashSet<int> hidden = new HashSet<int>(new int[6] { 6257, 6258, 6259, 6260, 6264, 6265 }); foreach (ItemProto item in ((ProtoSet<ItemProto>)(object)LDB.items).dataArray.Where((ItemProto i) => hidden.Contains(((Proto)i).ID))) { item.GridIndex = 0; } foreach (RecipeProto item2 in ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray.Where((RecipeProto r) => r.Results.Any(hidden.Contains) || r.Items.Any(RetiredItems.Contains) || r.Results.Any(RetiredItems.Contains))) { item2.GridIndex = 0; if (item2.Items.Any(RetiredItems.Contains) || item2.Results.Any(RetiredItems.Contains)) { RetiredRecipes.Add(((Proto)item2).ID); } } TechProto[] dataArray = ((ProtoSet<TechProto>)(object)LDB.techs).dataArray; foreach (TechProto val in dataArray) { val.UnlockRecipes = (val.UnlockRecipes ?? new int[0]).Where((int id) => !RetiredRecipes.Contains(id) && ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(id) != null && !((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(id).Results.Any(hidden.Contains)).ToArray(); } } internal void MoveCarrierToMega21a() { if (!mega21) { return; } RecipeProto val = OriginalMegaRecipe21(9488); if (val == null) { return; } int megaTab = val.GridIndex / 1000; RecipeProto[] moving = (from r in ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray where r.Results.Contains(1503) && CatalogGrid21a(r.GridIndex) && !RetiredRecipes.Contains(((Proto)r).ID) orderby ((Proto)r).ID select r).ToArray(); HashSet<int> used = new HashSet<int>(from r in ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray where !moving.Contains(r) && CatalogGrid21a(r.GridIndex) select r.GridIndex); RecipeProto[] array = moving; foreach (RecipeProto val2 in array) { int item = (val2.GridIndex = ((val2.GridIndex / 1000 == megaTab && !used.Contains(val2.GridIndex)) ? val2.GridIndex : Enumerable.Range(1, 9).SelectMany((int row) => from col in Enumerable.Range(1, 17) select megaTab * 1000 + row * 100 + col).First((int g) => !used.Contains(g)))); used.Add(item); } ItemProto val3 = ((ProtoSet<ItemProto>)(object)LDB.items).Select(1503); if (val3 != null && moving.Length != 0) { val3.GridIndex = moving[0].GridIndex; } } private void RegisterEarlySails21a() { TechProto val = ((IEnumerable<TechProto>)((ProtoSet<TechProto>)(object)LDB.techs).dataArray).FirstOrDefault((Func<TechProto, bool>)((TechProto t) => ((Proto)t).ID >= 2000 && (t.UnlockFunctions ?? new int[0]).Contains(12))); if (val == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"JOSE21a: no se encontró plantilla de vida de velas; mejoras tempranas omitidas"); return; } for (int num = 0; num < 2; num++) { int num2 = 2920 + num; if (((ProtoSet<TechProto>)(object)LDB.techs).Exist(num2)) { throw new InvalidOperationException("JOSE21a: ID de estabilidad orbital ocupado " + num2); } TechProto val2 = CloneDriveStage20(val, 20 + num); ((Proto)val2).ID = num2; val2.Level = (val2.MaxLevel = 0); ((Proto)val2).Name = Text("Estabilidad orbital José " + (num + 1)); val2.UnlockFunctions = new int[1] { 12 }; val2.UnlockValues = new double[1] { 600.0 }; LDBTool.PreAddProto((Proto)(object)val2); } } private void ApplyEarlySails21a() { //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) TechProto val = (from t in ((ProtoSet<TechProto>)(object)LDB.techs).dataArray where ((Proto)t).ID >= 2000 && ((Proto)t).ID != 2920 && ((Proto)t).ID != 2921 && (t.UnlockFunctions ?? new int[0]).Contains(12) orderby t.Level, ((Proto)t).ID select t).FirstOrDefault(); if (val != null && ((ProtoSet<TechProto>)(object)LDB.techs).Exist(2920) && ((ProtoSet<TechProto>)(object)LDB.techs).Exist(2921)) { for (int num = 0; num < 2; num++) { TechProto val2 = ((ProtoSet<TechProto>)(object)LDB.techs).Select(2920 + num); ((Proto)val2).Name = Text("Estabilidad orbital José " + (num + 1)); val2.Desc = Text("Añade 10 minutos a la vida de las velas solares. Rama temprana opcional; las mejoras originales conservan su progreso y costes."); val2.Conclusion = val2.Desc; val2.Level = (val2.MaxLevel = 0); val2.PreTechs = ((num == 0) ? new int[1] { 1964 } : new int[2] { 2920, 1992 }); val2.PreTechsImplicit = new int[0]; val2.PreItem = new int[0]; val2.Items = ((num == 0) ? new int[1] { 8267 } : new int[2] { 6278, 8268 }); val2.ItemPoints = ((num == 0) ? new int[1] { 60 } : new int[2] { 100, 100 }); val2.HashNeeded = 3600L; val2.LevelCoef1 = (val2.LevelCoef2 = 0); val2.PropertyOverrideItems = (int[])val2.Items.Clone(); val2.PropertyItemCounts = (int[])val2.ItemPoints.Clone(); val2.PropertyOverrideItemArray = (IDCNT[])(object)new IDCNT[0]; val2.UnlockFunctions = new int[1] { 12 }; val2.UnlockValues = new double[1] { 600.0 }; val2.UnlockRecipes = new int[0]; val2.AddItems = new int[0]; val2.AddItemCounts = new int[0]; val2.IsLabTech = true; val2.Published = true; val2.IsHiddenTech = false; val2.Position = new Vector2(val.Position.x - 8f + (float)(4 * num), val.Position.y - 4f); val2.postTechArray = null; } val.PreTechs = (val.PreTechs ?? new int[0]).Concat(new int[1] { 2921 }).Distinct().ToArray(); } } private static IEnumerable<RecipeProto> VisibleRecipes(int itemId) { return from r in ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray where CatalogGrid21a(r.GridIndex) && r.Results.Length == 1 && r.Results[0] == itemId && !RetiredRecipes.Contains(((Proto)r).ID) orderby ((Proto)r).ID select r; } private void ArrangeBuildings() { int[] array = new int[6] { 6257, 6258, 6259, 6260, 6264, 6265 }; foreach (int num in array) { foreach (RecipeProto item in VisibleRecipes(num)) { item.GridIndex = 0; } ((ProtoSet<ItemProto>)(object)LDB.items).Select(num).GridIndex = 0; } ((ProtoSet<ItemProto>)(object)LDB.items).Select(2207).GridIndex = 0; RenameBuilding(2011, "Brazo Mk.I"); RenameBuilding(2012, "Brazo Mk.II"); RenameBuilding(2013, "Brazo Mk.III"); RenameBuilding(2014, "Brazo apilador"); RenameBuilding(2307, "Extractor de petróleo"); RenameBuilding(8283, "Extractor de petróleo avanzado"); RenameBuilding(2308, "Refinería de petróleo"); RenameBuilding(8284, "Refinería de petróleo avanzada"); RenameBuilding(2310, "Colisionador de partículas miniatura"); RenameBuilding(8285, "Colisionador de partículas avanzado"); int[][] array2 = new int[8][] { new int[12] { 2201, 2202, 2212, 2203, 2204, 2205, 2213, 2206, 2209, 6221, 2210, 3008 }, MachineLines[2].Concat(new int[1]).Concat(MachineLines[3]).Concat(new int[5] { 0, 2020, 2030, 2040, 2313 }) .ToArray(), MachineLines[0].Concat(new int[12] { 0, 0, 2101, 2102, 2106, 6229, 0, 2107, 2103, 2104, 2105, 6267 }).ToArray(), MachineLines[1], new int[16] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2208, 2311, 2312, 2401 }, new int[0], new int[7] { 2307, 2308, 2310, 2309, 2301, 2306, 2901 }, new int[7] { 8283, 8284, 8285, 2317, 2316, 6266, 2902 } }; HashSet<int> known = new HashSet<int>(array2.SelectMany((int[] row) => row)); ItemProto[] array3 = (from val3 in ((ProtoSet<ItemProto>)(object)LDB.items).dataArray where val3.GridIndex > 0 && (val3.GridIndex / 1000 == 2 || val3.CanBuild) && !known.Contains(((Proto)val3).ID) && !RetiredItems.Contains(((Proto)val3).ID) && !IsDefenseItem13(((Proto)val3).ID) orderby val3.GridIndex select val3).ToArray(); HashSet<int> movedRecipes = new HashSet<int>(); HashSet<int> occupied = new HashSet<int>(); for (int num2 = 0; num2 < array2.Length; num2++) { for (int num3 = 0; num3 < array2[num2].Length; num3++) { int num4 = 2101 + num2 * 100 + num3; if (array2[num2][num3] != 0) { MoveBuilding(array2[num2][num3], num4, movedRecipes); occupied.Add(num4); } } } Queue<int> queue = new Queue<int>(from grid in (from row in Enumerable.Range(1, 9) where row != 6 select row).SelectMany((int row) => from col in Enumerable.Range(1, 17) select 2000 + row * 100 + col) where !occupied.Contains(grid) select grid); ItemProto[] array4 = array3; foreach (ItemProto val in array4) { MoveBuilding(((Proto)val).ID, queue.Dequeue(), movedRecipes); } RecipeProto[] array5 = (from r in ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray where r.GridIndex / 1000 == 2 && !movedRecipes.Contains(((Proto)r).ID) orderby r.GridIndex select r).ToArray(); foreach (RecipeProto val2 in array5) { val2.GridIndex = queue.Dequeue(); } } private static void MoveBuilding(int id, int grid, HashSet<int> movedRecipes) { ItemProto val = ((ProtoSet<ItemProto>)(object)LDB.items).Select(id); if (val != null && !RetiredItems.Contains(id)) { val.GridIndex = grid; RecipeProto val2 = VisibleRecipes(id).FirstOrDefault(); if (val2 != null) { val2.GridIndex = grid; movedRecipes.Add(((Proto)val2).ID); } } } private static void RenameBuilding(int id, string name) { ((Proto)((ProtoSet<ItemProto>)(object)LDB.items).Select(id)).Name = Text(name); foreach (RecipeProto item in VisibleRecipes(id)) { ((Proto)item).Name = Text(name); } } private void ArrangeMatrices() { int num = matrixTab * 1000; int[] array = new int[9] { 6001, 6002, 6278, 6003, 6004, 6279, 6005, 6280, 6006 }; int[] array2 = new int[4] { 8267, 8268, 8252, 8282 }; for (int i = 0; i < array.Length; i++) { MoveMatrix(array[i], num + 101 + i); } for (int j = 0; j < array2.Length; j++) { MoveMatrix(array2[j], num + ((j < 3) ? (202 + j) : 208)); } MoveMatrix(8298, num + 402); MoveMatrix(8299, num + 403); ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(9308).GridIndex = num + 209; } private static void MoveMatrix(int id, int grid) { ((ProtoSet<ItemProto>)(object)LDB.items).Select(id).GridIndex = grid; foreach (RecipeProto item in from r in VisibleRecipes(id) where ((Proto)r).ID != 9308 select r) { item.GridIndex = grid; } } private void ArrangeItems(HashSet<int> alternativeIds) { ArrangeItems11b(alternativeIds); } private static int RecipeTech(int id) { int value; return RecipeOwners.TryGetValue(id, out value) ? value : (id switch { 9274 => 1993, 9273 => 1992, 9255 => 1991, _ => 1941, }); } private void RegisterExpansion() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_05e7: Unknown result type (might be due to invalid IL or missing references) //IL_0662: Unknown result type (might be due to invalid IL or missing references) //IL_06fe: Unknown result type (might be due to invalid IL or missing references) AddItem(8254, "Aurorita JOSE", "Cadena experimental JOSE; ver RECETAS.md.", "Icons/ItemRecipe/iron-ore", 201, 1, new Color(0.9f, 0.65f, 0.3f)); AddItem(8255, "Concentrado de aurorita", "Cadena experimental JOSE; ver RECETAS.md.", "Icons/ItemRecipe/iron-plate", 202, 2, new Color(0.9f, 0.65f, 0.3f)); AddRecipe(9258, "Concentrado de aurorita", 202, 1, hand: true, new int[1] { 8254 }, new int[1] { 2 }, 8255, 2, 120); AddItem(8256, "Lingote aurorico", "Cadena experimental JOSE; ver RECETAS.md.", "Icons/ItemRecipe/iron-plate", 203, 2, new Color(0.9f, 0.65f, 0.3f)); AddRecipe(9259, "Lingote aurorico", 203, 1, hand: true, new int[1] { 8255 }, new int[1] { 2 }, 8256, 1, 120); AddItem(8257, "Placa aurorica", "Cadena experimental JOSE; ver RECETAS.md.", "Icons/ItemRecipe/iron-plate", 204, 2, new Color(0.9f, 0.65f, 0.3f)); AddRecipe(9260, "Placa aurorica", 204, 4, hand: true, new int[2] { 8256, 1101 }, new int[2] { 1, 1 }, 8257, 2, 120); AddItem(8258, "Hilo aurorico", "Cadena experimental JOSE; ver RECETAS.md.", "Icons/ItemRecipe/iron-plate", 205, 2, new Color(0.9f, 0.65f, 0.3f)); AddRecipe(9261, "Hilo aurorico", 205, 4, hand: true, new int[1] { 8256 }, new int[1] { 1 }, 8258, 3, 120); AddItem(8259, "Bobina resonante", "Cadena experimental JOSE; ver RECETAS.md.", "Icons/ItemRecipe/iron-plate", 206, 2, new Color(0.9f, 0.65f, 0.3f)); AddRecipe(9262, "Bobina resonante", 206, 4, hand: true, new int[2] { 8258, 1202 }, new int[2] { 2, 1 }, 8259, 1, 120); AddItem(8260, "Ceramica prismatica", "Cadena experimental JOSE; ver RECETAS.md.", "Icons/ItemRecipe/iron-plate", 207, 2, new Color(0.9f, 0.65f, 0.3f)); AddRecipe(9263, "Ceramica prismatica", 207, 1, hand: true, new int[2] { 1005, 8255 }, new int[2] { 2, 1 }, 8260, 2, 120); AddItem(8261, "Lente fotonica", "Cadena experimental JOSE; ver RECETAS.md.", "Icons/ItemRecipe/iron-plate", 208, 2, new Color(0.9f, 0.65f, 0.3f)); AddRecipe(9264, "Lente fotonica", 208, 4, hand: true, new int[2] { 8260, 8255 }, new int[2] { 1, 1 }, 8261, 1, 120); AddItem(8262, "Fibra luminosa", "Cadena experimental JOSE; ver RECETAS.md.", "Icons/ItemRecipe/iron-plate", 209, 2, new Color(0.9f, 0.65f, 0.3f)); AddRecipe(9265, "Fibra luminosa", 209, 4, hand: true, new int[2] { 8260, 8258 }, new int[2] { 1, 1 }, 8262, 2, 120); AddItem(8263, "Circuito fotonico", "Cadena experimental JOSE; ver RECETAS.md.", "Icons/ItemRecipe/iron-plate", 210, 2, new Color(0.9f, 0.65f, 0.3f)); AddRecipe(9266, "Circuito fotonico", 210, 4, hand: true, new int[3] { 8257, 8262, 1202 }, new int[3] { 1, 1, 1 }, 8263, 1, 120); AddItem(8264, "Resonador gravitico", "Cadena experimental JOSE; ver RECETAS.md.", "Icons/ItemRecipe/iron-plate", 301, 2, new Color(0.9f, 0.65f, 0.3f)); AddRecipe(9267, "Resonador gravitico", 301, 4, hand: true, new int[2] { 8259, 8260 }, new int[2] { 1, 1 }, 8264, 1, 120); AddItem(8265, "Nucleo de confinamiento", "Cadena experimental JOSE; ver RECETAS.md.", "Icons/ItemRecipe/iron-plate", 302, 2, new Color(0.9f, 0.65f, 0.3f)); AddRecipe(9268, "Nucleo de confinamiento", 302, 4, hand: true, new int[2] { 8264, 8257 }, new int[2] { 1, 2 }, 8265, 1, 120); AddItem(8266, "Modulo cuantico", "Cadena experimental JOSE; ver RECETAS.md.", "Icons/ItemRecipe/iron-plate", 303, 2, new Color(0.9f, 0.65f, 0.3f)); AddRecipe(9269, "Modulo cuantico", 303, 4, hand: true, new int[2] { 8263, 8265 }, new int[2] { 1, 1 }, 8266, 1, 120); AddItem(8267, "Matriz fotonica JOSE", "Cadena experimental JOSE; ver RECETAS.md.", "Icons/ItemRecipe/t-matrix", 304, 11, new Color(1f, 0.8f, 0.2f)); AddRecipe(9270, "Matriz fotonica JOSE", 304, 15, hand: false, new int[2] { 8261, 8263 }, new int[2] { 1, 1 }, 8267, 1, 120); AddItem(8268, "Matriz gravitonica JOSE", "Cadena experimental JOSE; ver RECETAS.md.", "Icons/ItemRecipe/t-matrix", 305, 11, new Color(0.2f, 0.88f, 0.54f)); AddRecipe(9271, "Matriz gravitonica JOSE", 305, 15, hand: false, new int[2] { 8264, 8266 }, new int[2] { 1, 1 }, 8268, 1, 120); ItemProto val = ((ProtoSet<ItemProto>)(object)LDB.items).Select(2303); ModelProto val2 = ((ProtoSet<ModelProto>)(object)LDB.models).Select(val.ModelIndex); AddItem(8269, "Ensamblador aurorico JOSE", "Ensamblador de prueba basado en MK.I; velocidad original.", val.IconPath, 306, 6, new Color(0.8f, 0.4f, 0.95f)); ItemProto val3 = items[items.Count - 1]; val3.HpMax = val.HpMax; ModelProto val4 = ProtoRegistry.RegisterModel(851, val3, val2.PrefabPath, (Material[])null, val.DescFields, 0, 0, new int[0], val2.RendererType); if (((Proto)val4).ID != 851) { throw new InvalidOperationException("Modelo assembler remapeado."); } AddRecipe(9272, "Ensamblador aurorico JOSE", 306, 4, hand: true, new int[3] { 2303, 8257, 8259 }, new int[3] { 1, 2, 1 }, 8269, 1, 180); AddRecipe(9273, "Placa aurorica eficiente", 307, 4, hand: true, new int[2] { 8256, 1101 }, new int[2] { 1, 1 }, 8257, 3, 120); AddRecipe(9274, "Lingote aurorico eficiente", 308, 1, hand: true, new int[1] { 8255 }, new int[1] { 2 }, 8256, 2, 120); recipes[recipes.Count - 1].Explicit = true; recipes[recipes.Count - 2].Explicit = true; RegisterTech(1992, "Ciencia dual JOSE", new int[1] { 1941 }, new int[2] { 8267, 8268 }, new int[1] { 9273 }); RegisterTech(1993, "Convergencia multicolor JOSE", new int[2] { 1991, 1992 }, JoseMatrices, new int[1] { 9274 }); } private void RegisterTech(int id, string name, int[] pre, int[] matrices, int[] unlock) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) TechProto val = new TechProto(); ((Proto)val).ID = id; ((Proto)val).Name = Text(name); val.Desc = Text("Consume 10 unidades de cada matriz indicada en laboratorios. Desbloquea una receta eficiente."); val.Conclusion = Text("Cadena JOSE verificada."); val.IconPath = "Icons/Tech/1401"; val.IconTag = "jose-tech-" + id; val.Published = true; val.IsLabTech = true; val.PreTechs = pre; val.PreTechsImplicit = new int[0]; val.PreItem = new int[0]; val.Items = matrices; val.ItemPoints = matrices.Select((int x) => 60).ToArray(); val.HashNeeded = 600L; val.UnlockRecipes = unlock; val.UnlockFunctions = new int[0]; val.UnlockValues = new double[0]; val.AddItems = new int[0]; val.AddItemCounts = new int[0]; val.PropertyOverrideItems = new int[1] { 6001 }; val.PropertyItemCounts = new int[1] { 10 }; val.PropertyOverrideItemArray = (IDCNT[])(object)new IDCNT[0]; val.Position = new Vector2(17f, 64f); TechProto val2 = val; LDBTool.PreAddProto((Proto)(object)val2); if (((Proto)val2).ID != id) { throw new InvalidOperationException("Tech remapeada " + id); } extraTechs.Add(val2); } private void FinishExpansionTechs() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < extraTechs.Count; i++) { TechProto val = extraTechs[i]; float y = technology.Position.y; int[] array = new int[11] { 1992, 1991, 1993, 1994, 1995, 1996, 1997, 1988, 1998, 1999, 1989 }; int num = Array.IndexOf(array, ((Proto)val).ID); val.Position = new Vector2((float)(17 + 8 * (num % 4)), y - (float)(6 * (num / 4))); val.IconPath = ((((Proto)val).ID == 1997 || ((Proto)val).ID == 1998) ? "Icons/ItemRecipe/t-matrix" : ((((Proto)val).ID == 1988 || ((Proto)val).ID == 1994 || ((Proto)val).ID == 1995) ? "Icons/ItemRecipe/assembler-1" : "Icons/ItemRecipe/t-matrix")); int[] preTechs = val.PreTechs; foreach (int num2 in preTechs) { TechProto val2 = ((ProtoSet<TechProto>)(object)LDB.techs).Select(num2); val2.postTechArray = ((IEnumerable<TechProto>)(((object)val2.postTechArray) ?? ((object)new TechProto[0]))).Concat((IEnumerable<TechProto>)(object)new TechProto[1] { val }).Distinct().ToArray(); } val.Preload(); val.Preload2(); } } private void QueueNextResearch() { int[] array = new int[14] { 1964, 1992, 1991, 1993, 1995, 1996, 1997, 1994, 1965, 1966, 1988, 1998, 1999, 1989 }; foreach (int num in array) { if (!GameMain.history.TechUnlocked(num) && GameMain.history.CanEnqueueTech(num)) { GameMain.history.EnqueueTech(num); UIRealtimeTip.Popup("Astral: queued " + ((Proto)((ProtoSet<TechProto>)(object)LDB.techs).Select(num)).Name + ". Supply the laboratory to begin research.", true, 0); return; } } UIRealtimeTip.Popup("Astral: check the research queue and prerequisites.", true, 0); } private void ApplyAssemblerAppearance() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) PrefabDesc prefabDesc = ((ProtoSet<ModelProto>)(object)LDB.models).Select(851).prefabDesc; PrefabDesc prefabDesc2 = ((ProtoSet<ModelProto>)(object)LDB.models).Select(((ProtoSet<ItemProto>)(object)LDB.items).Select(2303).ModelIndex).prefabDesc; prefabDesc.assemblerRecipeType = (ERecipeType)4; prefabDesc.assemblerSpeed = prefabDesc2.assemblerSpeed; prefabDesc.workEnergyPerTick = prefabDesc2.workEnergyPerTick; prefabDesc.idleEnergyPerTick = prefabDesc2.idleEnergyPerTick; Material[][] array = (Material[][])prefabDesc.lodMaterials.Clone(); for (int i = 0; i < array.Length; i++) { if (array[i] == null) { continue; } array[i] = (Material[])array[i].Clone(); for (int j = 0; j < array[i].Length; j++) { Material val = array[i][j]; if (!((Object)(object)val == (Object)null) && val.HasProperty("_Color")) { Material val2 = new Material(val); val2.SetColor("_Color", (j == 0) ? new Color(0.28f, 0.2f, 0.35f) : new Color(0.8f, 0.5f, 1f)); array[i][j] = val2; } } } prefabDesc.lodMaterials = array; } private void RestoreDefenseTab13() { int tabId = TabSystem.GetTabId("org.LoShin.GenesisBook:org.LoShin.GenesisBookTab3"); TabData obj = FindDefenseTab13(TabSystem.GetAllTabs(), tabId); Text("Defenses"); Text("Matrices"); AccessTools.Field(typeof(TabData), "tabName").SetValue(obj, "Defenses"); AccessTools.Field(typeof(TabData), "tabIconPath").SetValue(obj, "Icons/Tech/1801"); } internal static TabData FindDefenseTab13(IEnumerable<TabData> tabs, int id) { TabData[] array = (tabs ?? Enumerable.Empty<TabData>()).Where((TabData t) => t != null && t.tabIndex == id).ToArray(); if (array.Length != 1) { throw new InvalidOperationException("JOSE: no se ha encontrado una única pestaña de defensas de Genesis (ID " + id + ")."); } return array[0]; } private void RegisterJoseRoot13() { RegisterTech(1964, "Ciencia José", new int[1] { 1900 }, new int[1] { 6001 }, new int[0]); TechProto val = extraTechs.Last(); val.HashNeeded = 600L; val.ItemPoints = new int[1] { 60 }; val.Desc = Text("Entrada provisional a la rama José. Coste: 10 matrices azules. Diseñaremos sus etapas a continuación."); val.Conclusion = val.Desc; } private void CaptureGenesisTree13() { int defenses = TabSystem.GetTabId("org.LoShin.GenesisBook:org.LoShin.GenesisBookTab3"); int[] array = new int[4] { 2304, 2315, 2305, 2902 }; foreach (int num in array) { nativeItemOverrides13[num] = ((ProtoSet<ItemProto>)(object)LDB.items).Select(num).PreTechOverride; } foreach (ItemProto item in ((ProtoSet<ItemProto>)(object)LDB.items).dataArray.Where((ItemProto val) => val.GridIndex / 1000 == defenses)) { defenseItems13[((Proto)item).ID] = item.GridIndex; } foreach (RecipeProto item2 in ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray.Where((RecipeProto r) => r.GridIndex / 1000 == defenses)) { defenseRecipes13[((Proto)item2).ID] = item2.GridIndex; } foreach (TechProto item3 in ((ProtoSet<TechProto>)(object)LDB.techs).dataArray.Where((TechProto t) => ((Proto)t).ID < 1964 || ((Proto)t).ID >= 2000)) { Dictionary<string, object> dictionary = new Dictionary<string, object>(); string[] treeFields = TreeFields13; foreach (string text in treeFields) { FieldInfo field = typeof(TechProto).GetField(text, BindingFlags.Instance | BindingFlags.Public); if (!(field == null)) { object value = field.GetValue(item3); dictionary[text] = ((value is Array) ? ((Array)value).Clone() : value); } } genesisTree13[((Proto)item3).ID] = dictionary; } } private bool IsDefenseItem13(int id) { return defenseItems13.ContainsKey(id); } private void RestoreDefenseCatalog13() { foreach (KeyValuePair<int, int> item in defenseItems13) { ItemProto val = ((ProtoSet<ItemProto>)(object)LDB.items).Select(item.Key); if (val != null && !RetiredItems.Contains(item.Key)) { val.GridIndex = item.Value; } } foreach (KeyValuePair<int, int> item2 in defenseRecipes13) { RecipeProto val2 = ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(item2.Key); if (val2 != null && !RetiredRecipes.Contains(item2.Key)) { val2.GridIndex = item2.Value; } } } private void RestoreGenesisTree13() { //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair<int, Dictionary<string, object>> item in genesisTree13) { TechProto val = ((ProtoSet<TechProto>)(object)LDB.techs).Select(item.Key); foreach (KeyValuePair<string, object> item2 in item.Value) { typeof(TechProto).GetField(item2.Key).SetValue(val, item2.Value); } val.UnlockRecipes = (val.UnlockRecipes ?? new int[0]).Where((int id) => id < 9000 && !RetiredRecipes.Contains(id)).ToArray(); val.postTechArray = null; } HashSet<int> nativeRewards = new HashSet<int>(from id in genesisTree13.Values.SelectMany((Dictionary<string, object> d) => ((int[])d["UnlockRecipes"]) ?? new int[0]) where id < 9000 select id); int[] array = RecipeOwners.Keys.Where((int id) => id < 9000 && nativeRewards.Contains(id)).ToArray(); foreach (int key in array) { RecipeOwners.Remove(key); } TechProto[] array2 = ((ProtoSet<TechProto>)(object)LDB.techs).dataArray.Where((TechProto t) => IsJoseTech15(((Proto)t).ID)).ToArray(); TechProto val2 = ((ProtoSet<TechProto>)(object)LDB.techs).Select(1964); val2.UnlockRecipes = (from r in recipes where RecipeTech(((Proto)r).ID) == 1941 && !RetiredRecipes.Contains(((Proto)r).ID) select ((Proto)r).ID).ToArray(); int[] unlockRecipes = val2.UnlockRecipes; foreach (int key2 in unlockRecipes) { RecipeOwners[key2] = 1964; } float num3 = ((ProtoSet<TechProto>)(object)LDB.techs).dataArray.Where((TechProto t) => ((Proto)t).ID < 1964 && t.Published && !t.IsHiddenTech).Min((TechProto t) => t.Position.y) - 12f; int[] array3 = new int[14] { 1964, 1992, 1991, 1993, 1994, 1995, 1996, 1997, 1988, 1998, 1999, 1989, 1965, 1966 }; TechProto[] array4 = array2; foreach (TechProto val3 in array4) { val3.UnlockRecipes = ((((Proto)val3).ID == 1964) ? val2.UnlockRecipes : (val3.UnlockRecipes ?? new int[0]).Where((int id) => !nativeRewards.Contains(id) && !RetiredRecipes.Contains(id)).ToArray()); val3.PreTechs = (val3.PreTechs ?? new int[0]).Select((int id) => (id == 1941) ? 1964 : id).Distinct().ToArray(); int num5 = Array.IndexOf(array3, ((Proto)val3).ID); val3.Position = new Vector2((float)(9 + 8 * (num5 % 4)), num3 - (float)(7 * (num5 / 4))); val3.Published = true; val3.IsHiddenTech = false; val3.postTechArray = null; } RetiredTechs.Clear(); ApplyTechs14(num3); ApplyDriveUpgrades20(); ApplyEarlySails21a(); ApplyDrive32(); ApplyScience33(num3); ApplyScience34(num3); ApplyScience35B(); ApplyScience35C(); ApplyScience37(); ApplyScience37C(); ArrangeScience32(num3); PolishTree36A(); PolishTree37C(); PolishTree38(); TechProto[] dataArray = ((ProtoSet<TechProto>)(object)LDB.techs).dataArray; foreach (TechProto val4 in dataArray) { val4.Preload(); } TechProto[] dataArray2 = ((ProtoSet<TechProto>)(object)LDB.techs).dataArray; foreach (TechProto val5 in dataArray2) { val5.Preload2(); } RecipeProto[] dataArray3 = ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray; foreach (RecipeProto recipe in dataArray3) { recipe.preTech = ((IEnumerable<TechProto>)((ProtoSet<TechProto>)(object)LDB.techs).dataArray).FirstOrDefault((Func<TechProto, bool>)((TechProto t) => (t.UnlockRecipes ?? new int[0]).Contains(((Proto)recipe).ID))); if (RecipeOwners.TryGetValue(((Proto)recipe).ID, out var value)) { recipe.preTech = ((ProtoSet<TechProto>)(object)LDB.techs).Select(value); } } foreach (KeyValuePair<int, int> item3 in nativeItemOverrides13) { ItemProto val6 = ((ProtoSet<ItemProto>)(object)LDB.items).Select(item3.Key); val6.PreTechOverride = item3.Value; val6.preTech = ((item3.Value > 0) ? ((ProtoSet<TechProto>)(object)LDB.techs).Select(item3.Value) : ((val6.maincraft == null) ? null : val6.maincraft.preTech)); } foreach (ItemProto item4 in items) { item4.preTech = ((item4.PreTechOverride > 0) ? ((ProtoSet<TechProto>)(object)LDB.techs).Select(item4.PreTechOverride) : ((item4.maincraft == null) ? null : item4.maincraft.preTech)); } ((BaseUnityPlugin)Instance).Logger.LogInfo((object)"JOSE13 TREE READY | Genesis original restaurado | Ciencia José debajo | defensas restauradas"); } private void RegisterProgression09() { //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) for (int i = 8276; i <= 8286; i++) { if (((ProtoSet<ItemProto>)(object)LDB.items).Exist(i)) { throw new InvalidOperationException("ID de objeto ocupado: " + i); } } for (int j = 9301; j <= 9311; j++) { if (((ProtoSet<RecipeProto>)(object)LDB.recipes).Exist(j)) { throw new InvalidOperationException("ID de receta ocupado: " + j); } } for (int k = 858; k <= 860; k++) { if (((ProtoSet<ModelProto>)(object)LDB.models).Exist(k)) { throw new InvalidOperationException("ID de modelo ocupado: " + k); } } for (int l = 1997; l <= 1999; l++) { if (((ProtoSet<TechProto>)(object)LDB.techs).Exist(l)) { throw new InvalidOperationException("ID tecnológico ocupado: " + l); } } AddItem(8276, "Horizontita", "Mena de planetas sólidos en sistemas de agujero negro.", "Icons/ItemRecipe/iron-ore", 111, 1, new Color(0.9f, 0.15f, 0.18f)); AddItem(8277, "Neutronita", "Mena de planetas sólidos en sistemas de estrella de neutrones.", "Icons/ItemRecipe/iron-ore", 112, 1, new Color(0.59f, 0.21f, 0.82f)); AddStellarMaterial(8278, "Horizontita procesada", 311, 9302, 1, new int[1] { 8276 }, new int[1] { 2 }, 180); AddStellarMaterial(8279, "Neutronita refinada", 312, 9303, 1, new int[1] { 8277 }, new int[1] { 2 }, 180); AddStellarMaterial(8280, "Anillo de horizonte", 411, 9304, 10, new int[2] { 8278, 8264 }, new int[2] { 2, 1 }, 240); AddStellarMaterial(8281, "Bobina de neutrones", 412, 9305, 10, new int[2] { 8279, 8259 }, new int[2] { 2, 2 }, 240); AddStellarMaterial(8282, "Matriz de singularidad JOSE", 511, 9306, 15, new int[3] { 8280, 8281, 8252 }, new int[3] { 1, 1, 1 }, 300, 1998); AddStellarMaterial(8286, "Núcleo de confinamiento estelar", 811, 9307, 10, new int[3] { 8278, 8279, 8266 }, new int[3] { 2, 2, 1 }, 360, 1998); AddRecipe(9301, "Vela solar de matriz multicolor", 812, 9, hand: false, new int[4] { 8252, 6204, 1123, 1404 }, new int[4] { 1, 2, 3, 4 }, 1501, 4, 240); RecipeOwners[9301] = 1993; AddRecipe(9308, "Matriz universal de singularidad", 813, 15, hand: false, new int[3] { 8282, 1120, 1122 }, new int[3] { 1, 2, 2 }, 6006, 4, 360); RecipeOwners[9308] = 1999; AddMachine(8283, 858, 2307, "Extractor de petróleo avanzado", 614, 9309, new int[3] { 2307, 8280, 8286 }, new int[3] { 1, 2, 1 }, 1999); AddMachine(8284, 859, 2308, "Refinería de petróleo avanzada", 615, 9310, new int[3] { 2308, 8281, 8286 }, new int[3] { 1, 2, 1 }, 1999); AddMachine(8285, 860, 2310, "Colisionador miniatura avanzado", 616, 9311, new int[4] { 2310, 8280, 8281, 8286 }, new int[4] { 1, 2, 2, 2 }, 1999); RegisterTech(1997, "Mineralogía estelar JOSE", new int[2] { 1704, 1996 }, new int[2] { 8252, 8268 }, new int[4] { 9302, 9303, 9304, 9305 }); RegisterTech(1998, "Síntesis de singularidad JOSE", new int[1] { 1997 }, JoseMatrices, new int[2] { 9306, 9307 }); RegisterTech(1999, "Confinamiento estelar JOSE", new int[3] { 1998, 1507, 1142 }, new int[1] { 8282 }, new int[4] { 9308, 9309, 9310, 9311 }); for (int m = extraTechs.Count - 3; m < extraTechs.Count; m++) { TechProto val = extraTechs[m]; int num = ((((Proto)val).ID == 1999) ? 20 : 40); val.HashNeeded = num * 60; val.PropertyItemCounts = new int[1] { num }; val.Desc = Text("Investigación industrial estelar. Consume " + num + " unidades de cada matriz indicada."); } } private void AddStellarMaterial(int id, string name, int slot, int recipeId, int type, int[] inputs, int[] counts, int ticks, int tech = 1997) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) AddItem(id, name, "Componente de la cadena industrial estelar JOSE.", (id == 8282) ? "Icons/ItemRecipe/t-matrix" : "Icons/ItemRecipe/iron-plate", slot, (id == 8282) ? 11 : 2, new Color(0.55f, 0.35f, 0.85f)); items[items.Count - 1].PreTechOverride = tech; AddRecipe(recipeId, name, slot, type, hand: false, inputs, counts, id, 1, ticks); RecipeOwners[recipeId] = tech; } private void ApplyOrbitalProgression() { TechProto val = ((ProtoSet<TechProto>)(object)LDB.techs).Select(1503); val.PreTechs = new int[1] { 1502 }; val.PreTechsImplicit = new int[5] { 1131, 1711, 1414, 1403, 1942 }; val.Items = new int[1] { 6278 }; val.ItemPoints = new int[1] { 10 }; val.HashNeeded = 288000L; TechProto val2 = ((ProtoSet<TechProto>)(object)LDB.techs).Select(1504); val2.PreTechs = new int[1] { 1502 }; val2.PreTechsImplicit = new int[4] { 1711, 1414, 1403, 1942 }; val2.Items = new int[1] { 6278 }; val2.ItemPoints = new int[1] { 10 }; val2.HashNeeded = 576000L; ChangeRecipe(72, new int[5] { 6502, 1107, 1105, 1404, 1205 }, new int[5] { 4, 8, 12, 8, 20 }); } private void ConfigureProgressionModels() { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) ScaleGenerator(2203, 85); ScaleGenerator(2204, 80); ScaleGenerator(2205, 40); for (int i = 0; i < AdvancedEquipment.Length; i++) { int num = (new int[3] { 2307, 2308, 2310 })[i]; PrefabDesc prefabDesc = ((ProtoSet<ItemProto>)(object)LDB.items).Select(num).prefabDesc; PrefabDesc prefabDesc2 = ((ProtoSet<ItemProto>)(object)LDB.items).Select(AdvancedEquipment[i]).prefabDesc; if (i == 0) { prefabDesc2.minerPeriod = Math.Max(1, prefabDesc.minerPeriod / 2); } else { prefabDesc2.assemblerSpeed = checked(prefabDesc.assemblerSpeed * 2); prefabDesc2.assemblerRecipeType = prefabDesc.assemblerRecipeType; } prefabDesc2.workEnergyPerTick = checked(prefabDesc.workEnergyPerTick * 5) / 2; prefabDesc2.idleEnergyPerTick = checked(prefabDesc.idleEnergyPerTick * 2); SetUpgradeChain(new int[2] { num, AdvancedEquipment[i] }); } } private static void ScaleGenerator(int itemId, int percent) { PrefabDesc prefabDesc = ((ProtoSet<ItemProto>)(object)LDB.items).Select(itemId).prefabDesc; prefabDesc.genEnergyPerTick = prefabDesc.genEnergyPerTick * percent / 100; } private void OrganizePresentation() { RecipeProto[] dataArray = ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray; HashSet<int> alternativeIds = new HashSet<int>(BaseAlternatives.Concat(RareAlternatives).Concat(stellarRecipes.Select((RecipeProto r) => ((Proto)r).ID))); ArrangeMatrices(); MoveJoseItem(8292, 407); ArrangeChemistry(); int[] array = new int[4] { 8250, 8254, 8276, 8277 }; for (int num = 0; num < array.Length; num++) { MoveJoseItem(array[num], 101 + num); } MoveJosePair(8256, 9259, 9274, 204); MoveJosePair(8257, 9260, 9273, 206); int[] array2 = new int[3] { 8251, 8255, 8260 }; for (int num2 = 0; num2 < array2.Length; num2++) { MoveJoseItem(array2[num2], 201 + num2); } int[] array3 = new int[9] { 8258, 8259, 8261, 8262, 8263, 8264, 8265, 8266, 8287 }; for (int num3 = 0; num3 < array3.Length; num3++) { MoveJoseItem(array3[num3], 301 + num3); } int[] array4 = new int[6] { 8278, 8279, 8291, 8280, 8281, 8293 }; for (int num4 = 0; num4 < array4.Length; num4++) { MoveJoseItem(array4[num4], 401 + num4); } int[] array5 = new int[5] { 8294, 8295, 8296, 8286, 8297 }; for (int num5 = 0; num5 < array5.Length; num5++) { MoveJoseItem(array5[num5], 501 + num5); } for (int num6 = 0; num6 < MachineLines.Length; num6++) { for (int num7 = 0; num7 < MachineLines[num6].Length; num7++) { if (num6 == 3) { continue; } ItemProto item = ((ProtoSet<ItemProto>)(object)LDB.items).Select(MachineLines[num6][num7]); string text = ((num6 == 2 && num7 != 2) ? (TierNames[num7].TrimEnd('o') + "a") : TierNames[num7]); string s = FamilyNames[num6] + " " + text; ((Proto)item).Name = Text(s); item.Description = Text("Nivel industrial " + (num7 + 1) + " de 5. Mejora con U."); foreach (RecipeProto item2 in dataArray.Where((RecipeProto r) => r.Results.Contains(((Proto)item).ID) && !RetiredRecipes.Contains(((Proto)r).ID))) { ((Proto)item2).Name = Text(s); } } } ArrangeBuildings(); ArrangeItems(alternativeIds); ArrangeIndustry29(); ArrangeActinides29A(); ArrangeIndustry29B(); ArrangeIndustry29D(); ArrangeChemistry31(); EnforceTritium32(); } private void ArrangeChemistry() { int chemistry = TabSystem.GetTabId("org.LoShin.GenesisBook:org.LoShin.GenesisBookTab2"); if (chemistry <= 2 || chemistry == matrixTab || chemistry == tab) { return; } CompactRows(chemistry, (int grid) => false, closeEmptyRows: true); HashSet<int> occupied = new HashSet<int>(((ProtoSet<ItemProto>)(object)LDB.items).dataArray.Select((ItemProto x) => x.GridIndex).Concat(((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray.Select((RecipeProto x) => x.GridIndex))); int num = Enumerable.Range(1, 9).FirstOrDefault((int y) => Enumerable.Range(1, 4).All((int x) => !occupied.Contains(chemistry * 1000 + y * 100 + x))); if (num != 0) { int[] array = new int[4] { 8288, 8289, 8290, 8292 }; for (int num2 = 0; num2 < array.Length; num2++) { int gridIndex = chemistry * 1000 + num * 100 + num2 + 1; ((ProtoSet<ItemProto>)(object)LDB.items).Select(array[num2]).GridIndex = gridIndex; ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(9312 + array[num2] - 8287).GridIndex = gridIndex; } } } private static void CompactRows(int group, Func<int, bool> reserved, bool closeEmptyRows) { ItemProto[] array = ((ProtoSet<ItemProto>)(object)LDB.items).dataArray.Where((ItemProto x) => x.GridIndex / 1000 == group).ToArray(); RecipeProto[] array2 = ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray.Where((RecipeProto x) => x.GridIndex / 1000 == group).ToArray(); IEnumerable<IGrouping<int, int>> enumerable = from x in (from x in array.Select((ItemProto x) => x.GridIndex).Concat(array2.Select((RecipeProto x) => x.GridIndex)) where !reserved(x) select x).Distinct() orderby x group x by x / 100 % 10; Dictionary<int, int> dictionary = new Dictionary<int, int>(); int num = 1; foreach (IGrouping<int, int> item in enumerable) { int num2 = (closeEmptyRows ? num++ : item.Key); int num3 = 1; foreach (int item2 in item) { for (; num3 <= 17 && reserved(group * 1000 + num2 * 100 + num3); num3++) { } if (num3 > 17) { throw new InvalidOperationException("Fila del catálogo sin espacio: " + group + "/" + num2); } dictionary.Add(item2, group * 1000 + num2 * 100 + num3++); } } ItemProto[] array3 = array; foreach (ItemProto val in array3) { if (dictionary.TryGetValue(val.GridIndex, out var value)) { val.GridIndex = value; } } RecipeProto[] array4 = array2; foreach (RecipeProto val2 in array4) { if (dictionary.TryGetValue(val2.GridIndex, out var value2)) { val2.GridIndex = value2; } } } private void MoveJosePair(int item, int normal, int efficient, int slot) { ((ProtoSet<ItemProto>)(object)LDB.items).Select(item).GridIndex = tab * 1000 + slot; ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(normal).GridIndex = tab * 1000 + slot; ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(efficient).GridIndex = ((!RetiredRecipes.Contains(efficient)) ? (tab * 1000 + slot + 1) : 0); } private void MoveJoseItem(int id, int slot) { ItemProto val = ((ProtoSet<ItemProto>)(object)LDB.items).Select(id); val.GridIndex = tab * 1000 + slot; RecipeProto[] dataArray = ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray; foreach (RecipeProto val2 in dataArray) { if (val2.Results.Length == 1 && val2.Results[0] == id && !RetiredRecipes.Contains(((Proto)val2).ID)) { val2.GridIndex = val.GridIndex; } } } private void ApplyPresentationIcons() { //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) FieldInfo fieldInfo = AccessTools.Field(typeof(RecipeProto), "_iconSprite"); for (int i = 0; i < BaseAlternatives.Length; i++) { Sprite iconSprite = ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(BaseAlternatives[i]).iconSprite; if (!((Object)(object)iconSprite == (Object)null)) { fieldInfo.SetValue(stellarRecipes[i], iconSprite); fieldInfo.SetValue(((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(RareAlternatives[i]), iconSprite); RecipeBadges.Register(((Proto)stellarRecipes[i]).ID, isPro: true); RecipeBadges.Register(RareAlternatives[i], isPro: false); } } RecipeBadges.Register(9273, isPro: false); RecipeBadges.Register(9274, isPro: false); RecipeBadges.Register(9301, isPro: false); RecipeBadges.Register(9308, isPro: true); RecipeBadges.Register(9330, isPro: false); Color[] equipmentColors = EquipmentColors; for (int j = 0; j < AdvancedEquipment.Length; j++) { try { TintMachine(AdvancedEquipment[j], equipmentColors[j]); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("JOSE 10d tinte " + AdvancedEquipment[j] + ": " + ex.Message)); } } for (int k = 0; k < MachineLines.Length; k++) { for (int l = 0; l < MachineLines[k].Length; l++) { int num = MachineLines[k][l]; if (k != 2 && num != 8253 && !UsesOriginalAppearance(num)) { try { TintMachine(num, Color32.op_Implicit(TierColors[l])); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("JOSE09r TINTE " + num + ": " + ex2.Message)); } } } } } private void RegisterAstral25() { //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) int[] array = new int[2] { 8298, 8299 }; for (int i = 0; i < array.Length; i++) { int num = array[i]; if (((ProtoSet<ItemProto>)(object)LDB.items).Exist(num)) { throw new InvalidOperationException("Astral25: objeto ocupado " + num); } } int[] array2 = new int[2] { 9333, 9334 }; for (int j = 0; j < array2.Length; j++) { int num2 = array2[j]; if (((ProtoSet<RecipeProto>)(object)LDB.recipes).Exist(num2)) { throw new InvalidOperationException("Astral25: receta ocupada " + num2); } } AddItem(8298, "Matriz fotónica eclipsada", "Matriz de confinamiento de horizonte para convergencia estelar.", "Icons/ItemRecipe/t-matrix", 807, 11, new Color(1f, 0.65f, 0.18f)); AddItem(8299, "Matriz gravitónica sobrecargada", "Matriz de confinamiento neutrónico para convergencia estelar.", "Icons/ItemRecipe/t-matrix", 808, 11, new Color(0.4f, 1f, 0.52f)); AddRecipe(9333, "Matriz fotónica eclipsada", 807, 15, hand: false, new int[2] { 8267, 8286 }, new int[2] { 1, 1 }, 8298, 1, 240); AddRecipe(9334, "Matriz gravitónica sobrecargada", 808, 15, hand: false, new int[2] { 8268, 8297 }, new int[2] { 1, 1 }, 8299, 1, 240); Dictionary<int, int> recipeOwners = RecipeOwners; int value = (RecipeOwners[9334] = 1998); recipeOwners[9333] = value; } private void ApplyAstral25Recipes() { ChangeRecipe(9267, new int[2] { 8259, 8250 }, new int[2] { 1, 1 }); ChangeRecipe(9319, new int[3] { 8291, 8260, 8278 }, new int[3] { 2, 1, 1 }); ChangeRecipe(9307, new int[3] { 8280, 8294, 8266 }, new int[3] { 1, 1, 1 }); ChangeRecipe(9315, new int[2] { 8279, 1000 }, new int[2] { 2, 2 }); ChangeRecipe(9321, new int[3] { 8289, 8290, 1119 }, new int[3] { 4, 2, 1 }); ChangeRecipe(9322, new int[3] { 8295, 8281, 8296 }, new int[3] { 1, 1, 1 }); ChangeRecipe(9306, new int[3] { 8252, 8298, 8299 }, new int[3] { 1, 1, 1 }); ChangeRecipe(9308, new int[3] { 8282, 1120, 1122 }, new int[3] { 1, 1, 1 }); ((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(9308).ResultCounts = new int[1] { 12 }; } private static bool IsJoseTech15(int id) { return (id >= 1964 && id <= 1987) || (id >= 1988 && id <= 1999); } private static bool DependsOn15(int descendant, int ancestor) { Stack<int> stack = new Stack<int>(); HashSet<int> hashSet = new HashSet<int>(); stack.Push(descendant); while (stack.Count > 0) { int num = stack.Pop(); if (!hashSet.Add(num)) { continue; } TechProto val = ((ProtoSet<TechProto>)(object)LDB.techs).Select(num); if (val == null) { continue; } foreach (int item in (val.PreTechs ?? new int[0]).Concat(val.PreTechsImplicit ?? new int[0])) { if (item == ancestor) { return true; } stack.Push(item); } } return false; } private void RegisterTierResearch15() { int[] array = new int[2] { 1965, 1966 }; for (int i = 0; i < array.Length; i++) { int num = array[i]; if (((ProtoSet<TechProto>)(object)LDB.techs).Exist(num)) { throw new InvalidOperationException("JOSE15: ID tecnológico ocupado " + num); } RegisterTech(num, (num == 1965) ? "Electrónica estelar Pro" : "Logística cuántica Pro", new int[1] { 1997 }, new int[2] { 8252, 6005 }, new int[0]); } } private void ApplyAlternatives15() { //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) int[][] array = new int[11][] { new int[3] { 1012, 8276, 8254 }, new int[3] { 1013, 8277, 8254 }, new int[3] { 1011, 8277, 8250 }, new int[3] { 1015, 8276, 8250 }, new int[4] { 1106, 1117, 8276, 8256 }, new int[3] { 8279, 1123, 1120 }, new int[3] { 1014, 8278, 8262 }, new int[4] { 1016, 8279, 1123, 8260 }, new int[5] { 7504, 1106, 8278, 8279, 8251 }, new int[3] { 1208, 8279, 8251 }, new int[4] { 6005, 8278, 8279, 8266 } }; int[][] array2 = new int[11][] { new int[3] { 1, 1, 1 }, new int[3] { 1, 1, 1 }, new int[3] { 1, 1, 1 }, new int[3] { 1, 1, 1 }, new int[4] { 3, 1, 1, 1 }, new int[3] { 4, 2, 12 }, new int[3] { 1, 1, 1 }, new int[4] { 6, 1, 2, 1 }, new int[5] { 1, 1, 1, 1, 1 }, new int[3] { 2, 1, 1 }, new int[4] { 1, 1, 1, 1 } }; int[] array3 = new int[11] { 16, 16, 16, 8, 8, 8, 8, 6, 16, 4, 64 }; int[] array4 = new int[11] { 120, 120, 240, 120, 240, 480,