Decompiled source of DarkFogWars v1.0.16
DarkFogWars.dll
Decompiled a day 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.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UXAssist.UI; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("DarkFogWars")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+17c10299592f21a3964196820c8623486c0a8fd4")] [assembly: AssemblyProduct("DarkFogWars")] [assembly: AssemblyTitle("DarkFogWars")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace DarkFogWars { [BepInPlugin("com.leo.darkfogwars", "DarkFogWars", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class DarkFogWarsPlugin : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static UnityAction <0>__CheckGroundUnits; public static UnityAction <1>__CheckAggrStats; public static UnityAction <2>__CheckHiveUnits; public static UnityAction <3>__CheckHiveStatus; public static UnityAction <4>__ForceSendLancers; public static UnityAction <5>__CheckTurretBeaconPrefab; public static UnityAction <6>__ForceSpawnSeeds; public static UnityAction <7>__PopulateHivesInCurrentStar; public static UnityAction <8>__ClearGroundUnitsOnPlanet; public static UnityAction <9>__LancersCheatfill; } [CompilerGenerated] private sealed class <DFGBaseComponent_UpdateFactoryThreat_Transpiler>d__115 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable<CodeInstruction> instructions; public IEnumerable<CodeInstruction> <>3__instructions; private MethodInfo <overrideMethod>5__2; private IEnumerator<CodeInstruction> <>7__wrap2; private CodeInstruction <instruction>5__4; CodeInstruction IEnumerator<CodeInstruction>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DFGBaseComponent_UpdateFactoryThreat_Transpiler>d__115(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 1u) { try { } finally { <>m__Finally1(); } } <overrideMethod>5__2 = null; <>7__wrap2 = null; <instruction>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <overrideMethod>5__2 = AccessTools.Method(typeof(DarkFogWarsPlugin), "OverrideAssaultingBaseCount", (Type[])null, (Type[])null); <>7__wrap2 = instructions.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; if (<instruction>5__4.opcode == OpCodes.Ldarg_S && <instruction>5__4.operand is byte b && b == 5) { <>2__current = new CodeInstruction(OpCodes.Call, (object)<overrideMethod>5__2); <>1__state = 2; return true; } goto IL_00f3; case 2: { <>1__state = -3; goto IL_00f3; } IL_00f3: <instruction>5__4 = null; break; } if (<>7__wrap2.MoveNext()) { <instruction>5__4 = <>7__wrap2.Current; <>2__current = <instruction>5__4; <>1__state = 1; return true; } <>m__Finally1(); <>7__wrap2 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap2 != null) { <>7__wrap2.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator() { <DFGBaseComponent_UpdateFactoryThreat_Transpiler>d__115 <DFGBaseComponent_UpdateFactoryThreat_Transpiler>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <DFGBaseComponent_UpdateFactoryThreat_Transpiler>d__ = this; } else { <DFGBaseComponent_UpdateFactoryThreat_Transpiler>d__ = new <DFGBaseComponent_UpdateFactoryThreat_Transpiler>d__115(0); } <DFGBaseComponent_UpdateFactoryThreat_Transpiler>d__.instructions = <>3__instructions; return <DFGBaseComponent_UpdateFactoryThreat_Transpiler>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<CodeInstruction>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <DFGReplicatorComponent_LogicTick_Transpiler>d__117 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable<CodeInstruction> instructions; public IEnumerable<CodeInstruction> <>3__instructions; private MethodInfo <addUnitMethod>5__2; private MethodInfo <batchAddUnitMethod>5__3; private IEnumerator<CodeInstruction> <>7__wrap3; CodeInstruction IEnumerator<CodeInstruction>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DFGReplicatorComponent_LogicTick_Transpiler>d__117(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 1u) { try { } finally { <>m__Finally1(); } } <addUnitMethod>5__2 = null; <batchAddUnitMethod>5__3 = null; <>7__wrap3 = null; <>1__state = -2; } private bool MoveNext() { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <addUnitMethod>5__2 = AccessTools.Method(typeof(EnemyFormation), "AddUnit", (Type[])null, (Type[])null); <batchAddUnitMethod>5__3 = AccessTools.Method(typeof(DarkFogWarsPlugin), "BatchAddUnitGround", (Type[])null, (Type[])null); <>7__wrap3 = instructions.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; break; case 2: <>1__state = -3; break; } if (<>7__wrap3.MoveNext()) { CodeInstruction current = <>7__wrap3.Current; if (CodeInstructionExtensions.Calls(current, <addUnitMethod>5__2)) { <>2__current = new CodeInstruction(OpCodes.Call, (object)<batchAddUnitMethod>5__3); <>1__state = 1; return true; } <>2__current = current; <>1__state = 2; return true; } <>m__Finally1(); <>7__wrap3 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap3 != null) { <>7__wrap3.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator() { <DFGReplicatorComponent_LogicTick_Transpiler>d__117 <DFGReplicatorComponent_LogicTick_Transpiler>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <DFGReplicatorComponent_LogicTick_Transpiler>d__ = this; } else { <DFGReplicatorComponent_LogicTick_Transpiler>d__ = new <DFGReplicatorComponent_LogicTick_Transpiler>d__117(0); } <DFGReplicatorComponent_LogicTick_Transpiler>d__.instructions = <>3__instructions; return <DFGReplicatorComponent_LogicTick_Transpiler>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<CodeInstruction>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <DFRelayComponent_LogicTickLogisticsOrders_Transpiler>d__105 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable<CodeInstruction> instructions; public IEnumerable<CodeInstruction> <>3__instructions; private MethodInfo <multiplyMatterMethod>5__2; private MethodInfo <multiplyEnergyMethod>5__3; private IEnumerator<CodeInstruction> <>7__wrap3; CodeInstruction IEnumerator<CodeInstruction>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DFRelayComponent_LogicTickLogisticsOrders_Transpiler>d__105(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 4u) { try { } finally { <>m__Finally1(); } } <multiplyMatterMethod>5__2 = null; <multiplyEnergyMethod>5__3 = null; <>7__wrap3 = null; <>1__state = -2; } private bool MoveNext() { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <multiplyMatterMethod>5__2 = AccessTools.Method(typeof(DarkFogWarsPlugin), "MultiplyCarrierMatter", (Type[])null, (Type[])null); <multiplyEnergyMethod>5__3 = AccessTools.Method(typeof(DarkFogWarsPlugin), "MultiplyCarrierEnergy", (Type[])null, (Type[])null); <>7__wrap3 = instructions.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; <>2__current = new CodeInstruction(OpCodes.Call, (object)<multiplyMatterMethod>5__2); <>1__state = 2; return true; case 2: <>1__state = -3; break; case 3: <>1__state = -3; <>2__current = new CodeInstruction(OpCodes.Call, (object)<multiplyEnergyMethod>5__3); <>1__state = 4; return true; case 4: <>1__state = -3; break; case 5: <>1__state = -3; break; } if (<>7__wrap3.MoveNext()) { CodeInstruction current = <>7__wrap3.Current; if (current.opcode == OpCodes.Ldc_I4 && current.operand is int num && num == 6000) { <>2__current = current; <>1__state = 1; return true; } if (current.opcode == OpCodes.Ldc_I4 && current.operand is int num2 && num2 == 5000000) { <>2__current = current; <>1__state = 3; return true; } <>2__current = current; <>1__state = 5; return true; } <>m__Finally1(); <>7__wrap3 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap3 != null) { <>7__wrap3.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator() { <DFRelayComponent_LogicTickLogisticsOrders_Transpiler>d__105 <DFRelayComponent_LogicTickLogisticsOrders_Transpiler>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <DFRelayComponent_LogicTickLogisticsOrders_Transpiler>d__ = this; } else { <DFRelayComponent_LogicTickLogisticsOrders_Transpiler>d__ = new <DFRelayComponent_LogicTickLogisticsOrders_Transpiler>d__105(0); } <DFRelayComponent_LogicTickLogisticsOrders_Transpiler>d__.instructions = <>3__instructions; return <DFRelayComponent_LogicTickLogisticsOrders_Transpiler>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<CodeInstruction>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <DFRelayComponent_RealizePlanetBase_Transpiler>d__95 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable<CodeInstruction> instructions; public IEnumerable<CodeInstruction> <>3__instructions; private List<CodeInstruction>.Enumerator <>7__wrap1; CodeInstruction IEnumerator<CodeInstruction>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DFRelayComponent_RealizePlanetBase_Transpiler>d__95(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <>7__wrap1 = default(List<CodeInstruction>.Enumerator); <>1__state = -2; } private bool MoveNext() { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: { <>1__state = -1; MethodInfo methodInfo = AccessTools.Method(typeof(GrowthPattern_DFGround), "BakePreview", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(DarkFogWarsPlugin), "GetMatterSpeedScale", (Type[])null, (Type[])null); List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (i < list.Count - 1 && list[i].opcode == OpCodes.Ldc_I4_1 && CodeInstructionExtensions.Calls(list[i + 1], methodInfo)) { list[i] = new CodeInstruction(OpCodes.Call, (object)methodInfo2); } } <>7__wrap1 = list.GetEnumerator(); <>1__state = -3; break; } case 1: <>1__state = -3; break; } if (<>7__wrap1.MoveNext()) { CodeInstruction current = <>7__wrap1.Current; <>2__current = current; <>1__state = 1; return true; } <>m__Finally1(); <>7__wrap1 = default(List<CodeInstruction>.Enumerator); return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>7__wrap1).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator() { <DFRelayComponent_RealizePlanetBase_Transpiler>d__95 <DFRelayComponent_RealizePlanetBase_Transpiler>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <DFRelayComponent_RealizePlanetBase_Transpiler>d__ = this; } else { <DFRelayComponent_RealizePlanetBase_Transpiler>d__ = new <DFRelayComponent_RealizePlanetBase_Transpiler>d__95(0); } <DFRelayComponent_RealizePlanetBase_Transpiler>d__.instructions = <>3__instructions; return <DFRelayComponent_RealizePlanetBase_Transpiler>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<CodeInstruction>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <DFSReplicatorComponent_LogicTick_Transpiler>d__119 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable<CodeInstruction> instructions; public IEnumerable<CodeInstruction> <>3__instructions; private MethodInfo <addUnitMethod>5__2; private MethodInfo <batchAddUnitMethod>5__3; private IEnumerator<CodeInstruction> <>7__wrap3; CodeInstruction IEnumerator<CodeInstruction>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DFSReplicatorComponent_LogicTick_Transpiler>d__119(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 1u) { try { } finally { <>m__Finally1(); } } <addUnitMethod>5__2 = null; <batchAddUnitMethod>5__3 = null; <>7__wrap3 = null; <>1__state = -2; } private bool MoveNext() { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <addUnitMethod>5__2 = AccessTools.Method(typeof(EnemyFormation), "AddUnit", (Type[])null, (Type[])null); <batchAddUnitMethod>5__3 = AccessTools.Method(typeof(DarkFogWarsPlugin), "BatchAddUnitHive", (Type[])null, (Type[])null); <>7__wrap3 = instructions.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; break; case 2: <>1__state = -3; break; } if (<>7__wrap3.MoveNext()) { CodeInstruction current = <>7__wrap3.Current; if (CodeInstructionExtensions.Calls(current, <addUnitMethod>5__2)) { <>2__current = new CodeInstruction(OpCodes.Call, (object)<batchAddUnitMethod>5__3); <>1__state = 1; return true; } <>2__current = current; <>1__state = 2; return true; } <>m__Finally1(); <>7__wrap3 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap3 != null) { <>7__wrap3.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator() { <DFSReplicatorComponent_LogicTick_Transpiler>d__119 <DFSReplicatorComponent_LogicTick_Transpiler>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <DFSReplicatorComponent_LogicTick_Transpiler>d__ = this; } else { <DFSReplicatorComponent_LogicTick_Transpiler>d__ = new <DFSReplicatorComponent_LogicTick_Transpiler>d__119(0); } <DFSReplicatorComponent_LogicTick_Transpiler>d__.instructions = <>3__instructions; return <DFSReplicatorComponent_LogicTick_Transpiler>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<CodeInstruction>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <EnemyBuilderComponent_BuildLogic_Ground_Transpiler>d__97 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable<CodeInstruction> instructions; public IEnumerable<CodeInstruction> <>3__instructions; private FieldInfo <matterSpeedField>5__2; private MethodInfo <multiplyMethod>5__3; private IEnumerator<CodeInstruction> <>7__wrap3; private CodeInstruction <instruction>5__5; CodeInstruction IEnumerator<CodeInstruction>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <EnemyBuilderComponent_BuildLogic_Ground_Transpiler>d__97(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 1u) { try { } finally { <>m__Finally1(); } } <matterSpeedField>5__2 = null; <multiplyMethod>5__3 = null; <>7__wrap3 = null; <instruction>5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <matterSpeedField>5__2 = AccessTools.Field(typeof(Builder), "matterSpeed"); <multiplyMethod>5__3 = AccessTools.Method(typeof(DarkFogWarsPlugin), "MultiplyGroundBuilderSpeed", (Type[])null, (Type[])null); <>7__wrap3 = instructions.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; if (CodeInstructionExtensions.LoadsField(<instruction>5__5, <matterSpeedField>5__2, false)) { <>2__current = new CodeInstruction(OpCodes.Call, (object)<multiplyMethod>5__3); <>1__state = 2; return true; } goto IL_00e5; case 2: { <>1__state = -3; goto IL_00e5; } IL_00e5: <instruction>5__5 = null; break; } if (<>7__wrap3.MoveNext()) { <instruction>5__5 = <>7__wrap3.Current; <>2__current = <instruction>5__5; <>1__state = 1; return true; } <>m__Finally1(); <>7__wrap3 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap3 != null) { <>7__wrap3.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator() { <EnemyBuilderComponent_BuildLogic_Ground_Transpiler>d__97 <EnemyBuilderComponent_BuildLogic_Ground_Transpiler>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <EnemyBuilderComponent_BuildLogic_Ground_Transpiler>d__ = this; } else { <EnemyBuilderComponent_BuildLogic_Ground_Transpiler>d__ = new <EnemyBuilderComponent_BuildLogic_Ground_Transpiler>d__97(0); } <EnemyBuilderComponent_BuildLogic_Ground_Transpiler>d__.instructions = <>3__instructions; return <EnemyBuilderComponent_BuildLogic_Ground_Transpiler>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<CodeInstruction>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <EnemyBuilderComponent_BuildLogic_Space_Transpiler>d__99 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable<CodeInstruction> instructions; public IEnumerable<CodeInstruction> <>3__instructions; private FieldInfo <matterSpeedField>5__2; private MethodInfo <multiplyMethod>5__3; private IEnumerator<CodeInstruction> <>7__wrap3; private CodeInstruction <instruction>5__5; CodeInstruction IEnumerator<CodeInstruction>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <EnemyBuilderComponent_BuildLogic_Space_Transpiler>d__99(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 1u) { try { } finally { <>m__Finally1(); } } <matterSpeedField>5__2 = null; <multiplyMethod>5__3 = null; <>7__wrap3 = null; <instruction>5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <matterSpeedField>5__2 = AccessTools.Field(typeof(Builder), "matterSpeed"); <multiplyMethod>5__3 = AccessTools.Method(typeof(DarkFogWarsPlugin), "MultiplyHiveBuilderSpeed", (Type[])null, (Type[])null); <>7__wrap3 = instructions.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; if (CodeInstructionExtensions.LoadsField(<instruction>5__5, <matterSpeedField>5__2, false)) { <>2__current = new CodeInstruction(OpCodes.Call, (object)<multiplyMethod>5__3); <>1__state = 2; return true; } goto IL_00e5; case 2: { <>1__state = -3; goto IL_00e5; } IL_00e5: <instruction>5__5 = null; break; } if (<>7__wrap3.MoveNext()) { <instruction>5__5 = <>7__wrap3.Current; <>2__current = <instruction>5__5; <>1__state = 1; return true; } <>m__Finally1(); <>7__wrap3 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap3 != null) { <>7__wrap3.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator() { <EnemyBuilderComponent_BuildLogic_Space_Transpiler>d__99 <EnemyBuilderComponent_BuildLogic_Space_Transpiler>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <EnemyBuilderComponent_BuildLogic_Space_Transpiler>d__ = this; } else { <EnemyBuilderComponent_BuildLogic_Space_Transpiler>d__ = new <EnemyBuilderComponent_BuildLogic_Space_Transpiler>d__99(0); } <EnemyBuilderComponent_BuildLogic_Space_Transpiler>d__.instructions = <>3__instructions; return <EnemyBuilderComponent_BuildLogic_Space_Transpiler>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<CodeInstruction>)this).GetEnumerator(); } } public const string PluginGuid = "com.leo.darkfogwars"; public const string PluginName = "DarkFogWars"; public const string PluginVersion = "1.0.0"; private const string LogPrefix = "[DarkFogWars] "; private static DarkFogWarsPlugin _instance; private static Harmony _harmony; public static ConfigEntry<float> CfgAggressivenessOverride; public static ConfigEntry<int> CfgReplicatorBatchSize; public static ConfigEntry<int> CfgMaxRaiders; public static ConfigEntry<int> CfgMaxRangers; public static ConfigEntry<int> CfgMaxGuardians; public static ConfigEntry<int> CfgLancerSupplyMultiplier; public static ConfigEntry<int> CfgLancerBatchSize; public static ConfigEntry<int> CfgLancerWaveMultiplier; public static ConfigEntry<int> CfgHiveThreatMultiplier; public static ConfigEntry<int> CfgGroundThreatTrend; public static ConfigEntry<int> CfgGroundBuilderSpeed; public static ConfigEntry<int> CfgHiveBuilderSpeed; public static ConfigEntry<int> CfgHiveGenEnergy; public static ConfigEntry<int> CfgGroundGenMatter; public static ConfigEntry<float> CfgCarrierCapacity; public static ConfigEntry<float> CfgHiveTurretAttackRange; public static ConfigEntry<float> CfgUnitAttackRange; public static ConfigEntry<bool> CfgNeverStoppingThreat; public static ConfigEntry<int> CfgRelayMaxPorts; public static ConfigEntry<int> CfgPlanetaryBaseWaveMultiplier; public static ConfigEntry<float> CfgHiveThreatSnowball; public static ConfigEntry<int> CfgHiveThreatTrend; public static ConfigEntry<int> CfgIcarusGroundFleetPortMultiplier; public static ConfigEntry<int> CfgIcarusSpaceFleetPortMultiplier; public static ConfigEntry<float> CfgIcarusDroneHpMultiplier; public static ConfigEntry<float> CfgIcarusSpaceShipHpMultiplier; public static ConfigEntry<float> CfgIcarusSignalTowerRangeMultiplier; public static ConfigEntry<float> CfgIcarusMissileTurretSpaceRangeMultiplier; public static ConfigEntry<float> CfgIcarusGroundFleetEnergyMultiplier; public static ConfigEntry<float> CfgIcarusSpaceFleetEnergyMultiplier; public static ConfigEntry<float> CfgIcarusSignalTowerHpMultiplier; public static ConfigEntry<float> CfgIcarusBABPickRangeMultiplier; public static ConfigEntry<float> CfgIcarusBABHpMultiplier; public static ConfigEntry<int> CfgMissileTurretSpaceRange; public static ConfigEntry<int> CfgSignalTowerSpaceRange; public static ConfigEntry<int> CfgBABConstructionDrones; public static ConfigEntry<float> CfgBABRepairBonusPercent; public static ConfigEntry<float> CfgPlasmaTurretFirerateMultiplier; public static ConfigEntry<float> CfgGaussTurretFirerateMultiplier; public static ConfigEntry<float> CfgShieldEnergyConsumptionMultiplier; public static ConfigEntry<float> CfgShieldEnergyPoolMultiplier; public static ConfigEntry<float> CfgSeedSpeedMultiplier; private static bool _uiRegistered; private static RectTransform _tabCommands; private static RectTransform _tabHive; private static RectTransform _tabGround; private static RectTransform _tabIcarus; private static int _threatBefore; private const int SIGNAL_TOWER_BASE_HP = 300000; private const int BAB_BASE_HP = 75000; private void Awake() { //IL_05b7: Unknown result type (might be due to invalid IL or missing references) //IL_05c1: Expected O, but got Unknown _instance = this; CfgAggressivenessOverride = ((BaseUnityPlugin)this).Config.Bind<float>("Aggressiveness", "AggressivenessOverride", 3f, "Override aggressiveness level. -1 = use game setting. 3-8 = custom level (3=Sharp, 4=Rampage, 5=Apocalypse, 6=Cataclysm, 7=Extinction, 8=Annihilation)"); CfgReplicatorBatchSize = ((BaseUnityPlugin)this).Config.Bind<int>("Ground", "ReplicatorBatchSize", 3, "Number of units spawned per replicator completion. 1 = vanilla, up to 75."); CfgMaxRaiders = ((BaseUnityPlugin)this).Config.Bind<int>("Ground", "MaxRaiders", 360, "Base max raiders per ground base. Vanilla = 72. Scaled by aggressiveness and level."); CfgMaxRangers = ((BaseUnityPlugin)this).Config.Bind<int>("Ground", "MaxRangers", 470, "Base max rangers per ground base. Vanilla = 108. Scaled by aggressiveness and level."); CfgMaxGuardians = ((BaseUnityPlugin)this).Config.Bind<int>("Ground", "MaxGuardians", 120, "Base max guardians per ground base. Vanilla = 48. Scaled by aggressiveness and level."); CfgLancerSupplyMultiplier = ((BaseUnityPlugin)this).Config.Bind<int>("Hive", "LancerSupplyMultiplier", 10, "Multiplier for hive lancer supply. 1 = vanilla, 10 = 10x lancer production capacity."); CfgLancerBatchSize = ((BaseUnityPlugin)this).Config.Bind<int>("Hive", "LancerBatchSize", 10, "Number of lancers spawned per hive replicator completion. 1 = vanilla, up to 75."); CfgLancerWaveMultiplier = ((BaseUnityPlugin)this).Config.Bind<int>("Hive", "LancerWaveMultiplier", 10, "Multiplier for lancer assault wave size. 1 = vanilla (max 360), 10 = 10x lancers per wave."); CfgHiveThreatMultiplier = ((BaseUnityPlugin)this).Config.Bind<int>("Hive", "ThreatMultiplier", 30, "Multiplier for hive threat generation. 1 = vanilla, 30 = 30x faster threat accumulation."); CfgGroundThreatTrend = ((BaseUnityPlugin)this).Config.Bind<int>("Ground", "ThreatTrend", 10, "Percentage of maxThreat added to other bases on same planet when one base launches assault. 1-20%."); CfgGroundBuilderSpeed = ((BaseUnityPlugin)this).Config.Bind<int>("Ground", "BuilderSpeed", 5, "Multiplier for ground builder matter transfer speed. 1 = vanilla, 5 = 5x faster building."); CfgHiveBuilderSpeed = ((BaseUnityPlugin)this).Config.Bind<int>("Hive", "BuilderSpeed", 5, "Multiplier for hive builder matter transfer speed. 1 = vanilla, 5 = 5x faster building."); CfgHiveGenEnergy = ((BaseUnityPlugin)this).Config.Bind<int>("Hive", "GenEnergy", 5, "Multiplier for hive energy generation. 1 = vanilla, 5 = 5x faster energy."); CfgGroundGenMatter = ((BaseUnityPlugin)this).Config.Bind<int>("Ground", "GenMatter", 5, "Multiplier for ground base matter generation. 1 = vanilla, 5 = 5x faster matter."); CfgCarrierCapacity = ((BaseUnityPlugin)this).Config.Bind<float>("Hive", "CarrierCapacity", 5f, "Multiplier for carrier matter/energy capacity. 1 = vanilla, 5 = 5x capacity."); CfgHiveTurretAttackRange = ((BaseUnityPlugin)this).Config.Bind<float>("Hive", "TurretAttackRange", 1.1f, "Multiplier for hive core turret attack range. 1 = vanilla, 1.1 = 1.1x range."); CfgUnitAttackRange = ((BaseUnityPlugin)this).Config.Bind<float>("Ground", "UnitAttackRange", 1.1f, "Multiplier for raider/ranger attack range. 1 = vanilla, 1.1 = 1.1x range."); CfgNeverStoppingThreat = ((BaseUnityPlugin)this).Config.Bind<bool>("Ground", "NeverStoppingThreat", true, "If true, base threat continues to build during assault waves instead of halting."); CfgRelayMaxPorts = ((BaseUnityPlugin)this).Config.Bind<int>("Hive", "RelayMaxPorts", 160, "Max relay ports per hive. Vanilla = 6, max = 160. Allows hive to produce more relays."); CfgPlanetaryBaseWaveMultiplier = ((BaseUnityPlugin)this).Config.Bind<int>("Ground", "PlanetaryBaseWaveMultiplier", 5, "Multiplier for planetary base assault wave size. 1 = vanilla, 5 = 5x wave size."); CfgHiveThreatSnowball = ((BaseUnityPlugin)this).Config.Bind<float>("Hive", "ThreatSnowball", 0.1f, "Extra threat added per wave count. 0 = disabled, 0.1 = +10% threat per wave (wave 5 = +50% threat rate)."); CfgHiveThreatTrend = ((BaseUnityPlugin)this).Config.Bind<int>("Hive", "ThreatTrend", 10, "Percentage of maxThreat added to other hives when one hive launches assault. 1-80%."); CfgIcarusGroundFleetPortMultiplier = ((BaseUnityPlugin)this).Config.Bind<int>("Icarus", "GroundFleetPortMultiplier", 5, "Multiplier for Icarus ground fleet drone ports per fleet. 1 = vanilla (12 ports), 5 = 60 ports, etc. Formation is duplicated with offset."); CfgIcarusSpaceFleetPortMultiplier = ((BaseUnityPlugin)this).Config.Bind<int>("Icarus", "SpaceFleetPortMultiplier", 5, "Multiplier for Icarus space fleet drone ports per fleet. 1 = vanilla, 5 = 5x ports. Formation is duplicated with offset."); CfgIcarusDroneHpMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Icarus", "DroneHpMultiplier", 4f, "Multiplier for Icarus combat drone HP (ground fleet). 1 = vanilla, 4 = 4x HP."); CfgIcarusSpaceShipHpMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Icarus", "SpaceShipHpMultiplier", 4f, "Multiplier for Icarus space ship HP (Corvettes, Destroyers). 1 = vanilla, 4 = 4x HP."); CfgIcarusSignalTowerRangeMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Icarus", "SignalTowerRangeMultiplier", 1.1f, "Multiplier for Signal Tower signal range. Also increases energy consumption by 2x of this value."); CfgIcarusMissileTurretSpaceRangeMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Icarus", "MissileTurretSpaceRangeMultiplier", 2f, "Multiplier for Missile Turret space attack range. 1 = vanilla, 2 = 2x range."); CfgIcarusGroundFleetEnergyMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Icarus", "GroundFleetEnergyMultiplier", 0.5f, "Multiplier for ground fleet drone energy consumption. 1 = vanilla, 0.5 = half energy."); CfgIcarusSpaceFleetEnergyMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Icarus", "SpaceFleetEnergyMultiplier", 0.5f, "Multiplier for space fleet drone energy consumption. 1 = vanilla, 0.5 = half energy."); CfgIcarusSignalTowerHpMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Icarus", "SignalTowerHpMultiplier", 2f, "Multiplier for Signal Tower HP. 1 = vanilla, 2 = 2x HP."); CfgIcarusBABPickRangeMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Icarus", "BABPickRangeMultiplier", 1.25f, "Multiplier for Battlefield Analysis Base garbage collector (pick) range. 1 = vanilla, 1.25 = 1.25x range."); CfgIcarusBABHpMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Icarus", "BABHpMultiplier", 2f, "Multiplier for Battlefield Analysis Base HP. 1 = vanilla, 2 = 2x HP."); CfgMissileTurretSpaceRange = ((BaseUnityPlugin)this).Config.Bind<int>("Buildings", "MissileTurretSpaceRange", 7800, "Missile Turret space attack range in meters. Vanilla = 4200."); CfgSignalTowerSpaceRange = ((BaseUnityPlugin)this).Config.Bind<int>("Buildings", "SignalTowerSpaceRange", 7800, "Signal Tower space signal range in meters. Vanilla = 4200."); CfgBABConstructionDrones = ((BaseUnityPlugin)this).Config.Bind<int>("Buildings", "BABConstructionDrones", 24, "Number of construction drones for Battlefield Analysis Base. Vanilla = 12."); CfgBABRepairBonusPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Ground", "BABRepairBonusPercent", 0.001f, "Bonus HP repair per tick as percentage of unit max HP. 0.001 = 0.1%, 0.02 = 2.0%."); CfgPlasmaTurretFirerateMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Ground", "PlasmaTurretFirerateMultiplier", 2f, "Multiplier for Plasma Turret fire rate. 1 = vanilla, 2 = 2x faster, 10 = 10x faster."); CfgGaussTurretFirerateMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Ground", "GaussTurretFirerateMultiplier", 3f, "Multiplier for Gauss Turret fire rate. 1 = vanilla, 4 = 4x faster, 10 = 10x faster."); CfgShieldEnergyConsumptionMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Buildings", "ShieldEnergyConsumptionMultiplier", 4f, "Multiplier for Planetary Shield energy consumption. 1 = vanilla, 4 = 4x consumption."); CfgShieldEnergyPoolMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Buildings", "ShieldEnergyPoolMultiplier", 4f, "Multiplier for Planetary Shield energy pool capacity. 1 = vanilla, 4 = 4x capacity."); CfgSeedSpeedMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Hive", "SeedSpeedMultiplier", 3.5f, "Multiplier for seed (tinder) travel speed. 1 = vanilla, 3.5 = 3.5x faster."); _harmony = new Harmony("com.leo.darkfogwars"); _harmony.PatchAll(typeof(DarkFogWarsPlugin)); ((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("{0}Plugin loaded. Aggressiveness override: {1}", "[DarkFogWars] ", CfgAggressivenessOverride.Value)); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } [HarmonyPatch(typeof(UIRoot), "OpenMainMenuUI")] [HarmonyPostfix] private static void UIRoot_OpenMainMenuUI_Postfix() { RegisterUI(); } [HarmonyPatch(typeof(UIRoot), "OpenGameUI")] [HarmonyPostfix] private static void UIRoot_OpenGameUI_Postfix() { RegisterUI(); } private static void RegisterUI() { if (_uiRegistered) { return; } _uiRegistered = true; try { MyConfigWindow.OnUICreated = (Action<MyConfigWindow, RectTransform>)Delegate.Combine(MyConfigWindow.OnUICreated, new Action<MyConfigWindow, RectTransform>(CreateUI)); DarkFogWarsPlugin instance = _instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)"[DarkFogWars] Registered with UXAssist"); } } catch (Exception ex) { DarkFogWarsPlugin instance2 = _instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogError((object)("[DarkFogWars] Failed to register UI: " + ex.Message)); } } } private static void CreateUI(MyConfigWindow wnd, RectTransform trans) { //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_00b5: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Expected O, but got Unknown //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Expected O, but got Unknown //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Expected O, but got Unknown //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Expected O, but got Unknown //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Expected O, but got Unknown //IL_0687: Unknown result type (might be due to invalid IL or missing references) //IL_068c: Unknown result type (might be due to invalid IL or missing references) //IL_0692: Expected O, but got Unknown ((MyWindowWithTabs)wnd).AddTabGroup(trans, "Dark Fog Wars", "tab-group-darkfogwars"); _tabCommands = ((MyWindowWithTabs)wnd).AddTab(trans, "Commands"); float num = 10f; float num2 = 0f; ((MyWindow)wnd).AddText2(num2, num, _tabCommands, "Aggressiveness Override:", 14, "label"); num += 24f; ((MyWindow)wnd).AddSlider<float>(num2, num, _tabCommands, CfgAggressivenessOverride, (ValueMapper<float>)(object)new RangeValueWithMultiplierMapper<float>(3, 8, 1f), "F0", 200f); num += 30f; float num3 = num; RectTransform tabCommands = _tabCommands; object obj = <>O.<0>__CheckGroundUnits; if (obj == null) { UnityAction val = CheckGroundUnits; <>O.<0>__CheckGroundUnits = val; obj = (object)val; } ((MyWindow)wnd).AddButton(num2, num3, 200f, tabCommands, "Check Ground Units", 14, "btn-ground-units", (UnityAction)obj); num += 30f; float num4 = num; RectTransform tabCommands2 = _tabCommands; object obj2 = <>O.<1>__CheckAggrStats; if (obj2 == null) { UnityAction val2 = CheckAggrStats; <>O.<1>__CheckAggrStats = val2; obj2 = (object)val2; } ((MyWindow)wnd).AddButton(num2, num4, 200f, tabCommands2, "Check Aggr Stats", 14, "btn-aggr-stats", (UnityAction)obj2); num += 30f; float num5 = num; RectTransform tabCommands3 = _tabCommands; object obj3 = <>O.<2>__CheckHiveUnits; if (obj3 == null) { UnityAction val3 = CheckHiveUnits; <>O.<2>__CheckHiveUnits = val3; obj3 = (object)val3; } ((MyWindow)wnd).AddButton(num2, num5, 200f, tabCommands3, "Check Hive Units", 14, "btn-hive-units", (UnityAction)obj3); num += 30f; float num6 = num; RectTransform tabCommands4 = _tabCommands; object obj4 = <>O.<3>__CheckHiveStatus; if (obj4 == null) { UnityAction val4 = CheckHiveStatus; <>O.<3>__CheckHiveStatus = val4; obj4 = (object)val4; } ((MyWindow)wnd).AddButton(num2, num6, 200f, tabCommands4, "Check Hive Status", 14, "btn-hive-status", (UnityAction)obj4); num += 30f; float num7 = num; RectTransform tabCommands5 = _tabCommands; object obj5 = <>O.<4>__ForceSendLancers; if (obj5 == null) { UnityAction val5 = ForceSendLancers; <>O.<4>__ForceSendLancers = val5; obj5 = (object)val5; } ((MyWindow)wnd).AddButton(num2, num7, 200f, tabCommands5, "Force Send Lancers", 14, "btn-force-lancers", (UnityAction)obj5); num += 30f; float num8 = num; RectTransform tabCommands6 = _tabCommands; object obj6 = <>O.<5>__CheckTurretBeaconPrefab; if (obj6 == null) { UnityAction val6 = CheckTurretBeaconPrefab; <>O.<5>__CheckTurretBeaconPrefab = val6; obj6 = (object)val6; } ((MyWindow)wnd).AddButton(num2, num8, 200f, tabCommands6, "Check Turret/Beacon", 14, "btn-check-prefab", (UnityAction)obj6); num += 30f; float num9 = num; RectTransform tabCommands7 = _tabCommands; object obj7 = <>O.<6>__ForceSpawnSeeds; if (obj7 == null) { UnityAction val7 = ForceSpawnSeeds; <>O.<6>__ForceSpawnSeeds = val7; obj7 = (object)val7; } ((MyWindow)wnd).AddButton(num2, num9, 200f, tabCommands7, "Force Spawn Seeds", 14, "btn-force-seeds", (UnityAction)obj7); num += 30f; float num10 = num; RectTransform tabCommands8 = _tabCommands; object obj8 = <>O.<7>__PopulateHivesInCurrentStar; if (obj8 == null) { UnityAction val8 = PopulateHivesInCurrentStar; <>O.<7>__PopulateHivesInCurrentStar = val8; obj8 = (object)val8; } ((MyWindow)wnd).AddButton(num2, num10, 200f, tabCommands8, "Populate Hives", 14, "btn-populate-hives", (UnityAction)obj8); num += 30f; float num11 = num; RectTransform tabCommands9 = _tabCommands; object obj9 = <>O.<8>__ClearGroundUnitsOnPlanet; if (obj9 == null) { UnityAction val9 = ClearGroundUnitsOnPlanet; <>O.<8>__ClearGroundUnitsOnPlanet = val9; obj9 = (object)val9; } ((MyWindow)wnd).AddButton(num2, num11, 200f, tabCommands9, "Clear Ground Units", 14, "btn-clear-ground", (UnityAction)obj9); _tabHive = ((MyWindowWithTabs)wnd).AddTab(trans, "Hive"); float num12 = 10f; float num13 = 0f; ((MyWindow)wnd).AddText2(num13, num12, _tabHive, "Lancer Units per Batch:", 14, "label"); num12 += 24f; ((MyWindow)wnd).AddSlider<int>(num13, num12, _tabHive, CfgLancerBatchSize, (ValueMapper<int>)(object)new RangeValueMapper<int>(1, 75), "", 200f); num12 += 36f; ((MyWindow)wnd).AddText2(num13, num12, _tabHive, "Lancer Wave Multiplier:", 14, "label"); num12 += 24f; ((MyWindow)wnd).AddSlider<int>(num13, num12, _tabHive, CfgLancerWaveMultiplier, (ValueMapper<int>)(object)new RangeValueMapper<int>(1, 20), "", 200f); num12 += 36f; ((MyWindow)wnd).AddText2(num13, num12, _tabHive, "Threat Multiplier:", 14, "label"); num12 += 24f; ((MyWindow)wnd).AddSlider<int>(num13, num12, _tabHive, CfgHiveThreatMultiplier, (ValueMapper<int>)(object)new RangeValueMapper<int>(1, 50), "", 200f); num12 += 36f; ((MyWindow)wnd).AddText2(num13, num12, _tabHive, "Builder Speed Multiplier:", 14, "label"); num12 += 24f; ((MyWindow)wnd).AddSlider<int>(num13, num12, _tabHive, CfgHiveBuilderSpeed, (ValueMapper<int>)(object)new RangeValueMapper<int>(1, 10), "", 200f); num12 += 36f; ((MyWindow)wnd).AddText2(num13, num12, _tabHive, "Energy Generation Multiplier:", 14, "label"); num12 += 24f; ((MyWindow)wnd).AddSlider<int>(num13, num12, _tabHive, CfgHiveGenEnergy, (ValueMapper<int>)(object)new RangeValueMapper<int>(1, 10), "", 200f); num12 += 36f; ((MyWindow)wnd).AddText2(num13, num12, _tabHive, "Carrier Capacity Multiplier:", 14, "label"); num12 += 24f; ((MyWindow)wnd).AddSlider<float>(num13, num12, _tabHive, CfgCarrierCapacity, (ValueMapper<float>)(object)new RangeValueMapper<float>(1, 10), "", 200f); num12 += 36f; ((MyWindow)wnd).AddText2(num13, num12, _tabHive, "Turret Attack Range Multiplier:", 14, "label"); num12 += 24f; ((MyWindow)wnd).AddSlider<float>(num13, num12, _tabHive, CfgHiveTurretAttackRange, (ValueMapper<float>)(object)new RangeValueWithMultiplierMapper<float>(1, 3, 0.1f), "F1", 200f); num12 += 36f; ((MyWindow)wnd).AddText2(num13, num12, _tabHive, "Relay Max Ports:", 14, "label"); num12 += 24f; ((MyWindow)wnd).AddSlider<int>(num13, num12, _tabHive, CfgRelayMaxPorts, (ValueMapper<int>)(object)new RangeValueMapper<int>(6, 160), "", 200f); num12 += 36f; ((MyWindow)wnd).AddText2(num13, num12, _tabHive, "Threat Snowball (per wave):", 14, "label"); num12 += 24f; ((MyWindow)wnd).AddSlider<float>(num13, num12, _tabHive, CfgHiveThreatSnowball, (ValueMapper<float>)(object)new RangeValueWithMultiplierMapper<float>(0, 50, 0.01f), "P0", 200f); num12 += 36f; ((MyWindow)wnd).AddText2(num13, num12, _tabHive, "Hive Threat Trend (%):", 14, "label"); num12 += 24f; ((MyWindow)wnd).AddSlider<int>(num13, num12, _tabHive, CfgHiveThreatTrend, (ValueMapper<int>)(object)new RangeValueMapper<int>(1, 80), "", 200f); num12 += 36f; ((MyWindow)wnd).AddText2(num13, num12, _tabHive, "Seed Speed Multiplier:", 14, "label"); num12 += 24f; ((MyWindow)wnd).AddSlider<float>(num13, num12, _tabHive, CfgSeedSpeedMultiplier, (ValueMapper<float>)(object)new RangeValueWithMultiplierMapper<float>(1, 10, 0.5f), "F1", 200f); num12 += 36f; float num14 = num12; RectTransform tabHive = _tabHive; object obj10 = <>O.<9>__LancersCheatfill; if (obj10 == null) { UnityAction val10 = LancersCheatfill; <>O.<9>__LancersCheatfill = val10; obj10 = (object)val10; } ((MyWindow)wnd).AddButton(num13, num14, 200f, tabHive, "Lancers Cheatfill", 14, "btn-lancers-cheatfill", (UnityAction)obj10); _tabGround = ((MyWindowWithTabs)wnd).AddTab(trans, "Ground"); float num15 = 10f; float num16 = 0f; ((MyWindow)wnd).AddText2(num16, num15, _tabGround, "Replicator Units per Batch:", 14, "label"); num15 += 24f; ((MyWindow)wnd).AddSlider<int>(num16, num15, _tabGround, CfgReplicatorBatchSize, (ValueMapper<int>)(object)new RangeValueMapper<int>(1, 75), "", 200f); num15 += 36f; ((MyWindow)wnd).AddText2(num16, num15, _tabGround, "Threat As a Trend (%):", 14, "label"); num15 += 24f; ((MyWindow)wnd).AddSlider<int>(num16, num15, _tabGround, CfgGroundThreatTrend, (ValueMapper<int>)(object)new RangeValueMapper<int>(1, 20), "", 200f); num15 += 36f; ((MyWindow)wnd).AddText2(num16, num15, _tabGround, "Builder Speed Multiplier:", 14, "label"); num15 += 24f; ((MyWindow)wnd).AddSlider<int>(num16, num15, _tabGround, CfgGroundBuilderSpeed, (ValueMapper<int>)(object)new RangeValueMapper<int>(1, 10), "", 200f); num15 += 36f; ((MyWindow)wnd).AddText2(num16, num15, _tabGround, "Matter Generation Multiplier:", 14, "label"); num15 += 24f; ((MyWindow)wnd).AddSlider<int>(num16, num15, _tabGround, CfgGroundGenMatter, (ValueMapper<int>)(object)new RangeValueMapper<int>(1, 10), "", 200f); num15 += 36f; ((MyWindow)wnd).AddCheckBox(num16, num15, _tabGround, CfgNeverStoppingThreat, "Never-Stopping Threat", 15); num15 += 36f; ((MyWindow)wnd).AddText2(num16, num15, _tabGround, "Unit Attack Range Multiplier:", 14, "label"); num15 += 24f; ((MyWindow)wnd).AddSlider<float>(num16, num15, _tabGround, CfgUnitAttackRange, (ValueMapper<float>)(object)new RangeValueWithMultiplierMapper<float>(100, 200, 0.01f), "F2", 200f); num15 += 36f; ((MyWindow)wnd).AddText2(num16, num15, _tabGround, "Planetary Base Wave Multiplier:", 14, "label"); num15 += 24f; ((MyWindow)wnd).AddSlider<int>(num16, num15, _tabGround, CfgPlanetaryBaseWaveMultiplier, (ValueMapper<int>)(object)new RangeValueMapper<int>(1, 20), "", 200f); num15 += 36f; ((MyWindow)wnd).AddText2(num16, num15, _tabGround, "Signal Tower Space Range:", 14, "label"); num15 += 24f; ((MyWindow)wnd).AddSlider<float>(num16, num15, _tabGround, CfgIcarusSignalTowerRangeMultiplier, (ValueMapper<float>)(object)new RangeValueWithMultiplierMapper<float>(1, 2, 0.05f), "F1", 200f); num15 += 36f; ((MyWindow)wnd).AddText2(num16, num15, _tabGround, "Missile Turret Space Range:", 14, "label"); num15 += 24f; ((MyWindow)wnd).AddSlider<float>(num16, num15, _tabGround, CfgIcarusMissileTurretSpaceRangeMultiplier, (ValueMapper<float>)(object)new RangeValueWithMultiplierMapper<float>(1, 2, 0.5f), "F1", 200f); num15 += 36f; ((MyWindow)wnd).AddText2(num16, num15, _tabGround, "BAB Drone Repair Bonus:", 14, "label"); num15 += 24f; ((MyWindow)wnd).AddSlider<float>(num16, num15, _tabGround, CfgBABRepairBonusPercent, (ValueMapper<float>)(object)new RangeValueWithMultiplierMapper<float>(1, 20, 0.001f), "P1", 200f); num15 += 36f; ((MyWindow)wnd).AddText2(num16, num15, _tabGround, "Plasma Turret Firerate Multiplier:", 14, "label"); num15 += 24f; ((MyWindow)wnd).AddSlider<float>(num16, num15, _tabGround, CfgPlasmaTurretFirerateMultiplier, (ValueMapper<float>)(object)new RangeValueWithMultiplierMapper<float>(1, 10, 1f), "F0", 200f); num15 += 36f; ((MyWindow)wnd).AddText2(num16, num15, _tabGround, "Gauss Turret Firerate Multiplier:", 14, "label"); num15 += 24f; ((MyWindow)wnd).AddSlider<float>(num16, num15, _tabGround, CfgGaussTurretFirerateMultiplier, (ValueMapper<float>)(object)new RangeValueWithMultiplierMapper<float>(1, 10, 1f), "F0", 200f); num15 += 36f; _tabIcarus = ((MyWindowWithTabs)wnd).AddTab(trans, "Icarus"); float num17 = 10f; float num18 = 0f; ((MyWindow)wnd).AddText2(num18, num17, _tabIcarus, "Ground Fleet Port Multiplier:", 14, "label"); num17 += 24f; ((MyWindow)wnd).AddSlider<int>(num18, num17, _tabIcarus, CfgIcarusGroundFleetPortMultiplier, (ValueMapper<int>)(object)new RangeValueMapper<int>(1, 8), "", 200f); num17 += 36f; ((MyWindow)wnd).AddText2(num18, num17, _tabIcarus, "Space Fleet Port Multiplier:", 14, "label"); num17 += 24f; ((MyWindow)wnd).AddSlider<int>(num18, num17, _tabIcarus, CfgIcarusSpaceFleetPortMultiplier, (ValueMapper<int>)(object)new RangeValueMapper<int>(1, 8), "", 200f); num17 += 36f; ((MyWindow)wnd).AddText2(num18, num17, _tabIcarus, "Ground Drone HP Multiplier:", 14, "label"); num17 += 24f; ((MyWindow)wnd).AddSlider<float>(num18, num17, _tabIcarus, CfgIcarusDroneHpMultiplier, (ValueMapper<float>)(object)new RangeValueWithMultiplierMapper<float>(1, 8, 1f), "F0", 200f); num17 += 36f; ((MyWindow)wnd).AddText2(num18, num17, _tabIcarus, "Space Ship HP Multiplier:", 14, "label"); num17 += 24f; ((MyWindow)wnd).AddSlider<float>(num18, num17, _tabIcarus, CfgIcarusSpaceShipHpMultiplier, (ValueMapper<float>)(object)new RangeValueWithMultiplierMapper<float>(1, 8, 1f), "F0", 200f); num17 += 36f; ((MyWindow)wnd).AddText2(num18, num17, _tabIcarus, "Ground Fleet Energy Multiplier:", 14, "label"); num17 += 24f; ((MyWindow)wnd).AddSlider<float>(num18, num17, _tabIcarus, CfgIcarusGroundFleetEnergyMultiplier, (ValueMapper<float>)(object)new RangeValueWithMultiplierMapper<float>(5, 10, 0.1f), "F1", 200f); num17 += 36f; ((MyWindow)wnd).AddText2(num18, num17, _tabIcarus, "Space Fleet Energy Multiplier:", 14, "label"); num17 += 24f; ((MyWindow)wnd).AddSlider<float>(num18, num17, _tabIcarus, CfgIcarusSpaceFleetEnergyMultiplier, (ValueMapper<float>)(object)new RangeValueWithMultiplierMapper<float>(5, 10, 0.1f), "F1", 200f); num17 += 36f; ((MyWindow)wnd).AddText2(num18, num17, _tabIcarus, "Signal Tower HP Multiplier:", 14, "label"); num17 += 24f; ((MyWindow)wnd).AddSlider<float>(num18, num17, _tabIcarus, CfgIcarusSignalTowerHpMultiplier, (ValueMapper<float>)(object)new RangeValueWithMultiplierMapper<float>(1, 4, 0.5f), "F1", 200f); num17 += 36f; ((MyWindow)wnd).AddText2(num18, num17, _tabIcarus, "BAB Pick Range:", 14, "label"); num17 += 24f; ((MyWindow)wnd).AddSlider<float>(num18, num17, _tabIcarus, CfgIcarusBABPickRangeMultiplier, (ValueMapper<float>)(object)new RangeValueWithMultiplierMapper<float>(1, 2, 0.25f), "F2", 200f); num17 += 36f; ((MyWindow)wnd).AddText2(num18, num17, _tabIcarus, "BAB HP:", 14, "label"); num17 += 24f; ((MyWindow)wnd).AddSlider<float>(num18, num17, _tabIcarus, CfgIcarusBABHpMultiplier, (ValueMapper<float>)(object)new RangeValueWithMultiplierMapper<float>(1, 4, 0.5f), "F1", 200f); num17 += 36f; ((MyWindow)wnd).AddText2(num18, num17, _tabIcarus, "(Requires game restart to take effect)", 12, "label"); } private static void CheckGroundUnits() { StringBuilder stringBuilder = new StringBuilder(); try { stringBuilder.AppendLine("=== Ground Units in Current System ==="); if (GameMain.data == null) { stringBuilder.AppendLine("No game loaded."); DarkFogWarsPlugin instance = _instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)string.Format("{0}{1}", "[DarkFogWars] ", stringBuilder)); } return; } StarData localStar = GameMain.localStar; if (localStar == null) { stringBuilder.AppendLine("Not in a star system."); DarkFogWarsPlugin instance2 = _instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)string.Format("{0}{1}", "[DarkFogWars] ", stringBuilder)); } return; } stringBuilder.AppendLine("Star: " + localStar.displayName); stringBuilder.AppendLine(); stringBuilder.AppendLine("Base | Lvl | Raiders | Rangers | Guardians"); stringBuilder.AppendLine("-----|-----|---------|---------|----------"); float aggressiveness = CfgAggressivenessOverride?.Value ?? (-1f); int num = 0; if (localStar.planets == null) { stringBuilder.AppendLine("No planets loaded."); DarkFogWarsPlugin instance3 = _instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogInfo((object)string.Format("{0}{1}", "[DarkFogWars] ", stringBuilder)); } return; } PlanetData[] planets = localStar.planets; foreach (PlanetData val in planets) { if (val == null) { continue; } PlanetFactory factory = val.factory; if (factory?.enemySystem == null) { continue; } EnemyDFGroundSystem enemySystem = factory.enemySystem; if (enemySystem?.bases?.buffer == null) { continue; } for (int j = 1; j < enemySystem.bases.cursor && j < enemySystem.bases.buffer.Length; j++) { ref DFGBaseComponent reference = ref enemySystem.bases.buffer[j]; if (reference.id == j && reference.forms != null) { int num2 = 0; try { num2 = reference.evolve.level; } catch { } GetMaxUnits(aggressiveness, num2); int num3 = 0; int num4 = 0; int num5 = 0; int num6 = 0; int num7 = 0; int num8 = 0; if (reference.forms.Length != 0 && reference.forms[0] != null) { num3 = reference.forms[0].unitCount; num4 = reference.forms[0].portCount; } if (reference.forms.Length > 1 && reference.forms[1] != null) { num5 = reference.forms[1].unitCount; num6 = reference.forms[1].portCount; } if (reference.forms.Length > 2 && reference.forms[2] != null) { num7 = reference.forms[2].unitCount; num8 = reference.forms[2].portCount; } stringBuilder.AppendLine($"{reference.id,4} | {num2,3} | {num3,3}/{num4,3} | {num5,3}/{num6,3} | {num7,3}/{num8,3}"); num++; } } } stringBuilder.AppendLine(); stringBuilder.AppendLine($"Total bases: {num}"); DarkFogWarsPlugin instance4 = _instance; if (instance4 != null) { ((BaseUnityPlugin)instance4).Logger.LogInfo((object)string.Format("{0}{1}", "[DarkFogWars] ", stringBuilder)); } } catch (Exception ex) { DarkFogWarsPlugin instance5 = _instance; if (instance5 != null) { ((BaseUnityPlugin)instance5).Logger.LogError((object)("[DarkFogWars] Error checking ground units: " + ex.Message)); } } } private static void CheckAggrStats() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("=== Aggressiveness Scaling ==="); stringBuilder.AppendLine(); stringBuilder.AppendLine("Level | Threat | Cooldown | Hatred | Sensor"); stringBuilder.AppendLine("-------------|--------|----------|--------|-------"); float[] array = new float[9] { 0f, 1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f }; foreach (float aggressiveness in array) { (float threatMult, float cooldownMult, float hatredMult, float sensorMult) aggressivenessScaling = GetAggressivenessScaling(aggressiveness); float item = aggressivenessScaling.threatMult; float item2 = aggressivenessScaling.cooldownMult; float item3 = aggressivenessScaling.hatredMult; float item4 = aggressivenessScaling.sensorMult; string aggressivenessName = GetAggressivenessName(aggressiveness); stringBuilder.AppendLine($"{aggressivenessName,-12} | {item,5:F1}x | {item2,7:F2}x | {item3,5:F1}x | {item4,5:F2}x"); } stringBuilder.AppendLine(); float num = CfgAggressivenessOverride?.Value ?? (-1f); var (num2, num3, num4, num5) = GetAggressivenessScaling(num); stringBuilder.AppendLine($"Current: {GetAggressivenessName(num)} ({num:F1})"); stringBuilder.AppendLine($" Threat: {num2:F1}x, Cooldown: {num3:F2}x, Hatred: {num4:F1}x, Sensor: {num5:F2}x"); DarkFogWarsPlugin instance = _instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)string.Format("{0}{1}", "[DarkFogWars] ", stringBuilder)); } } private static void CheckHiveUnits() { StringBuilder stringBuilder = new StringBuilder(); try { stringBuilder.AppendLine("=== Hive Units in Current System ==="); if (GameMain.data == null) { stringBuilder.AppendLine("No game loaded."); DarkFogWarsPlugin instance = _instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)string.Format("{0}{1}", "[DarkFogWars] ", stringBuilder)); } return; } StarData localStar = GameMain.localStar; if (localStar == null) { stringBuilder.AppendLine("Not in a star system."); DarkFogWarsPlugin instance2 = _instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)string.Format("{0}{1}", "[DarkFogWars] ", stringBuilder)); } return; } stringBuilder.AppendLine("Star: " + localStar.displayName); stringBuilder.AppendLine(); stringBuilder.AppendLine("Hive | Lancers | Humpbacks | Fortresses | Relays"); stringBuilder.AppendLine("-----|---------------|---------------|---------------|--------"); SpaceSector spaceSector = GameMain.data.spaceSector; if (spaceSector?.dfHives == null) { stringBuilder.AppendLine("No hives found."); DarkFogWarsPlugin instance3 = _instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogInfo((object)string.Format("{0}{1}", "[DarkFogWars] ", stringBuilder)); } return; } int num = 0; for (EnemyDFHiveSystem val = spaceSector.dfHives[localStar.index]; val != null; val = val.nextSibling) { num++; EnemyFormation obj = val.forms[0]; int num2 = ((obj != null) ? obj.unitCount : 0); EnemyFormation obj2 = val.forms[0]; int num3 = ((obj2 != null) ? obj2.portCount : 0); EnemyFormation obj3 = val.forms[1]; int num4 = ((obj3 != null) ? obj3.unitCount : 0); EnemyFormation obj4 = val.forms[1]; int num5 = ((obj4 != null) ? obj4.portCount : 0); EnemyFormation obj5 = val.forms[2]; int num6 = ((obj5 != null) ? obj5.unitCount : 0); EnemyFormation obj6 = val.forms[2]; int num7 = ((obj6 != null) ? obj6.portCount : 0); int num8; if (val.forms.Length <= 3) { num8 = 0; } else { EnemyFormation obj7 = val.forms[3]; num8 = ((obj7 != null) ? obj7.unitCount : 0); } int num9 = num8; int num10; if (val.forms.Length <= 3) { num10 = 0; } else { EnemyFormation obj8 = val.forms[3]; num10 = ((obj8 != null) ? obj8.portCount : 0); } int num11 = num10; stringBuilder.AppendLine($"{num,4} | {num2,5}/{num3,-6} | {num4,5}/{num5,-6} | {num6,5}/{num7,-6} | {num9,3}/{num11,-3}"); } stringBuilder.AppendLine(); stringBuilder.AppendLine($"Total hives: {num}"); } catch (Exception ex) { DarkFogWarsPlugin instance4 = _instance; if (instance4 != null) { ((BaseUnityPlugin)instance4).Logger.LogError((object)("[DarkFogWars] Error checking hive units: " + ex.Message)); } } DarkFogWarsPlugin instance5 = _instance; if (instance5 != null) { ((BaseUnityPlugin)instance5).Logger.LogInfo((object)string.Format("{0}{1}", "[DarkFogWars] ", stringBuilder)); } } private static void CheckHiveStatus() { //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) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder(); try { stringBuilder.AppendLine("=== Hive Status in Current System ==="); if (GameMain.data == null) { stringBuilder.AppendLine("No game loaded."); DarkFogWarsPlugin instance = _instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)string.Format("{0}{1}", "[DarkFogWars] ", stringBuilder)); } return; } StarData localStar = GameMain.localStar; if (localStar == null) { stringBuilder.AppendLine("Not in a star system."); DarkFogWarsPlugin instance2 = _instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)string.Format("{0}{1}", "[DarkFogWars] ", stringBuilder)); } return; } SpaceSector spaceSector = GameMain.data.spaceSector; if (spaceSector?.dfHives == null) { stringBuilder.AppendLine("No hives found."); DarkFogWarsPlugin instance3 = _instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogInfo((object)string.Format("{0}{1}", "[DarkFogWars] ", stringBuilder)); } return; } stringBuilder.AppendLine("Star: " + localStar.displayName); int num = 0; for (EnemyDFHiveSystem val = spaceSector.dfHives[localStar.index]; val != null; val = val.nextSibling) { num++; stringBuilder.AppendLine(); stringBuilder.AppendLine($"--- Hive {num} ({val.hiveCode}) ---"); stringBuilder.AppendLine($" Realized: {val.realized}, IsAlive: {val.isAlive}"); stringBuilder.AppendLine($" TurboTicks: {val.turboTicks}"); stringBuilder.AppendLine($" Evolve Level: {val.evolve.level}, Exp: {((EvolveData)(ref val.evolve)).exp_total}"); stringBuilder.AppendLine($" Threat: {val.evolve.threat}/{val.evolve.maxThreat}"); stringBuilder.AppendLine($" Matter: Prod={val.matterProduction}, Cons={val.matterConsumption}"); stringBuilder.AppendLine(" Formations:"); for (int i = 0; i < val.forms.Length; i++) { EnemyFormation val2 = val.forms[i]; if (val2 != null) { string text = i switch { 1 => "Humpbacks", 0 => "Lancers", _ => "Fortresses", }; stringBuilder.AppendLine($" [{i}] {text}: units={val2.unitCount}, ports={val2.portCount}, supply={val2.supply}, vacancies={val2.vacancyCount}, supplyBal={val2.supplyBalance}"); } } stringBuilder.AppendLine($" Replicators: {val.replicators.count}"); for (int j = 1; j < val.replicators.cursor; j++) { ref DFSReplicatorComponent reference = ref val.replicators.buffer[j]; if (reference.id == j) { string text2 = ((reference.productFormId == 0) ? "Lancer" : ((reference.productFormId == 1) ? "Humpback" : "Fortress")); EnemyBuilderComponent val3 = val.builders.buffer[reference.builderId]; stringBuilder.AppendLine($" Rep[{j}]: {text2}, progress={reference.productSp}/{reference.productSpMax}, builderState={val3.state}, matter={val3.matter}, energy={val3.energy}"); } } stringBuilder.AppendLine($" Relays: {val.relayCount}, Tinders: {val.tinderCount}"); stringBuilder.AppendLine($" IdleRelays: {val.idleRelayCount}, IdleTinders: {val.idleTinderCount}"); } } catch (Exception ex) { DarkFogWarsPlugin instance4 = _instance; if (instance4 != null) { ((BaseUnityPlugin)instance4).Logger.LogError((object)("[DarkFogWars] Error checking hive status: " + ex.Message)); } } DarkFogWarsPlugin instance5 = _instance; if (instance5 != null) { ((BaseUnityPlugin)instance5).Logger.LogInfo((object)string.Format("{0}{1}", "[DarkFogWars] ", stringBuilder)); } } private static void ForceSendLancers() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) try { if (GameMain.data == null) { DarkFogWarsPlugin instance = _instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)"[DarkFogWars] No game loaded."); } return; } StarData localStar = GameMain.localStar; if (localStar == null) { DarkFogWarsPlugin instance2 = _instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)"[DarkFogWars] Not in a star system."); } return; } SpaceSector spaceSector = GameMain.data.spaceSector; if (spaceSector?.dfHives == null) { DarkFogWarsPlugin instance3 = _instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogInfo((object)"[DarkFogWars] No hives found."); } return; } EAggressiveLevel aggressiveLevel = ((CombatSettings)(ref GameMain.data.history.combatSettings)).aggressiveLevel; int num = 0; for (EnemyDFHiveSystem val = spaceSector.dfHives[localStar.index]; val != null; val = val.nextSibling) { if (val.realized && val.isAlive) { val.evolve.threat = val.evolve.maxThreat; val.AssaultingWavesDetermineAI(aggressiveLevel); num++; DarkFogWarsPlugin instance4 = _instance; if (instance4 != null) { ((BaseUnityPlugin)instance4).Logger.LogInfo((object)("[DarkFogWars] Forced lancer assault from hive " + val.hiveCode)); } } } DarkFogWarsPlugin instance5 = _instance; if (instance5 != null) { ((BaseUnityPlugin)instance5).Logger.LogInfo((object)string.Format("{0}Forced lancer assaults from {1} hives in {2}", "[DarkFogWars] ", num, localStar.displayName)); } } catch (Exception ex) { DarkFogWarsPlugin instance6 = _instance; if (instance6 != null) { ((BaseUnityPlugin)instance6).Logger.LogError((object)("[DarkFogWars] Error forcing lancers: " + ex.Message)); } } } private static void CheckTurretBeaconPrefab() { //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Invalid comparison between Unknown and I4 //IL_030e: Unknown result type (might be due to invalid IL or missing references) try { DarkFogWarsPlugin instance = _instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)"[DarkFogWars] === Checking Turret/Beacon PrefabDesc Values ==="); } ItemProto val = ((ProtoSet<ItemProto>)(object)LDB.items)?.Select(2256); if (val != null) { DarkFogWarsPlugin instance2 = _instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)string.Format("{0}ItemProto 2256 (Missile Turret): ModelIndex={1}, prefabDesc null={2}", "[DarkFogWars] ", val.ModelIndex, val.prefabDesc == null)); } if (val.prefabDesc != null) { DarkFogWarsPlugin instance3 = _instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogInfo((object)string.Format("{0} turretSpaceAttackRange={1}", "[DarkFogWars] ", val.prefabDesc.turretSpaceAttackRange)); } DarkFogWarsPlugin instance4 = _instance; if (instance4 != null) { ((BaseUnityPlugin)instance4).Logger.LogInfo((object)string.Format("{0} turretType={1}", "[DarkFogWars] ", val.prefabDesc.turretType)); } } } ItemProto val2 = ((ProtoSet<ItemProto>)(object)LDB.items)?.Select(2103); if (val2 != null) { DarkFogWarsPlugin instance5 = _instance; if (instance5 != null) { ((BaseUnityPlugin)instance5).Logger.LogInfo((object)string.Format("{0}ItemProto 2103 (Signal Tower): ModelIndex={1}, prefabDesc null={2}", "[DarkFogWars] ", val2.ModelIndex, val2.prefabDesc == null)); } if (val2.prefabDesc != null) { DarkFogWarsPlugin instance6 = _instance; if (instance6 != null) { ((BaseUnityPlugin)instance6).Logger.LogInfo((object)string.Format("{0} beaconSpaceSignalRange={1}", "[DarkFogWars] ", val2.prefabDesc.beaconSpaceSignalRange)); } DarkFogWarsPlugin instance7 = _instance; if (instance7 != null) { ((BaseUnityPlugin)instance7).Logger.LogInfo((object)string.Format("{0} isBeacon={1}", "[DarkFogWars] ", val2.prefabDesc.isBeacon)); } } } ModelProto val3 = ((ProtoSet<ModelProto>)(object)LDB.models)?.Select(407); if (val3 != null) { DarkFogWarsPlugin instance8 = _instance; if (instance8 != null) { ((BaseUnityPlugin)instance8).Logger.LogInfo((object)string.Format("{0}ModelProto 407: prefabDesc null={1}", "[DarkFogWars] ", val3.prefabDesc == null)); } if (val3.prefabDesc != null) { DarkFogWarsPlugin instance9 = _instance; if (instance9 != null) { ((BaseUnityPlugin)instance9).Logger.LogInfo((object)string.Format("{0} turretSpaceAttackRange={1}", "[DarkFogWars] ", val3.prefabDesc.turretSpaceAttackRange)); } DarkFogWarsPlugin instance10 = _instance; if (instance10 != null) { ((BaseUnityPlugin)instance10).Logger.LogInfo((object)string.Format("{0} turretType={1}", "[DarkFogWars] ", val3.prefabDesc.turretType)); } } } if (PlanetFactory.PrefabDescByModelIndex != null && PlanetFactory.PrefabDescByModelIndex.Length > 407) { PrefabDesc val4 = PlanetFactory.PrefabDescByModelIndex[407]; DarkFogWarsPlugin instance11 = _instance; if (instance11 != null) { ((BaseUnityPlugin)instance11).Logger.LogInfo((object)string.Format("{0}PrefabDescByModelIndex[407]: null={1}", "[DarkFogWars] ", val4 == null)); } if (val4 != null) { DarkFogWarsPlugin instance12 = _instance; if (instance12 != null) { ((BaseUnityPlugin)instance12).Logger.LogInfo((object)string.Format("{0} turretSpaceAttackRange={1}", "[DarkFogWars] ", val4.turretSpaceAttackRange)); } DarkFogWarsPlugin instance13 = _instance; if (instance13 != null) { ((BaseUnityPlugin)instance13).Logger.LogInfo((object)string.Format("{0} turretType={1}", "[DarkFogWars] ", val4.turretType)); } } } DarkFogWarsPlugin instance14 = _instance; if (instance14 != null) { ((BaseUnityPlugin)instance14).Logger.LogInfo((object)"[DarkFogWars] Searching for all Missile turret models..."); } ModelProto[] dataArray = ((ProtoSet<ModelProto>)(object)LDB.models).dataArray; foreach (ModelProto val5 in dataArray) { if (val5?.prefabDesc != null && (int)val5.prefabDesc.turretType == 5) { DarkFogWarsPlugin instance15 = _instance; if (instance15 != null) { ((BaseUnityPlugin)instance15).Logger.LogInfo((object)string.Format("{0} Found Missile turret: ModelID={1}, turretSpaceAttackRange={2}", "[DarkFogWars] ", ((Proto)val5).ID, val5.prefabDesc.turretSpaceAttackRange)); } } } DarkFogWarsPlugin instance16 = _instance; if (instance16 != null) { ((BaseUnityPlugin)instance16).Logger.LogInfo((object)"[DarkFogWars] Searching for all Beacon models..."); } dataArray = ((ProtoSet<ModelProto>)(object)LDB.models).dataArray; foreach (ModelProto val6 in dataArray) { if (val6?.prefabDesc != null && val6.prefabDesc.isBeacon) { DarkFogWarsPlugin instance17 = _instance; if (instance17 != null) { ((BaseUnityPlugin)instance17).Logger.LogInfo((object)string.Format("{0} Found Beacon: ModelID={1}, beaconSpaceSignalRange={2}", "[DarkFogWars] ", ((Proto)val6).ID, val6.prefabDesc.beaconSpaceSignalRange)); } } } DarkFogWarsPlugin instance18 = _instance; if (instance18 != null) { ((BaseUnityPlugin)instance18).Logger.LogInfo((object)"[DarkFogWars] === Check Complete ==="); } } catch (Exception ex) { DarkFogWarsPlugin instance19 = _instance; if (instance19 != null) { ((BaseUnityPlugin)instance19).Logger.LogError((object)("[DarkFogWars] Error checking prefab: " + ex.Message)); } } } private static void LancersCheatfill() { try { if (GameMain.data == null) { DarkFogWarsPlugin instance = _instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)"[DarkFogWars] No game loaded."); } return; } StarData localStar = GameMain.localStar; if (localStar == null) { DarkFogWarsPlugin instance2 = _instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)"[DarkFogWars] Not in a star system."); } return; } SpaceSector spaceSector = GameMain.data.spaceSector; if (spaceSector?.dfHives == null) { DarkFogWarsPlugin instance3 = _instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogInfo((object)"[DarkFogWars] No hives found."); } return; } int num = 0; int num2 = 0; for (EnemyDFHiveSystem val = spaceSector.dfHives[localStar.index]; val != null; val = val.nextSibling) { if (val.realized && val.isAlive) { EnemyFormation val2 = val.forms[0]; if (val2 != null && val2.units != null) { int num3 = 0; while (val2.vacancyCount > 0 && val2.AddUnit() > 0) { num3++; } num2 += num3; num++; DarkFogWarsPlugin instance4 = _instance; if (instance4 != null) { ((BaseUnityPlugin)instance4).Logger.LogInfo((object)string.Format("{0}Hive {1}: Added {2} lancers (total: {3}/{4})", "[DarkFogWars] ", val.hiveCode, num3, val2.unitCount, val2.portCount)); } } } } DarkFogWarsPlugin instance5 = _instance; if (instance5 != null) { ((BaseUnityPlugin)instance5).Logger.LogInfo((object)string.Format("{0}Cheatfilled {1} lancers across {2} hives in {3}", "[DarkFogWars] ", num2, num, localStar.displayName)); } } catch (Exception ex) { DarkFogWarsPlugin instance6 = _instance; if (instance6 != null) { ((BaseUnityPlugin)instance6).Logger.LogError((object)("[DarkFogWars] Error cheatfilling lancers: " + ex.Message)); } } } private static void ForceSpawnSeeds() { try { if (GameMain.data == null) { DarkFogWarsPlugin instance = _instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)"[DarkFogWars] No game loaded."); } return; } StarData localStar = GameMain.localStar; if (localStar == null) { DarkFogWarsPlugin instance2 = _instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)"[DarkFogWars] Not in a star system."); } return; } SpaceSector spaceSector = GameMain.data.spaceSector; if (spaceSector?.dfHives == null) { DarkFogWarsPlugin instance3 = _instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogInfo((object)"[DarkFogWars] No hives found."); } return; } int num = 0; int num2 = 0; for (EnemyDFHiveSystem val = spaceSector.dfHives[localStar.index]; val != null; val = val.nextSibling) { if (val.realized && val.isAlive) { if (val.idleTinderCount < val.tinderDocks.Length) { int idleTinderCount = val.idleTinderCount; val.AddTinderDeferred(idleTinderCount); val.ExecuteDeferredEnemyChange(); if (val.idleTinderCount > 0) { int num3 = val.idleTinderIds[val.idleTinderCount - 1]; if (num3 > 0 && num3 < val.tinders.cursor) { ref DFTinderComponent reference = ref val.tinders.buffer[num3]; if (reference.id == num3 && reference.builderId > 0) { ref EnemyBuilderComponent reference2 = ref val.builders.buffer[reference.builderId]; if (reference2.id == reference.builderId) { reference2.matter = reference2.maxMatter; reference2.energy = reference2.maxEnergy; reference2.sp = reference2.spMax; DarkFogWarsPlugin instance4 = _instance; if (instance4 != null) { ((BaseUnityPlugin)instance4).Logger.LogInfo((object)string.Format("{0}Hive {1}: Spawned seed {2}, filled builder with matter={3}, energy={4}", "[DarkFogWars] ", val.hiveCode, num3, reference2.maxMatter, reference2.maxEnergy)); } } } } num2++; } } else { DarkFogWarsPlugin instance5 = _instance; if (instance5 != null) { ((BaseUnityPlugin)instance5).Logger.LogInfo((object)string.Format("{0}Hive {1}: All seed docks full ({2}/{3})", "[DarkFogWars] ", val.hiveCode, val.idleTinderCount, val.tinderDocks.Length)); } } num++; } } DarkFogWarsPlugin instance6 = _instance; if (instance6 != null) { ((BaseUnityPlugin)instance6).Logger.LogInfo((object)string.Format("{0}Spawned {1} seeds across {2} hives in {3}", "[DarkFogWars] ", num2, num, localStar.displayName)); } } catch (Exception ex) { DarkFogWarsPlugin instance7 = _instance; if (instance7 != null) { ((BaseUnityPlugin)instance7).Logger.LogError((object)("[DarkFogWars] Error spawning seeds: " + ex.Message + "\n" + ex.StackTrace)); } } } private static void PopulateHivesInCurrentStar() { try { if (GameMain.data == null) { DarkFogWarsPlugin instance = _instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)"[DarkFogWars] No game loaded."); } return; } StarData localStar = GameMain.localStar; if (localStar == null) { DarkFogWarsPlugin instance2 = _instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)"[DarkFogWars] Not in a star system."); } return; } SpaceSector spaceSector = GameMain.data.spaceSector; if (spaceSector == null) { DarkFogWarsPlugin instance3 = _instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogInfo((object)"[DarkFogWars] No space sector found."); } return; } int num = 0; int num2 = 0; for (int i = 0; i < 8; i++) { EnemyDFHiveSystem val = spaceSector.TryCreateNewHive(localStar); if (val != null) { val.SetForNewGame(); num++; } } for (EnemyDFHiveSystem val2 = spaceSector.dfHives[localStar.index]; val2 != null; val2 = val2.nextSibling) { if (!val2.realized && !val2.isEmpty) { val2.Realize(); num2++; } } DarkFogWarsPlugin instance4 = _instance; if (instance4 != null) { ((BaseUnityPlugin)instance4).Logger.LogInfo((object)string.Format("{0}Populated hives in {1}: {2} created, {3} realized", "[DarkFogWars] ", localStar.displayName, num, num2)); } } catch (Exception ex) { DarkFogWarsPlugin instance5 = _instance; if (instance5 != null) { ((BaseUnityPlugin)instance5).Logger.LogError((object)("[DarkFogWars] Error populating hives: " + ex.Message + "\n" + ex.StackTrace)); } } } private static void ClearGroundUnitsOnPlanet() { try { if (GameMain.data == null) { DarkFogWarsPlugin instance = _instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)"[DarkFogWars] No game loaded."); } return; } PlanetData localPlanet = GameMain.localPlanet; if (localPlanet == null) { DarkFogWarsPlugin instance2 = _instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)"[DarkFogWars] Not on a planet."); } return; } PlanetFactory factory = localPlanet.factory; if (factory == null) { DarkFogWarsPlugin instance3 = _instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogInfo((object)"[DarkFogWars] No factory on this planet."); } return; } EnemyDFGroundSystem enemySystem = factory.enemySystem; if (enemySystem == null) { DarkFogWarsPlugin instance4 = _instance; if (instance4 != null) { ((BaseUnityPlugin)instance4).Logger.LogInfo((object)"[DarkFogWars] No enemy system on this planet."); } return; } if (enemySystem.bases == null || enemySystem.bases.buffer == null) { DarkFogWarsPlugin instance5 = _instance; if (instance5 != null) { ((BaseUnityPlugin)instance5).Logger.LogInfo((object)"[DarkFogWars] No bases on this planet."); } return; } int num = 0; int num2 = 0; int cursor = enemySystem.bases.cursor; DFGBaseComponent[] buffer = enemySystem.bases.buffer; for (int i = 1; i < cursor; i++) { DFGBaseComponent val = buffer[i]; if (val == null || val.id != i || val.forms == null) { continue; } for (int j = 0; j < val.forms.Length; j++) { EnemyFormation val2 = val.forms[j]; if (val2 != null && val2.units != null) { num += val2.unitCount; val2.Clear(); } } num2++; } string text = localPlanet.displayName ?? "Unknown"; DarkFogWarsPlugin instance6 = _instance; if (instance6 != null) { ((BaseUnityPlugin)instance6).Logger.LogInfo((object)string.Format("{0}Cleared {1} ground units from {2} bases on {3}", "[DarkFogWars] ", num, num2, text)); } } catch (Exception ex) { DarkFogWarsPlugin instance7 = _instance; if (instance7 != null) { ((BaseUnityPlugin)instance7).Logger.LogError((object)("[DarkFogWars] Error clearing ground units: " + ex.Message + "\n" + ex.StackTrace)); } } } public static (float threatMult, float cooldownMult, float hatredMult, float sensorMult) GetAggressivenessScaling(float aggressiveness) { if (aggressiveness < 0f) { return (1f, 1f, 1f, 1f); } if (aggressiveness <= 0f) { return (0.5f, 1.5f, 0f, 0.8f); } if (aggressiveness < 1.5f) { return (0.8f, 1.2f, 0.6f, 0.8f); } if (aggressiveness < 2.5f) { return (1f, 1f, 1f, 1f); } if (aggressiveness < 3.5f) { return (2f, 0.8f, 4f, 1.25f); } if (aggressiveness < 4.5f) { return (4f, 0.6f, 6f, 1.55f); } if (aggressiveness < 5.5f) { return (8f, 0.4f, 8f, 1.8f); } if (aggressiveness < 6.5f) { return (15f, 0.25f, 10f, 2.1f); } if (aggressiveness < 7.5f) { return (25f, 0.15f, 12f, 2.5f); } if (aggressiveness < 8.5f) { return (40f, 0.1f, 15f, 3f); } return (60f, 0.05f, 20f, 4f); } public static (int maxRaiders, int maxRangers, int maxGuardians) GetMaxUnits(float aggressiveness, int baseLevel) { float num = ((aggressiveness < 0f) ? 1f : ((aggressiveness < 2.5f) ? (0.5f + aggressiveness * 0.1f) : ((!(aggressiveness < 4.5f)) ? (1f + (aggressiveness - 4.5f) * 0.25f) : (0.75f + (aggressiveness - 2.5f) * 0.125f)))); float num2 = Math.Min(1f, (float)baseLevel / 40f) * 0.5f; float num3 = num + num2; int item = (int)((float)(CfgMaxRaiders?.Value ?? 360) * num3); int item2 = (int)((float)(CfgMaxRangers?.Value ?? 470) * num3); int item3 = (int)((float)(CfgMaxGuardians?.Value ?? 120) * num3); return (item, item2, item3); } public static string GetAggressivenessName(float aggressiveness) { if (aggressiveness < 0f) { return "Game Setting"; } if (aggressiveness < 0.5f) { return "Passive"; } if (aggressiveness < 1.5f) { return "Torpid"; } if (aggressiveness < 2.5f) { return "Normal"; } if (aggressiveness < 3.5f) { return "Sharp"; } if (aggressiveness < 4.5f) { return "Rampage"; } if (aggressiveness < 5.5f) { return "Apocalypse"; } if (aggressiveness < 6.5f) { return "Cataclysm"; } if (aggressiveness < 7.5f) { return "Extinction"; } if (aggressiveness < 8.5f) { return "Annihilation"; } return "Oblivion"; } [HarmonyPatch(typeof(DFGBaseComponent), "InitFormations")] [HarmonyPostfix] private static void DFGBaseComponent_InitFormations_Postfix(ref DFGBaseComponent __instance) { try { float num = CfgAggressivenessOverride?.Value ?? (-1f); if (!(num < 0f) && __instance.forms != null) { var (portCount, portCount2, portCount3) = GetMaxUnits(num, 0); if (__instance.forms.Length != 0 && __instance.forms[0] != null) { __instance.forms[0].SetPortCount(portCount); } if (__instance.forms.Length > 1 && __instance.forms[1] != null) { __instance.forms[1].SetPortCount(portCount2); } if (__instance.forms.Length > 2 && __instance.forms[2] != null) { __instance.forms[2].SetPortCount(portCount3); } } } catch { } } [HarmonyPatch(typeof(EnemyDFGroundSystem), "NewDFGBaseComponent")] [HarmonyPostfix] private static void EnemyDFGroundSystem_NewDFGBaseComponent_Postfix(EnemyDFGroundSystem __instance, int __result) { try { float num = CfgAggressivenessOverride?.Value ?? (-1f); if (num < 0f || __result <= 0 || __instance.bases?.buffer == null) { return; } ref DFGBaseComponent reference = ref __instance.bases.buffer[__result]; if (reference.id == __result && reference.forms != null) { int level = reference.evolve.level; var (num2, num3, num4) = GetMaxUnits(num, level); if (reference.forms.Length != 0 && reference.forms[0] != null) { reference.forms[0].SetPortCount(num2); reference.forms[0].supply = num2; } if (reference.forms.Length > 1 && reference.forms[1] != null) { reference.forms[1].SetPortCount(num3); reference.forms[1].supply = num3; } if (reference.forms.Length > 2 && reference.forms[2] != null) { reference.forms[2].SetPortCount(num4); reference.forms[2].supply = num4; } } } catch { } } [HarmonyPatch(typeof(DFGBaseComponent), "Import")] [HarmonyPostfix] private static void DFGBaseComponent_Import_Postfix(ref DFGBaseComponent __instance) { try { float num = CfgAggressivenessOverride?.Value ?? (-1f); if (!(num < 0f) && __instance.id > 0 && __instance.forms != null) { int level = __instance.evolve.level; var (num2, num3, num4) = GetMaxUnits(num, level); if (__instance.forms.Length != 0 && __instance.forms[0] != null) { ExpandFormationPorts(__instance.forms[0], num2); __instance.forms[0].supply = num2; } if (__instance.forms.Length > 1 && __instance.forms[1] != null) { ExpandFormationPorts(__instance.forms[1], num3); __instance.forms[1].supply = num3; } if (__instance.forms.Length > 2 && __instance.forms[2] != null) { ExpandFormationPorts(__instance.forms[2], num4); __instance.forms[2].supply = num4; } } } catch { } } [HarmonyPatch(typeof(GameMain), "Begin")] [HarmonyPostfix] private static void GameMain_Begin_Postfix() { if (DSPGame.IsMenuDemo) { return; } try { float num = CfgAggressivenessOverride?.Value ?? (-1f); if (num < 0f) { return; } int num2 = 0; PlanetFactory[] array = GameMain.data?.factories; if (array == null) { return; } PlanetFactory[] array2 = array; foreach (PlanetFactory val in array2) { if (val?.enemySystem == null) { continue; } EnemyDFGroundSystem enemySystem = val.enemySystem; if (enemySystem?.bases?.buffer == null) { continue; } for (int j = 1; j < enemySystem.bases.cursor && j < enemySystem.bases.buffer.Length; j++) { ref DFGBaseComponent reference = ref enemySystem.bases.buffer[j]; if (reference.id == j && reference.forms != null) { int level = reference.evolve.level; var (supply, supply2, supply3) = GetMaxUnits(num, level); if (reference.forms.Length != 0 && reference.forms[0] != null) { reference.forms[0].supply = supply; } if (reference.forms.Length > 1 && reference.forms[1] != null) { reference.forms[1].supply = supply2; } if (reference.forms.Length > 2 && reference.forms[2] != null) { reference.forms[2].supply = supply3; } num2++; } } } DarkFogWarsPlugin instance = _instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)string.Format("{0}[save-load] Updated supply for {1} bases (aggr={2})", "[DarkFogWars] ", num2, GetAggressivenessName(num))); } } catch (Exception ex) { DarkFogWarsPlugin instance2 = _instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogError((object)("[DarkFogWars] [save-load] Error updating supply: " + ex.Message)); } } } private static void ExpandFormationPorts(EnemyFormation form, int newPortCount) { if (form == null) { return; } int portCount = form.portCount; if (newPortCount > portCount) { int[] units = form.units; form.SetPortCount(newPortCount); if (units != null) { int length = Math.Min(units.Length, form.units.Length); Array.Copy(units, form.units, length); } } } [HarmonyPatch(typeof(EnemyFormation), "RemoveUnit")] [HarmonyPrefix] private static bool EnemyFormation_RemoveUnit_Prefix(EnemyFormation __instance, int port, int[] ___vacancies, ref int ___vacancyCursor) { if (__instance.units == null || port < 0 || port >= __instance.units.Length) { return false; } if (___vacancies == null || ___vacancyCursor < 0 || ___vacancyCursor >= ___vacancies.Length) { return false; } if (__instance.units[port] != 0) { ___vacancies[___vacancyCursor++] = port; __instance.units[port] = 0; } return false; } [HarmonyPatch(typeof(DFGBaseComponent), "UpdateFactoryThreat")] [HarmonyPostfix] private static void DFGBaseComponent_UpdateFactoryThreat_Postfix(ref DFGBaseComponent __instance) { if (DSPGame.IsMenuDemo) { return; } try { float num = CfgAggressivenessOverride?.Value ?? (-1f); if (!(num < 0f) && __instance.forms != null) { int level = __instance.evolve.level; var (supply, supply2, supply3) = GetMaxUnits(num, level); if (__instance.forms.Length != 0 && __instance.forms[0] != null) { __instance.forms[0].supply = supply; } if (__instance.forms.Length > 1 && __instance.forms[1] != null) { __instance.forms[1].supply = supply2; } if (__instance.forms.Length > 2 && __instance.forms[2] != null) { __instance.forms[2].supply = supply3; } } } catch { } } [HarmonyPatch(typeof(EvolveData), "AddExpPoint")] [HarmonyPrefix] private static bool EvolveData_AddExpPoint_Prefix(ref EvolveData __instance, int _addexpp) { if (__instance.level >= 40) { if (__instance.expf != 0 || __instance.expp != 0 || __instance.level != 40) { __instance.level = 40; __instance.expf = 0; __instance.expp = 0; __instance.expl = EvolveData.LevelCummulativeExp(40); } return false; } if (_addexpp <= 0) { return false; } __instance.expp += _addexpp; if (__instance.expp < 10000) { return false; } __instance.expf += __instance.expp / 10000; __instance.expp %= 10000; while (__instance.expf >= EvolveData.levelExps[__instance.level]) { int num = EvolveData.levelExps.Length - 1; __instance.expf -= EvolveData.levelExps[__instance.level]; __instance.expl += EvolveData.levelExps[__instance.level]; __instance.level++; if (__instance.level >= 40 || __instance.level >= num) { __instance.level = Math.Min(40, num); __instance.expf = 0; __instance.expp = 0; break; } } return false; } [HarmonyPatch(typeof(EvolveData), "AddExp")] [HarmonyPrefix] private static bool EvolveData_AddExp_Prefix(ref EvolveData __instance, int _addexp) { if (__instance.level >= 40) { if (__instance.expf != 0 || __instance.expp != 0 || __instance.level != 40) { __instance.level = 40; __instance.expf = 0; __instance.expp = 0; __instance.expl = EvolveData.LevelCummulativeExp(40); } return false; } __instance.expf += _addexp; while (__instance.expf >= EvolveData.levelExps[__instance.level]) { int num = EvolveData.levelExps.Length - 1;