Decompiled source of FireBallShooter v1.4.1

Mods/Fireball.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using BoneLib.Notifications;
using FistShooterNS;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.Data;
using Il2CppSLZ.Marrow.Pool;
using Il2CppSLZ.Marrow.Warehouse;
using Il2CppSystem.Collections.Generic;
using LabFusion.Marrow.Pool;
using LabFusion.Network;
using LabFusion.RPC;
using MelonLoader;
using MelonLoader.Preferences;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(FistShooterMod), "Fireball", "1.0.0", "Dave", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: AssemblyTitle("Fireball")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Fireball")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("75ea7173-a6e0-4232-b83b-d0a7217605e7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace FistShooterNS;

public class FistShooterMod : MelonMod
{
	private const string BARCODE_FIREBALL = "c1534c5a-355a-4734-8103-5ded46697265";

	private const string BARCODE_VOIDBALL = "SLZ.BONELAB.Content.Spawnable.ProjectileVoidBall";

	private static readonly string[] PROJECTILE_NAMES = new string[2] { "Fireball", "Void Ball" };

	private static readonly string[] PROJECTILE_BARCODES = new string[2] { "c1534c5a-355a-4734-8103-5ded46697265", "SLZ.BONELAB.Content.Spawnable.ProjectileVoidBall" };

	private static bool _enabled = false;

	private static float _shootSpeed = 20f;

	private static float _fireRate = 0.3f;

	private static int _handMode = 0;

	private static int _leftProjectile = 0;

	private static int _rightProjectile = 0;

	private static float _projectileSize = 1f;

	private static bool _orbitActive = false;

	private static float _orbitRadius = 1.5f;

	private static float _orbitSpeed = 3f;

	private static int _orbitCount = 5;

	private static float _orbitHeight = 0.3f;

	private static string _orbitBarcode = "c1534c5a-355a-4734-8103-5ded46697265";

	private static List<GameObject> _orbitObjects = new List<GameObject>();

	private static FunctionElement _orbitElement = null;

	private static float _lastYTime = -999f;

	private static bool _yWasPressed = false;

	private const float DOUBLE_CLICK_WINDOW = 0.35f;

	private static float _leftCooldown = 0f;

	private static float _rightCooldown = 0f;

	private static FunctionElement _statusElement = null;

	private static FunctionElement _handElement = null;

	private static FunctionElement _leftProjElement = null;

	private static FunctionElement _rightProjElement = null;

	private static readonly string[] HAND_LABELS = new string[3] { "Left Hand", "Right Hand", "Both Hands" };

	private static bool _fusionChecked = false;

	private static bool _fusionReady = false;

	private static bool _debugOpen = false;

	private static string _searchText = "";

	private static string _lastSearch = "\0";

	private static Vector2 _scroll = Vector2.zero;

	private static List<string[]> _allCrates = new List<string[]>();

	private static List<string[]> _filtered = new List<string[]>();

	private static bool _cratesLoaded = false;

	private static int _pageIndex = 0;

	private const int PER_PAGE = 9;

	private static string _copiedMsg = "";

	private static float _copiedTimer = 0f;

	private static MelonPreferences_Category _cat;

	private static MelonPreferences_Entry<float> _prefSpeed;

	private static MelonPreferences_Entry<float> _prefRate;

	private static Vector3 _flingDir = Vector3.forward;

	public override void OnInitializeMelon()
	{
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: 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_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0242: Unknown result type (might be due to invalid IL or missing references)
		//IL_0254: Unknown result type (might be due to invalid IL or missing references)
		//IL_0288: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0310: Unknown result type (might be due to invalid IL or missing references)
		//IL_0355: Unknown result type (might be due to invalid IL or missing references)
		//IL_0399: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
		_cat = MelonPreferences.CreateCategory("Fireball");
		_prefSpeed = _cat.CreateEntry<float>("ShootSpeed", 20f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		_prefRate = _cat.CreateEntry<float>("FireRate", 0.3f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		_shootSpeed = _prefSpeed.Value;
		_fireRate = _prefRate.Value;
		Page obj = Page.Root.CreatePage("Fireball", Color.red, 0, true);
		_statusElement = obj.CreateFunction("Status: OFF", Color.red, (Action)delegate
		{
		});
		_handElement = obj.CreateFunction("Hand: Left Hand", Color.cyan, (Action)delegate
		{
			_handMode = (_handMode + 1) % 3;
			((Element)_handElement).ElementName = "Hand: " + HAND_LABELS[_handMode];
		});
		_leftProjElement = obj.CreateFunction("Left: " + PROJECTILE_NAMES[_leftProjectile], Color.yellow, (Action)delegate
		{
			_leftProjectile = (_leftProjectile + 1) % PROJECTILE_NAMES.Length;
			((Element)_leftProjElement).ElementName = "Left: " + PROJECTILE_NAMES[_leftProjectile];
		});
		_rightProjElement = obj.CreateFunction("Right: " + PROJECTILE_NAMES[_rightProjectile], Color.magenta, (Action)delegate
		{
			_rightProjectile = (_rightProjectile + 1) % PROJECTILE_NAMES.Length;
			((Element)_rightProjElement).ElementName = "Right: " + PROJECTILE_NAMES[_rightProjectile];
		});
		obj.CreateFloat("Shoot Speed", Color.yellow, _shootSpeed, 5f, 5f, 200f, (Action<float>)delegate(float v)
		{
			_shootSpeed = v;
			_prefSpeed.Value = v;
			MelonPreferences.Save();
		});
		obj.CreateFloat("Fire Rate", Color.white, _fireRate, 0.05f, 0.05f, 2f, (Action<float>)delegate(float v)
		{
			_fireRate = v;
			_prefRate.Value = v;
			MelonPreferences.Save();
		});
		obj.CreateFloat("Projectile Size", Color.white, _projectileSize, 0.5f, 0.5f, 10f, (Action<float>)delegate(float v)
		{
			_projectileSize = v;
		});
		Page obj2 = obj.CreatePage("Orbit Mode", Color.cyan, 0, true);
		_orbitElement = obj2.CreateFunction("Orbit: OFF", Color.red, (Action)delegate
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			_orbitActive = !_orbitActive;
			((Element)_orbitElement).ElementName = (_orbitActive ? "Orbit: ON" : "Orbit: OFF");
			((Element)_orbitElement).ElementColor = (_orbitActive ? Color.green : Color.red);
			if (_orbitActive)
			{
				SpawnOrbit();
			}
			else
			{
				DespawnOrbit();
			}
		});
		obj2.CreateFloat("Radius", Color.cyan, _orbitRadius, 0.25f, 0.5f, 5f, (Action<float>)delegate(float v)
		{
			_orbitRadius = v;
		});
		obj2.CreateFloat("Speed", Color.white, _orbitSpeed, 0.5f, 0.5f, 10f, (Action<float>)delegate(float v)
		{
			_orbitSpeed = v;
		});
		obj2.CreateFloat("Count", Color.yellow, (float)_orbitCount, 1f, 1f, 20f, (Action<float>)delegate(float v)
		{
			_orbitCount = (int)v;
		});
		obj2.CreateFloat("Height Offset", Color.white, _orbitHeight, 0.1f, -1f, 2f, (Action<float>)delegate(float v)
		{
			_orbitHeight = v;
		});
		obj2.CreateString("Custom Barcode", Color.green, _orbitBarcode, (Action<string>)delegate(string v)
		{
			if (!string.IsNullOrEmpty(v))
			{
				_orbitBarcode = v;
			}
			MelonLogger.Msg("[Fireball] Orbit barcode: " + _orbitBarcode);
		});
		obj2.CreateFunction("Respawn Orbit", Color.yellow, (Action)delegate
		{
			DespawnOrbit();
			if (_orbitActive)
			{
				SpawnOrbit();
			}
		});
		MelonLogger.Msg("[Fireball] Loaded — double-tap Y to toggle");
	}

	public override void OnLateInitializeMelon()
	{
		try
		{
			CacheFusion();
		}
		catch
		{
		}
	}

	public override void OnUpdate()
	{
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: 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_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)
		//IL_0155: 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)
		//IL_016c: Expected O, but got Unknown
		//IL_0118: 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)
		if (Input.GetKeyDown((KeyCode)120))
		{
			_debugOpen = !_debugOpen;
			if (_debugOpen && !_cratesLoaded)
			{
				LoadAllCrates();
			}
		}
		if (_copiedTimer > 0f)
		{
			_copiedTimer -= Time.deltaTime;
		}
		if (_leftCooldown > 0f)
		{
			_leftCooldown -= Time.deltaTime;
		}
		if (_rightCooldown > 0f)
		{
			_rightCooldown -= Time.deltaTime;
		}
		bool flag = false;
		try
		{
			Hand leftHand = Player.LeftHand;
			if ((Object)(object)leftHand != (Object)null && (Object)(object)leftHand.Controller != (Object)null)
			{
				flag = leftHand.Controller._bButtonDown;
			}
		}
		catch
		{
		}
		if (flag && !_yWasPressed)
		{
			float time = Time.time;
			if (time - _lastYTime < 0.35f)
			{
				_enabled = !_enabled;
				if (_statusElement != null)
				{
					((Element)_statusElement).ElementName = (_enabled ? "Status: ON" : "Status: OFF");
					((Element)_statusElement).ElementColor = (_enabled ? Color.green : Color.red);
				}
				Notifier.Send(new Notification
				{
					Title = NotificationText.op_Implicit("Fireball"),
					Message = NotificationText.op_Implicit(_enabled ? "ENABLED" : "DISABLED"),
					PopupLength = 1.5f,
					ShowTitleOnPopup = true
				});
				MelonLogger.Msg("[Fireball] " + (_enabled ? "ON" : "OFF"));
				_lastYTime = -999f;
			}
			else
			{
				_lastYTime = time;
			}
		}
		_yWasPressed = flag;
		if (!_enabled)
		{
			return;
		}
		if (_orbitActive)
		{
			UpdateOrbit();
		}
		try
		{
			if (_handMode == 0 || _handMode == 2)
			{
				ProcessHand(Player.LeftHand, ref _leftCooldown, PROJECTILE_BARCODES[_leftProjectile]);
			}
			if (_handMode == 1 || _handMode == 2)
			{
				ProcessHand(Player.RightHand, ref _rightCooldown, PROJECTILE_BARCODES[_rightProjectile]);
			}
		}
		catch
		{
		}
	}

	private static void ProcessHand(Hand hand, ref float cooldown, string barcode)
	{
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: 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_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_0080: 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_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)hand == (Object)null || (Object)(object)hand.m_CurrentAttachedGO != (Object)null || cooldown > 0f)
		{
			return;
		}
		float num = 0f;
		try
		{
			if ((Object)(object)hand.Controller != (Object)null)
			{
				num = hand.Controller._primaryAxis;
			}
		}
		catch
		{
			return;
		}
		if (!(num < 0.7f))
		{
			cooldown = _fireRate;
			Vector3 forward = ((Component)hand).transform.forward;
			Vector3 pos = ((Component)hand).transform.position + forward * 0.5f;
			Quaternion rot = Quaternion.LookRotation(forward);
			SpawnAndFling(pos, rot, forward, barcode);
		}
	}

	private static void SpawnAndFling(Vector3 pos, Quaternion rot, Vector3 dir, string barcode)
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: 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_001f: 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)
		bool flag = false;
		if (_fusionReady)
		{
			try
			{
				flag = HasServer();
			}
			catch
			{
			}
		}
		if (flag && _fusionReady)
		{
			try
			{
				NetworkSpawn(pos, rot, dir, barcode);
				return;
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[Fireball] Net spawn fail: " + ex.Message);
				return;
			}
		}
		LocalSpawn(pos, rot, dir, barcode);
	}

	[MethodImpl(MethodImplOptions.NoInlining)]
	private static void LocalSpawn(Vector3 pos, Quaternion rot, Vector3 dir, string barcode)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//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_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		//IL_0024: 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_0037: Expected O, but got Unknown
		try
		{
			Spawnable val = new Spawnable
			{
				crateRef = new SpawnableCrateReference(barcode)
			};
			LocalAssetSpawner.Register(val);
			LocalAssetSpawner.Spawn(val, pos, rot, (Action<Poolee>)delegate(Poolee poolee)
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)poolee == (Object)null))
				{
					FlingObject(((Component)poolee).gameObject, dir);
				}
			});
		}
		catch (Exception ex)
		{
			MelonLogger.Warning("[Fireball] Local spawn: " + ex.Message);
		}
	}

	[MethodImpl(MethodImplOptions.NoInlining)]
	private static void NetworkSpawn(Vector3 pos, Quaternion rot, Vector3 dir, string barcode)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Expected O, but got Unknown
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: 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_002b: 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_0066: Unknown result type (might be due to invalid IL or missing references)
		Spawnable val = new Spawnable();
		val.crateRef = new SpawnableCrateReference(barcode);
		_flingDir = dir;
		SpawnRequestInfo val2 = default(SpawnRequestInfo);
		val2.Spawnable = val;
		val2.Position = pos;
		val2.Rotation = rot;
		val2.SpawnEffect = false;
		val2.SpawnCallback = delegate(SpawnCallbackInfo info)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)info.Spawned != (Object)null)
			{
				FlingObject(info.Spawned, _flingDir);
			}
		};
		NetworkAssetSpawner.Spawn(val2);
	}

	private static void FlingObject(GameObject go, Vector3 dir)
	{
		//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)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		if (_projectileSize != 1f)
		{
			go.transform.localScale = Vector3.one * _projectileSize;
		}
		Rigidbody componentInChildren = go.GetComponentInChildren<Rigidbody>();
		if ((Object)(object)componentInChildren != (Object)null)
		{
			componentInChildren.isKinematic = false;
			componentInChildren.useGravity = false;
			componentInChildren.velocity = dir * _shootSpeed;
			componentInChildren.angularVelocity = Vector3.zero;
		}
		try
		{
			PhysicsRig physicsRig = Player.RigManager.physicsRig;
			if (!((Object)(object)physicsRig != (Object)null))
			{
				return;
			}
			Il2CppArrayBase<Collider> componentsInChildren = go.GetComponentsInChildren<Collider>();
			Il2CppArrayBase<Collider> componentsInChildren2 = ((Component)physicsRig).GetComponentsInChildren<Collider>();
			foreach (Collider item in componentsInChildren)
			{
				foreach (Collider item2 in componentsInChildren2)
				{
					Physics.IgnoreCollision(item, item2, true);
				}
			}
		}
		catch
		{
		}
	}

	[MethodImpl(MethodImplOptions.NoInlining)]
	private static void CacheFusion()
	{
		if (!_fusionChecked)
		{
			_fusionChecked = true;
			if (typeof(NetworkAssetSpawner) != null)
			{
				_fusionReady = true;
			}
			MelonLogger.Msg(_fusionReady ? "[Fireball] Fusion ready — networked spawning enabled" : "[Fireball] Fusion not found — local only");
		}
	}

	[MethodImpl(MethodImplOptions.NoInlining)]
	private static bool HasServer()
	{
		return NetworkInfo.HasServer;
	}

	private static void LoadAllCrates()
	{
		_allCrates.Clear();
		try
		{
			AssetWarehouse instance = AssetWarehouse.Instance;
			if (instance == null)
			{
				MelonLogger.Warning("[Fireball] Warehouse null");
				return;
			}
			List<Crate> crates = instance.GetCrates();
			if (crates == null)
			{
				return;
			}
			int count = crates.Count;
			for (int i = 0; i < count; i++)
			{
				try
				{
					Crate val = crates[i];
					if ((Object)(object)val == (Object)null || (Object)(object)((Il2CppObjectBase)val).TryCast<SpawnableCrate>() == (Object)null)
					{
						continue;
					}
					string text = ((Scannable)val).Title ?? "Unknown";
					string text2 = ((((Scannable)val).Barcode != (Barcode)null) ? ((Scannable)val).Barcode.ID : "");
					string text3 = "Unknown";
					try
					{
						if ((Object)(object)val.Pallet != (Object)null)
						{
							text3 = val.Pallet.Author ?? "Unknown";
						}
					}
					catch
					{
					}
					if (!string.IsNullOrEmpty(text2))
					{
						_allCrates.Add(new string[3] { text, text3, text2 });
					}
				}
				catch
				{
				}
			}
			_allCrates.Sort((string[] a, string[] b) => string.Compare(a[0], b[0], StringComparison.OrdinalIgnoreCase));
			_cratesLoaded = true;
			_lastSearch = "\0";
			MelonLogger.Msg($"[Fireball] Loaded {_allCrates.Count} crates");
		}
		catch (Exception ex)
		{
			MelonLogger.Error("[Fireball] LoadCrates: " + ex.Message);
		}
	}

	private static void RefilterCrates()
	{
		_filtered.Clear();
		string text = (_searchText ?? "").ToLower().Trim();
		foreach (string[] allCrate in _allCrates)
		{
			if (text.Length == 0 || allCrate[0].ToLower().Contains(text) || allCrate[1].ToLower().Contains(text) || allCrate[2].ToLower().Contains(text))
			{
				_filtered.Add(allCrate);
			}
		}
		_lastSearch = _searchText;
		_pageIndex = 0;
	}

	public override void OnGUI()
	{
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: Unknown result type (might be due to invalid IL or missing references)
		//IL_024f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0307: Unknown result type (might be due to invalid IL or missing references)
		//IL_0283: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_039d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_041c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0445: Unknown result type (might be due to invalid IL or missing references)
		//IL_0465: Unknown result type (might be due to invalid IL or missing references)
		//IL_047d: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0516: Unknown result type (might be due to invalid IL or missing references)
		//IL_055e: Unknown result type (might be due to invalid IL or missing references)
		if (!_debugOpen)
		{
			return;
		}
		if (_searchText != _lastSearch)
		{
			RefilterCrates();
		}
		float num = 660f;
		float num2 = 600f;
		float num3 = ((float)Screen.width - num) / 2f;
		float num4 = ((float)Screen.height - num2) / 2f;
		GUI.color = new Color(0.08f, 0.08f, 0.1f, 0.92f);
		GUI.Box(new Rect(num3, num4, num, num2), "");
		GUI.color = Color.white;
		GUI.Label(new Rect(num3 + 20f, num4 + 12f, num - 40f, 25f), $"BARCODE BROWSER  —  {_filtered.Count} results  (press X to close)");
		GUI.Label(new Rect(num3 + 20f, num4 + 44f, 60f, 25f), "Search:");
		_searchText = GUI.TextField(new Rect(num3 + 85f, num4 + 44f, num - 290f, 26f), _searchText ?? "");
		if (GUI.Button(new Rect(num3 + num - 195f, num4 + 44f, 80f, 26f), "Clear"))
		{
			_searchText = "";
		}
		if (GUI.Button(new Rect(num3 + num - 105f, num4 + 44f, 85f, 26f), "Reload"))
		{
			_cratesLoaded = false;
			LoadAllCrates();
		}
		int num5 = Mathf.Max(1, Mathf.CeilToInt((float)_filtered.Count / 9f));
		_pageIndex = Mathf.Clamp(_pageIndex, 0, num5 - 1);
		if (GUI.Button(new Rect(num3 + 20f, num4 + 78f, 70f, 26f), "< Prev") && _pageIndex > 0)
		{
			_pageIndex--;
		}
		GUI.Label(new Rect(num3 + 98f, num4 + 80f, 130f, 24f), $"Page {_pageIndex + 1} / {num5}");
		if (GUI.Button(new Rect(num3 + 215f, num4 + 78f, 70f, 26f), "Next >") && _pageIndex < num5 - 1)
		{
			_pageIndex++;
		}
		if (_copiedTimer > 0f)
		{
			GUI.color = Color.green;
			GUI.Label(new Rect(num3 + 300f, num4 + 80f, num - 320f, 24f), _copiedMsg);
			GUI.color = Color.white;
		}
		GUI.color = new Color(1f, 1f, 1f, 0.15f);
		GUI.Box(new Rect(num3 + 20f, num4 + 112f, num - 40f, 1f), "");
		GUI.color = Color.white;
		float num6 = num4 + 122f;
		float num7 = num3 + num - 200f;
		float num8 = num7 - (num3 + 20f) - 10f;
		int num9 = _pageIndex * 9;
		int num10 = Mathf.Min(num9 + 9, _filtered.Count);
		for (int i = num9; i < num10; i++)
		{
			string[] array = _filtered[i];
			int num11 = i - num9;
			float num12 = num6 + (float)num11 * 48f;
			if (num11 % 2 == 0)
			{
				GUI.color = new Color(1f, 1f, 1f, 0.04f);
				GUI.Box(new Rect(num3 + 12f, num12 - 2f, num - 24f, 44f), "");
				GUI.color = Color.white;
			}
			string text = ((array[0].Length > 42) ? (array[0].Substring(0, 40) + "..") : array[0]);
			GUI.Label(new Rect(num3 + 20f, num12 + 4f, num8, 20f), text ?? "");
			GUI.color = new Color(0.6f, 0.85f, 1f, 1f);
			GUI.Label(new Rect(num3 + 20f, num12 + 22f, num8, 18f), "by " + array[1]);
			GUI.color = Color.white;
			string text2 = ((array[2].Length > 48) ? (array[2].Substring(0, 46) + "..") : array[2]);
			GUI.color = new Color(0.55f, 0.55f, 0.58f, 1f);
			GUI.Label(new Rect(num3 + num8 - 240f, num12 + 22f, 250f, 18f), text2);
			GUI.color = Color.white;
			if (GUI.Button(new Rect(num7, num12 + 8f, 88f, 30f), "Copy"))
			{
				GUIUtility.systemCopyBuffer = array[2];
				_copiedMsg = "Copied to clipboard!";
				_copiedTimer = 2f;
			}
			if (GUI.Button(new Rect(num7 + 92f, num12 + 8f, 88f, 30f), "Use Orbit"))
			{
				_orbitBarcode = array[2];
				_copiedMsg = "Orbit set: " + array[0];
				_copiedTimer = 2f;
			}
		}
	}

	[MethodImpl(MethodImplOptions.NoInlining)]
	private static void SpawnOrbit()
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: 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_0028: 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_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_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Expected O, but got Unknown
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Expected O, but got Unknown
		//IL_00e6: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: Expected O, but got Unknown
		DespawnOrbit();
		Vector3 val = Player.Head.position + Player.Head.forward * 2f;
		bool flag = false;
		if (_fusionReady)
		{
			try
			{
				flag = HasServer();
			}
			catch
			{
			}
		}
		for (int i = 0; i < _orbitCount; i++)
		{
			if (flag)
			{
				try
				{
					Spawnable spawnable = LocalAssetSpawner.CreateSpawnable(_orbitBarcode);
					SpawnRequestInfo val2 = default(SpawnRequestInfo);
					val2.Spawnable = spawnable;
					val2.Position = val;
					val2.Rotation = Quaternion.identity;
					val2.SpawnEffect = false;
					val2.SpawnCallback = delegate(SpawnCallbackInfo cb)
					{
						//IL_0000: 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_001e: 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_0067: Unknown result type (might be due to invalid IL or missing references)
						//IL_0072: Unknown result type (might be due to invalid IL or missing references)
						//IL_007c: Unknown result type (might be due to invalid IL or missing references)
						if ((Object)(object)cb.Spawned != (Object)null)
						{
							_orbitObjects.Add(cb.Spawned);
							Rigidbody component2 = cb.Spawned.GetComponent<Rigidbody>();
							if ((Object)(object)component2 != (Object)null)
							{
								component2.useGravity = false;
								component2.drag = 5f;
								component2.angularDrag = 5f;
								component2.velocity = Vector3.zero;
							}
							if (_projectileSize != 1f)
							{
								cb.Spawned.transform.localScale = Vector3.one * _projectileSize;
							}
						}
					};
					NetworkAssetSpawner.Spawn(val2);
				}
				catch (Exception ex)
				{
					MelonLogger.Warning("[Fireball] Orbit net spawn: " + ex.Message);
				}
				continue;
			}
			try
			{
				Spawnable val3 = new Spawnable
				{
					crateRef = new SpawnableCrateReference(_orbitBarcode)
				};
				LocalAssetSpawner.Register(val3);
				LocalAssetSpawner.Spawn(val3, val, Quaternion.identity, (Action<Poolee>)delegate(Poolee poolee)
				{
					//IL_0048: Unknown result type (might be due to invalid IL or missing references)
					//IL_0064: Unknown result type (might be due to invalid IL or missing references)
					//IL_006e: Unknown result type (might be due to invalid IL or missing references)
					if (!((Object)(object)poolee == (Object)null))
					{
						_orbitObjects.Add(((Component)poolee).gameObject);
						Rigidbody component = ((Component)poolee).GetComponent<Rigidbody>();
						if ((Object)(object)component != (Object)null)
						{
							component.useGravity = false;
							component.drag = 5f;
							component.angularDrag = 5f;
							component.velocity = Vector3.zero;
						}
						if (_projectileSize != 1f)
						{
							((Component)poolee).transform.localScale = Vector3.one * _projectileSize;
						}
					}
				});
			}
			catch (Exception ex2)
			{
				MelonLogger.Warning("[Fireball] Orbit local spawn: " + ex2.Message);
			}
		}
		MelonLogger.Msg($"[Fireball] Orbit spawning {_orbitCount} fireballs, radius {_orbitRadius}");
	}

	private static void DespawnOrbit()
	{
		foreach (GameObject orbitObject in _orbitObjects)
		{
			try
			{
				if ((Object)(object)orbitObject != (Object)null)
				{
					Poolee component = orbitObject.GetComponent<Poolee>();
					if ((Object)(object)component != (Object)null)
					{
						component.Despawn();
					}
				}
			}
			catch
			{
			}
		}
		_orbitObjects.Clear();
	}

	private static void UpdateOrbit()
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//IL_00b0: 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)
		if (_orbitObjects.Count == 0)
		{
			return;
		}
		Vector3 position;
		try
		{
			position = Player.Head.position;
		}
		catch
		{
			return;
		}
		int num = 0;
		for (int i = 0; i < _orbitObjects.Count; i++)
		{
			GameObject val = _orbitObjects[i];
			if (!((Object)(object)val == (Object)null))
			{
				float num2 = Time.time * _orbitSpeed + (float)num * ((float)Math.PI * 2f / (float)_orbitObjects.Count);
				Vector3 val2 = position + new Vector3(Mathf.Cos(num2) * _orbitRadius, _orbitHeight, Mathf.Sin(num2) * _orbitRadius);
				Rigidbody component = val.GetComponent<Rigidbody>();
				if ((Object)(object)component != (Object)null)
				{
					component.MovePosition(val2);
				}
				else
				{
					val.transform.position = val2;
				}
				num++;
			}
		}
	}
}