Decompiled source of HardFog v0.0.6

HardFog.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UXAssist.Common;
using UXAssist.UI;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("DSPmod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DSPmod")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7c8b9be3-d449-4188-b858-5efa47ca4d37")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 HardFog
{
	[BepInPlugin("me.liantian.plugin.HardFog", "HardFog", "0.0.6")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class HardFog : BaseUnityPlugin
	{
		private static class MoreFrequentRelaysPatch
		{
			private static Harmony _patch;

			public static void Enable(bool enable)
			{
				if (enable)
				{
					_patch = Harmony.CreateAndPatchAll(typeof(MoreFrequentRelaysPatch), (string)null);
					return;
				}
				Harmony patch = _patch;
				if (patch != null)
				{
					patch.UnpatchSelf();
				}
				_patch = null;
			}

			[HarmonyPrefix]
			[HarmonyPatch(typeof(EnemyDFHiveSystem), "GameTickLogic")]
			public static void EnemyDFHiveSystemPreGameTickLogic(EnemyDFHiveSystem __instance, long gameTick)
			{
				_ = gameTick % 6000;
				__instance.relayNeutralizedCounter = 0;
			}

			[HarmonyPrefix]
			[HarmonyPatch(typeof(DFRelayComponent), "RelaySailLogic")]
			public static void DFRelayComponentRelaySailLogic(DFRelayComponent __instance, ref bool keyFrame)
			{
				keyFrame = true;
			}
		}

		private static class DysonSphereDebuffImmunityPatch
		{
			private static Harmony _patch;

			public static void Enable(bool enable)
			{
				if (enable)
				{
					_patch = Harmony.CreateAndPatchAll(typeof(DysonSphereDebuffImmunityPatch), (string)null);
					return;
				}
				Harmony patch = _patch;
				if (patch != null)
				{
					patch.UnpatchSelf();
				}
				_patch = null;
			}

			[HarmonyPrefix]
			[HarmonyPatch(/*Could not decode attribute arguments.*/)]
			public static bool EnergyDFHivesDebuffCoef_Patch(ref double __result)
			{
				__result = 1.0;
				return false;
			}
		}

		private static class SuperRayReceptionPatch
		{
			private static Harmony _patch;

			public static void Enable(bool enable)
			{
				if (enable)
				{
					_patch = Harmony.CreateAndPatchAll(typeof(SuperRayReceptionPatch), (string)null);
					return;
				}
				Harmony patch = _patch;
				if (patch != null)
				{
					patch.UnpatchSelf();
				}
				_patch = null;
			}

			[HarmonyPrefix]
			[HarmonyPatch(/*Could not decode attribute arguments.*/)]
			public static bool energyRespCoef_Patch(ref float __result)
			{
				__result = 1f;
				return false;
			}
		}

		private static class DFSCoreSuperEnergyPatch
		{
			private static Harmony _patch;

			public static void Enable(bool enable)
			{
				if (enable)
				{
					_patch = Harmony.CreateAndPatchAll(typeof(DFSCoreSuperEnergyPatch), (string)null);
					return;
				}
				Harmony patch = _patch;
				if (patch != null)
				{
					patch.UnpatchSelf();
				}
				_patch = null;
			}

			[HarmonyPrefix]
			[HarmonyPatch(typeof(DFSCoreComponent), "LogicTick")]
			public static void DFSCoreComponentLogicTick(DFSCoreComponent __instance, EnemyDFHiveSystem hive)
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				if (hive.isLocal)
				{
					ref EnemyBuilderComponent reference = ref hive.builders.buffer[__instance.builderId];
					reference.matter = reference.maxMatter;
					reference.energy = reference.maxEnergy;
				}
			}
		}

		private static class DFGBaseSuperEnergyPatch
		{
			private static Harmony _patch;

			public static void Enable(bool enable)
			{
				if (enable)
				{
					_patch = Harmony.CreateAndPatchAll(typeof(DFGBaseSuperEnergyPatch), (string)null);
					return;
				}
				Harmony patch = _patch;
				if (patch != null)
				{
					patch.UnpatchSelf();
				}
				_patch = null;
			}

			[HarmonyPrefix]
			[HarmonyPatch(typeof(DFGBaseComponent), "LogicTick")]
			public static void DFGBaseComponentLogicTick(DFGBaseComponent __instance, ref EnemyBuilderComponent builder)
			{
				builder.matter = builder.maxMatter;
				builder.energy = builder.maxEnergy;
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static Action<MyConfigWindow, RectTransform> <0>__CreateUI;

			public static UnityAction <1>__ClearCurrentPlanetEnemies;

			public static UnityAction <2>__ClearStarEnemies;

			public static UnityAction <3>__StarsFillHive;

			public static UnityAction <4>__StarResetHive;

			public static UnityAction <5>__SetCoreInvincible;

			public static UnityAction <6>__SetCoreVulnerable;

			public static UnityAction <7>__ClearAllVein;
		}

		private static ConfigEntry<bool> MoreFrequentRelaysEnable;

		private static ConfigEntry<bool> DysonSphereDebuffImmunityEnable;

		private static ConfigEntry<bool> SuperRayReceptionEnable;

		private static ConfigEntry<bool> DFSCoreSuperEnergyEnable;

		private static ConfigEntry<bool> DFGBaseSuperEnergyEnable;

		private static int Iron = 1;

		private static int Copper = 2;

		private static int Silicium = 3;

		private static int Titanium = 4;

		private static int Stone = 5;

		private static int Coal = 6;

		private static int Oil = 7;

		private static int Fireice = 8;

		private static int Diamond = 9;

		private static int Fractal = 10;

		private static int Crysrub = 11;

		private static int Grat = 12;

		private static int Bamboo = 13;

		private static int Mag = 14;

		private static UIButton buttonClearPlanet;

		private static UIButton buttonClearStar;

		private static UIButton buttonFillHive;

		private static UIButton buttonResetHive;

		public static ManualLogSource Logger;

		private static RectTransform _windowTrans;

		public void Awake()
		{
			MoreFrequentRelaysEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("FogCheats", "MoreFrequentRelays", false, "巢穴更频繁的发送的中继站");
			DysonSphereDebuffImmunityEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("Cheats", "DysonSphereDebuffImmunity", false, "黑雾无法偷电");
			SuperRayReceptionEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("Cheats", "SuperRayReception", false, "射线接收器满速接收");
			DFSCoreSuperEnergyEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("FogCheats", "DFSCoreSuperEnergy", false, "玩家所在星系黑雾巢穴满能量");
			DFGBaseSuperEnergyEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("FogCheats", "DFGBaseSuperEnergy", false, "黑雾地面基地满能量");
			Logger = ((BaseUnityPlugin)this).Logger;
			Harmony.CreateAndPatchAll(typeof(HardFog), (string)null);
			I18N.Add("Clear the enemies on the current planet", "Clear the enemies on the current planet", "清理当前星球的黑雾");
			I18N.Add("Clear the space enemies of the current star", "Clear the space enemies of the current star", "清理当前恒星的太空黑雾");
			I18N.Add("Fill the galaxy with Hive", "Fill the galaxy with Hive", "为所有星系填满黑雾巢穴");
			I18N.Add("Reset the Hive in the current star", "Reset the Hive in the current star", "为当前恒星重置黑雾巢穴");
			I18N.Add("More Frequent Relays", "The HIVE is sending out Relays more frequently.", "黑雾巢穴更频繁的发送中继站");
			I18N.Add("Set HiveCore Invincible", "The HiveCore in the current star is invulnerable to attacks", "当前恒星的黑雾巢穴核心无法被攻击");
			I18N.Add("Set HiveCore Vulnerable", "The HiveCore in the current star is vulnerable to attacks.", "当前恒星的黑雾巢穴核心可以被攻击");
			I18N.Add("Fog cannot steal electricity", "Fog cannot steal electricity", "黑雾无法偷取电力");
			I18N.Add("the ray receiver receives at full power", "ray receiver receives at full power", "射线接收器满接收");
			I18N.Add("The Hive in the current star get full energy and matter", "The Hive in the current star get full energy and matter", "当前恒星的黑雾巢穴满能量/物质");
			I18N.Add("The Fogbase get full energy and matter", "The Fog core on base get full energy and matter", "黑雾地面核心获得满能量/物质");
			I18N.Add("Clear all vein on the current planet", "Clear all vein on the current planet", "清除矿脉");
			I18N.Add("Batch add vein on the current planet(candy)", "Batch add vein on the current planet(candy)", "批量添加矿脉(糖)");
			I18N.Add("Batch add vein on the current planet(2)", "Batch add vein on the current planet(2)", "批量添加矿脉(2)");
			I18N.Add("Batch add vein on the current planet(3)", "Batch add vein on the current planet(3)", "批量添加矿脉(3)");
			I18N.Add("Batch add vein on the current planet(4)", "Batch add vein on the current planet(4)", "批量添加矿脉(4)");
			I18N.Add("Reset the Hive in the current star", "reset all vein on the current planet", "重建矿物储量");
			I18N.Apply();
			MyConfigWindow.OnUICreated = (Action<MyConfigWindow, RectTransform>)Delegate.Combine(MyConfigWindow.OnUICreated, new Action<MyConfigWindow, RectTransform>(CreateUI));
			MoreFrequentRelaysEnable.SettingChanged += delegate
			{
				MoreFrequentRelaysPatch.Enable(MoreFrequentRelaysEnable.Value);
			};
			DysonSphereDebuffImmunityEnable.SettingChanged += delegate
			{
				DysonSphereDebuffImmunityPatch.Enable(DysonSphereDebuffImmunityEnable.Value);
			};
			SuperRayReceptionEnable.SettingChanged += delegate
			{
				SuperRayReceptionPatch.Enable(SuperRayReceptionEnable.Value);
			};
			DFSCoreSuperEnergyEnable.SettingChanged += delegate
			{
				DFSCoreSuperEnergyPatch.Enable(DFSCoreSuperEnergyEnable.Value);
			};
			DFGBaseSuperEnergyEnable.SettingChanged += delegate
			{
				DFGBaseSuperEnergyPatch.Enable(DFGBaseSuperEnergyEnable.Value);
			};
			Logger.LogInfo((object)"HardFog 初始化");
		}

		private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//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_00b2: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Expected O, but got Unknown
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Expected O, but got Unknown
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Expected O, but got Unknown
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Expected O, but got Unknown
			//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_0289: Expected O, but got Unknown
			_windowTrans = trans;
			float num = 10f;
			float num2 = 10f;
			((MyWindowWithTabs)wnd).AddSplitter(trans, 10f);
			((MyWindowWithTabs)wnd).AddTabGroup(trans, "Hard fog", "tab-group-hard-fog");
			RectTransform val = ((MyWindowWithTabs)wnd).AddTab(_windowTrans, "General");
			float num3 = num;
			float num4 = num2;
			object obj = <>O.<1>__ClearCurrentPlanetEnemies;
			if (obj == null)
			{
				UnityAction val2 = ClearCurrentPlanetEnemies;
				<>O.<1>__ClearCurrentPlanetEnemies = val2;
				obj = (object)val2;
			}
			buttonClearPlanet = ((MyWindow)wnd).AddButton(num3, num4, 200f, val, "Clear the enemies on the current planet", 16, "button-clear-planet", (UnityAction)obj);
			num2 += 36f;
			float num5 = num;
			float num6 = num2;
			object obj2 = <>O.<2>__ClearStarEnemies;
			if (obj2 == null)
			{
				UnityAction val3 = ClearStarEnemies;
				<>O.<2>__ClearStarEnemies = val3;
				obj2 = (object)val3;
			}
			buttonClearStar = ((MyWindow)wnd).AddButton(num5, num6, 200f, val, "Clear the space enemies of the current star", 16, "button-clear-star", (UnityAction)obj2);
			num2 += 36f;
			float num7 = num;
			float num8 = num2;
			object obj3 = <>O.<3>__StarsFillHive;
			if (obj3 == null)
			{
				UnityAction val4 = StarsFillHive;
				<>O.<3>__StarsFillHive = val4;
				obj3 = (object)val4;
			}
			buttonFillHive = ((MyWindow)wnd).AddButton(num7, num8, 200f, val, "Fill the galaxy with Hive", 16, "button-fill-hive", (UnityAction)obj3);
			num2 += 36f;
			float num9 = num;
			float num10 = num2;
			object obj4 = <>O.<4>__StarResetHive;
			if (obj4 == null)
			{
				UnityAction val5 = StarResetHive;
				<>O.<4>__StarResetHive = val5;
				obj4 = (object)val5;
			}
			buttonResetHive = ((MyWindow)wnd).AddButton(num9, num10, 200f, val, "Reset the Hive in the current star", 16, "button-reset-hive", (UnityAction)obj4);
			num2 += 36f;
			MyCheckBox.CreateCheckBox(num, num2, val, MoreFrequentRelaysEnable, "More Frequent Relays", 15);
			num2 += 36f;
			float num11 = num;
			float num12 = num2;
			object obj5 = <>O.<5>__SetCoreInvincible;
			if (obj5 == null)
			{
				UnityAction val6 = SetCoreInvincible;
				<>O.<5>__SetCoreInvincible = val6;
				obj5 = (object)val6;
			}
			((MyWindow)wnd).AddButton(num11, num12, 200f, val, "Set HiveCore Invincible", 12, "button-set-core-invincible", (UnityAction)obj5);
			num2 += 36f;
			float num13 = num;
			float num14 = num2;
			object obj6 = <>O.<6>__SetCoreVulnerable;
			if (obj6 == null)
			{
				UnityAction val7 = SetCoreVulnerable;
				<>O.<6>__SetCoreVulnerable = val7;
				obj6 = (object)val7;
			}
			((MyWindow)wnd).AddButton(num13, num14, 200f, val, "Set HiveCore Vulnerable", 12, "button-set-core-vulnerable", (UnityAction)obj6);
			num2 += 36f;
			MyCheckBox.CreateCheckBox(num, num2, val, DysonSphereDebuffImmunityEnable, "Fog cannot steal electricity", 15);
			num2 += 36f;
			MyCheckBox.CreateCheckBox(num, num2, val, SuperRayReceptionEnable, "the ray receiver receives at full power", 15);
			num2 += 36f;
			MyCheckBox.CreateCheckBox(num, num2, val, DFSCoreSuperEnergyEnable, "The Hive in the current star get full energy and matter", 15);
			num2 += 36f;
			MyCheckBox.CreateCheckBox(num, num2, val, DFGBaseSuperEnergyEnable, "The Fogbase get full energy and matter", 15);
			num = 330f;
			num2 = 10f;
			float num15 = num;
			float num16 = num2;
			object obj7 = <>O.<7>__ClearAllVein;
			if (obj7 == null)
			{
				UnityAction val8 = ClearAllVein;
				<>O.<7>__ClearAllVein = val8;
				obj7 = (object)val8;
			}
			((MyWindow)wnd).AddButton(num15, num16, 200f, val, "Clear all vein on the current planet", 16, "button-clear-vein", (UnityAction)obj7);
		}

		private static void ClearAllVein()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_0066: 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_008b: 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_00b4: 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_00e1: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			if (GameMain.mainPlayer == null)
			{
				return;
			}
			PlanetData localPlanet = GameMain.localPlanet;
			VeinData[] veinPool = localPlanet.factory.veinPool;
			foreach (VeinData val in veinPool)
			{
				localPlanet.factory.veinGroups[val.groupIndex].count--;
				localPlanet.factory.veinGroups[val.groupIndex].amount -= val.amount;
				localPlanet.factory.RemoveVeinWithComponents(val.id);
				if (localPlanet.factory.veinGroups[val.groupIndex].count == 0)
				{
					localPlanet.factory.veinGroups[val.groupIndex].type = (EVeinType)0;
					localPlanet.factory.veinGroups[val.groupIndex].amount = 0L;
					localPlanet.factory.veinGroups[val.groupIndex].pos = Vector3.zero;
				}
			}
		}

		private static void WealtAllVein()
		{
			//IL_0029: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Invalid comparison between Unknown and I4
			//IL_0073: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			if (GameMain.mainPlayer == null)
			{
				return;
			}
			PlanetData localPlanet = GameMain.localPlanet;
			Random random = new Random();
			VeinData[] veinPool = localPlanet.factory.veinPool;
			foreach (VeinData val in veinPool)
			{
				if ((int)val.type != 7)
				{
					localPlanet.factory.veinPool[val.id].amount = random.Next(8500, 11500);
				}
				else
				{
					localPlanet.factory.veinPool[val.id].amount = random.Next(150000, 200000);
				}
				localPlanet.factory.RecalculateVeinGroup((int)val.groupIndex);
			}
		}

		private static Vector3 ConvertToVector3(int X, int Y)
		{
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			PlanetData localPlanet = GameMain.localPlanet;
			_ = localPlanet.radius;
			double num = Math.PI * (0.36 * (double)Y) / 180.0;
			double num2 = Math.Sin(num);
			double num3 = Math.Cos(num);
			float num4 = (float)(num2 * (double)localPlanet.radius);
			double num5 = num3 * (double)localPlanet.radius;
			double num6 = (double)X / 1000.0 * 360.0;
			double num7 = Math.Sin(Math.PI * num6 / 180.0) * num5;
			double num8 = Math.Cos(Math.PI * num6 / 180.0) * num5;
			float num9 = (float)num7;
			float num10 = (float)num8;
			return new Vector3(num9, num4, num10);
		}

		private static void AddVeinVeinByRange(int veintype, int x_start, int x_end, int y_start, int y_end)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			for (int i = x_start; i < x_end; i++)
			{
				for (int j = y_start; j < y_end; j++)
				{
					AddVein(veintype, 50000, ConvertToVector3(i, j));
				}
			}
		}

		private static void BatchAddVein()
		{
			//IL_024b: 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_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			if (GameMain.mainPlayer != null)
			{
				_ = GameMain.localPlanet;
				int num = 13;
				int num2 = 11;
				AddVeinVeinByRange(Silicium, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Titanium, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Silicium, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Copper, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Iron, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Silicium, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Copper, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Iron, num, num + 5, num2, num2 + 7);
				num = 13;
				num2 = 31;
				AddVeinVeinByRange(Grat, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Fractal, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Fireice, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Stone, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Diamond, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Titanium, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Crysrub, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Coal, num, num + 5, num2, num2 + 7);
				num = 13;
				num2 = 51;
				AddVeinVeinByRange(Bamboo, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Silicium, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Grat, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Bamboo, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Mag, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Coal, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Copper, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Mag, num, num + 5, num2, num2 + 7);
				num = 15;
				num2 = 65;
				AddVein(Oil, 175000, ConvertToVector3(num, num2));
				num += 10;
				AddVein(Oil, 175000, ConvertToVector3(num, num2));
				num += 10;
				AddVein(Oil, 175000, ConvertToVector3(num, num2));
				num += 10;
				AddVein(Oil, 175000, ConvertToVector3(num, num2));
				num += 10;
				AddVein(Oil, 175000, ConvertToVector3(num, num2));
				num += 10;
				AddVein(Oil, 175000, ConvertToVector3(num, num2));
				num += 10;
				AddVein(Oil, 175000, ConvertToVector3(num, num2));
				num += 10;
				AddVein(Oil, 175000, ConvertToVector3(num, num2));
			}
		}

		private static void BatchAddVein2()
		{
			if (GameMain.mainPlayer != null)
			{
				_ = GameMain.localPlanet;
				int num = 13;
				int num2 = 11;
				AddVeinVeinByRange(Fireice, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Silicium, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Mag, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Iron, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Mag, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Iron, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Mag, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Iron, num, num + 5, num2, num2 + 7);
				num = 13;
				num2 = 31;
				AddVeinVeinByRange(Copper, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Diamond, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Copper, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Bamboo, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Copper, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Silicium, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Copper, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Titanium, num, num + 5, num2, num2 + 7);
				num = 13;
				num2 = 51;
				AddVeinVeinByRange(Mag, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Silicium, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Mag, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Iron, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Mag, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Iron, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Mag, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Iron, num, num + 5, num2, num2 + 7);
			}
		}

		private static void BatchAddVein3()
		{
			if (GameMain.mainPlayer != null)
			{
				_ = GameMain.localPlanet;
				int num = 13;
				int num2 = 11;
				AddVeinVeinByRange(Diamond, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Coal, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Bamboo, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Coal, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Bamboo, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Coal, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Bamboo, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Coal, num, num + 5, num2, num2 + 7);
				num = 13;
				num2 = 31;
				AddVeinVeinByRange(Bamboo, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Diamond, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Coal, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Bamboo, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Coal, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Bamboo, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Coal, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Bamboo, num, num + 5, num2, num2 + 7);
				num = 13;
				num2 = 51;
				AddVeinVeinByRange(Diamond, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Coal, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Bamboo, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Coal, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Bamboo, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Coal, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Bamboo, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Coal, num, num + 5, num2, num2 + 7);
			}
		}

		private static void BatchAddVein4()
		{
			if (GameMain.mainPlayer != null)
			{
				_ = GameMain.localPlanet;
				int num = 13;
				int num2 = 11;
				num += 10;
				AddVeinVeinByRange(Stone, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Iron, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Copper, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Silicium, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Titanium, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Mag, num, num + 5, num2, num2 + 7);
				num += 10;
				num = 13;
				num2 = 31;
				num += 10;
				AddVeinVeinByRange(Mag, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Grat, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Mag, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Diamond, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Mag, num, num + 5, num2, num2 + 7);
				num += 10;
				AddVeinVeinByRange(Fireice, num, num + 5, num2, num2 + 7);
				num += 10;
			}
		}

		public static void AddVein(int veintype, int number, Vector3 pos)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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_0022: 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_0057: 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_008e: 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)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: 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_00e1: 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_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: 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_0151: Unknown result type (might be due to invalid IL or missing references)
			PlanetData localPlanet = GameMain.localPlanet;
			VeinData val = default(VeinData);
			val.amount = number;
			val.type = (EVeinType)(byte)veintype;
			val.pos = pos;
			val.productId = ((ProtoSet<VeinProto>)(object)LDB.veins).Select(veintype).MiningItem;
			val.modelIndex = (short)((ProtoSet<VeinProto>)(object)LDB.veins).Select(veintype).ModelIndex;
			VeinData val2 = val;
			val2.id = localPlanet.factory.AddVeinData(val2);
			val2.colliderId = localPlanet.physics.AddColliderData(((ColliderData)(ref ((ProtoSet<VeinProto>)(object)LDB.veins).Select(veintype).prefabDesc.colliders[0])).BindToObject(val2.id, 0, (EObjectType)2, val2.pos, Quaternion.FromToRotation(Vector3.up, ((Vector3)(ref val2.pos)).normalized)));
			val2.modelId = localPlanet.factoryModel.gpuiManager.AddModel((int)val2.modelIndex, val2.id, val2.pos, Maths.SphericalRotation(val2.pos, Random.value * 360f), true);
			val2.minerCount = 0;
			localPlanet.factory.AssignGroupIndexForNewVein(ref val2);
			localPlanet.factory.veinPool[val2.id] = val2;
			localPlanet.factory.RefreshVeinMiningDisplay(val2.id, 0, 0);
			localPlanet.factory.RecalculateVeinGroup((int)localPlanet.factory.veinPool[val2.id].groupIndex);
		}

		private static void ClearCurrentPlanetEnemies()
		{
			((Behaviour)buttonClearPlanet).enabled = false;
			string arg = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
			string arg2 = GameMain.data.gameDesc.galaxySeed.ToString("00000000");
			GameSave.SaveCurrentGame($"[{arg2}] {arg}");
			if (GameMain.mainPlayer != null)
			{
				ClearPlanetEnemies(GameMain.localPlanet);
				((Behaviour)buttonClearPlanet).enabled = true;
			}
		}

		private static void ClearPlanetEnemies(PlanetData planet)
		{
			Player mainPlayer = GameMain.mainPlayer;
			if (mainPlayer == null)
			{
				return;
			}
			Logger.LogInfo((object)("planet.name: " + planet.name));
			int astroId = planet.astroId;
			Logger.LogInfo((object)("astroid" + astroId));
			PlanetFactory orCreateFactory = GameMain.data.GetOrCreateFactory(planet);
			CombatStat[] buffer = orCreateFactory.skillSystem.combatStats.buffer;
			ObjectPool<DFGBaseComponent> bases = orCreateFactory.enemySystem.bases;
			for (int i = 1; i < bases.cursor; i++)
			{
				DFGBaseComponent val = bases.buffer[i];
				EnemyFormation[] forms = val.forms;
				for (int j = 0; j < forms.Length; j++)
				{
					if (forms[j].unitCount > 0)
					{
						try
						{
							Logger.LogInfo((object)("clear DFGBaseComponent:" + val.id + "  -> form count : " + forms[j].unitCount));
							forms[j].Clear();
						}
						catch (Exception)
						{
							Logger.LogInfo((object)("error to kill  forms" + j));
						}
					}
				}
			}
			for (int num = orCreateFactory.enemyCursor - 1; num > 0; num--)
			{
				ref EnemyData reference = ref orCreateFactory.enemyPool[num];
				if (reference.id == num)
				{
					try
					{
						Logger.LogInfo((object)("KillEnemyFinally -> enemyData.id: " + reference.id));
						int combatStatId = reference.combatStatId;
						orCreateFactory.skillSystem.OnRemovingSkillTarget(combatStatId, buffer[combatStatId].originAstroId, (ETargetType)64);
						orCreateFactory.skillSystem.combatStats.Remove(combatStatId);
						orCreateFactory.KillEnemyFinally(mainPlayer, num, ref CombatStat.empty);
					}
					catch (Exception)
					{
						Logger.LogInfo((object)("error to kill  KillEnemyFinally" + reference.id));
					}
				}
			}
			Logger.LogInfo((object)"------------------------------------");
			Logger.LogInfo((object)("planetFactory.craftPool.Length " + orCreateFactory.craftPool.Length));
			SpaceSector spaceSector = GameMain.spaceSector;
			for (int num2 = spaceSector.enemyCursor - 1; num2 > 0; num2--)
			{
				ref EnemyData reference2 = ref spaceSector.enemyPool[num2];
				if (reference2.id == num2 && reference2.astroId == planet.id)
				{
					Logger.LogInfo((object)("KillEnemyFinal -> enemyData.id: " + reference2.id));
					spaceSector.KillEnemyFinal(reference2.id, ref CombatStat.empty);
				}
			}
		}

		private static void ClearStarEnemies()
		{
			((Behaviour)buttonClearStar).enabled = false;
			string arg = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
			string arg2 = GameMain.data.gameDesc.galaxySeed.ToString("00000000");
			GameSave.SaveCurrentGame($"[{arg2}] {arg}");
			if (GameMain.mainPlayer == null)
			{
				return;
			}
			_ = GameMain.localPlanet;
			StarData localStar = GameMain.localStar;
			SpaceSector spaceSector = GameMain.spaceSector;
			List<int> list = new List<int>();
			for (int num = spaceSector.enemyCursor - 1; num > 0; num--)
			{
				ref EnemyData reference = ref spaceSector.enemyPool[num];
				if (reference.id == num && !((EnemyData)(ref reference)).isInvincible && reference.dfSCoreId <= 0 && reference.astroId == localStar.astroId)
				{
					Logger.LogInfo((object)("active replys->" + reference.id));
					list.Add(reference.id);
				}
			}
			for (EnemyDFHiveSystem val = spaceSector.dfHives[localStar.index]; val != null; val = val.nextSibling)
			{
				if (val.isAlive)
				{
					Logger.LogInfo((object)("enemyDFHiveSystem.hiveAstroId " + val.hiveAstroId));
					Logger.LogInfo((object)("enemyDFHiveSystem.rootEnemyId " + val.rootEnemyId));
					for (int num2 = val.units.cursor - 1; num2 > 0; num2--)
					{
						int enemyId = val.units.buffer[num2].enemyId;
						if (enemyId > 0)
						{
							ref EnemyData reference2 = ref spaceSector.enemyPool[enemyId];
							if (!((EnemyData)(ref reference2)).isInvincible && reference2.dfSCoreId <= 0)
							{
								list.Add(enemyId);
							}
						}
					}
					for (int num3 = val.tinders.cursor - 1; num3 > 0; num3--)
					{
						int enemyId2 = val.tinders.buffer[num3].enemyId;
						if (enemyId2 > 0)
						{
							ref EnemyData reference3 = ref spaceSector.enemyPool[enemyId2];
							if (!((EnemyData)(ref reference3)).isInvincible && reference3.dfSCoreId <= 0)
							{
								list.Add(enemyId2);
							}
						}
					}
					for (int num4 = val.idleRelayCount - 1; num4 > 0; num4--)
					{
						int enemyId3 = val.relays.buffer[val.idleRelayIds[num4]].enemyId;
						if (enemyId3 > 0)
						{
							ref EnemyData reference4 = ref spaceSector.enemyPool[enemyId3];
							if (!((EnemyData)(ref reference4)).isInvincible && reference4.dfSCoreId <= 0)
							{
								list.Add(enemyId3);
							}
						}
					}
					for (int num5 = val.turrets.cursor - 1; num5 > 0; num5--)
					{
						int enemyId4 = val.turrets.buffer[num5].enemyId;
						if (enemyId4 > 0)
						{
							ref EnemyData reference5 = ref spaceSector.enemyPool[enemyId4];
							if (!((EnemyData)(ref reference5)).isInvincible && reference5.dfSCoreId <= 0)
							{
								list.Add(enemyId4);
							}
						}
					}
					for (int num6 = val.gammas.cursor - 1; num6 > 0; num6--)
					{
						int enemyId5 = val.gammas.buffer[num6].enemyId;
						if (enemyId5 > 0)
						{
							ref EnemyData reference6 = ref spaceSector.enemyPool[enemyId5];
							if (!((EnemyData)(ref reference6)).isInvincible && reference6.dfSCoreId <= 0)
							{
								list.Add(enemyId5);
							}
						}
					}
					for (int num7 = val.replicators.cursor - 1; num7 > 0; num7--)
					{
						int enemyId6 = val.replicators.buffer[num7].enemyId;
						if (enemyId6 > 0)
						{
							ref EnemyData reference7 = ref spaceSector.enemyPool[enemyId6];
							if (!((EnemyData)(ref reference7)).isInvincible && reference7.dfSCoreId <= 0)
							{
								list.Add(enemyId6);
							}
						}
					}
					for (int num8 = val.connectors.cursor - 1; num8 > 0; num8--)
					{
						int enemyId7 = val.connectors.buffer[num8].enemyId;
						if (enemyId7 > 0)
						{
							ref EnemyData reference8 = ref spaceSector.enemyPool[enemyId7];
							if (!((EnemyData)(ref reference8)).isInvincible && reference8.dfSCoreId <= 0)
							{
								list.Add(enemyId7);
							}
						}
					}
					for (int num9 = val.nodes.cursor - 1; num9 > 0; num9--)
					{
						int enemyId8 = val.nodes.buffer[num9].enemyId;
						if (enemyId8 > 0)
						{
							ref EnemyData reference9 = ref spaceSector.enemyPool[enemyId8];
							if (!((EnemyData)(ref reference9)).isInvincible && reference9.dfSCoreId <= 0)
							{
								list.Add(enemyId8);
							}
						}
					}
					for (int num10 = val.builders.cursor - 1; num10 > 0; num10--)
					{
						int enemyId9 = val.builders.buffer[num10].enemyId;
						if (enemyId9 > 0)
						{
							ref EnemyData reference10 = ref spaceSector.enemyPool[enemyId9];
							if (!((EnemyData)(ref reference10)).isInvincible && reference10.dfSCoreId <= 0)
							{
								list.Add(enemyId9);
							}
						}
					}
					EnemyFormation[] forms = val.forms;
					for (int i = 0; i < forms.Length; i++)
					{
						if (forms[i].unitCount > 0)
						{
							Logger.LogInfo((object)("clear form " + forms[i].unitCount));
							forms[i].Clear();
						}
					}
					for (int num11 = val.cores.cursor - 1; num11 > 0; num11--)
					{
						ref EnemyBuilderComponent reference11 = ref val.builders.buffer[val.cores.buffer[num11].builderId];
						reference11.matter = 0;
						reference11.energy = 0;
					}
				}
			}
			foreach (int item in list.Distinct().ToList())
			{
				try
				{
					spaceSector.KillEnemyFinal(item, ref CombatStat.empty);
				}
				catch (Exception)
				{
					Logger.LogInfo((object)("error to kill " + item));
				}
			}
			((Behaviour)buttonClearStar).enabled = true;
		}

		private static void StarsFillHive()
		{
			((Behaviour)buttonFillHive).enabled = false;
			string arg = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
			string arg2 = GameMain.data.gameDesc.galaxySeed.ToString("00000000");
			GameSave.SaveCurrentGame($"[{arg2}] {arg}");
			if (GameMain.mainPlayer == null)
			{
				return;
			}
			GalaxyData galaxy = GameMain.galaxy;
			SpaceSector spaceSector = GameMain.spaceSector;
			for (int i = 0; i < galaxy.starCount; i++)
			{
				StarData val = galaxy.stars[i];
				int num = val.maxHiveCount;
				if (num > 8)
				{
					num = 8;
				}
				EnemyDFHiveSystem val2 = spaceSector.dfHives[val.index];
				int num2 = 0;
				while (val2 != null)
				{
					num2++;
					val2 = val2.nextSibling;
				}
				for (int j = 0; j < num - num2; j++)
				{
					EnemyDFHiveSystem val3 = spaceSector.TryCreateNewHive(val);
					if (val3 == null)
					{
						continue;
					}
					Logger.LogInfo((object)(val.displayName + " Add 1 hive"));
					val3.isEmpty = false;
					val3.matterStatComplete = false;
					float num3 = Mathf.Pow(1f - val3.starData.safetyFactor, 1.4f);
					int num4 = RandomTable.Integer(ref val3.rtseed, 600);
					float initialGrowth = val3.history.combatSettings.initialGrowth;
					val3.ticks = 600 + (int)(num3 * 72000f) + num4;
					val3.ticks = (int)((float)val3.ticks * initialGrowth);
					val3.ticks = val3.InitialGrowthToTicks(val3.ticks);
					if (val3.ticks < 4)
					{
						val3.ticks = 4;
					}
					if (initialGrowth > 1f)
					{
						float num5 = initialGrowth - 1f;
						val3.evolve.rankBase = (int)((float)val3.evolve.rankBase * initialGrowth + 0.5f);
						val3.evolve.rankBase = val3.evolve.rankBase + (int)(num5 * 40f + 0.5f);
						if (val3.evolve.rankBase > 127)
						{
							val3.evolve.rankBase = 127;
						}
					}
					else if (initialGrowth < 1f)
					{
						val3.evolve.rankBase = (int)((float)val3.evolve.rankBase * Mathf.Lerp(initialGrowth, 1f, 0.5f) + 0.5f);
					}
					val3.isCarrierRealized = val3.starData.id == val3.galaxy.birthStarId;
					val3.tindersInTransit = 0;
				}
			}
		}

		private static void StarResetHive()
		{
			((Behaviour)buttonResetHive).enabled = false;
			string arg = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
			string arg2 = GameMain.data.gameDesc.galaxySeed.ToString("00000000");
			GameSave.SaveCurrentGame($"[{arg2}] {arg}");
			if (GameMain.mainPlayer != null)
			{
				_ = GameMain.localPlanet;
				StarData localStar = GameMain.localStar;
				for (EnemyDFHiveSystem val = GameMain.spaceSector.dfHives[localStar.index]; val != null; val = val.nextSibling)
				{
					val.SetForNewGame();
				}
				((Behaviour)buttonResetHive).enabled = true;
			}
		}

		private static void SetCoreInvincible()
		{
			if (GameMain.mainPlayer == null)
			{
				return;
			}
			_ = GameMain.localPlanet;
			StarData localStar = GameMain.localStar;
			SpaceSector spaceSector = GameMain.spaceSector;
			for (EnemyDFHiveSystem val = spaceSector.dfHives[localStar.index]; val != null; val = val.nextSibling)
			{
				for (int num = val.cores.cursor - 1; num > 0; num--)
				{
					((EnemyData)(ref spaceSector.enemyPool[val.cores.buffer[num].enemyId])).isInvincible = true;
				}
			}
		}

		private static void SetCoreVulnerable()
		{
			if (GameMain.mainPlayer == null)
			{
				return;
			}
			_ = GameMain.localPlanet;
			StarData localStar = GameMain.localStar;
			SpaceSector spaceSector = GameMain.spaceSector;
			for (EnemyDFHiveSystem val = spaceSector.dfHives[localStar.index]; val != null; val = val.nextSibling)
			{
				for (int num = val.cores.cursor - 1; num > 0; num--)
				{
					((EnemyData)(ref spaceSector.enemyPool[val.cores.buffer[num].enemyId])).isInvincible = false;
				}
			}
		}
	}
}
namespace DSPmod
{
	public class Class1
	{
	}
}