Decompiled source of StrayMode v1.0.6

Straymode2.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using GameConsole;
using HarmonyLib;
using Straymode.IdentifierCode;
using Straymode.InGameCode.CustomProjectiles;
using Straymode.WeaponCode;
using TMPro;
using ULTRAKILL.Cheats;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ThundergunRevised")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ThundergunRevised")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5711e2a0-d5a7-4ddf-b8d4-00f355fe9397")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguage("en-FI")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Straymode
{
	public class DebugLog : ICommand
	{
		public string Name => "straymode-debug";

		public string Description => "";

		public string Command => "straymode-debug";

		public void Execute(Console con, string[] args)
		{
			MainCode.Log("Debugging " + !MainCode.Debugging);
			MainCode.Debugging = !MainCode.Debugging;
		}
	}
	public class PlySCBeam : MonoBehaviour
	{
		private GameObject hitParticle;

		public bool active = true;

		public Vector3 hitPosition;

		public Quaternion hitRotation;

		private void Start()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			hitParticle = new GameObject();
		}

		private void FixedUpdate()
		{
		}

		private void Update()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			hitPosition = ((Component)this).transform.position + ((Component)this).transform.forward * 100f;
			Vector3 forward = ((Component)this).transform.forward * -1f;
			LayerMask val = LayerMaskDefaults.Get((LMD)3);
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(((Component)this).transform.position, ((Component)this).transform.forward, ref val2, 100f, LayerMask.op_Implicit(val), (QueryTriggerInteraction)1))
			{
				hitPosition = ((RaycastHit)(ref val2)).point;
				forward = ((RaycastHit)(ref val2)).normal;
			}
			hitParticle.transform.position = hitPosition;
			hitParticle.transform.forward = forward;
			hitRotation = hitParticle.transform.rotation;
		}
	}
	[BepInPlugin("plonk.straymode", "Straymode2", "1.0.0")]
	public class MainCode : BaseUnityPlugin
	{
		[HarmonyPatch]
		public class PatchesToMakeTheModPlayable
		{
			[HarmonyPostfix]
			[HarmonyPatch(typeof(ShopZone), "Start")]
			public static void ResizeShops(ShopZone __instance)
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				if (tcenabled)
				{
					Transform transform = ((Component)__instance).transform;
					transform.localScale *= 1.3f;
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(OptionsMenuToManager), "Start")]
			public static void ChangeMenuTitle(OptionsMenuToManager __instance)
			{
				Transform val = ((Component)__instance).transform.Find("Main Menu (1)");
				if (!((Object)(object)val == (Object)null) && tcenabled)
				{
					GameObject gameObject = ((Component)val.GetChild(0)).gameObject;
					GameObject val2 = Object.Instantiate<GameObject>(gameObject, gameObject.transform.parent);
					val2.GetComponent<Image>().sprite = MainCode.FetchFromBundle<Sprite>("mainmenu.png", autofill: true);
					gameObject.SetActive(false);
				}
			}

			[HarmonyPrefix]
			[HarmonyPatch(typeof(EnemyIdentifier), "Start")]
			public static void SCDontAttackPatch(EnemyIdentifier __instance)
			{
				//IL_0004: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Invalid comparison between Unknown and I4
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Invalid comparison between Unknown and I4
				bool flag = false;
				if (((int)__instance.enemyType == 13) | ((int)__instance.enemyType == 15))
				{
					flag = true;
				}
				if (flag & tcenabled & ((Object)(object)((Component)__instance).GetComponent<PlayerSCID>() == (Object)null))
				{
					__instance.prioritizeEnemiesUnlessAttacked = true;
					__instance.attackEnemies = true;
				}
			}

			[HarmonyPrefix]
			[HarmonyPatch(typeof(BulletCheck), "OnTriggerEnter")]
			public static bool StopDeflect(BulletCheck __instance)
			{
				if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponentInParent<PlayerSCID>()))
				{
					return false;
				}
				return true;
			}

			[HarmonyPrefix]
			[HarmonyPatch(typeof(Streetcleaner), "Update")]
			public static bool WalkFix(Streetcleaner __instance)
			{
				if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<PlayerSCID>()))
				{
					return false;
				}
				return true;
			}

			[HarmonyPrefix]
			[HarmonyPatch(typeof(ContinuousBeam), "Update")]
			public static bool LimitBeamRange(ContinuousBeam __instance)
			{
				//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_0021: 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_0039: 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_006c: 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_0051: 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_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ff: 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_012d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01da: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_02af: Unknown result type (might be due to invalid IL or missing references)
				//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0565: Unknown result type (might be due to invalid IL or missing references)
				//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_044c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0452: Invalid comparison between Unknown and I4
				if ((Object)(object)((Component)__instance).GetComponent<PlayableStreetcleanerPatchID>() != (Object)null)
				{
					Vector3 zero = Vector3.zero;
					RaycastHit val = default(RaycastHit);
					zero = ((!Physics.Raycast(((Component)__instance).transform.position, ((Component)__instance).transform.forward, ref val, float.PositiveInfinity, LayerMask.op_Implicit(__instance.environmentMask))) ? (((Component)__instance).transform.position + ((Component)__instance).transform.forward * 999f) : ((RaycastHit)(ref val)).point);
					__instance.lr.SetPosition(0, ((Component)__instance).transform.position);
					__instance.lr.SetPosition(1, zero);
					if (Object.op_Implicit((Object)(object)__instance.impactEffect))
					{
						__instance.impactEffect.transform.position = zero;
					}
					RaycastHit[] array = Physics.SphereCastAll(((Component)__instance).transform.position + ((Component)__instance).transform.forward * __instance.beamWidth, __instance.beamWidth, ((Component)__instance).transform.forward, Mathf.Clamp(Vector3.Distance(((Component)__instance).transform.position, zero), __instance.beamWidth, 15f) - __instance.beamWidth, LayerMask.op_Implicit(__instance.hitMask));
					if (array != null && array.Length != 0)
					{
						Bleeder val3 = default(Bleeder);
						for (int i = 0; i < array.Length; i++)
						{
							if (__instance.canHitPlayer && __instance.playerCooldown <= 0f && ((Component)((RaycastHit)(ref array[i])).collider).gameObject.CompareTag("Player"))
							{
								__instance.playerCooldown = 0.5f;
								if (!Physics.Raycast(((Component)__instance).transform.position, ((RaycastHit)(ref array[i])).point - ((Component)__instance).transform.position, ((RaycastHit)(ref array[i])).distance, LayerMask.op_Implicit(__instance.environmentMask)))
								{
									MonoSingleton<NewMovement>.Instance.GetHurt(Mathf.RoundToInt(__instance.damage), true, 1f, false, false, 1f, true);
								}
							}
							else if ((((Component)((RaycastHit)(ref array[i])).transform).gameObject.layer == 10 || ((Component)((RaycastHit)(ref array[i])).transform).gameObject.layer == 11) && __instance.canHitEnemy)
							{
								EnemyIdentifierIdentifier component = ((Component)((RaycastHit)(ref array[i])).transform).GetComponent<EnemyIdentifierIdentifier>();
								if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.eid) || (__instance.enemy && (component.eid.enemyType == __instance.safeEnemyType || EnemyIdentifier.CheckHurtException(__instance.safeEnemyType, component.eid.enemyType, __instance.target))))
								{
									continue;
								}
								EnemyIdentifier eid = component.eid;
								bool flag = false;
								if (__instance.hitEnemies.Contains(eid))
								{
									flag = true;
								}
								if (flag && !(__instance.enemyCooldowns[__instance.hitEnemies.IndexOf(eid)] <= 0f))
								{
									continue;
								}
								if (!flag)
								{
									__instance.hitEnemies.Add(eid);
									__instance.enemyCooldowns.Add(0.5f);
								}
								else
								{
									__instance.enemyCooldowns[__instance.hitEnemies.IndexOf(eid)] = 0.5f;
								}
								eid.hitter = "FlameThrower";
								eid.DeliverDamage(((Component)((RaycastHit)(ref array[i])).transform).gameObject, Vector3.zero, ((RaycastHit)(ref array[i])).point, __instance.damage / 10f, true, 0f, (GameObject)null, false, false);
								if (!eid.dead)
								{
									if (eid.health <= __instance.damage / 10f)
									{
										MonoSingleton<StyleHUD>.instance.AddPoints(100, "ultrakill.fried", (GameObject)null, eid, 1, "<color=orange>", " TO DEATH</color>");
									}
									else
									{
										MonoSingleton<StyleHUD>.instance.AddPoints(5, "ultrakill.fried", (GameObject)null, eid, 1, "", "");
									}
									if ((int)eid.enemyType == 6)
									{
										MonoSingleton<StyleHUD>.instance.AddPoints(0, "ultrakill.disrespect", (GameObject)null, eid, 1, "<color=red>", "</color>");
										eid.attackEnemies = false;
										eid.ignorePlayer = false;
									}
								}
								Flammable component2 = ((Component)eid).GetComponent<Flammable>();
								if ((Object)(object)component2 != (Object)null && !component2.playerOnly)
								{
									component2.Burn(10f, false);
								}
							}
							else if (((Component)((RaycastHit)(ref array[i])).transform).gameObject.layer == 8 || ((Component)((RaycastHit)(ref array[i])).transform).gameObject.layer == 24)
							{
								Flammable val2 = null;
								if (((Component)((RaycastHit)(ref array[i])).transform).gameObject.TryGetComponent<Flammable>(ref val2))
								{
									val2.Burn(1f, false);
								}
								if (((Component)((RaycastHit)(ref array[i])).transform).gameObject.TryGetComponent<Bleeder>(ref val3))
								{
									val3.GetHit(((RaycastHit)(ref array[i])).point, (GoreType)3, false);
								}
							}
						}
					}
					if (__instance.playerCooldown > 0f)
					{
						__instance.playerCooldown = Mathf.MoveTowards(__instance.playerCooldown, 0f, Time.deltaTime);
					}
					if (__instance.enemyCooldowns.Count > 0)
					{
						for (int j = 0; j < __instance.enemyCooldowns.Count; j++)
						{
							__instance.enemyCooldowns[j] = Mathf.MoveTowards(__instance.enemyCooldowns[j], 0f, Time.deltaTime);
						}
					}
					return false;
				}
				return true;
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(SaveSlotMenu), "OnEnable")]
			private static void GabeSlotMaker(SaveSlotMenu __instance)
			{
				//IL_010e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0118: Expected O, but got Unknown
				//IL_0132: Unknown result type (might be due to invalid IL or missing references)
				//IL_013c: Expected O, but got Unknown
				//IL_0149: Unknown result type (might be due to invalid IL or missing references)
				bool flag = false;
				for (int i = 0; i < __instance.slots.Length; i++)
				{
					if (__instance.slots[i].slotNumberLabel.text == "STRAYMODE")
					{
						flag = true;
					}
				}
				if (!flag)
				{
					SlotRowPanel newRow = Object.Instantiate<SlotRowPanel>(__instance.templateRow, ((Component)__instance.templateRow).transform.parent);
					newRow.slotIndex = 1015064006;
					((Component)newRow).gameObject.SetActive(true);
					__instance.UpdateSlotState(newRow, GetSlot(1015064006));
					((UnityEvent)newRow.selectButton.onClick).AddListener((UnityAction)delegate
					{
						__instance.SelectSlot(newRow.slotIndex);
					});
					((UnityEvent)newRow.deleteButton.onClick).AddListener((UnityAction)delegate
					{
						__instance.ClearSlot(newRow.slotIndex);
					});
					((Graphic)newRow.slotNumberLabel).color = Color.white;
					newRow.slotNumberLabel.text = "STRAYMODE";
					List<SlotRowPanel> list = new List<SlotRowPanel>();
					list.AddRange(__instance.slots);
					list.Add(newRow);
					__instance.slots = list.ToArray();
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(NewMovement), "Start")]
			private static void MovementSoundPatch(NewMovement __instance)
			{
				int @int = MonoSingleton<PrefsManager>.Instance.GetInt("selectedSaveSlot", 0);
				if (@int == 1015064006)
				{
					GameProgressMoneyAndGear generalProgress = GameProgressSaver.GetGeneralProgress();
					generalProgress.revalt = 0;
					generalProgress.rev3 = 0;
					generalProgress.sho2 = 0;
					generalProgress.nai0 = 0;
					generalProgress.nai1 = 0;
					generalProgress.nai2 = 0;
					generalProgress.nai3 = 0;
					generalProgress.naialt = 0;
					generalProgress.beam0 = 0;
					generalProgress.beam1 = 0;
					generalProgress.beam2 = 0;
					generalProgress.beam3 = 0;
					generalProgress.rai0 = 0;
					generalProgress.rai1 = 0;
					generalProgress.rai2 = 0;
					generalProgress.rai3 = 0;
					generalProgress.rock0 = 0;
					generalProgress.rock1 = 0;
					generalProgress.rock2 = 0;
					generalProgress.rock3 = 0;
					if (generalProgress.arm1 == 1)
					{
						Debug.Log((object)"gon astray");
					}
					generalProgress.arm1 = 0;
					generalProgress.arm2 = 0;
					generalProgress.arm3 = 0;
					GameProgressSaver.WriteFile(GameProgressSaver.generalProgressPath, (object)generalProgress);
				}
			}

			[HarmonyPrefix]
			[HarmonyPatch(typeof(Bonus), "OnTriggerEnter")]
			public static bool FixOverheal(Bonus __instance, Collider other)
			{
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_01a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a9: Invalid comparison between Unknown and I4
				//IL_011e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0124: Invalid comparison between Unknown and I4
				if (tcenabled)
				{
					if (((Component)other).gameObject.CompareTag("Player") && !__instance.activated)
					{
						if (!__instance.ghost)
						{
							__instance.activated = true;
							MonoSingleton<TimeController>.Instance.ParryFlash();
							StyleHUD instance = MonoSingleton<StyleHUD>.Instance;
							StatsManager instance2 = MonoSingleton<StatsManager>.Instance;
							Object.Instantiate<GameObject>(__instance.breakEffect, ((Component)__instance).transform.position, Quaternion.identity);
							instance.AddPoints(0, "ultrakill.secret", (GameObject)null, (EnemyIdentifier)null, -1, "", "");
							instance2.secrets++;
							instance2.SecretFound(__instance.secretNumber);
							Object.Destroy((Object)(object)((Component)__instance).gameObject);
						}
						else
						{
							if (__instance.tutorial)
							{
								MonoSingleton<TimeController>.Instance.ParryFlash();
							}
							Object.Instantiate<GameObject>(__instance.breakEffect, ((Component)__instance).transform.position, Quaternion.identity);
							Object.Destroy((Object)(object)((Component)__instance).gameObject);
						}
						if (__instance.superCharge)
						{
							if ((int)MonoSingleton<PlayerTracker>.Instance.playerType == 0)
							{
								overhealed = true;
								MonoSingleton<NewMovement>.Instance.hp = 140;
							}
							else
							{
								MonoSingleton<PlatformerMovement>.Instance.AddExtraHit(2);
							}
							if (!MonoSingleton<PrefsManager>.Instance.GetBool("hideSuperChargePopup", false))
							{
								MonoSingleton<PrefsManager>.Instance.SetBool("hideSuperChargePopup", true);
								MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>RED SOUL ORBS</color> give <color=green>200 HEALTH</color>. \nOverheal cannot be regained with blood.", "", "", 1, false);
							}
						}
						else if ((int)MonoSingleton<PlayerTracker>.Instance.playerType == 1)
						{
							MonoSingleton<PlatformerMovement>.Instance.AddExtraHit(1);
						}
					}
					return false;
				}
				return true;
			}

			[HarmonyPrefix]
			[HarmonyPatch(typeof(IntroTextController), "Awake")]
			public static void replaceTutorialText(IntroTextController __instance)
			{
				if (SceneHelper.CurrentScene == "Tutorial" && tcenabled)
				{
					((TMP_Text)__instance.page1Screen.GetComponent<TextMeshProUGUI>()).text = ((TMP_Text)MainCode.FetchFromBundle<GameObject>("page 1 first.prefab", autofill: true).GetComponent<TextMeshProUGUI>()).text;
					((TMP_Text)__instance.page1SecondTimeScreen.GetComponent<TextMeshProUGUI>()).text = ((TMP_Text)MainCode.FetchFromBundle<GameObject>("page 1 second.prefab", autofill: true).GetComponent<TextMeshProUGUI>()).text;
					((TMP_Text)__instance.page2Screen.GetComponent<TextMeshProUGUI>()).text = ((TMP_Text)MainCode.FetchFromBundle<GameObject>("page 2 alternate.prefab", autofill: true).GetComponent<TextMeshProUGUI>()).text;
					((TMP_Text)__instance.page2NoFade.GetComponent<TextMeshProUGUI>()).text = ((TMP_Text)MainCode.FetchFromBundle<GameObject>("page 2 nofade alternate.prefab", autofill: true).GetComponent<TextMeshProUGUI>()).text;
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(GunControl), "UpdateWeaponList")]
			public static void ReplaceWeaponsCaller(GunControl __instance)
			{
				if (tcenabled)
				{
					ReplaceWeapons();
				}
			}

			[HarmonyPrefix]
			[HarmonyPatch(typeof(FistControl), "ResetFists")]
			public static bool resetFistsPatch(FistControl __instance)
			{
				//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Invalid comparison between Unknown and I4
				//IL_0099: Unknown result type (might be due to invalid IL or missing references)
				if (tcenabled)
				{
					if (__instance.spawnedArms.Count > 0)
					{
						for (int i = 0; i < __instance.spawnedArms.Count; i++)
						{
							Object.Destroy((Object)(object)__instance.spawnedArms[i]);
						}
						__instance.spawnedArms.Clear();
						__instance.spawnedArmNums.Clear();
					}
					MonoSingleton<HookArm>.Instance.equipped = false;
					if ((MonoSingleton<PrefsManager>.Instance.GetInt("weapon.arm0", 1) == 1 && (__instance.forcedLoadout == null || (int)__instance.forcedLoadout.arm.blueVariant == 0)) || (__instance.forcedLoadout != null && (int)__instance.forcedLoadout.arm.blueVariant == 1))
					{
						GameObject item = Object.Instantiate<GameObject>(bluearm, ((Component)__instance).transform);
						__instance.spawnedArms.Add(item);
						__instance.spawnedArmNums.Add(0);
					}
					__instance.CheckFist("arm1");
					__instance.CheckFist("arm2");
					__instance.CheckFist("arm3");
					if (__instance.spawnedArms.Count <= 1 || !MonoSingleton<PrefsManager>.Instance.GetBool("armIcons", false))
					{
						GameObject[] fistPanels = __instance.fistPanels;
						for (int j = 0; j < fistPanels.Length; j++)
						{
							fistPanels[j].SetActive(false);
						}
					}
					else
					{
						GameObject[] fistPanels2 = __instance.fistPanels;
						for (int k = 0; k < fistPanels2.Length; k++)
						{
							fistPanels2[k].SetActive(true);
						}
					}
					__instance.ForceArm(__instance.currentVarNum, false);
					__instance.UpdateFistIcon();
					return false;
				}
				return true;
			}

			[HarmonyPrefix]
			[HarmonyPatch(typeof(FistControl), "CheckFist")]
			public static bool checkFistsPatch(FistControl __instance, string name)
			{
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a7: Invalid comparison between Unknown and I4
				//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f8: Invalid comparison between Unknown and I4
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Invalid comparison between Unknown and I4
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Invalid comparison between Unknown and I4
				if (tcenabled)
				{
					if (__instance.forcedLoadout != null)
					{
						if (!(name == "arm1"))
						{
							if (name == "arm2")
							{
								if ((int)__instance.forcedLoadout.arm.greenVariant == 1)
								{
									MonoSingleton<HookArm>.Instance.equipped = true;
									return false;
								}
								if ((int)__instance.forcedLoadout.arm.greenVariant == 2)
								{
									return false;
								}
							}
						}
						else
						{
							if ((int)__instance.forcedLoadout.arm.redVariant == 1)
							{
								__instance.spawnedArmNums.Add(1);
								__instance.spawnedArms.Add(Object.Instantiate<GameObject>(AddressablesExtensions.ToAsset(__instance.redArm), ((Component)__instance).transform));
								return false;
							}
							if ((int)__instance.forcedLoadout.arm.redVariant == 2)
							{
								return false;
							}
						}
					}
					if (MonoSingleton<PrefsManager>.Instance.GetInt("weapon." + name, 1) == 1 && GameProgressSaver.CheckGear(name) == 1)
					{
						GameObject val = null;
						switch (name)
						{
						case "arm3":
							val = Object.Instantiate<GameObject>(AddressablesExtensions.ToAsset(__instance.goldArm), ((Component)__instance).transform);
							__instance.spawnedArmNums.Add(3);
							break;
						case "arm2":
							MonoSingleton<HookArm>.Instance.equipped = true;
							break;
						case "arm1":
							val = Object.Instantiate<GameObject>(AddressablesExtensions.ToAsset(__instance.redArm), ((Component)__instance).transform);
							__instance.spawnedArmNums.Add(1);
							break;
						}
						if ((Object)(object)val != (Object)null)
						{
							__instance.spawnedArms.Add(val);
						}
					}
					return false;
				}
				return true;
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(VariationInfo), "Start")]
			public static void RemoveRedVariants(VariationInfo __instance)
			{
				if (!tcenabled)
				{
					return;
				}
				TextMeshProUGUI componentInChildren = ((Component)((Component)__instance).transform).GetComponentInChildren<TextMeshProUGUI>();
				ReplaceWeaponName(componentInChildren);
				if (__instance.weaponName.Contains("rev"))
				{
					Transform child = ((Component)__instance).transform.GetChild(2);
					if (__instance.weaponName.Contains("0"))
					{
						((Component)child).GetComponent<Image>().sprite = MainCode.FetchFromBundle<WeaponDescriptor>("Weapons/StrayPistol.asset", autofill: true).icon;
						((Component)((Component)__instance).transform.parent.Find("Variation Info (Blue)").Find("IconBG/Image")).GetComponent<Image>().sprite = ((Component)child).GetComponent<Image>().sprite;
						((TMP_Text)((Component)((Component)__instance).transform.parent.Find("Variation Info (Blue)").Find("Name")).GetComponent<TextMeshProUGUI>()).text = "PIERCING";
						((TMP_Text)((Component)((Component)__instance).transform.parent.Find("Variation Info (Blue)").Find("Description")).GetComponent<TextMeshProUGUI>()).text = "Fires a piercing projectile after charging for one second using the Primary fire. \nNo Alt fire.";
					}
					if (__instance.weaponName.Contains("2"))
					{
						((Component)child).GetComponent<Image>().sprite = MainCode.FetchFromBundle<WeaponDescriptor>("Weapons/StrayPistol Electric.asset", autofill: true).icon;
						((Component)((Component)__instance).transform.parent.Find("Variation Info (Green)").Find("IconBG/Image")).GetComponent<Image>().sprite = ((Component)child).GetComponent<Image>().sprite;
						((TMP_Text)((Component)((Component)__instance).transform.parent.Find("Variation Info (Green)").Find("Name")).GetComponent<TextMeshProUGUI>()).text = "EXPLOSIVE";
						((TMP_Text)((Component)((Component)__instance).transform.parent.Find("Variation Info (Green)").Find("Description")).GetComponent<TextMeshProUGUI>()).text = "Fires an explosive projectile after charging for two seconds using the Primary fire. \nNo Alt fire.";
					}
					Transform child2 = ((Component)__instance).transform.Find("EquipmentStuffs").Find("Order").GetChild(4);
					if (__instance.weaponName.Contains("0"))
					{
						((Component)child2).GetComponent<Image>().sprite = MainCode.FetchFromBundle<WeaponDescriptor>("Weapons/StrayPistol.asset", autofill: true).icon;
						((Component)((Component)__instance).transform.parent.Find("Variation Info (Blue)").Find("IconBG/Image")).GetComponent<Image>().sprite = ((Component)child2).GetComponent<Image>().sprite;
					}
					if (__instance.weaponName.Contains("2"))
					{
						((Component)child2).GetComponent<Image>().sprite = MainCode.FetchFromBundle<WeaponDescriptor>("Weapons/StrayPistol Electric.asset", autofill: true).icon;
						((Component)((Component)__instance).transform.parent.Find("Variation Info (Green)").Find("IconBG/Image")).GetComponent<Image>().sprite = ((Component)child2).GetComponent<Image>().sprite;
					}
					Log("Replaced Revolver Image!");
				}
				if (__instance.weaponName.Contains("sho"))
				{
					Transform child3 = ((Component)__instance).transform.GetChild(2);
					if (__instance.weaponName.Contains("0"))
					{
						((Component)child3).GetComponent<Image>().sprite = MainCode.FetchFromBundle<WeaponDescriptor>("Weapons/StrayLaserGun.asset", autofill: true).icon;
						((Component)((Component)__instance).transform.parent.Find("Variation Info (Blue)").Find("IconBG/Image")).GetComponent<Image>().sprite = ((Component)child3).GetComponent<Image>().sprite;
						((TMP_Text)((Component)((Component)__instance).transform.parent.Find("Variation Info (Blue)").Find("Name")).GetComponent<TextMeshProUGUI>()).text = "BLACK-HOLE";
						((TMP_Text)((Component)((Component)__instance).transform.parent.Find("Variation Info (Blue)").Find("Description")).GetComponent<TextMeshProUGUI>()).text = "Press Alt Fire to launch a <color=purple>Black hole</color>, which travels forwards for a bit and begins to <color=orange>suck in projectiles</color>, afterwards exploding. Players can re - press Alt Fire to make it immediately start sucking.";
					}
					if (__instance.weaponName.Contains("1"))
					{
						((Component)child3).GetComponent<Image>().sprite = MainCode.FetchFromBundle<WeaponDescriptor>("Weapons/StrayLaserGun.asset", autofill: true).icon;
						((Component)((Component)__instance).transform.parent.Find("Variation Info (Green)").Find("IconBG/Image")).GetComponent<Image>().sprite = ((Component)child3).GetComponent<Image>().sprite;
						((TMP_Text)((Component)((Component)__instance).transform.parent.Find("Variation Info (Green)").Find("Name")).GetComponent<TextMeshProUGUI>()).text = "NAPALM";
						((TMP_Text)((Component)((Component)__instance).transform.parent.Find("Variation Info (Green)").Find("Description")).GetComponent<TextMeshProUGUI>()).text = "Primary fire shoots <color=orange>flaming projectiles</color> at a slower rate than the regluar Machinegun.\nAlt fire shoots <color=purple>Napalm</color> projectiles.";
					}
					Transform child4 = ((Component)__instance).transform.Find("EquipmentStuffs").Find("Order").GetChild(4);
					if (__instance.weaponName.Contains("0"))
					{
						((Component)child4).GetComponent<Image>().sprite = MainCode.FetchFromBundle<WeaponDescriptor>("Weapons/StrayLaserGun.asset", autofill: true).icon;
						((Component)((Component)__instance).transform.parent.Find("Variation Info (Blue)").Find("IconBG/Image")).GetComponent<Image>().sprite = ((Component)child4).GetComponent<Image>().sprite;
					}
					if (__instance.weaponName.Contains("1"))
					{
						((Component)child4).GetComponent<Image>().sprite = MainCode.FetchFromBundle<WeaponDescriptor>("Weapons/StrayLaserGun.asset", autofill: true).icon;
						((Component)((Component)__instance).transform.parent.Find("Variation Info (Green)").Find("IconBG/Image")).GetComponent<Image>().sprite = ((Component)child4).GetComponent<Image>().sprite;
					}
					Log("Replaced Shotgun Image!");
				}
				if ((!__instance.weaponName.Contains("rev") & (__instance.weaponName.Contains("2") | __instance.weaponName.Contains("3"))) | (__instance.weaponName.Contains("rev") & (__instance.weaponName.Contains("1") | __instance.weaponName.Contains("3"))))
				{
					((Component)__instance).gameObject.SetActive(false);
					if (GameProgressSaver.CheckGear(__instance.weaponName) > 0)
					{
						__instance.ChangeEquipment(0);
					}
				}
				if (!GetWeaponName(__instance.weaponName, shortname: true) && GameProgressSaver.CheckGear(__instance.weaponName) > 0)
				{
					__instance.ChangeEquipment(0);
				}
				((Component)((Component)__instance).transform.parent.Find("Info and Color Panel")).gameObject.SetActive(false);
			}

			public static void ReplaceWeaponName(TextMeshProUGUI nameText)
			{
				if (tcenabled)
				{
					if (((TMP_Text)nameText).text == "PIERCER")
					{
						((TMP_Text)nameText).text = "PIERCING";
					}
					else if (((TMP_Text)nameText).text == "MARKSMAN")
					{
						((TMP_Text)nameText).text = "EXPLOSIVE";
					}
					if (((TMP_Text)nameText).text == "CORE EJECT")
					{
						((TMP_Text)nameText).text = "BLACK-HOLE";
					}
					else if (((TMP_Text)nameText).text == "PUMP CHARGE")
					{
						((TMP_Text)nameText).text = "NAPALM";
					}
					if (((TMP_Text)nameText).text == "ATTRACTOR")
					{
						((TMP_Text)nameText).text = "???";
					}
					else if (((TMP_Text)nameText).text == "OVERHEAT")
					{
						((TMP_Text)nameText).text = "???";
					}
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(ShopCategory), "CheckGear")]
			public static void RemoveEverythingExceptRevolverCategory(ShopCategory __instance)
			{
				if (tcenabled)
				{
					if (!GetWeaponName(__instance.weaponName, shortname: true))
					{
						((Component)__instance).gameObject.SetActive(false);
					}
					else if (__instance.weaponName.Contains("rev"))
					{
						((TMP_Text)((Component)__instance).GetComponentInChildren<TextMeshProUGUI>()).text = "STRAY ARM";
					}
					else if (__instance.weaponName.Contains("sho"))
					{
						((TMP_Text)((Component)__instance).GetComponentInChildren<TextMeshProUGUI>()).text = "MACHINEGUN";
					}
				}
			}

			[HarmonyPrefix]
			[HarmonyPatch(typeof(MenuActSelect), "OnEnable")]
			public static void RemoveAct2And3(MenuActSelect __instance)
			{
				if (tcenabled && ((((Object)((Component)__instance).transform).name == "Act I") | (((Object)((Component)__instance).transform).name == "Act II") | (((Object)((Component)__instance).transform).name == "Act III")))
				{
					__instance.forceOff = true;
				}
			}

			[HarmonyPrefix]
			[HarmonyPatch(typeof(LeaderboardController), "SubmitLevelScore")]
			[HarmonyPatch(typeof(LeaderboardController), "SubmitCyberGrindScore")]
			private static bool DisableLeaderboardSubmissions()
			{
				return false;
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(NewMovement), "Respawn")]
			[HarmonyPatch(typeof(WeaponCharges), "MaxCharges")]
			public static void ResetWeaponsStuff()
			{
				shoAmmo = 40;
				shoAmmo1 = 40;
				foreach (StrayGun armgun in armguns)
				{
					armgun.Reset();
				}
				foreach (StrayLaserGun lasergun in laserguns)
				{
					lasergun.Reset();
				}
			}

			[HarmonyPrefix]
			[HarmonyPatch(typeof(EnemyInfoPage), "Start")]
			public static void UpdateInfoThingy(EnemyInfoPage __instance)
			{
				SpawnableObjectsDatabase objects = __instance.objects;
				bool flag = true;
				SpawnableObject[] enemies = objects.enemies;
				foreach (SpawnableObject val in enemies)
				{
					if ((Object)(object)val == (Object)(object)MainCode.FetchFromBundle<SpawnableObject>("PlayerStray_Terminal.asset", autofill: true))
					{
						flag = false;
					}
				}
				if (!flag)
				{
					return;
				}
				SpawnableObject[] array = (SpawnableObject[])(object)new SpawnableObject[objects.enemies.Length + 1];
				for (int j = 0; j < array.Length; j++)
				{
					if (j < 2)
					{
						array[j] = objects.enemies[j];
					}
					if (j == 2)
					{
						array[j] = MainCode.FetchFromBundle<SpawnableObject>("PlayerStray_Terminal.asset", autofill: true);
					}
					if (j > 2)
					{
						array[j] = objects.enemies[j - 1];
					}
				}
				objects.enemies = array;
				Log("Injected the Stray into Terminal!");
			}

			[HarmonyPrefix]
			[HarmonyPatch(typeof(PlayerActivator), "OnTriggerEnter")]
			public static void Skip01Thing(PlayerActivator __instance, Collider other)
			{
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				if (((Component)other).gameObject.CompareTag("Player") && tcenabled && SceneHelper.CurrentScene == "Level 0-1" && !__instance.activated && canTeleportPlayer)
				{
					((Component)MonoSingleton<NewMovement>.instance).transform.position = new Vector3(40f, 0f, 380f);
					canTeleportPlayer = false;
				}
			}
		}

		public static bool tcenabled;

		public static AssetBundle tcbundle;

		public static GameObject stray;

		public static GameObject bluearm;

		private static GameObject[] arm;

		private static GameObject[] shotgun;

		private static GameObject[] lasergun;

		public static int shoAmmo = 40;

		public static int shoAmmo1 = 40;

		private float shoAmmoCharge;

		private float shoAmmoCharge1;

		public static bool sgshooting;

		public static bool sgshooting1;

		private static bool candoshit;

		public static bool overhealed;

		public static bool Debugging;

		public static GameObject beam;

		public static PlySCBeam bgbeam;

		public static List<StrayGun> armguns = new List<StrayGun>();

		public static List<StrayLaserGun> laserguns = new List<StrayLaserGun>();

		private static bool canTeleportPlayer;

		public static void SendHudMessage(string msg, int delay = 0, bool silent = false)
		{
			MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage(msg, "", "", delay, silent);
		}

		public static Type Fetch<Type>(string name)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return Addressables.LoadAssetAsync<Type>((object)name).WaitForCompletion();
		}

		public static Type FetchFromBundle<Type>(string name, bool autofill = false) where Type : Object
		{
			if ((Object)(object)tcbundle == (Object)null)
			{
				Log("Straymode bundle is null!", 3);
				return default(Type);
			}
			if (!autofill)
			{
				return tcbundle.LoadAsset<Type>(name);
			}
			return tcbundle.LoadAsset<Type>("assets/formods/straymode/" + name);
		}

		public static void SetLayerRecursive(GameObject gobject, string layername)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			gobject.layer = LayerMask.NameToLayer(layername);
			foreach (Transform item in gobject.transform)
			{
				Transform val = item;
				((Component)val).gameObject.layer = LayerMask.NameToLayer(layername);
				Transform componentInChildren = ((Component)val).GetComponentInChildren<Transform>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					SetLayerRecursive(((Component)val).gameObject, layername);
				}
			}
		}

		public static GameObject FindChild(Transform parent, string objPath)
		{
			return ((Component)parent.Find(objPath)).gameObject;
		}

		public Vector3 Shake(Vector3 originpos, Vector3 pos, float shakeamt)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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_003f: 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_0056: 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)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.zero;
			val = pos + new Vector3(Random.Range(0f - shakeamt, shakeamt), Random.Range(0f - shakeamt, shakeamt), Random.Range(0f - shakeamt, shakeamt));
			((Vector3)(ref val))..ctor(Mathf.Clamp(val.x, originpos.x - 0.01f, originpos.x + 0.01f), Mathf.Clamp(val.y, originpos.y - 0.01f, originpos.y + 0.01f), Mathf.Clamp(val.z, originpos.z - 0.01f, originpos.z + 0.01f));
			return val;
		}

		public static void Log(string log, int type = 1)
		{
			switch (type)
			{
			case 1:
				Debug.Log((object)log);
				break;
			case 2:
				Debug.LogWarning((object)log);
				break;
			case 3:
				Debug.LogError((object)log);
				break;
			}
		}

		public static SlotData GetSlot(int slot)
		{
			//IL_0044: 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_0051: Expected O, but got Unknown
			int currentSlot = GameProgressSaver.currentSlot;
			GameProgressSaver.currentSlot = slot;
			string savePath = GameProgressSaver.SavePath;
			SlotData val = null;
			val = ((!Directory.Exists(savePath)) ? null : ((GameProgressSaver.ReadFile(GameProgressSaver.generalProgressPath) is GameProgressMoneyAndGear) ? GameProgressSaver.GetDirectorySlotData(savePath) : null));
			if (val == null)
			{
				val = new SlotData
				{
					exists = false
				};
			}
			GameProgressSaver.currentSlot = currentSlot;
			return val;
		}

		public static bool IsPluginLoaded(string guid)
		{
			if (!Chainloader.PluginInfos.ContainsKey(guid))
			{
				return false;
			}
			return (Object)(object)Chainloader.PluginInfos[guid].Instance != (Object)null;
		}

		public void Awake()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Invalid comparison between Unknown and I4
			if ((Object)(object)((Component)this).gameObject != (Object)null && (int)((Object)((Component)this).gameObject).hideFlags != 61)
			{
				((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			}
			Log("Built Config Straymode");
			if ((Object)(object)tcbundle == (Object)null)
			{
				string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
				tcbundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "straymode"));
				if ((Object)(object)tcbundle != (Object)null)
				{
					Log("Got bundle " + (object)tcbundle);
					for (int i = 0; i < tcbundle.GetAllAssetNames().Length; i++)
					{
						Log(tcbundle.GetAllAssetNames()[i].ToString());
					}
				}
				else
				{
					Log("Failed to get bundle!", 3);
				}
			}
			if ((Object)(object)tcbundle != (Object)null)
			{
				Log("Got bundle Straymode");
			}
			SceneManager.activeSceneChanged += OnSceneChange;
			Log("Added onscenechange Straymode");
			GetWeapons();
			Log("Got weapons Straymode");
			Log("Straymode loaded!");
		}

		public static void GetWeapons()
		{
			bluearm = MainCode.FetchFromBundle<GameObject>("Weapons/Stray arm Blue.prefab", autofill: true);
			Log("Got Bluearm Straymode");
			arm = (GameObject[])(object)new GameObject[1];
			arm[0] = MainCode.FetchFromBundle<GameObject>("Weapons/Stray Pistol.prefab", autofill: true);
			Log("Got Armgun Straymode");
			shotgun = (GameObject[])(object)new GameObject[1];
			shotgun[0] = MainCode.FetchFromBundle<GameObject>("Weapons/Stray Lasergun.prefab", autofill: true);
			Log("Got Shotgun Straymode");
			lasergun = (GameObject[])(object)new GameObject[1];
			lasergun[0] = MainCode.FetchFromBundle<GameObject>("Weapons/StrayLasers.prefab", autofill: true);
			Log("Got Lasergun Straymode");
			Log("Got prefabs Straymode");
		}

		public void Start()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("plonk.straymode");
			val.PatchAll();
		}

		private void OnSceneChange(Scene before, Scene after)
		{
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			overhealed = false;
			if (tcenabled)
			{
				switch (SceneHelper.CurrentScene)
				{
				case "Tutorial":
					MonoSingleton<PrefsManager>.instance.SetInt("ShoUseTut", 0);
					break;
				case "Level 0-1":
				{
					canTeleportPlayer = true;
					FindObjectEvenIfDisabled("3 - Gun Room", "RevolverPickUp/Revolver Heavy").SetActive(false);
					FindObjectEvenIfDisabled("3 - Gun Room", "Pedestal").SetActive(false);
					GameObject val7 = Object.Instantiate<GameObject>(MainCode.FetchFromBundle<GameObject>("MapMods/0-1 Mods.prefab", autofill: true));
					Transform child = val7.transform.GetChild(0);
					FindObjectEvenIfDisabled("3 - Gun Room", "RevolverPickUp").transform.localRotation = Quaternion.Euler(0f, 90f, 0f);
					FindObjectEvenIfDisabled("3 - Gun Room", "RevolverPickUp").GetComponent<BoxCollider>().size = new Vector3(4f, 4f, 4f);
					child.parent = FindObjectEvenIfDisabled("3 - Gun Room", "RevolverPickUp").transform;
					UltrakillEvent events = FindObjectEvenIfDisabled("3 - Gun Room", "RevolverPickUp").GetComponent<ObjectActivator>().events;
					GameObject[] array3 = (GameObject[])(object)new GameObject[events.toActivateObjects.Length + 1];
					Array.Copy(events.toActivateObjects, array3, events.toActivateObjects.Length);
					array3[1] = ((Component)child.GetChild(0)).gameObject;
					events.toActivateObjects = array3;
					child.GetChild(0).parent = FindObjectEvenIfDisabled("3 - Gun Room").transform;
					HudMessage component2 = FindObjectEvenIfDisabled("5 - Glass Intro", "5 Nonstuff", 12, useChildNum: true).GetComponent<HudMessage>();
					component2.actionReference = null;
					component2.message = "<color=#40E7FF>STRAY ARM</color>:\n<color=orange>Parry your own projectiles</color> immediately after shooting to break <color=orange>glass</color>.";
					component2.message2 = "";
					break;
				}
				case "Level 0-2":
					if (MonoSingleton<PrefsManager>.instance.GetInt("ShoUseTut", 0) == 0)
					{
						GameObject val6 = FindObjectEvenIfDisabled("ShopTutorialDoor", "");
						((Behaviour)val6.GetComponent<GetPlayerPref>()).enabled = false;
						if (!val6.activeSelf)
						{
							val6.SetActive(true);
						}
						SendHudMessage("You can buy new variants of weapons you have in the <color=orange>Terminal</color>", 1);
						MonoSingleton<PrefsManager>.instance.SetInt("ShoUseTut", 1);
					}
					break;
				case "Level 0-3":
				{
					((Renderer)FindObjectEvenIfDisabled("6 - Path 1 - Boss Arena", "6 Nonstuff/Walls/Cube (1)").GetComponent<MeshRenderer>()).enabled = false;
					GameObject val3 = Object.Instantiate<GameObject>(MainCode.FetchFromBundle<GameObject>("MapMods/0-3 Mods.prefab", autofill: true));
					Flicker val4 = FindObjectEvenIfDisabled("6 - Path 1 - Boss Arena", "6 Nonstuff/Lights/Point Light (4)").AddComponent<Flicker>();
					val4.delay = 0.5f;
					val4.timeRandomizer = 0.45f;
					Light component = ((Component)val4).gameObject.GetComponent<Light>();
					component.intensity /= 2f;
					FindObjectEvenIfDisabled("6 - Path 1 - Boss Arena", "Boss Arena Contents/Statue (4)").SetActive(false);
					FindObjectEvenIfDisabled("7 - Path 2 - Menacing Room", "7 Nonstuff/Decorations").SetActive(false);
					FindObjectEvenIfDisabled("7 - Path 2 - Menacing Room", "7 Nonstuff/Floor 1").SetActive(false);
					FindObjectEvenIfDisabled("2 - Side Hallway - Floor 1", "2 Nonstuff/Decorations").SetActive(false);
					FindObjectEvenIfDisabled("8 - Path 2 - Menacing Hallway", "8 Nonstuff").SetActive(false);
					((Component)val3.transform.GetChild(0)).gameObject.SetActive(true);
					val3.transform.GetChild(0).parent = FindObjectEvenIfDisabled("4 - Side Stairway - Floor 1-2", "4 Nonstuff").transform;
					val3.transform.GetChild(1).parent = FindObjectEvenIfDisabled("7 - Path 2 - Menacing Room", "7 Nonstuff").transform;
					val3.transform.GetChild(1).parent = FindObjectEvenIfDisabled("7 - Path 2 - Menacing Room", "7 Nonstuff").transform;
					val3.transform.GetChild(1).parent = FindObjectEvenIfDisabled("2 - Side Hallway - Floor 1", "2 Nonstuff").transform;
					val3.transform.GetChild(1).parent = FindObjectEvenIfDisabled("8 - Path 2 - Menacing Hallway").transform;
					HudMessage[] array = Resources.FindObjectsOfTypeAll<HudMessage>();
					HudMessage[] array2 = array;
					foreach (HudMessage val5 in array2)
					{
						if (((Object)((Component)val5).gameObject).name == "Cube (3)")
						{
							Log(val5.message + " \n " + val5.message2, 3);
							val5.message = "<color=#00ffff>MACHINEGUN</color>: The <color=purple>black hole</color> can be fed <color=orange>projectiles</color>.";
						}
						else if (((Object)((Component)((Component)val5).transform.parent).gameObject).name == "Spot Light")
						{
							val5.message = "<color=#00ffff>MACHINEGUN</color>: Press '<color=orange>";
							val5.message2 = " </color>' to launch a <color=purple>black hole</color> that sucks in <color=orange>projectiles</color>.\n Re-press Secondary fire to make it start sucking immediately.";
							Log(val5.message + " \n " + val5.message2, 3);
						}
					}
					break;
				}
				case "Level 0-4":
				{
					FindObjectEvenIfDisabled("5 - Tube Hallways", "5 Content/Tunnels").SetActive(false);
					FindObjectEvenIfDisabled("5 - Tube Hallways", "5 Nonstuff/Walls", 5, useChildNum: true).SetActive(false);
					Transform transform = FindObjectEvenIfDisabled("8 - Tube Hallway", "8 Content").transform;
					((Component)transform.GetChild(3)).gameObject.SetActive(false);
					((Component)transform.GetChild(4)).gameObject.SetActive(false);
					((Component)transform.GetChild(5)).gameObject.SetActive(false);
					GameObject val2 = Object.Instantiate<GameObject>(MainCode.FetchFromBundle<GameObject>("MapMods/0-4 Mods.prefab", autofill: true));
					val2.transform.GetChild(0).parent = FindObjectEvenIfDisabled("5 - Tube Hallways", "5 Content").transform;
					val2.transform.GetChild(0).parent = FindObjectEvenIfDisabled("8 - Tube Hallway", "8 Content").transform;
					val2.transform.GetChild(0).parent = FindObjectEvenIfDisabled("2 - Arena", "2 Stuff").transform;
					break;
				}
				case "Level 1-1":
					Object.Instantiate<GameObject>(MainCode.FetchFromBundle<GameObject>("1-1 Construction.prefab", autofill: true));
					break;
				case "CreditsMuseum2":
				{
					FindObjectEvenIfDisabled("__DEV_SPACE_ALL", "Dev_Space_ (1)").SetActive(false);
					GameObject val = Object.Instantiate<GameObject>(MainCode.FetchFromBundle<GameObject>("MapMods/Museum Mods.prefab", autofill: true));
					break;
				}
				}
			}
			shoAmmo = 40;
			armguns.Clear();
			laserguns.Clear();
		}

		public static GameObject FindObjectEvenIfDisabled(string rootName, string objPath = null, int childNum = 0, bool useChildNum = false)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = null;
			Scene activeScene = SceneManager.GetActiveScene();
			GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
			bool flag = false;
			GameObject[] array = rootGameObjects;
			foreach (GameObject val2 in array)
			{
				if (((Object)val2).name == rootName)
				{
					val = val2;
					flag = true;
				}
			}
			if (flag)
			{
				GameObject val3 = val;
				if (objPath != null)
				{
					val3 = ((Component)val.transform.Find(objPath)).gameObject;
					if (!useChildNum)
					{
						val = val3;
					}
				}
				if (useChildNum)
				{
					GameObject gameObject = ((Component)val3.transform.GetChild(childNum)).gameObject;
					val = gameObject;
				}
			}
			return val;
		}

		public void Update()
		{
			//IL_0150: 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_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			//IL_01a8: 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_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Expected O, but got Unknown
			if (!candoshit && SceneHelper.CurrentScene == "Main Menu")
			{
				if ((Object)(object)tcbundle != (Object)null)
				{
					candoshit = true;
					MonoSingleton<Console>.Instance.RegisterCommand((ICommand)(object)new DebugLog());
				}
				else
				{
					SendHudMessage("Straymode mod failed to load.\r\n<color=green>The asset bundle (filename \"straymode\") is missing or in the wrong place. please place it where the mod's .dll is located.</color>", 0, silent: true);
				}
			}
			if (candoshit && (Object)(object)MonoSingleton<PrefsManager>.Instance != (Object)null)
			{
				if (MonoSingleton<PrefsManager>.Instance.GetInt("selectedSaveSlot", 0) == 1015064006 && !tcenabled)
				{
					if (!tcenabled && Debugging)
					{
						Debug.Log((object)"enabled straymode mod");
					}
					tcenabled = true;
				}
				if (MonoSingleton<PrefsManager>.Instance.GetInt("selectedSaveSlot", 0) != 1015064006 && tcenabled)
				{
					if (tcenabled && Debugging)
					{
						Debug.Log((object)"disabled straymode mod");
					}
					tcenabled = false;
				}
			}
			if (candoshit && SceneHelper.CurrentScene != "Main Menu")
			{
				if ((Object)(object)beam == (Object)null)
				{
					beam = Object.Instantiate<GameObject>(new GameObject(), ((Component)MonoSingleton<CameraController>.instance).transform.position, ((Component)MonoSingleton<CameraController>.instance).transform.rotation, ((Component)MonoSingleton<CameraController>.instance).transform);
					bgbeam = beam.AddComponent<PlySCBeam>();
				}
				if (tcenabled)
				{
					Vector2 val = default(Vector2);
					if ((Object)(object)MonoSingleton<InputManager>.instance != (Object)null)
					{
						val = MonoSingleton<InputManager>.instance.InputSource.Move.ReadValue<Vector2>();
					}
					NewMovement instance = MonoSingleton<NewMovement>.instance;
					Rigidbody val2 = null;
					if ((Object)(object)instance != (Object)null)
					{
						val2 = instance.rb;
					}
					if (instance.gc.onGround)
					{
						instance.walkSpeed = 550f;
					}
					else
					{
						instance.walkSpeed = 600f;
					}
					((Component)instance).transform.localScale = new Vector3(1.3f, 1.3f, 1.3f);
					((Component)instance).GetComponent<CapsuleCollider>().radius = 0.35f;
					if ((Object)(object)instance != (Object)null && (Object)(object)val2 != (Object)null && (Object)(object)MonoSingleton<InputManager>.instance != (Object)null && (Object)(object)MonoSingleton<FistControl>.instance != (Object)null && (Object)(object)MonoSingleton<CameraController>.instance != (Object)null)
					{
						if ((Object)(object)MonoSingleton<RailcannonMeter>.instance != (Object)null && ((Behaviour)MonoSingleton<RailcannonMeter>.instance).enabled)
						{
							((Behaviour)MonoSingleton<RailcannonMeter>.instance).enabled = false;
						}
						if ((Object)(object)beam == (Object)null)
						{
							beam = Object.Instantiate<GameObject>(new GameObject(), ((Component)MonoSingleton<CameraController>.instance).transform.position, ((Component)MonoSingleton<CameraController>.instance).transform.rotation, ((Component)MonoSingleton<CameraController>.instance).transform);
							bgbeam = beam.AddComponent<PlySCBeam>();
							beam.AddComponent<PlayableStreetcleanerPatchID>();
						}
						instance.antiHp = (overhealed ? Mathf.Clamp(100 - instance.hp, 0, 100) : 40);
						if (instance.hp > 60 && !overhealed)
						{
							instance.hp = 60;
						}
						if (overhealed && instance.hp <= 60)
						{
							overhealed = false;
						}
						if (instance.boostCharge > 200f)
						{
							instance.boostCharge = 200f;
						}
					}
				}
				if (!Debugging)
				{
				}
			}
			if (!tcenabled)
			{
			}
		}

		public void FixedUpdate()
		{
			if (!sgshooting)
			{
				shoAmmoCharge = Mathf.MoveTowards(shoAmmoCharge, 0f, Time.deltaTime);
			}
			if (shoAmmoCharge <= 0f)
			{
				shoAmmoCharge = 0.25f;
				if (shoAmmo < 40)
				{
					shoAmmo++;
				}
			}
			if (NoWeaponCooldown.NoCooldown)
			{
				shoAmmo = 40;
			}
			if (!sgshooting1)
			{
				shoAmmoCharge1 = Mathf.MoveTowards(shoAmmoCharge1, 0f, Time.deltaTime);
			}
			if (shoAmmoCharge1 <= 0f)
			{
				shoAmmoCharge1 = 0.25f;
				if (shoAmmo1 < 40)
				{
					shoAmmo1++;
				}
			}
			if (NoWeaponCooldown.NoCooldown)
			{
				shoAmmo1 = 40;
			}
		}

		public static GameObject MakeStray(string name, int type)
		{
			return null;
		}

		public static void ReplaceWeapons(string target = "guncontrol")
		{
			if (!(target == "guncontrol"))
			{
				return;
			}
			for (int i = 0; i < MonoSingleton<GunControl>.instance.slots.Count; i++)
			{
				for (int j = 0; j < MonoSingleton<GunControl>.instance.slots[i].Count; j++)
				{
					if (i > 4)
					{
						return;
					}
					GameObject val = MonoSingleton<GunControl>.instance.slots[i][j];
					if (!((Object)val).name.Contains("Stray"))
					{
						MonoSingleton<StyleHUD>.instance.weaponFreshness.Remove(val);
						MonoSingleton<GunControl>.Instance.slotDict.Remove(val);
						MonoSingleton<GunControl>.instance.allWeapons.Remove(val);
						if (!GetWeaponName(((Object)val).name))
						{
							MonoSingleton<GunControl>.instance.slots[i] = new List<GameObject>(0);
						}
						if (GetWeaponName(((Object)val).name))
						{
							MakeWeapon(i + 1, GetWeaponVariation(i + 1, ((Object)val).name), j + 1);
						}
						Log("Destroyed weapon " + (object)val);
						Object.Destroy((Object)(object)val);
					}
				}
			}
		}

		public static bool GetWeaponName(string name, bool shortname = false)
		{
			if (!shortname)
			{
				if (name.Contains("Revolver") | name.Contains("Shotgun"))
				{
					return true;
				}
				return false;
			}
			if (name.Contains("rev") | name.Contains("sho"))
			{
				return true;
			}
			return false;
		}

		public static int GetWeaponVariation(int slot, string weaponName)
		{
			int result = 1;
			if (slot == 1)
			{
				if (weaponName.Contains("Pierce"))
				{
					result = 1;
				}
				else if (weaponName.Contains("Ricochet"))
				{
					result = 2;
				}
				else if (weaponName.Contains("Twirl"))
				{
					result = 3;
				}
			}
			if (slot == 2)
			{
				if (weaponName.Contains("Grenade"))
				{
					result = 1;
				}
				else if (weaponName.Contains("Pump"))
				{
					result = 2;
				}
				else if (weaponName.Contains("???"))
				{
					Log("How does the weapon have the red shotgun?", 3);
					result = 3;
				}
			}
			return result;
		}

		public static void MakeWeapon(int slot, int var, int slotpos = 0)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			GunControl instance = MonoSingleton<GunControl>.instance;
			GameObject val = new GameObject("StraymodeEmptyWeapon");
			switch (slot)
			{
			case 1:
				if (var < 3)
				{
					val = Object.Instantiate<GameObject>(arm[0], ((Component)instance).transform.position, ((Component)instance).transform.rotation, ((Component)instance).transform);
					armguns.Add(GameObjectExtensions.GetOrAddComponent<StrayGun>(val));
					val.GetComponent<StrayGun>().variant = var;
					if (var == 2)
					{
						val.GetComponent<WeaponIcon>().weaponDescriptor = MainCode.FetchFromBundle<WeaponDescriptor>("Weapons/StrayPistol Electric.asset", autofill: true);
					}
				}
				break;
			case 2:
				if (var < 3)
				{
					val = Object.Instantiate<GameObject>(shotgun[0], ((Component)instance).transform.position, ((Component)instance).transform.rotation, ((Component)instance).transform);
					laserguns.Add(GameObjectExtensions.GetOrAddComponent<StrayLaserGun>(val));
					val.GetComponent<StrayLaserGun>().variant = var;
					if (var == 2)
					{
						val.GetComponent<WeaponIcon>().weaponDescriptor = MainCode.FetchFromBundle<WeaponDescriptor>("Weapons/StrayLaserGun Green.asset", autofill: true);
					}
				}
				break;
			}
			instance.slots[slot - 1][(slotpos == 0) ? (var - 1) : (slotpos - 1)] = val;
			instance.allWeapons.Add(val);
			instance.slotDict.Add(val, slot - 1);
			MonoSingleton<StyleHUD>.instance.weaponFreshness.Add(val, 10f);
			MonoSingleton<GunControl>.Instance.ForceWeapon(val, true);
		}

		public static void ResetPlayer()
		{
		}
	}
}
namespace Straymode.WeaponCode
{
	public class StrayLaserGun : MonoBehaviour
	{
		public int variant = 1;

		public Vector2 projSpread = new Vector2(0.5f, 1f);

		public Vector2 projSpread2 = new Vector2(2f, 3f);

		public float fireRate = 0.05f;

		public float fireRate1 = 2f;

		private float curFireRate = 0f;

		private GameObject hitscan;

		private GameObject blackhole;

		private GameObject muzzleFlash;

		private GameObject muzzleFlash1;

		private Transform shootPoint;

		private Transform shootPointTwo;

		private InputManager inman;

		private PlayerInput insource;

		private CameraController cc;

		private Animator anim;

		private TextMeshProUGUI ammoText;

		private Transform curBlackHole;

		private WeaponIdentifier wid;

		private GameObject oilStartSound;

		private GameObject oilShootingSound;

		private GameObject oilStopSound;

		private GameObject curOilShootSound;

		private void OnDisable()
		{
			if (variant == 1)
			{
				MainCode.sgshooting = false;
			}
			if (variant == 2)
			{
				MainCode.sgshooting1 = false;
			}
			if ((Object)(object)curOilShootSound != (Object)null)
			{
				Object.Destroy((Object)(object)curOilShootSound);
			}
		}

		private void OnEnable()
		{
			curFireRate = 0.25f;
		}

		private void Start()
		{
			hitscan = ((variant == 1) ? MainCode.FetchFromBundle<GameObject>("Projectiles/Laser.prefab", autofill: true) : MainCode.FetchFromBundle<GameObject>("Projectiles/LaserFire.prefab", autofill: true));
			muzzleFlash = ((variant == 1) ? MainCode.FetchFromBundle<GameObject>("Projectiles/LaserMuzzleFlash.prefab", autofill: true) : MainCode.FetchFromBundle<GameObject>("Projectiles/LaserMuzzleFlash Green.prefab", autofill: true));
			muzzleFlash1 = ((variant == 1) ? MainCode.FetchFromBundle<GameObject>("Projectiles/LaserMuzzleFlashBig.prefab", autofill: true) : MainCode.FetchFromBundle<GameObject>("Projectiles/LaserMuzzleFlash Purple.prefab", autofill: true));
			blackhole = ((variant == 1) ? MainCode.FetchFromBundle<GameObject>("Projectiles/BlackHole.prefab", autofill: true) : MainCode.FetchFromBundle<GameObject>("Projectiles/GasolineProjectile.prefab", autofill: true));
			shootPoint = ((Component)this).transform.GetChild(0).Find("ShootPoint");
			shootPointTwo = ((Component)this).transform.GetChild(0).Find("ShootPoint01");
			oilStartSound = MainCode.FetchFromBundle<GameObject>("Sounds/oilStart.prefab", autofill: true);
			oilShootingSound = MainCode.FetchFromBundle<GameObject>("Sounds/oilSpray.prefab", autofill: true);
			oilStopSound = MainCode.FetchFromBundle<GameObject>("Sounds/oilStop.prefab", autofill: true);
			inman = MonoSingleton<InputManager>.Instance;
			insource = inman.InputSource;
			cc = MonoSingleton<CameraController>.Instance;
			anim = ((Component)this).GetComponent<Animator>();
			ammoText = ((Component)this).GetComponentInChildren<TextMeshProUGUI>();
			wid = ((Component)this).GetComponent<WeaponIdentifier>();
			if (variant == 2)
			{
				fireRate1 = 0.15f;
				fireRate = 0.075f;
			}
		}

		private void Update()
		{
			//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
			curFireRate = Mathf.MoveTowards(curFireRate, 0f, Time.deltaTime);
			if (insource.Fire1.IsPressed && curFireRate <= 0f && (((variant == 1) & (MainCode.shoAmmo > 0)) | ((variant == 2) & (MainCode.shoAmmo1 > 1))))
			{
				Fire();
				if (wid.delay == 0f)
				{
					if (variant == 1)
					{
						MainCode.shoAmmo--;
					}
					if (variant == 2)
					{
						MainCode.shoAmmo1 -= 2;
					}
				}
				curFireRate = ((variant == 1) ? fireRate : fireRate1);
			}
			if (variant == 1)
			{
				if (insource.Fire2.WasPerformedThisFrame && curFireRate <= 0f && MainCode.shoAmmo >= 20 && (Object)(object)curBlackHole == (Object)null)
				{
					if (wid.delay == 0f)
					{
						Fire(1);
						MainCode.shoAmmo -= 20;
					}
					else
					{
						Fire(10);
					}
					curFireRate = (NoWeaponCooldown.NoCooldown ? 0.5f : fireRate1);
				}
			}
			else if (variant == 2)
			{
				if (insource.Fire2.IsPressed && curFireRate <= 0f && MainCode.shoAmmo1 >= 16)
				{
					Fire(2);
					if (wid.delay == 0f)
					{
						MainCode.shoAmmo1--;
					}
					curFireRate = fireRate;
					if (MainCode.shoAmmo == 15 && wid.delay == 0f)
					{
						Object.Instantiate<GameObject>(oilStopSound);
					}
				}
				if (wid.delay == 0f)
				{
					if ((insource.Fire2.IsPressed & (MainCode.shoAmmo1 >= 16) & !insource.Fire1.IsPressed) && (Object)(object)curOilShootSound == (Object)null)
					{
						curOilShootSound = Object.Instantiate<GameObject>(oilShootingSound);
					}
					if ((!insource.Fire2.IsPressed | (MainCode.shoAmmo1 <= 15) | insource.Fire1.IsPressed) && (Object)(object)curOilShootSound != (Object)null)
					{
						Object.Destroy((Object)(object)curOilShootSound);
					}
					if (!insource.Fire1.IsPressed)
					{
						if (insource.Fire2.WasPerformedThisFrame & (MainCode.shoAmmo1 >= 16))
						{
							Object.Instantiate<GameObject>(oilStartSound);
						}
						if ((insource.Fire2.WasCanceledThisFrame & (MainCode.shoAmmo1 >= 16)) | (insource.Fire2.WasPerformedThisFrame & (MainCode.shoAmmo1 <= 15)))
						{
							Object.Instantiate<GameObject>(oilStopSound);
						}
					}
				}
			}
			if (((Behaviour)this).enabled && wid.delay == 0f)
			{
				if (variant == 1)
				{
					MainCode.sgshooting = insource.Fire1.IsPressed;
				}
				if (variant == 2)
				{
					MainCode.sgshooting1 = insource.Fire2.IsPressed | insource.Fire1.IsPressed;
				}
			}
			if (wid.delay == 0f)
			{
				((TMP_Text)ammoText).text = ((variant == 1) ? MainCode.shoAmmo : MainCode.shoAmmo1).ToString() ?? "";
			}
			else
			{
				((TMP_Text)ammoText).text = "";
			}
			if (variant == 2)
			{
				((Graphic)ammoText).color = new Color(Mathf.Abs((float)MainCode.shoAmmo1 - 40f) / 30f, (float)MainCode.shoAmmo1 / 40f, 0f, 1f);
			}
		}

		private void Fire(int type = 0)
		{
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00fe: 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_00ac: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			if (type == 0)
			{
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(Random.Range(0f - projSpread2.x, projSpread2.x), Random.Range(0f - projSpread2.y, projSpread2.y), 0f);
				Vector3 val2 = default(Vector3);
				for (int i = 0; i < ((variant == 1) ? 3 : 6); i++)
				{
					((Vector3)(ref val2))..ctor(Random.Range(0f - projSpread.x, projSpread.x), Random.Range(0f - projSpread.y, projSpread.y), 0f);
					if (variant == 2)
					{
						val2 *= 2f;
					}
					GameObject val3 = Object.Instantiate<GameObject>(hitscan, shootPointTwo.position, ((Component)cc).transform.rotation);
					val3.transform.LookAt(MainCode.bgbeam.hitPosition);
					val3.transform.Rotate(val2);
					val3.transform.Rotate(val);
					val3.GetComponent<Projectile>().sourceWeapon = ((Component)this).gameObject;
					val3.GetComponent<Projectile>().unparryable = true;
					if (variant == 2)
					{
						GameObjectExtensions.GetOrAddComponent<Flammable>(val3).Burn(10f, true);
					}
				}
				Object.Instantiate<GameObject>(muzzleFlash, shootPointTwo.position, ((Component)cc).transform.rotation);
				anim.SetTrigger("Shoot");
			}
			if (type == 1)
			{
				GameObject val4 = Object.Instantiate<GameObject>(blackhole, shootPointTwo.position, ((Component)cc).transform.rotation);
				val4.transform.LookAt(MainCode.bgbeam.hitPosition);
				GameObjectExtensions.GetOrAddComponent<BlackHole>(val4).sourceWeapon = ((Component)this).gameObject;
				curBlackHole = val4.transform;
				Object.Instantiate<GameObject>(muzzleFlash1, shootPointTwo.position, ((Component)cc).transform.rotation);
				anim.SetTrigger("ShootStrong");
			}
			if (type == 2)
			{
				Vector3 val5 = default(Vector3);
				for (int j = 0; j < 3; j++)
				{
					((Vector3)(ref val5))..ctor(Random.Range(0f - projSpread2.x, projSpread2.x), Random.Range(0f - projSpread2.y, projSpread2.y), 0f);
					GameObject val6 = Object.Instantiate<GameObject>(blackhole, shootPointTwo.position, ((Component)cc).transform.rotation);
					val6.transform.Rotate(val5);
					val6.GetComponent<Rigidbody>().AddForce(val6.transform.forward * 150f, (ForceMode)2);
				}
				Object.Instantiate<GameObject>(muzzleFlash1, shootPointTwo.position, ((Component)cc).transform.rotation);
				anim.SetTrigger("ShootOil");
			}
			if (type == 10)
			{
				anim.SetTrigger("Cooldown");
			}
		}

		public void Reset()
		{
		}
	}
	public class StrayGun : MonoBehaviour
	{
		public int variant = 1;

		public int projAmount = 6;

		public Vector2 projSpread = new Vector2(0.5f, 1f);

		public float chargeRate = 120f;

		private float curCharge;

		private GameObject chargeProjectile;

		private GameObject curChargeProjectile;

		private GameObject projectileToFire;

		private Transform shootPoint;

		private Transform rotator;

		private InputManager inman;

		private PlayerInput insource;

		private bool onCooldown;

		private CameraController cc;

		private Light chargeLight;

		private void Start()
		{
			//IL_012b: 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_0143: 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_00fb: 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_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			if (variant == 1)
			{
				chargeProjectile = MainCode.FetchFromBundle<GameObject>("Projectiles/ChargeProj.prefab", autofill: true);
				projectileToFire = MainCode.FetchFromBundle<GameObject>("Projectiles/Projectile.prefab", autofill: true);
			}
			else if (variant == 2)
			{
				chargeProjectile = MainCode.FetchFromBundle<GameObject>("Projectiles/EleChargeProj.prefab", autofill: true);
				projectileToFire = MainCode.FetchFromBundle<GameObject>("Projectiles/EleProjectile.prefab", autofill: true);
			}
			rotator = ((Component)this).transform.GetChild(0);
			shootPoint = rotator.Find("ShootPoint");
			inman = MonoSingleton<InputManager>.Instance;
			insource = inman.InputSource;
			cc = MonoSingleton<CameraController>.Instance;
			chargeLight = ((Component)this).GetComponent<Light>();
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(255f, 99f, 0f);
			Vector3 val2 = default(Vector3);
			((Vector3)(ref val2))..ctor(0f, 159f, 255f);
			chargeLight.color = ((variant == 1) ? new Color(val.x / 255f, val.y / 255f, val.z / 255f, 1f) : new Color(val2.x / 255f, val2.y / 255f, val2.z / 255f, 0f));
		}

		private void Update()
		{
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: 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_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			if (insource.Fire1.IsPressed && !onCooldown)
			{
				curCharge = Mathf.MoveTowards(curCharge, 100f, Time.deltaTime * (chargeRate / ((variant == 1) ? 1f : 1.5f)));
			}
			if (insource.Fire1.WasCanceledThisFrame && curCharge >= 100f && !onCooldown)
			{
				Fire();
				onCooldown = true;
			}
			if (onCooldown && curCharge <= 0f)
			{
				onCooldown = false;
			}
			if (!insource.Fire1.IsPressed | onCooldown)
			{
				curCharge = Mathf.MoveTowards(curCharge, 0f, Time.deltaTime * chargeRate * (onCooldown ? 6f : 2f));
			}
			if (curCharge > 0f && !onCooldown)
			{
				if ((Object)(object)curChargeProjectile == (Object)null)
				{
					curChargeProjectile = Object.Instantiate<GameObject>(chargeProjectile, shootPoint.position, shootPoint.rotation, shootPoint);
				}
				else
				{
					curChargeProjectile.transform.localScale = Vector3.one * (curCharge / 100f);
				}
				chargeLight.intensity = curCharge * 5f / 100f;
			}
			else
			{
				if ((Object)(object)curChargeProjectile != (Object)null)
				{
					Object.Destroy((Object)(object)curChargeProjectile);
				}
				chargeLight.intensity = 0f;
			}
			rotator.localRotation = Quaternion.Euler(180f + curCharge * 2f, 180f, 0f);
		}

		private void Fire()
		{
			//IL_001a: 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_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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < ((variant != 1) ? 1 : projAmount); i++)
			{
				GameObject val = Object.Instantiate<GameObject>(projectileToFire, ((Component)cc).transform.position + ((Component)cc).transform.forward * 0.5f, ((Component)cc).transform.rotation);
				val.transform.Rotate(new Vector3(Random.Range(0f - projSpread.x, projSpread.x), Random.Range(0f - projSpread.y, projSpread.y), 0f));
				val.GetComponent<Projectile>().unparryable = variant == 2;
				val.GetComponent<Projectile>().sourceWeapon = ((Component)this).gameObject;
			}
		}

		public void Reset()
		{
			curCharge = 0f;
			onCooldown = false;
			if ((Object)(object)curChargeProjectile != (Object)null)
			{
				Object.Destroy((Object)(object)curChargeProjectile);
			}
		}
	}
}
namespace Straymode.InGameCode
{
	public class PlonkReference : AssetReference
	{
		private GameObject _asset;

		public override Object Asset => (Object)(object)_asset;

		public PlonkReference(GameObject asset)
		{
			_asset = asset;
		}

		public Object ToAsset()
		{
			return ((AssetReference)this).Asset;
		}
	}
	public class RemoveProjectileIfNearBlackHole : MonoBehaviour
	{
		public Transform blackHole;

		private float projWeight = 0.5f;

		private void Start()
		{
			if (((Component)this).GetComponent<Projectile>().playerBullet)
			{
				projWeight /= 2f;
			}
		}

		private void Update()
		{
			//IL_001e: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)blackHole == (Object)null)
			{
				Object.Destroy((Object)(object)this);
			}
			Vector3 val = ((Component)this).transform.position - blackHole.position;
			if (((Vector3)(ref val)).magnitude < 2f)
			{
				((Component)blackHole).GetComponent<BlackHole>().accumulatedWeight += projWeight;
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
}
namespace Straymode.InGameCode.CustomProjectiles
{
	public class BlackHole : MonoBehaviour
	{
		public float forwardTime = 4f;

		public float suckTime = 4f;

		public float forwardSpeed = 20f;

		private float curForwardTime;

		private float curSuckTime;

		private bool forwarding = true;

		private bool sucking = false;

		private GameObject massProjectile;

		public GameObject sourceWeapon;

		public float accumulatedWeight;

		private Transform shooter;

		private GameObject zapParticles;

		private GameObject suckParticles;

		private AudioSource suckAud;

		private void Start()
		{
			massProjectile = MainCode.FetchFromBundle<GameObject>("Projectiles/BHole Explosion.prefab", autofill: true);
			curForwardTime = forwardTime;
			curSuckTime = suckTime;
			shooter = ((Component)this).transform.Find("ProjShooter");
			((Behaviour)ComponentExtensions.GetOrAddComponent<EnemyIdentifier>((Component)(object)((Component)this).transform)).enabled = false;
			zapParticles = ((Component)((Component)this).transform.Find("zapParticles")).gameObject;
			suckParticles = ((Component)((Component)this).transform.Find("suckParticles")).gameObject;
			suckAud = suckParticles.GetComponentInChildren<AudioSource>();
			suckParticles.SetActive(false);
		}

		private void Update()
		{
			//IL_005b: 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_0071: 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)
			if (MonoSingleton<InputManager>.Instance.InputSource.Fire2.WasPerformedThisFrame)
			{
				curForwardTime = 0f;
			}
			if (forwarding)
			{
				curForwardTime = Mathf.MoveTowards(curForwardTime, 0f, Time.deltaTime);
				((Component)this).transform.position = ((Component)this).transform.position + ((Component)this).transform.forward * forwardSpeed * Time.deltaTime;
				if (curForwardTime <= 0f)
				{
					sucking = true;
					zapParticles.SetActive(false);
					suckParticles.SetActive(true);
					suckAud.pitch = 1f;
					forwarding = false;
				}
			}
			if (sucking)
			{
				suckAud.pitch = Mathf.MoveTowards(suckAud.pitch, float.PositiveInfinity, Time.deltaTime / 2f);
				curSuckTime = Mathf.MoveTowards(curSuckTime, 0f, Time.deltaTime);
				if (curSuckTime <= 0f)
				{
					Blow(accumulatedWeight);
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
			}
		}

		private void OnTriggerEnter(Collider other)
		{
			Projectile val = default(Projectile);
			if (sucking && ((Component)other).TryGetComponent<Projectile>(ref val))
			{
				((Component)val).transform.LookAt(((Component)this).transform);
				ComponentExtensions.GetOrAddComponent<RemoveProjectileIfNearBlackHole>((Component)(object)val).blackHole = ((Component)this).transform;
			}
		}

		private void Blow(float weight)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			float num = weight / 3f;
			num = Mathf.Clamp(num, 0f, 20f);
			((Component)shooter).transform.rotation = Quaternion.Euler(0f, 0f, 0f);
			ShootProjectile(num);
		}

		private void ShootProjectile(float projAmt)
		{
			//IL_000d: 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)
			GameObject val = Object.Instantiate<GameObject>(massProjectile, shooter.position, shooter.rotation);
			Explosion[] componentsInChildren = val.GetComponentsInChildren<Explosion>();
			Explosion[] array = componentsInChildren;
			foreach (Explosion val2 in array)
			{
				float maxSize = val2.maxSize;
				val2.speed += projAmt / 10f;
				val2.maxSize += projAmt;
				val2.sourceWeapon = sourceWeapon;
				float num = val2.maxSize / maxSize;
				val2.damage *= Mathf.RoundToInt(num);
			}
		}
	}
}
namespace Straymode.IdentifierCode
{
	internal class PlayableStreetcleanerPatchID : MonoBehaviour
	{
	}
	internal class PlayerSCID : MonoBehaviour
	{
	}
}