Decompiled source of Submerged v1.0.0

Submerged.dll

Decompiled 4 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using DM;
using FhpSLib;
using HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.AI.Components.Modifiers;
using Landfall.TABS.GameState;
using Landfall.TABS.UnitEditor;
using Landfall.TABS.Workshop;
using Pathfinding;
using SLMA;
using SubmergedCustomScripts;
using TFBGames;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Submerged")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("GeeztJeez")]
[assembly: AssemblyProduct("Submerged")]
[assembly: AssemblyCopyright("Copyright © Geezt Lifetime")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7acfaef0-7669-4401-8bff-5a9a02e18c75")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Submerged
{
	public static class UManager
	{
		public class Utility : MonoBehaviour
		{
			public static class ItemCategorizer
			{
				public static GameObject SetTag(GameObject item, string categoryName = "Submerged", TagType tagType = 0)
				{
					//IL_0018: Unknown result type (might be due to invalid IL or missing references)
					//IL_0020: 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_002e: Unknown result type (might be due to invalid IL or missing references)
					try
					{
						CharacterItem componentInChildren = item.GetComponentInChildren<CharacterItem>();
						if (Object.op_Implicit((Object)(object)componentInChildren))
						{
							componentInChildren.tags = new List<Tag>
							{
								new Tag
								{
									tagType = tagType,
									value = categoryName
								}
							};
						}
					}
					catch (Exception ex)
					{
						Debug.LogError((object)ex);
					}
					return item;
				}
			}

			private static Dictionary<DatabaseID, GameObject> CombatMoves
			{
				get
				{
					Dictionary<DatabaseID, GameObject> dictionary = HelpLibrary.m_combatMoves;
					if (dictionary == null)
					{
						dictionary = (HelpLibrary.m_combatMoves = new Dictionary<DatabaseID, GameObject>());
					}
					return dictionary;
				}
			}

			private static Dictionary<DatabaseID, GameObject> CharacterProps
			{
				get
				{
					Dictionary<DatabaseID, GameObject> dictionary = HelpLibrary.m_characterProps;
					if (dictionary == null)
					{
						dictionary = (HelpLibrary.m_characterProps = new Dictionary<DatabaseID, GameObject>());
					}
					return dictionary;
				}
			}

			private static Dictionary<DatabaseID, GameObject> UnitBases
			{
				get
				{
					Dictionary<DatabaseID, GameObject> dictionary = HelpLibrary.m_unitBases;
					if (dictionary == null)
					{
						dictionary = (HelpLibrary.m_unitBases = new Dictionary<DatabaseID, GameObject>());
					}
					return dictionary;
				}
			}

			private static Dictionary<DatabaseID, Faction> Factions
			{
				get
				{
					Dictionary<DatabaseID, Faction> dictionary = HelpLibrary.m_factions;
					if (dictionary == null)
					{
						dictionary = (HelpLibrary.m_factions = new Dictionary<DatabaseID, Faction>());
					}
					return dictionary;
				}
			}

			private static Dictionary<DatabaseID, GameObject> Weapons
			{
				get
				{
					Dictionary<DatabaseID, GameObject> dictionary = HelpLibrary.m_weapons;
					if (dictionary == null)
					{
						dictionary = (HelpLibrary.m_weapons = new Dictionary<DatabaseID, GameObject>());
					}
					return dictionary;
				}
			}

			private static Dictionary<DatabaseID, GameObject> Projectiles
			{
				get
				{
					Dictionary<DatabaseID, GameObject> dictionary = HelpLibrary.m_projectiles;
					if (dictionary == null)
					{
						dictionary = (HelpLibrary.m_projectiles = new Dictionary<DatabaseID, GameObject>());
					}
					return dictionary;
				}
			}

			public static Sprite LoadBundleTextureToSprite(string name)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				Texture2D val = (Texture2D)assetsBundle.LoadAsset(name);
				((Texture)val).filterMode = (FilterMode)0;
				return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
			}

			public static GameObject LoadBundleGameObject(string name)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (GameObject)assetsBundle.LoadAsset(name);
			}

			public static Material LoadBundleMaterial(string name)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (Material)assetsBundle.LoadAsset(name);
			}

			public static int IDChecker(AssetType type, int startId = 1)
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				int num = Math.Max(1, startId);
				DatabaseID id = default(DatabaseID);
				((DatabaseID)(ref id))..ctor(num);
				while (IsOccupied(type, id))
				{
					num++;
					((DatabaseID)(ref id))..ctor(num);
				}
				return num;
			}

			private static bool IsOccupied(AssetType type, DatabaseID id)
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				return type switch
				{
					AssetType.Prop => CharacterProps.ContainsKey(id), 
					AssetType.UnitBase => UnitBases.ContainsKey(id), 
					AssetType.Faction => Factions.ContainsKey(id), 
					AssetType.Ability => CombatMoves.ContainsKey(id), 
					AssetType.Weapon => Weapons.ContainsKey(id), 
					AssetType.Projectile => Projectiles.ContainsKey(id), 
					_ => throw new ArgumentOutOfRangeException("type", type, null), 
				};
			}
		}

		public enum AssetType
		{
			Prop,
			UnitBase,
			Faction,
			Ability,
			Weapon,
			Projectile
		}

		public class UnitCostComparer : IComparer
		{
			public int Compare(object x, object y)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				uint unitCost = ((UnitBlueprint)x).GetUnitCost(true);
				uint unitCost2 = ((UnitBlueprint)y).GetUnitCost(true);
				if (unitCost < unitCost2)
				{
					return -1;
				}
				if (unitCost > unitCost2)
				{
					return 1;
				}
				return 0;
			}
		}

		public static string comment;

		public static AssetBundle assetsBundle;

		public static void Init(LandfallContentDatabase db)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_04af: Expected O, but got Unknown
			//IL_0665: Unknown result type (might be due to invalid IL or missing references)
			//IL_067f: Expected O, but got Unknown
			Sprite val = Utility.LoadBundleTextureToSprite("Submerged_logo");
			Sprite val2 = Utility.LoadBundleTextureToSprite("icon_phantomdiver");
			Sprite val3 = Utility.LoadBundleTextureToSprite("icon_giantcrab");
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Create Custom Units";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Faction val4 = (Faction)SLMALoader.SDic["factions"]["Secret"];
			Faction val5 = (Faction)SLMALoader.SDic["factions"]["Subunits"];
			SLMATool.CreateUnit("Sunken Diver", (UnitBlueprint)null, val4, val2);
			SLMATool.CreateUnit("Eutherians Platoon", (UnitBlueprint)null, val5, val3);
			SLMATool.CreateUnit("Subnautic Scuba General", (UnitBlueprint)null, val5, val2);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Clothing";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("EutheriansPlatoonDiverBelt", Utility.LoadBundleGameObject("EutheriansPlatoonDiverBelt"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.Prop, 638415290), true), "Submerged", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("EutheriansPlatoonDiverGauntlet", Utility.LoadBundleGameObject("EutheriansPlatoonDiverGauntlet"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.Prop, 951742836), true), "Submerged", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("EutheriansPlatoonDiverHelmet", Utility.LoadBundleGameObject("EutheriansPlatoonDiverHelmet"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.Prop, 287134509), true), "Submerged", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("EutheriansPlatoonDiverLeftBoots", Utility.LoadBundleGameObject("EutheriansPlatoonDiverLeftBoots"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.Prop, 763892145), true), "Submerged", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("EutheriansPlatoonDiverRightBoots", Utility.LoadBundleGameObject("EutheriansPlatoonDiverRightBoots"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.Prop, 519476802), true), "Submerged", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("EutheriansPlatoonDiverShoulderpad", Utility.LoadBundleGameObject("EutheriansPlatoonDiverShoulderpad"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.Prop, 874162357), true), "Submerged", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("EutheriansPlatoonDiverSuit", Utility.LoadBundleGameObject("EutheriansPlatoonDiverSuit"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.Prop, 345971284), true), "Submerged", (TagType)0);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Weapons";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Submegalo Pincer", Utility.LoadBundleGameObject("Submegalo Pincer"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.Weapon, 684231957), true), "Submerged", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Depthspear Mk III", Utility.LoadBundleGameObject("Depthspear Mk III"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.Weapon, 512879304), true), "Submerged", (TagType)0);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Projectiles";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("P_Crab_Torpedo", Utility.LoadBundleGameObject("P_Crab_Torpedo"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.Projectile, 532452342), true), "Submerged", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("P_Crab_MineBomb", Utility.LoadBundleGameObject("P_Crab_MineBomb"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.Projectile, 123413212), true), "Submerged", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("P_DepthspearMkIII", Utility.LoadBundleGameObject("P_DepthspearMkIII"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.Projectile, 56834682), true), "Submerged", (TagType)0);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Abilities";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_UnderwaterFlow", Utility.LoadBundleGameObject("Move_UnderwaterFlow"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.Ability, 412311231), true), "Submerged", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_DepthPressureResist", Utility.LoadBundleGameObject("Move_DepthPressureResist"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.Ability, 839217465), true), "Submerged", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_HydrocoreArmada", Utility.LoadBundleGameObject("Move_HydrocoreArmada"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.Ability, 271984630), true), "Submerged", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_HypersonicRadar", Utility.LoadBundleGameObject("Move_HypersonicRadar"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.Ability, 746519203), true), "Submerged", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_SpawnScubaDiver", (GameObject)SLMALoader.SDic["moves"]["Head_up"], true, (HideFlags)52, val, Utility.IDChecker(AssetType.Ability, 193845677), true), "Submerged", (TagType)0);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Explosions";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Exp_HypersonicSlam", Utility.LoadBundleGameObject("Exp_HypersonicSlam"), true, (HideFlags)52, val, 0, true), "Submerged", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Exp_HydrocoreArmada", Utility.LoadBundleGameObject("Exp_HydrocoreArmada"), true, (HideFlags)52, val, 0, true), "Submerged", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Exp_SubmegaloPincer", Utility.LoadBundleGameObject("Exp_SubmegaloPincer"), true, (HideFlags)52, val, 0, true), "Submerged", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Exp_HarpoonJam", Utility.LoadBundleGameObject("Exp_HarpoonJam"), true, (HideFlags)52, val, 0, true), "Submerged", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Exp_Crab_Torpedo", Utility.LoadBundleGameObject("Exp_Crab_Torpedo"), true, (HideFlags)52, val, 0, true), "Submerged", (TagType)0);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Effect";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Eff_Eutrophication", Utility.LoadBundleGameObject("Eff_Eutrophication"), true, (HideFlags)52, val, 0, true), "Submerged", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Eff_EMP_Disrupt", Utility.LoadBundleGameObject("Eff_EMP_Disrupt"), true, (HideFlags)52, val, 0, true), "Submerged", (TagType)0);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Unit Bases";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Drowned_Humanoid_Base", (GameObject)SLMALoader.SDic["bases"]["Humanoid"], true, (HideFlags)52, val2, Utility.IDChecker(AssetType.UnitBase, 347198625), true), "Submerged", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Giant_Crab_Base", Utility.LoadBundleGameObject("Giant_Crab_Base"), true, (HideFlags)52, val3, Utility.IDChecker(AssetType.UnitBase, 908741532), true), "Submerged", (TagType)0);
		}

		public static void SetBlueprint(UnitBlueprint unit, LandfallContentDatabase db)
		{
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Expected O, but got Unknown
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Expected O, but got Unknown
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Expected O, but got Unknown
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Expected O, but got Unknown
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Expected O, but got Unknown
			//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Expected O, but got Unknown
			//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cf: Expected O, but got Unknown
			//IL_05ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f0: Expected O, but got Unknown
			//IL_060b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0611: Expected O, but got Unknown
			//IL_062c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0632: Expected O, but got Unknown
			comment = "The Sunken Diver";
			if (unit.Entity.Name == "Sunken Diver")
			{
				SLMATool.UnitCost(unit, 3000);
				unit.Entity.SetUnlockKey("SECRET_SUNKEN_DIVER");
				unit.UnitBase = UPool.MyPool.GetObject("Drowned_Humanoid_Base");
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"Submerged Attack Vocals/Scuba General");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"Submerged Death Vocals/Scuba General");
				s.SetField<UnitBlueprint>(unit, "footRef", (object)"Footsteps/Big");
				unit.health = 1500f;
				unit.turnSpeed *= 0.5f;
				unit.massMultiplier = 10f;
				unit.maxSizeRandom = 0.9f;
				unit.minSizeRandom = 1.1f;
				unit.sizeMultiplier = 1.2f;
				unit.animationMultiplier = 1.1f;
				unit.neckLimitMultiplier = 0.01f;
				unit.holdinigWithTwoHands = true;
				unit.RightWeapon = UPool.MyPool.GetObject("Depthspear Mk III");
				unit.m_props = (GameObject[])(object)new GameObject[7]
				{
					UPool.MyPool.GetObject("EutheriansPlatoonDiverBelt"),
					UPool.MyPool.GetObject("EutheriansPlatoonDiverGauntlet"),
					UPool.MyPool.GetObject("EutheriansPlatoonDiverHelmet"),
					UPool.MyPool.GetObject("EutheriansPlatoonDiverLeftBoots"),
					UPool.MyPool.GetObject("EutheriansPlatoonDiverRightBoots"),
					UPool.MyPool.GetObject("EutheriansPlatoonDiverShoulderpad"),
					UPool.MyPool.GetObject("EutheriansPlatoonDiverSuit")
				};
				unit.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[6]
				{
					UPool.MyPool.GetObject("Move_DepthPressureResist"),
					UPool.MyPool.GetObject("Move_UnderwaterFlow"),
					(GameObject)SLMALoader.SDic["moves"]["Kick_Harpooner_L"],
					(GameObject)SLMALoader.SDic["moves"]["Kick_Blackbeard_L"],
					(GameObject)SLMALoader.SDic["moves"]["BarrelArmor_Hip"],
					(GameObject)SLMALoader.SDic["moves"]["BarrelArmor_Head"]
				};
			}
			comment = "The Giant Crab";
			if (unit.Entity.Name == "Eutherians Platoon")
			{
				SLMATool.UnitCost(unit, 5000);
				unit.UnitBase = UPool.MyPool.GetObject("Giant_Crab_Base");
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"SubmergedEffects/PlatoonGrowl");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"SubmergedEffects/PlatoonGrowl");
				s.SetField<UnitBlueprint>(unit, "footRef", (object)"Footsteps/Mammoth");
				s.SetField<UnitBlueprint>(unit, "VoicePitch", (object)1f);
				unit.health = 7000f;
				unit.turnSpeed *= 10f;
				unit.massMultiplier = 30f;
				unit.maxSizeRandom = 0.9f;
				unit.minSizeRandom = 1.1f;
				unit.sizeMultiplier = 1.1f;
				unit.animationMultiplier = 10f;
				unit.movementSpeedMuiltiplier = 1.2f;
				unit.excludeFromWinCondition = true;
				unit.holdinigWithTwoHands = false;
				unit.LeftWeapon = UPool.MyPool.GetObject("Submegalo Pincer");
				unit.RightWeapon = UPool.MyPool.GetObject("Submegalo Pincer");
				unit.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[4]
				{
					(GameObject)SLMALoader.SDic["moves"]["Small_Hover"],
					UPool.MyPool.GetObject("Move_DepthPressureResist"),
					UPool.MyPool.GetObject("Move_SpawnScubaDiver"),
					UPool.MyPool.GetObject("Move_HydrocoreArmada")
				};
				unit.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(NeverStopRunning) };
			}
			comment = "The Scuba Diver";
			if (unit.Entity.Name == "Subnautic Scuba General")
			{
				SLMATool.UnitCost(unit, 5000);
				unit.UnitBase = UPool.MyPool.GetObject("Drowned_Humanoid_Base");
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"Submerged Attack Vocals/Scuba General");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"Submerged Death Vocals/Scuba General");
				s.SetField<UnitBlueprint>(unit, "footRef", (object)"Footsteps/Big");
				unit.health = 1500f;
				unit.turnSpeed *= 0.5f;
				unit.massMultiplier = 10f;
				unit.maxSizeRandom = 0.9f;
				unit.minSizeRandom = 1.1f;
				unit.sizeMultiplier = 1.2f;
				unit.animationMultiplier = 1.1f;
				unit.neckLimitMultiplier = 0.01f;
				unit.holdinigWithTwoHands = true;
				unit.RightWeapon = UPool.MyPool.GetObject("Depthspear Mk III");
				unit.m_props = (GameObject[])(object)new GameObject[7]
				{
					UPool.MyPool.GetObject("EutheriansPlatoonDiverBelt"),
					UPool.MyPool.GetObject("EutheriansPlatoonDiverGauntlet"),
					UPool.MyPool.GetObject("EutheriansPlatoonDiverHelmet"),
					UPool.MyPool.GetObject("EutheriansPlatoonDiverLeftBoots"),
					UPool.MyPool.GetObject("EutheriansPlatoonDiverRightBoots"),
					UPool.MyPool.GetObject("EutheriansPlatoonDiverShoulderpad"),
					UPool.MyPool.GetObject("EutheriansPlatoonDiverSuit")
				};
				unit.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[7]
				{
					UPool.MyPool.GetObject("Move_DepthPressureResist"),
					UPool.MyPool.GetObject("Move_HypersonicRadar"),
					(GameObject)SLMALoader.SDic["moves"]["Kick_Harpooner_L"],
					(GameObject)SLMALoader.SDic["moves"]["Kick_Blackbeard_L"],
					(GameObject)SLMALoader.SDic["moves"]["Dodge"],
					(GameObject)SLMALoader.SDic["moves"]["BarrelArmor_Hip"],
					(GameObject)SLMALoader.SDic["moves"]["BarrelArmor_Head"]
				};
			}
		}

		public static void SetEffects(GameObject effect)
		{
			if ((Object)(object)effect == (Object)(object)UPool.MyPool.GetObject("Eff_Eutrophication"))
			{
				CatchOrAddComponent(typeof(EutrophicationEffectBase), effect);
			}
			if ((Object)(object)effect == (Object)(object)UPool.MyPool.GetObject("Eff_EMP_Disrupt"))
			{
				CatchOrAddComponent(typeof(EMPDisruptEffectBase), effect);
			}
		}

		public static void SetExplosion(GameObject explosion)
		{
			if (Object.op_Implicit((Object)(object)(explosion = UPool.MyPool.GetObject("Exp_SubmegaloPincer"))))
			{
				explosion.GetComponentInChildren<AddObjectEffect>().EffectPrefab = (UnitEffectBase)(object)UPool.MyPool.GetObject("Eff_EMP_Disrupt").GetComponentInChildren<DamageOverTimeEffect>();
			}
		}

		public static void SetUnits(Unit unit, LandfallContentDatabase db)
		{
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Expected O, but got Unknown
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			if (((Object)((Component)unit).gameObject).name == ((Object)UPool.MyPool.GetObject("Drowned_Humanoid_Base")).name)
			{
				((Component)unit).GetComponentInChildren<RigidbodyHolder>().randomizeRigidbodySizes = false;
				TeamColor[] componentsInChildren = ((Component)unit).GetComponentsInChildren<TeamColor>();
				foreach (TeamColor obj in componentsInChildren)
				{
					obj.redMaterial = Utility.LoadBundleMaterial("StandardBlackMaterial");
					obj.blueMaterial = Utility.LoadBundleMaterial("StandardBlackMaterial");
				}
			}
			if (((Object)((Component)unit).gameObject).name == ((Object)UPool.MyPool.GetObject("Giant_Crab_Base")).name)
			{
				((Component)unit).gameObject.AddComponent<RotationStabilizerBehaviour>().rb = ((Component)unit).GetComponentInChildren<DataHandler>().hip;
				ClawDamageBehaviour clawDamageBehaviour = ((Component)unit).gameObject.AddComponent<ClawDamageBehaviour>();
				clawDamageBehaviour.explosionToSpawn = UPool.MyPool.GetObject("Exp_SubmegaloPincer");
				clawDamageBehaviour.unitEffectBase = (UnitEffectBase)(object)UPool.MyPool.GetObject("Eff_Eutrophication").GetComponentInChildren<DamageOverTimeEffect>();
				((Component)unit).GetComponentInChildren<RigidbodyHolder>().randomizeRigidbodySizes = false;
				FootSupport[] componentsInChildren2 = ((Component)unit).GetComponentsInChildren<FootSupport>();
				foreach (FootSupport val in componentsInChildren2)
				{
					((Component)val).gameObject.AddComponent<IKLeg>().target = ((Component)((Component)val).GetComponentInChildren<ForcePoint>()).gameObject.transform;
				}
				IKStepHandler iKStepHandler = ((Component)unit).gameObject.AddComponent<IKStepHandler>();
				iKStepHandler.legs = new List<IKLeg>(((Component)unit).GetComponentsInChildren<IKLeg>());
				iKStepHandler.targetPositions = new List<Transform>();
				iKStepHandler.followerHolder = ((Component)unit.data).gameObject.transform;
				componentsInChildren2 = ((Component)unit).GetComponentsInChildren<FootSupport>();
				foreach (FootSupport val2 in componentsInChildren2)
				{
					iKStepHandler.targetPositions.Add(((Component)((Component)val2).GetComponentInChildren<ForcePoint>()).transform);
				}
				iKStepHandler.groundMask = LayerMask.op_Implicit(LayerMask.NameToLayer("Map"));
				AnimationCurve val3 = new AnimationCurve();
				Keyframe val4 = default(Keyframe);
				((Keyframe)(ref val4))..ctor(0f, 0f);
				Keyframe val5 = default(Keyframe);
				((Keyframe)(ref val5))..ctor(0.5f, 1f);
				Keyframe val6 = default(Keyframe);
				((Keyframe)(ref val6))..ctor(1f, 0f);
				((Keyframe)(ref val5)).inTangent = 0f;
				((Keyframe)(ref val5)).outTangent = 0f;
				val3.AddKey(val4);
				val3.AddKey(val5);
				val3.AddKey(val6);
				val3.SmoothTangents(1, 0f);
				iKStepHandler.stepUpCurve = val3;
				SkinnedMeshRenderer[] componentsInChildren3 = ((Component)unit).GetComponentsInChildren<SkinnedMeshRenderer>();
				for (int j = 0; j < componentsInChildren3.Length; j++)
				{
					((Component)componentsInChildren3[j]).gameObject.tag = "UnitMesh";
				}
			}
		}

		public static void SetWeapon(GameObject weapon, HandType hand, Team team, Unit unit, MeleeWeapon melee, RangeWeapon range, LandfallContentDatabase db)
		{
			//IL_0056: 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)
			if ((Object)(object)weapon == (Object)(object)UPool.MyPool.GetObject("Submegalo Pincer"))
			{
				weapon.GetComponentInChildren<MeleeWeaponSpawn>().objectToSpawn = UPool.MyPool.GetObject("Exp_SubmegaloPincer");
				weapon.AddComponent<MoreWeaponHandling>();
			}
			if ((Object)(object)weapon == (Object)(object)UPool.MyPool.GetObject("Depthspear Mk III"))
			{
				Transform transform = weapon.transform;
				transform.localScale *= 1.15f;
				range.ObjectToSpawn = UPool.MyPool.GetObject("P_DepthspearMkIII");
				weapon.AddComponent<MoreWeaponHandling>();
			}
		}

		public static void SetProjectile(GameObject proj, ProjectileHit projhit, LandfallContentDatabase db)
		{
			if ((Object)(object)proj == (Object)(object)UPool.MyPool.GetObject("P_Crab_MineBomb"))
			{
				proj.GetComponentInChildren<AddObjectEffect>().EffectPrefab = (UnitEffectBase)(object)UPool.MyPool.GetObject("Eff_EMP_Disrupt").GetComponentInChildren<DamageOverTimeEffect>();
			}
			if ((Object)(object)proj == (Object)(object)UPool.MyPool.GetObject("P_DepthspearMkIII"))
			{
				ReturningProjectileBehaviour obj = (ReturningProjectileBehaviour)(object)CatchOrAddComponent(typeof(ReturningProjectileBehaviour), proj);
				obj.returnIndication = UPool.MyPool.GetObject("Exp_HarpoonJam");
				obj.ropeMaterial = Utility.LoadBundleMaterial("SubmergedSurfaceParticle");
				proj.GetComponentInChildren<AddObjectEffect>().EffectPrefab = (UnitEffectBase)(object)UPool.MyPool.GetObject("Eff_Eutrophication").GetComponentInChildren<DamageOverTimeEffect>();
			}
		}

		public static void SetMoves(GameObject move, DodgeMove dodge, LandfallContentDatabase db)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_SpawnScubaDiver"))
			{
				move.AddComponent<SubmergedCustomUnitInstaSpawner>().unitBlueprint = (UnitBlueprint)SLMATool.SLMADic["Subnautic Scuba General"];
			}
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_DepthPressureResist"))
			{
				move.AddComponent<DepthPressureResistChecker>();
			}
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_HydrocoreArmada"))
			{
				HydrocoreArmadaBehaviour hydrocoreArmadaBehaviour = move.AddComponent<HydrocoreArmadaBehaviour>();
				hydrocoreArmadaBehaviour.projectileClose = UPool.MyPool.GetObject("P_Crab_MineBomb");
				hydrocoreArmadaBehaviour.projectileFar = UPool.MyPool.GetObject("P_Crab_Torpedo");
				hydrocoreArmadaBehaviour.shootIndication = UPool.MyPool.GetObject("Exp_HydrocoreArmada");
			}
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_HypersonicRadar"))
			{
				HypersonicRadarMovement hypersonicRadarMovement = move.AddComponent<HypersonicRadarMovement>();
				hypersonicRadarMovement.delayEvent = move.GetComponentInChildren<DelayEvent>();
				hypersonicRadarMovement.explosion = UPool.MyPool.GetObject("Exp_HypersonicSlam");
			}
		}

		public static void SetClothes(GameObject cloth, CharacterItem ci, Renderer render, MeshRenderer mesh, SkinnedMeshRenderer skinnedMesh, LandfallContentDatabase db)
		{
		}

		public static void SetAllGameObject(GameObject all, LandfallContentDatabase db)
		{
		}

		public static Component CatchOrAddComponent(Type typeToSeek, GameObject obj)
		{
			Component val = obj.GetComponentInChildren(typeToSeek, true);
			if ((Object)(object)val == (Object)null)
			{
				val = obj.AddComponent(typeToSeek);
			}
			return val;
		}
	}
}
namespace SubmergedCustomScripts
{
	public class HypersonicRadarMovement : MonoBehaviour
	{
		public Unit unit;

		public float counter;

		public float cooldown;

		public Coroutine moveCoroutine;

		public DelayEvent delayEvent;

		public SubJaegerConnectBehaviour subJaegerConnectBehaviour;

		public Unit crabUnit;

		public WeaponHandler weaponHandler;

		public float range;

		public float yOffset;

		public float movementDuration;

		public GameObject explosion;

		public string soundEffect = "SubmergedEffects/SonarPing";

		public float volume = 1f;

		public float pitch = 0.8f;

		public void Start()
		{
			unit = ((Component)((Component)this).transform.root).GetComponentInChildren<Unit>();
			weaponHandler = unit.data.weaponHandler;
			subJaegerConnectBehaviour = ((Component)unit).GetComponentInChildren<SubJaegerConnectBehaviour>();
			crabUnit = subJaegerConnectBehaviour.theCrab;
		}

		public void Update()
		{
			//IL_00c4: 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)
			if (!Object.op_Implicit((Object)(object)unit) || !Object.op_Implicit((Object)(object)unit.data) || !Object.op_Implicit((Object)(object)crabUnit) || !Object.op_Implicit((Object)(object)crabUnit.data) || !Object.op_Implicit((Object)(object)weaponHandler))
			{
				return;
			}
			if (!unit.data.Dead && !crabUnit.data.Dead && Object.op_Implicit((Object)(object)unit.data.targetData))
			{
				Unit val = unit.data.targetData.unit;
				float num = Vector3.Distance(unit.data.mainRig.position, val.data.mainRig.position);
				counter += Time.deltaTime * weaponHandler.attackSpeedMultiplier;
				if (counter >= cooldown && num <= range && moveCoroutine == null)
				{
					counter = 0f;
					moveCoroutine = ((MonoBehaviour)this).StartCoroutine((IEnumerator)DoMove(unit, val));
				}
			}
			else if (unit.data.Dead && moveCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(moveCoroutine);
				moveCoroutine = null;
			}
		}

		public HypersonicRadarMovement()
		{
			yOffset = 15f;
			movementDuration = 2.5f;
			cooldown = 15f;
			range = 20f;
		}

		public IEnumerator<WaitForSeconds> DoMove(Unit unit, Unit target)
		{
			Vector3 position = unit.data.mainRig.position;
			Vector3 finalPos = target.data.mainRig.position;
			PlayEffect(0);
			delayEvent.Go();
			PlaySound(target.data.mainRig.position, soundEffect, volume, pitch);
			float num = Mathf.Clamp(Vector3.Distance(position, finalPos), 1f, 10f) * yOffset;
			Vector3 targetPosition = Vector3.Lerp(position, finalPos, 0.5f) + Vector3.up * num;
			TeleportTo(crabUnit, targetPosition);
			yield return new WaitForSeconds(movementDuration);
			TeleportTo(crabUnit, finalPos);
			SpawnExplosion(explosion, finalPos);
			moveCoroutine = null;
		}

		public void PlaySound(Vector3 pos, string soundname, float volume = 1f, float pitch = 1f)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			ServiceLocator.GetService<SoundPlayer>().PlaySoundEffect(soundname, volume, pos, (MaterialType)0, (Transform)null, pitch);
		}

		public void PlayEffect(int id = 1)
		{
			//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)
			Rigidbody[] allRigs = unit.data.allRigs.AllRigs;
			for (int i = 0; i < allRigs.Length; i++)
			{
				ServiceLocator.GetService<ParticlePlayer>().PlayEffect(id, allRigs[i].position, Vector3.up, (SkinnedMeshRenderer)null);
			}
		}

		public void TeleportTo(Unit unit, Vector3 targetPosition)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)unit) && Object.op_Implicit((Object)(object)unit.data) && Object.op_Implicit((Object)(object)unit.data.allRigs) && unit.data.allRigs.AllRigs.Length != 0 && !unit.data.Dead)
			{
				for (int i = 0; i < unit.data.allRigs.AllRigs.Length; i++)
				{
					unit.data.allRigs.AllRigs[i].position = targetPosition;
				}
			}
		}

		private void OnDisable()
		{
			if (moveCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(moveCoroutine);
				moveCoroutine = null;
			}
		}

		public GameObject SpawnExplosion(GameObject objectToSpawn, Vector3 spawnPos)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			GameObject obj = Object.Instantiate<GameObject>(objectToSpawn, spawnPos, Quaternion.identity, (Transform)null);
			TeamHolder val = new TeamHolder
			{
				team = unit.Team,
				spawner = ((Component)unit).gameObject
			};
			TeamHolder.AddTeamHolder(obj, unit, val);
			return obj;
		}
	}
	public class DestroyIfUnitNullGameListener : GameStateListener
	{
		public Unit unit;

		public void Update()
		{
			if (!Object.op_Implicit((Object)(object)unit))
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		protected override void Awake()
		{
			((GameStateListener)this).Awake();
		}

		public override void OnEnterBattleState()
		{
			Object.Destroy((Object)(object)this);
		}

		public override void OnEnterPlacementState()
		{
		}
	}
}
namespace Submerged
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("GeeztJeez.Submerged", "Submerged", "1.0.0")]
	internal class Loader : BaseUnityPlugin
	{
		public class UnitCostComparer : IComparer
		{
			public int Compare(object x, object y)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				uint unitCost = ((UnitBlueprint)x).GetUnitCost(true);
				uint unitCost2 = ((UnitBlueprint)y).GetUnitCost(true);
				if (unitCost < unitCost2)
				{
					return -1;
				}
				if (unitCost > unitCost2)
				{
					return 1;
				}
				return 0;
			}
		}

		private bool executed;

		public AssetBundle scenesBundle;

		public string nameDetection = "MovingAnimals_Submerged";

		public AssetBundle assetsBundle;

		private void Awake()
		{
			ApplyHarmony();
			((MonoBehaviour)this).StartCoroutine(Call());
		}

		public void SceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Expected O, but got Unknown
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Expected O, but got Unknown
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Expected O, but got Unknown
			//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0566: Unknown result type (might be due to invalid IL or missing references)
			//IL_056b: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Expected O, but got Unknown
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Expected O, but got Unknown
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Expected O, but got Unknown
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Expected O, but got Unknown
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Expected O, but got Unknown
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Expected O, but got Unknown
			try
			{
				if (((Scene)(ref scene)).name == "03_Sandbox_Ancient_01_VC")
				{
					Object.Instantiate<GameObject>((GameObject)assetsBundle.LoadAsset("SecretProp_Seawreck"));
				}
				if (((Scene)(ref scene)).name == "03_Lvl1_Ancient_VC")
				{
					Object.Instantiate<GameObject>((GameObject)assetsBundle.LoadAsset("SecretProp_Atlantis"));
				}
				if (((Scene)(ref scene)).name.Contains("SBMGD_Lvl_Seawreck"))
				{
					RenderSettings.ambientMode = (AmbientMode)3;
					RenderSettings.ambientLight = new Color(0.3f, 0.6f, 0.3f);
					RenderSettings.defaultReflectionMode = (DefaultReflectionMode)1;
					RenderSettings.reflectionIntensity = 0f;
				}
				if (!((Scene)(ref scene)).name.Contains("SBMGD_"))
				{
					return;
				}
				Rigidbody[] array = Object.FindObjectsOfType<Rigidbody>();
				int num = 0;
				Rigidbody[] array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					GameObject gameObject = ((Component)array2[i]).gameObject;
					if (((Object)gameObject).name.StartsWith(nameDetection) && (Object)(object)gameObject.GetComponent<LivingPropBehaviour>() == (Object)null)
					{
						gameObject.AddComponent<LivingPropBehaviour>();
						num++;
					}
				}
				Debug.Log((object)$"[AnimalAttacher] Attached {num} scripts to submerged moving animals.");
				GameObject val = null;
				MapSettings val2 = null;
				GameObject bubbleEffectPrefab = (GameObject)assetsBundle.LoadAsset("UnderwaterBubbles");
				GameObject unitBubbleEffectPrefab = (GameObject)assetsBundle.LoadAsset("UnitUnderwaterBubbles");
				GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
				foreach (GameObject val3 in rootGameObjects)
				{
					if (((Object)val3).name == "AStar_Submerged")
					{
						val = val3;
					}
					if (((Object)val3).name == "SubmergedGravityBehaviour")
					{
						UnderwaterFloatZone underwaterFloatZone = val3.AddComponent<UnderwaterFloatZone>();
						underwaterFloatZone.bubbleEffectPrefab = bubbleEffectPrefab;
						underwaterFloatZone.unitBubbleEffectPrefab = unitBubbleEffectPrefab;
					}
					if (((Object)val3).name == "NavalBombSpawner")
					{
						val3.AddComponent<NavalBombSpawner>().prefabToSpawn = (GameObject)assetsBundle.LoadAsset("NavalMine");
					}
					if (Object.op_Implicit((Object)(object)val3.GetComponent<MapSettings>()))
					{
						val2 = val3.GetComponent<MapSettings>();
					}
					if (((Object)val3).name == "RandomAmbienceSFX")
					{
						AmbientRandomPlayer ambientRandomPlayer = val3.AddComponent<AmbientRandomPlayer>();
						if (((Scene)(ref scene)).name.Contains("SBMGD_Lvl_Seawreck"))
						{
							ambientRandomPlayer.audioClips = new List<AudioClip>
							{
								(AudioClip)assetsBundle.LoadAsset("SeawreckAmbience1"),
								(AudioClip)assetsBundle.LoadAsset("SeawreckAmbience2"),
								(AudioClip)assetsBundle.LoadAsset("SeawreckAmbience3")
							};
							ambientRandomPlayer.baseInterval = 40f;
							ambientRandomPlayer.randomIntervalRange = 30f;
							ambientRandomPlayer.clipsPerSequence = 2;
							ambientRandomPlayer.allowRepeats = true;
							ambientRandomPlayer.baseVolume = 0.03f;
							ambientRandomPlayer.volumeVariance = 0.025f;
							ambientRandomPlayer.basePitch = 0.7f;
							ambientRandomPlayer.pitchVariance = 0.4f;
							ambientRandomPlayer.enableSpatialRandomization = true;
							ambientRandomPlayer.spatialIntensity = 0.9f;
							ambientRandomPlayer.spatialRadius = 10f;
							ambientRandomPlayer.stereoPanRange = 0.8f;
							ambientRandomPlayer.loopSequence = true;
							ambientRandomPlayer.playOnStart = true;
						}
						else if (((Scene)(ref scene)).name.Contains("SBMGD_Lvl_Atlantis"))
						{
							ambientRandomPlayer.audioClips = new List<AudioClip>
							{
								(AudioClip)assetsBundle.LoadAsset("AtlantisAmbience1"),
								(AudioClip)assetsBundle.LoadAsset("AtlantisAmbience2"),
								(AudioClip)assetsBundle.LoadAsset("AtlantisAmbience3")
							};
							ambientRandomPlayer.baseInterval = 8f;
							ambientRandomPlayer.randomIntervalRange = 15f;
							ambientRandomPlayer.clipsPerSequence = 3;
							ambientRandomPlayer.allowRepeats = false;
							ambientRandomPlayer.baseVolume = 0.05f;
							ambientRandomPlayer.volumeVariance = 0.05f;
							ambientRandomPlayer.basePitch = 1f;
							ambientRandomPlayer.pitchVariance = 0.6f;
							ambientRandomPlayer.enableSpatialRandomization = true;
							ambientRandomPlayer.spatialIntensity = 0.3f;
							ambientRandomPlayer.spatialRadius = 2f;
							ambientRandomPlayer.stereoPanRange = 0.2f;
							ambientRandomPlayer.loopSequence = true;
							ambientRandomPlayer.playOnStart = true;
						}
					}
				}
				if (!((Object)(object)val != (Object)null) || !((Object)(object)val2 != (Object)null))
				{
					return;
				}
				AstarPath componentInChildren = val.GetComponentInChildren<AstarPath>(true);
				if (!((Object)(object)componentInChildren != (Object)null))
				{
					return;
				}
				if (componentInChildren.data.graphs != null)
				{
					NavGraph[] graphs = componentInChildren.data.graphs;
					foreach (NavGraph val4 in graphs)
					{
						if (val4 != null)
						{
							componentInChildren.data.RemoveGraph(val4);
						}
					}
				}
				NavGraph obj = componentInChildren.data.AddGraph(typeof(RecastGraph));
				RecastGraph val5 = (RecastGraph)(object)((obj is RecastGraph) ? obj : null);
				if (val5 != null)
				{
					float num2 = val2.m_mapRadius * 2f;
					((NavmeshBase)val5).forcedBoundsSize = new Vector3(num2, num2 * val2.mapRadiusYMultiplier, num2);
					val5.rasterizeTrees = true;
					val5.rasterizeMeshes = true;
					val5.rasterizeTerrain = true;
					val5.rasterizeColliders = true;
					val5.minRegionSize = 0.05f;
					val5.characterRadius = 0.3f;
					val5.walkableClimb = 1f;
					val5.walkableHeight = 1f;
					val5.cellSize = 0.2f;
					val5.mask = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "Map" }));
				}
				componentInChildren.Scan((NavGraph[])null);
				Debug.Log((object)"[Submerged] AstarPath graph scanned successfully.");
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"[Submerged] SceneLoaded failed: {arg}");
			}
		}

		private IEnumerator Call()
		{
			if (executed)
			{
				yield break;
			}
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)Object.FindObjectOfType<ServiceLocator>() != (Object)null));
			yield return (object)new WaitUntil((Func<bool>)(() => ServiceLocator.GetService<ISaveLoaderService>() != null));
			Debug.Log((object)"Loading Submerged!");
			SLMALoader.GetInstance();
			scenesBundle = GetBundle("submergedscenesbundle");
			assetsBundle = GetBundle("submergedassetsbundle");
			UManager.assetsBundle = assetsBundle;
			SceneManager.sceneLoaded += SceneLoaded;
			LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
			List<MapAsset> list = ((MapAsset[])typeof(LandfallContentDatabase).GetField("m_orderedMapAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(landfallContentDatabase)).ToList();
			Dictionary<DatabaseID, int> dictionary = (Dictionary<DatabaseID, int>)typeof(LandfallContentDatabase).GetField("m_mapAssetIndexLookup", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(landfallContentDatabase);
			foreach (MapAsset allMapAsset in GetAllMapAssets(assetsBundle))
			{
				if (!list.Contains(allMapAsset) && !dictionary.ContainsKey(allMapAsset.Entity.GUID))
				{
					list.Add(allMapAsset);
					dictionary.Add(allMapAsset.Entity.GUID, list.IndexOf(allMapAsset));
					Debug.Log((object)("Added the map asset named " + allMapAsset.MapName));
				}
			}
			foreach (SoundBank allSoundBank in GetAllSoundBanks(assetsBundle))
			{
				if (((Object)allSoundBank).name.Contains("Sound"))
				{
					SoundBank soundBank = ServiceLocator.GetService<SoundPlayer>().soundBank;
					SoundBankCategory[] categories = allSoundBank.Categories;
					for (int i = 0; i < categories.Length; i++)
					{
						categories[i].categoryMixerGroup = soundBank.Categories[0].categoryMixerGroup;
					}
					List<SoundBankCategory> list2 = soundBank.Categories.ToList();
					list2.AddRange(allSoundBank.Categories);
					soundBank.Categories = list2.ToArray();
				}
				if (!((Object)allSoundBank).name.Contains("Music"))
				{
					continue;
				}
				SoundBank bank = ServiceLocator.GetService<MusicHandler>().bank;
				List<SoundBankCategory> list3 = bank.Categories.ToList();
				list3.AddRange(allSoundBank.Categories);
				SoundBankCategory[] categories2 = allSoundBank.Categories;
				foreach (SoundBankCategory val in categories2)
				{
					SoundEffectInstance[] soundEffects = val.soundEffects;
					foreach (SoundEffectInstance val2 in soundEffects)
					{
						SongInstance val3 = new SongInstance();
						val3.clip = val2.clipTypes[0].clips[0];
						val3.soundEffectInstance = val2;
						val3.songRef = val.categoryName + "/" + val2.soundRef;
						ServiceLocator.GetService<MusicHandler>().m_songs.Add(val3.songRef, val3);
					}
				}
				bank.Categories = list3.ToArray();
			}
			typeof(LandfallContentDatabase).GetField("m_orderedMapAssets", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(landfallContentDatabase, list.ToArray());
			typeof(LandfallContentDatabase).GetField("m_mapAssetIndexLookup", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(landfallContentDatabase, dictionary);
			UManager.Init(landfallContentDatabase);
			GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
			HashSet<int> hashSet = new HashSet<int>();
			GameObject[] array2 = array;
			foreach (GameObject val4 in array2)
			{
				if ((Object)(object)val4 == (Object)null)
				{
					continue;
				}
				int instanceID = ((Object)val4).GetInstanceID();
				if (hashSet.Contains(instanceID))
				{
					continue;
				}
				hashSet.Add(instanceID);
				if (Object.op_Implicit((Object)(object)val4.GetComponent<Explosion>()))
				{
					UManager.SetExplosion(val4);
				}
				if (Object.op_Implicit((Object)(object)val4.GetComponent<WeaponItem>()))
				{
					UManager.SetWeapon(val4, val4.GetComponent<HandType>(), val4.GetComponent<Team>(), val4.GetComponent<Unit>(), val4.GetComponent<MeleeWeapon>(), val4.GetComponent<RangeWeapon>(), landfallContentDatabase);
					if (Object.op_Implicit((Object)(object)val4.GetComponent<MeleeWeapon>()))
					{
						MeleeWeapon componentInChildren = val4.GetComponentInChildren<MeleeWeapon>();
						if ((Object)(object)componentInChildren != (Object)null)
						{
							componentInChildren.Validate();
						}
					}
					if (Object.op_Implicit((Object)(object)val4.GetComponent<RangeWeapon>()))
					{
						RangeWeapon componentInChildren2 = val4.GetComponentInChildren<RangeWeapon>();
						if ((Object)(object)componentInChildren2 != (Object)null)
						{
							componentInChildren2.Validate();
						}
					}
				}
				if (Object.op_Implicit((Object)(object)val4.GetComponent<ProjectileHit>()) || Object.op_Implicit((Object)(object)val4.GetComponent<Projectile>()))
				{
					UManager.SetProjectile(val4, val4.GetComponent<ProjectileHit>(), landfallContentDatabase);
				}
				if (Object.op_Implicit((Object)(object)val4.GetComponent<PlaySoundEffect>()))
				{
					UManager.SetEffects(val4);
				}
				if (Object.op_Implicit((Object)(object)val4.GetComponent<Unit>()))
				{
					UManager.SetUnits(val4.GetComponent<Unit>(), landfallContentDatabase);
				}
				if (Object.op_Implicit((Object)(object)val4.GetComponent<SpecialAbility>()))
				{
					UManager.SetMoves(val4, val4.GetComponent<DodgeMove>(), landfallContentDatabase);
				}
				if (Object.op_Implicit((Object)(object)val4.GetComponentInChildren<PlaySoundEffect>()))
				{
					PlaySoundEffect[] componentsInChildren = val4.GetComponentsInChildren<PlaySoundEffect>();
					for (int l = 0; l < componentsInChildren.Length; l++)
					{
						componentsInChildren[l].Validate();
					}
				}
			}
			UnitBlueprint[] array3 = Resources.FindObjectsOfTypeAll<UnitBlueprint>();
			for (int m = 0; m < array3.Length; m++)
			{
				UManager.SetBlueprint(array3[m], landfallContentDatabase);
				array3[m].Validate();
			}
			Array.Sort(((Faction)SLMALoader.SDic["factions"]["Secret"]).Units, new UManager.UnitCostComparer());
			ServiceLocator.GetService<CustomContentLoaderModIO>().QuickRefresh((WorkshopContentType)5, (Action)null);
			executed = true;
			Debug.Log((object)"Submerged Successfully loaded!");
		}

		private void ApplyHarmony()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				new Harmony("Submerged").PatchAll(Assembly.GetExecutingAssembly());
				Debug.Log((object)"[Submerged] Harmony patched successfully!");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[Submerged] Harmony patch failed: " + ex));
				Debug.Log((object)"Please contact Geezt Jeez or try reloading the game for proper installation...");
			}
		}

		public static AssetBundle GetBundle(string assetBundleName)
		{
			Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(assetBundleName);
			if (manifestResourceStream == null)
			{
				Debug.LogError((object)("[LoadBundle] Failed to find resource: " + assetBundleName));
				return null;
			}
			if (!manifestResourceStream.CanRead)
			{
				Debug.LogError((object)("[LoadBundle] Resource stream is not readable: " + assetBundleName));
				return null;
			}
			return AssetBundle.LoadFromStream(manifestResourceStream);
		}

		public static List<MapAsset> GetAllMapAssets(AssetBundle bundle)
		{
			List<MapAsset> list = new List<MapAsset>();
			if ((Object)(object)bundle == (Object)null)
			{
				Debug.LogWarning((object)"[AssetBundleUtils] Bundle is null!");
				return list;
			}
			string[] allAssetNames = bundle.GetAllAssetNames();
			foreach (string text in allAssetNames)
			{
				Object obj = bundle.LoadAsset(text, typeof(MapAsset));
				MapAsset val = (MapAsset)(object)((obj is MapAsset) ? obj : null);
				if ((Object)(object)val != (Object)null)
				{
					list.Add(val);
				}
			}
			Debug.Log((object)$"[AssetBundleUtils] Loaded {list.Count} MapAssets from bundle '{((Object)bundle).name}'.");
			return list;
		}

		public static List<SoundBank> GetAllSoundBanks(AssetBundle bundle)
		{
			List<SoundBank> list = new List<SoundBank>();
			if ((Object)(object)bundle == (Object)null)
			{
				Debug.LogWarning((object)"[AssetBundleUtils] Bundle is null!");
				return list;
			}
			string[] allAssetNames = bundle.GetAllAssetNames();
			foreach (string text in allAssetNames)
			{
				Object obj = bundle.LoadAsset(text, typeof(SoundBank));
				SoundBank val = (SoundBank)(object)((obj is SoundBank) ? obj : null);
				if ((Object)(object)val != (Object)null)
				{
					list.Add(val);
				}
			}
			Debug.Log((object)$"[AssetBundleUtils] Loaded {list.Count} SoundBanks from bundle '{((Object)bundle).name}'.");
			return list;
		}
	}
}
namespace SubmergedCustomScripts
{
	public class SlowingProjectileCustom : MonoBehaviour
	{
		private MoveTransform moveTransform;

		public float lerpAmount = 3f;

		public void Update()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)moveTransform))
			{
				moveTransform.velocity = Vector3.Lerp(moveTransform.velocity, -moveTransform.velocity * lerpAmount, Time.deltaTime);
			}
		}

		public void Start()
		{
			moveTransform = ((Component)this).GetComponentInChildren<MoveTransform>();
		}
	}
	public class EMPDisruptEffectBase : UnitEffectBase
	{
		private Unit unit;

		private void Awake()
		{
			unit = ((Component)((Component)this).transform.root).GetComponentInChildren<Unit>();
		}

		public override void DoEffect()
		{
			if (Object.op_Implicit((Object)(object)unit) && Object.op_Implicit((Object)(object)unit.data))
			{
				ConditionalEvent[] componentsInChildren = ((Component)unit).GetComponentsInChildren<ConditionalEvent>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					componentsInChildren[i].StunAllOfMyMovesFor(5f);
				}
			}
		}

		public override void Ping()
		{
		}
	}
	public class MoreWeaponHandling : MonoBehaviour
	{
		public enum WeaponType
		{
			Ranged,
			Melee,
			Hybrid
		}

		public Unit unit;

		private RangeWeapon rangeWeapon;

		private MeleeWeapon meleeWeapon;

		public WeaponType weaponType;

		private Rigidbody weaponRig;

		private Rigidbody leftHandRig;

		private Rigidbody rightHandRig;

		private Holdable holdable;

		private void Start()
		{
			unit = ((Component)((Component)this).transform.root).GetComponentInChildren<Unit>();
			holdable = ((Component)this).GetComponentInChildren<Holdable>();
			rangeWeapon = ((Component)this).GetComponentInChildren<RangeWeapon>();
			meleeWeapon = ((Component)this).GetComponentInChildren<MeleeWeapon>();
			if (Object.op_Implicit((Object)(object)rangeWeapon) && Object.op_Implicit((Object)(object)meleeWeapon))
			{
				weaponType = WeaponType.Hybrid;
			}
			else if (Object.op_Implicit((Object)(object)rangeWeapon))
			{
				weaponType = WeaponType.Ranged;
			}
			else
			{
				weaponType = WeaponType.Melee;
			}
			weaponRig = ((Component)this).GetComponentInChildren<Rigidbody>();
			if (Object.op_Implicit((Object)(object)unit) && (Object)(object)unit.data != (Object)null)
			{
				Transform leftHand = unit.data.leftHand;
				leftHandRig = (((Object)(object)leftHand != (Object)null) ? ((Component)leftHand).GetComponentInChildren<Rigidbody>() : null);
				Transform rightHand = unit.data.rightHand;
				rightHandRig = (((Object)(object)rightHand != (Object)null) ? ((Component)rightHand).GetComponentInChildren<Rigidbody>() : null);
			}
		}

		private void Update()
		{
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)weaponRig != (Object)null && Object.op_Implicit((Object)(object)holdable) && holdable.holdableData != null && weaponRig.isKinematic && (Object)(object)unit != (Object)null && (Object)(object)unit.data != (Object)null && !unit.data.Dead)
			{
				Debug.LogError((object)"Weapon not connected to hands yet, connecting...");
				Debug.LogError((object)("HandLeftPos: " + leftHandRig.position));
				Vector3 val = Vector3.zero;
				Transform leftHand = holdable.holdableData.leftHand;
				if ((Object)(object)leftHand != (Object)null)
				{
					val = ((Component)leftHand).transform.position;
				}
				if ((Object)(object)leftHandRig != (Object)null)
				{
					leftHandRig.position = val;
				}
				Debug.LogError((object)("HandLeftSupposedToBe: " + val));
				Debug.LogError((object)("HandRightPos: " + rightHandRig.position));
				Vector3 val2 = Vector3.zero;
				Transform rightHand = holdable.holdableData.rightHand;
				if ((Object)(object)rightHand != (Object)null)
				{
					val2 = ((Component)rightHand).transform.position;
				}
				if ((Object)(object)rightHandRig != (Object)null)
				{
					rightHandRig.position = val2;
				}
				Debug.LogError((object)("HandRightSupposedToBe: " + val2));
			}
		}
	}
}
namespace SubmergedHarmonyPatch
{
	[HarmonyPatch(typeof(SpawnObject), "Start")]
	public class SpawnObjectSubmergedPatch
	{
		private static void Postfix(SpawnObject __instance)
		{
			if ((Object)(object)__instance == (Object)null)
			{
				return;
			}
			FieldInfo fieldInfo = AccessTools.Field(typeof(SpawnObject), "unit");
			if (fieldInfo == null)
			{
				Debug.LogError((object)"[Harmony] Could not find private field 'unit' on SpawnObject.");
				return;
			}
			object? value = fieldInfo.GetValue(__instance);
			if ((Object)((value is Unit) ? value : null) == (Object)null)
			{
				Unit component = ((Component)((Component)__instance).transform.root).GetComponent<Unit>();
				if ((Object)(object)component != (Object)null)
				{
					fieldInfo.SetValue(__instance, component);
					Debug.Log((object)"[Harmony] Assigned Unit to SpawnObject via reflection.");
				}
				else
				{
					Debug.LogWarning((object)"[Harmony] Could not find Unit on SpawnObject root.");
				}
			}
		}
	}
}
namespace SubmergedCustomScripts
{
	public class LivingPropBehaviour : MonoBehaviour
	{
		[Header("Anchor Settings")]
		[Tooltip("If left empty, the anchor will be set to this object's start position and rotation.")]
		public Transform anchorOverride;

		private Vector3 anchorPosition;

		private Quaternion anchorRotation;

		[Header("Movement Settings")]
		[Tooltip("How far it can drift from its anchor.")]
		public float maxDriftDistance = 1.2f;

		[Tooltip("How much random wandering force is applied.")]
		public float wanderForce = 0.5f;

		[Tooltip("How strongly it returns to its anchor position.")]
		public float returnForce = 0.4f;

		[Tooltip("How strongly it returns to its anchor rotation.")]
		public float rotationReturnSpeed = 0.1f;

		[Tooltip("How much random rotation variation it can have.")]
		public float rotationWobble = 80f;

		[Header("Randomization Settings")]
		[Tooltip("Time between random direction changes.")]
		public float wanderChangeInterval = 2f;

		private Vector3 wanderDirection;

		private float wanderTimer;

		private Rigidbody rb;

		private void Awake()
		{
			rb = ((Component)this).GetComponent<Rigidbody>();
			rb.useGravity = false;
			rb.drag = 1f;
			rb.angularDrag = 2f;
		}

		private void Start()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)anchorOverride != (Object)null)
			{
				anchorPosition = anchorOverride.position;
				anchorRotation = anchorOverride.rotation;
			}
			else
			{
				anchorPosition = ((Component)this).transform.position;
				anchorRotation = ((Component)this).transform.rotation;
			}
			Vector3 insideUnitSphere = Random.insideUnitSphere;
			wanderDirection = ((Vector3)(ref insideUnitSphere)).normalized;
		}

		private void FixedUpdate()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			wanderTimer -= Time.fixedDeltaTime;
			if (wanderTimer <= 0f)
			{
				wanderTimer = wanderChangeInterval;
				Vector3 insideUnitSphere = Random.insideUnitSphere;
				wanderDirection = ((Vector3)(ref insideUnitSphere)).normalized;
			}
			rb.AddForce(wanderDirection * wanderForce, (ForceMode)5);
			Vector3 val = ((Component)this).transform.position - anchorPosition;
			if (((Vector3)(ref val)).magnitude > maxDriftDistance)
			{
				rb.AddForce(-((Vector3)(ref val)).normalized * returnForce * ((Vector3)(ref val)).magnitude, (ForceMode)5);
			}
			Quaternion val2 = anchorRotation * Quaternion.Euler(Random.Range(0f - rotationWobble, rotationWobble), Random.Range(0f - rotationWobble, rotationWobble), Random.Range(0f - rotationWobble, rotationWobble));
			Quaternion val3 = Quaternion.Slerp(((Component)this).transform.rotation, val2, rotationReturnSpeed * Time.fixedDeltaTime);
			rb.MoveRotation(val3);
		}

		private void OnDrawGizmosSelected()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			Gizmos.color = Color.cyan;
			Gizmos.DrawWireSphere(Object.op_Implicit((Object)(object)anchorOverride) ? anchorOverride.position : ((Component)this).transform.position, maxDriftDistance);
		}
	}
	public class UnderwaterFloatZone : MonoBehaviour
	{
		[Header("Water Float Settings")]
		[Tooltip("How strong the up-and-down force is.")]
		public float floatStrength;

		[Tooltip("How fast the floating oscillation happens.")]
		public float floatFrequency;

		[Tooltip("Extra downward force when they reach the top (helps settle motion).")]
		public float dampingFactor;

		[Header("Layer Filter")]
		[Tooltip("Name of the layer to ignore for floating (but still spawn bubbles).")]
		public string ignoreLayerName;

		[Header("Bubble Effect")]
		[Tooltip("Bubble prefab for non-unit rigidbodies (props, debris, etc.)")]
		public GameObject bubbleEffectPrefab;

		[Tooltip("Offset above the Rigidbody’s position to spawn bubbles (for non-units).")]
		public Vector3 bubbleOffset;

		private int ignoreLayer;

		private readonly List<Rigidbody> bodies;

		private readonly Dictionary<Rigidbody, float> phaseOffset;

		[Tooltip("Bubble prefab variant for Units (spawned at head)")]
		public GameObject unitBubbleEffectPrefab;

		[Header("Water Resistance")]
		[Range(0f, 1f)]
		public float velocityResistance = 0.5f;

		[Range(0f, 1f)]
		public float angularResistance = 0.5f;

		private void Start()
		{
			ignoreLayer = LayerMask.NameToLayer(ignoreLayerName);
			Collider component = ((Component)this).GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				component.isTrigger = true;
			}
		}

		private void FixedUpdate()
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			if (bodies.Count == 0)
			{
				return;
			}
			float time = Time.time;
			for (int num = bodies.Count - 1; num >= 0; num--)
			{
				Rigidbody val = bodies[num];
				if ((Object)(object)val == (Object)null)
				{
					bodies.RemoveAt(num);
				}
				else if (!val.isKinematic)
				{
					float value;
					float num2 = (phaseOffset.TryGetValue(val, out value) ? value : 0f);
					float num3 = Mathf.Sin((time + num2) * floatFrequency) * floatStrength;
					Vector3 val2 = -val.velocity * dampingFactor * Time.fixedDeltaTime;
					val.AddForce(Vector3.up * num3 + val2, (ForceMode)5);
					val.velocity *= 1f - velocityResistance * Time.fixedDeltaTime * 10f;
					val.angularVelocity *= 1f - angularResistance * Time.fixedDeltaTime * 10f;
				}
			}
		}

		private void OnTriggerEnter(Collider other)
		{
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			Rigidbody attachedRigidbody = other.attachedRigidbody;
			if ((Object)(object)attachedRigidbody == (Object)null || Object.op_Implicit((Object)(object)((Component)((Component)other).transform.root).GetComponentInChildren<DepthPressureResistChecker>()))
			{
				return;
			}
			GameObject gameObject = ((Component)((Component)attachedRigidbody).transform.root).gameObject;
			Unit component = gameObject.GetComponent<Unit>();
			if (!((!((Object)(object)component != (Object)null)) ? ((Object)(object)((Component)attachedRigidbody).GetComponentInChildren<SubmergedHaveBubblesBehaviour>() != (Object)null) : ((Object)(object)gameObject.GetComponentInChildren<SubmergedHaveBubblesBehaviour>() != (Object)null)))
			{
				GameObject val = null;
				if ((Object)(object)component != (Object)null && (Object)(object)component.data != (Object)null && (Object)(object)component.data.head != (Object)null)
				{
					if ((Object)(object)unitBubbleEffectPrefab != (Object)null)
					{
						val = Object.Instantiate<GameObject>(unitBubbleEffectPrefab, component.data.head.position, Quaternion.identity, component.data.head);
						val.AddComponent<DestroyIfUnitDied>().unit = component;
					}
				}
				else if ((Object)(object)bubbleEffectPrefab != (Object)null)
				{
					Vector3 val2 = ((Component)attachedRigidbody).transform.position + bubbleOffset;
					val = Object.Instantiate<GameObject>(bubbleEffectPrefab, val2, Quaternion.identity, ((Component)attachedRigidbody).transform);
				}
				if ((Object)(object)val != (Object)null)
				{
					val.AddComponent<SubmergedHaveBubblesBehaviour>();
				}
			}
			if (((Component)attachedRigidbody).gameObject.layer != ignoreLayer && !attachedRigidbody.isKinematic && !bodies.Contains(attachedRigidbody))
			{
				bodies.Add(attachedRigidbody);
				phaseOffset[attachedRigidbody] = Random.Range(0f, (float)Math.PI * 2f);
			}
		}

		private void OnTriggerExit(Collider other)
		{
			Rigidbody attachedRigidbody = other.attachedRigidbody;
			if (!((Object)(object)attachedRigidbody == (Object)null))
			{
				bodies.Remove(attachedRigidbody);
				phaseOffset.Remove(attachedRigidbody);
			}
		}

		public UnderwaterFloatZone()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			floatStrength = 20f;
			floatFrequency = 1f;
			dampingFactor = 5f;
			ignoreLayerName = "Map";
			bubbleOffset = new Vector3(0f, 0.25f, 0f);
			bodies = new List<Rigidbody>();
			phaseOffset = new Dictionary<Rigidbody, float>();
		}
	}
	public class SubmergedHaveBubblesBehaviour : MonoBehaviour
	{
	}
	public class DestroyIfUnitDied : MonoBehaviour
	{
		public Unit unit;

		public void Update()
		{
			if (Object.op_Implicit((Object)(object)unit) && Object.op_Implicit((Object)(object)unit.data) && unit.data.Dead)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	public class NavalBombSpawner : MonoBehaviour
	{
		[Header("Prefab Settings")]
		[Tooltip("The prefab to spawn.")]
		public GameObject prefabToSpawn;

		[Header("Spawn Area")]
		[Tooltip("Radius of the sphere where objects will spawn.")]
		public float spawnRadius = 50f;

		[Tooltip("If true, spawns will be positioned relative to this transform.")]
		public bool useLocalSpace = true;

		[Header("Spawn Timing")]
		[Tooltip("Time (in seconds) between each spawn interval.")]
		public float spawnInterval = 8f;

		[Tooltip("How many objects to spawn per interval.")]
		public int amountPerInterval = 4;

		[Tooltip("Total number of objects to spawn (-1 for infinite).")]
		public int totalSpawnLimit = -1;

		[Header("Other Settings")]
		[Tooltip("Optional parent for spawned objects.")]
		public Transform spawnParent;

		private int totalSpawned;

		private float spawnTimer;

		private void SpawnObject()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Random.insideUnitSphere * spawnRadius;
			Vector3 val2 = (useLocalSpace ? ((Component)this).transform.TransformPoint(val) : (val + ((Component)this).transform.position));
			Quaternion rotation = Random.rotation;
			Object.Instantiate<GameObject>(prefabToSpawn, val2, rotation, spawnParent);
		}

		private void Update()
		{
			if (!((Object)(object)prefabToSpawn == (Object)null) && (totalSpawnLimit < 0 || totalSpawned < totalSpawnLimit))
			{
				spawnTimer -= Time.deltaTime;
				if (spawnTimer <= 0f)
				{
					SpawnBatch();
					spawnTimer = spawnInterval;
				}
			}
		}

		private void SpawnBatch()
		{
			for (int i = 0; i < amountPerInterval; i++)
			{
				if (totalSpawnLimit >= 0 && totalSpawned >= totalSpawnLimit)
				{
					break;
				}
				SpawnObject();
				totalSpawned++;
			}
		}
	}
	public class AmbientRandomPlayer : MonoBehaviour
	{
		[Header("\ud83c\udfb5 Audio Clips")]
		[Tooltip("List of ambient audio clips to choose from.")]
		public List<AudioClip> audioClips = new List<AudioClip>();

		[Header("\ud83d\udd22 Clip Selection Settings")]
		[Tooltip("How many clips to play in each sequence.")]
		public int clipsPerSequence = 3;

		[Tooltip("Whether to allow the same clip to repeat within one sequence.")]
		public bool allowRepeats;

		[Header("⏱\ufe0f Interval Settings (seconds)")]
		[Tooltip("Base time between clips.")]
		public float baseInterval = 5f;

		[Tooltip("Random extra time added or subtracted from the base interval.")]
		public float randomIntervalRange = 2f;

		[Header("\ud83d\udd0a Audio Modulation")]
		[Range(0f, 1f)]
		public float baseVolume = 1f;

		[Range(0f, 1f)]
		public float volumeVariance = 0.1f;

		[Range(0.1f, 3f)]
		public float basePitch = 1f;

		[Range(0f, 1f)]
		public float pitchVariance = 0.1f;

		[Header("⚙\ufe0f Behavior Settings")]
		public bool playOnStart = true;

		public bool loopSequence = true;

		private AudioSource source;

		private Coroutine playRoutine;

		[Header("\ud83c\udf10 Spatial Randomization")]
		[Tooltip("Enable subtle randomization of 2D stereo pan or 3D position.")]
		public bool enableSpatialRandomization = true;

		[Tooltip("How strong the spatial randomization effect is.")]
		[Range(0f, 1f)]
		public float spatialIntensity = 0.5f;

		[Tooltip("For 2D sounds: random left-right pan range (-1 to 1).")]
		[Range(0f, 1f)]
		public float stereoPanRange = 0.3f;

		[Tooltip("For 3D sounds: radius (in meters) around the source position where sounds can randomly play.")]
		public float spatialRadius = 2f;

		private Vector3 originalPosition;

		private void Awake()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			source = ((Component)this).GetComponent<AudioSource>();
			originalPosition = ((Component)this).transform.localPosition;
		}

		private void Start()
		{
			if (playOnStart)
			{
				StartPlaying();
			}
		}

		public void StartPlaying()
		{
			if (playRoutine == null)
			{
				playRoutine = ((MonoBehaviour)this).StartCoroutine(PlayAmbientSequence());
			}
		}

		public void StopPlaying()
		{
			if (playRoutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(playRoutine);
				playRoutine = null;
			}
		}

		private IEnumerator PlayAmbientSequence()
		{
			do
			{
				List<AudioClip> list = PickRandomClips();
				foreach (AudioClip item in list)
				{
					if ((Object)(object)item == (Object)null)
					{
						continue;
					}
					source.volume = Mathf.Clamp(baseVolume + Random.Range(0f - volumeVariance, volumeVariance), 0f, 1f);
					source.pitch = Mathf.Clamp(basePitch + Random.Range(0f - pitchVariance, pitchVariance), 0.1f, 3f);
					if (enableSpatialRandomization)
					{
						if (source.spatialBlend < 1f)
						{
							source.panStereo = Random.Range(0f - stereoPanRange, stereoPanRange) * spatialIntensity;
						}
						else
						{
							Vector3 val = Random.insideUnitSphere * spatialRadius * spatialIntensity;
							((Component)this).transform.localPosition = originalPosition + val;
						}
					}
					source.clip = item;
					source.Play();
					float num = item.length + baseInterval + Random.Range(0f - randomIntervalRange, randomIntervalRange);
					yield return (object)new WaitForSeconds(num);
					if (enableSpatialRandomization && source.spatialBlend >= 1f)
					{
						((Component)this).transform.localPosition = originalPosition;
					}
				}
			}
			while (loopSequence && loopSequence);
			playRoutine = null;
		}

		private List<AudioClip> PickRandomClips()
		{
			List<AudioClip> list = new List<AudioClip>();
			if (audioClips.Count == 0)
			{
				return list;
			}
			List<AudioClip> list2 = new List<AudioClip>(audioClips);
			for (int i = 0; i < clipsPerSequence; i++)
			{
				if (list2.Count == 0 && !allowRepeats)
				{
					break;
				}
				int index = Random.Range(0, list2.Count);
				list.Add(list2[index]);
				if (!allowRepeats)
				{
					list2.RemoveAt(index);
				}
			}
			return list;
		}
	}
	public class ReturningProjectileBehaviour : MonoBehaviour
	{
		public TeamHolder team;

		public Unit unit;

		private bool returning;

		private float returnSpeedMultiplier = 12f;

		private float minReturnDistance = 1f;

		private RangeWeapon weapon;

		public GameObject returnIndication;

		private MoveTransform moveTransform;

		private bool slowing;

		private float slowdownRate = 4.5f;

		private float returnTriggerSpeed = 1f;

		public GameObject shootPos;

		private LineRenderer ropeLine;

		private int ropeSegmentCount = 10;

		private float ropeCurveAmount = 2f;

		public GameObject rootWeapon;

		public ArrowIdlePosition arrowIdlePosition;

		private float ropeWidth = 0.065f;

		public Material ropeMaterial;

		public void Start()
		{
			team = ((Component)this).GetComponentInChildren<TeamHolder>();
			unit = ((Component)team.spawnerWeapon.transform.root).GetComponentInChildren<Unit>();
			weapon = team.spawnerWeapon.GetComponentInParent<RangeWeapon>();
			rootWeapon = ((Component)weapon).gameObject;
			shootPos = ((Component)((Component)rootWeapon.GetComponentInChildren<ShootPosition>()).transform).gameObject;
			moveTransform = ((Component)this).GetComponentInChildren<MoveTransform>();
			arrowIdlePosition = ((Component)this).GetComponentInChildren<ArrowIdlePosition>();
			slowing = true;
			AddRope();
		}

		private void StartReturn()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			returning = true;
			if ((Object)(object)returnIndication != (Object)null)
			{
				Spawn(returnIndication, ((Component)moveTransform).transform.position);
			}
		}

		private void OnReturn()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)returnIndication != (Object)null)
			{
				Spawn(returnIndication, shootPos.transform.position);
			}
			if ((Object)(object)weapon != (Object)null)
			{
				((Weapon)weapon).internalCounter = float.PositiveInfinity;
			}
			StopReturn();
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		private void StopReturn()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			returning = false;
			if ((Object)(object)moveTransform != (Object)null)
			{
				moveTransform.velocity = Vector3.zero;
				moveTransform.rotationFollowVelocity = false;
			}
		}

		private void Update()
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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_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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)shootPos == (Object)null || (Object)(object)moveTransform == (Object)null)
			{
				return;
			}
			float magnitude = ((Vector3)(ref moveTransform.velocity)).magnitude;
			if (slowing && !returning)
			{
				moveTransform.velocity = Vector3.Lerp(moveTransform.velocity, Vector3.zero, Time.fixedDeltaTime * slowdownRate);
				if (magnitude < returnTriggerSpeed)
				{
					slowing = false;
					StartReturn();
				}
			}
			if (returning)
			{
				Vector3 position = shootPos.transform.position;
				Vector3 position2 = ((Component)moveTransform).transform.position;
				Vector3 val = position - position2;
				float magnitude2 = ((Vector3)(ref val)).magnitude;
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				Vector3 forward = shootPos.transform.forward;
				float num = 250f;
				float num2 = 25f;
				float num3 = 0.15f;
				Vector3 val2 = Vector3.Slerp(normalized, forward, num3);
				Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
				float num4 = Mathf.Lerp(returnSpeedMultiplier * 3f, returnSpeedMultiplier * num2, Mathf.Clamp01(magnitude2 / 15f));
				moveTransform.velocity = Vector3.MoveTowards(moveTransform.velocity, normalized2 * num4, num * Time.deltaTime);
				moveTransform.rotationFollowVelocity = true;
				if (magnitude2 < minReturnDistance)
				{
					OnReturn();
				}
			}
		}

		public void Spawn(GameObject objectToSpawn, Vector3 position)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			TeamHolder.AddTeamHolder(Object.Instantiate<GameObject>(objectToSpawn, position, Quaternion.identity), unit, team);
		}

		private void UpdateRope()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_0061: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ropeLine == (Object)null || (Object)(object)shootPos == (Object)null || (Object)(object)moveTransform == (Object)null)
			{
				return;
			}
			Vector3 position = ((Component)arrowIdlePosition).transform.position;
			Vector3 position2 = shootPos.transform.position;
			float num = Vector3.Distance(position, position2);
			Vector3 val = (position + position2) * 0.5f;
			Vector3 val2 = position2 - position;
			val2 = Vector3.Cross(((Vector3)(ref val2)).normalized, Vector3.up);
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			float num2 = Mathf.Clamp01(num / 6f);
			Vector3 val3 = val + normalized * ropeCurveAmount * num2 * 0.5f;
			for (int i = 0; i < ropeSegmentCount; i++)
			{
				float num3 = (float)i / (float)(ropeSegmentCount - 1);
				float num4 = 1f - num3;
				Vector3 val4 = num4 * num4 * position + 2f * num4 * num3 * val3 + num3 * num3 * position2;
				Vector3 val5 = Vector3.zero;
				if (returning)
				{
					val5 = normalized * Mathf.Sin(Time.time * 6f + num3 * 3f) * 0.05f * num2;
				}
				ropeLine.SetPosition(i, val4 + val5);
			}
		}

		private void LateUpdate()
		{
			if (!((Object)(object)shootPos == (Object)null) && !((Object)(object)moveTransform == (Object)null))
			{
				UpdateRope();
			}
		}

		public void AddRope()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			ropeLine = ((Component)this).gameObject.AddComponent<LineRenderer>();
			ropeLine.positionCount = ropeSegmentCount;
			ropeLine.widthMultiplier = ropeWidth;
			((Renderer)ropeLine).material = ropeMaterial;
			ropeLine.startColor = new Color(0f, 0f, 0f);
			ropeLine.endColor = new Color(0.06f, 0.02f, 0.02f);
			ropeLine.useWorldSpace = true;
		}
	}
	public class DepthPressureResistChecker : MonoBehaviour
	{
	}
	public class EutrophicationEffectBase : UnitEffectBase
	{
		private float counter;

		public float cooldown = 0.05f;

		public float reduceAmount = 0.02f;

		private Unit unit;

		private DataHandler dataHandler;

		public float velocitySlowAmount = 0.1f;

		public override void DoEffect()
		{
			((UnitEffectBase)this).Ping();
		}

		public override void Ping()
		{
			Start();
		}

		private void Update()
		{
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			counter += Time.deltaTime;
			if (!Object.op_Implicit((Object)(object)unit) || !Object.op_Implicit((Object)(object)dataHandler) || dataHandler.Dead || !Object.op_Implicit((Object)(object)dataHandler.targetData) || !Object.op_Implicit((Object)(object)dataHandler.targetData.mainRig) || !((Object)(object)dataHandler.allRigs != (Object)null) || dataHandler.allRigs.AllRigs == null || !(counter >= cooldown))
			{
				return;
			}
			counter = 0f;
			_ = dataHandler.targetData.mainRig;
			RangeWeapon[] componentsInChildren = ((Component)unit).GetComponentsInChildren<RangeWeapon>();
			foreach (RangeWeapon obj in componentsInChildren)
			{
				((Weapon)obj).internalCounter = ((Weapon)obj).internalCounter - reduceAmount;
			}
			MeleeWeapon[] componentsInChildren2 = ((Component)unit).GetComponentsInChildren<MeleeWeapon>();
			foreach (MeleeWeapon obj2 in componentsInChildren2)
			{
				((Weapon)obj2).internalCounter = ((Weapon)obj2).internalCounter - reduceAmount;
			}
			ConditionalEvent[] componentsInChildren3 = ((Component)unit).GetComponentsInChildren<ConditionalEvent>();
			for (int k = 0; k < componentsInChildren3.Length; k++)
			{
				ConditionalEventInstance[] events = componentsInChildren3[k].events;
				for (int l = 0; l < events.Length; l++)
				{
					EventCondition[] conditions = events[l].conditions;
					foreach (EventCondition obj3 in conditions)
					{
						obj3.counter -= reduceAmount;
					}
				}
			}
			Rigidbody[] allRigs = dataHandler.allRigs.AllRigs;
			for (int n = 0; n < allRigs.Length; n++)
			{
				Rigidbody obj4 = allRigs[n];
				obj4.velocity *= velocitySlowAmount * Time.deltaTime;
				Rigidbody obj5 = allRigs[n];
				obj5.angularVelocity *= velocitySlowAmount * Time.deltaTime;
			}
		}

		private void Start()
		{
			unit = ((Component)((Component)this).transform.root).GetComponentInChildren<Unit>();
			if (Object.op_Implicit((Object)(object)unit))
			{
				dataHandler = unit.data;
			}
		}
	}
	public class SubmergedCustomUnitInstaSpawner : MonoBehaviour
	{
		private Unit rootUnit;

		public UnitBlueprint unitBlueprint;

		public int amountToSpawn = 1;

		private TeamHolder teamHolder;

		public Vector3 offset = new Vector3(0f, 2f, 0f);

		private void Start()
		{
			teamHolder = ((Component)this).GetComponentInParent<TeamHolder>();
			rootUnit = ((Component)((Component)this).transform.root).GetComponent<Unit>();
			SubJaegerConnectBehaviour subJaegerConnectBehaviour = ((Component)rootUnit).gameObject.AddComponent<SubJaegerConnectBehaviour>();
			subJaegerConnectBehaviour.theCrab = rootUnit;
			for (int i = 0; i < amountToSpawn; i++)
			{
				subJaegerConnectBehaviour.theDiver = Spawn();
			}
		}

		public Unit Spawn()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)rootUnit))
			{
				try
				{
					Unit val = default(Unit);
					unitBlueprint.Spawn(rootUnit.data.mainRig.position + offset, ((Component)this).transform.rotation, rootUnit.data.team, ref val, 1f, false, true, 0, (UnitPoolInfo?)null);
					SubJaegerConnectBehaviour subJaegerConnectBehaviour = ((Component)val).gameObject.AddComponent<SubJaegerConnectBehaviour>();
					subJaegerConnectBehaviour.theCrab = rootUnit;
					subJaegerConnectBehaviour.theDiver = val;
					((Component)val).gameObject.AddComponent<DestroyIfUnitNullGameListener>().unit = rootUnit;
					return val;
				}
				catch (Exception ex)
				{
					Debug.Log((object)ex);
					return null;
				}
			}
			return null;
		}
	}
	public class SubJaegerConnectBehaviour : MonoBehaviour
	{
		public Unit theDiver;

		public Unit theCrab;
	}
	public class HydrocoreArmadaBehaviour : MonoBehaviour
	{
		public string soundEffect = "Effects/HammerExplosion";

		public float pitch = 0.8f;

		public float volume = 1f;

		public Unit rootUnit;

		public float rangeChangeMin = 15f;

		public GameObject projectileFar;

		public GameObject projectileClose;

		public GameObject shootIndication;

		public ProjectilesSpawnManager m_spawnManager;

		public ShootPosition shootPosition;

		public float cooldown = 3f;

		public float counter;

		public WeaponHandler weaponHandler;

		public float closeProjectileForce = 5000f;

		public void Start()
		{
			shootPosition = ((Component)((Component)this).transform.root).GetComponentInChildren<ShootPosition>();
			rootUnit = ((Component)((Component)this).transform.root).GetComponentInChildren<Unit>();
			weaponHandler = rootUnit.data.weaponHandler;
			if ((Object)(object)m_spawnManager == (Object)null)
			{
				m_spawnManager = ServiceLocator.GetService<ProjectilesSpawnManager>();
			}
		}

		public void Update()
		{
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)rootUnit) || !Object.op_Implicit((Object)(object)rootUnit.data) || rootUnit.data.Dead || !Object.op_Implicit((Object)(object)rootUnit.data.targetData) || !Object.op_Implicit((Object)(object)shootPosition))
			{
				return;
			}
			Unit unit = rootUnit.data.targetData.unit;
			counter += Time.deltaTime * weaponHandler.attackSpeedMultiplier;
			float num = Ve