Decompiled source of Hatsune Miku v1.0.3

plugins/MikuMikuMod.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Text;
using Alexandria;
using Alexandria.Assetbundle;
using Alexandria.CharacterAPI;
using Alexandria.EnemyAPI;
using Alexandria.ItemAPI;
using Alexandria.Misc;
using Alexandria.PrefabAPI;
using Alexandria.SoundAPI;
using Alexandria.VisualAPI;
using BepInEx;
using BepInEx.Configuration;
using Dungeonator;
using Gungeon;
using HarmonyLib;
using JuneLib;
using MikuMikuMod.Code;
using MonoMod.RuntimeDetour;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mod")]
[assembly: AssemblyCopyright("Copyright ©  2020")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d6d7a494-722e-4763-959b-c2d6b6a42b01")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace MikuMikuMod
{
	internal class AssetBundleLoader
	{
		public static AssetBundle LoadAssetBundleFromLiterallyAnywhere(string name, bool logs = false)
		{
			AssetBundle result = null;
			string text = name + GetPlatformBundleExtension();
			if (File.Exists(MikuMikuModule.FilePathFolder + "/" + text))
			{
				try
				{
					result = AssetBundle.LoadFromFile(Path.Combine(MikuMikuModule.FilePathFolder, text));
					if (logs)
					{
						ETGModConsole.Log((object)"Successfully loaded assetbundle!", false);
					}
				}
				catch (Exception ex)
				{
					ETGModConsole.Log((object)"Failed loading asset bundle from file.", false);
					ETGModConsole.Log((object)ex.ToString(), false);
				}
			}
			else
			{
				ETGModConsole.Log((object)"AssetBundle NOT FOUND!", false);
			}
			return result;
		}

		private static string GetPlatformBundleExtension()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Invalid comparison between Unknown and I4
			if ((int)Application.platform == 13)
			{
				return "-linux";
			}
			if ((int)Application.platform == 1)
			{
				return "-macos";
			}
			return "-windows";
		}
	}
	public class AudioResourceLoader
	{
		public static void loadFromFolder(string modName)
		{
			ResourceLoaderSoundbanks resourceLoaderSoundbanks = new ResourceLoaderSoundbanks();
			resourceLoaderSoundbanks.AutoloadFromPath(MikuMikuModule.FilePathFolder, modName);
		}

		public static void loadFromAssembly(string bankName, string modName)
		{
			ResourceLoaderSoundbanks resourceLoaderSoundbanks = new ResourceLoaderSoundbanks();
			resourceLoaderSoundbanks.AutoloadFromAssembly(Assembly.GetExecutingAssembly(), bankName, modName);
		}
	}
	public class ResourceLoaderSoundbanks
	{
		public void AutoloadFromAssembly(Assembly assembly, string bankName, string prefix)
		{
			if ((object)assembly == null)
			{
				throw new ArgumentNullException("assembly", "Assembly cannot be null.");
			}
			if (prefix == null)
			{
				throw new ArgumentNullException("prefix", "Prefix name cannot be null.");
			}
			prefix = prefix.Trim();
			if (prefix == "")
			{
				throw new ArgumentException("Prefix name cannot be an empty (or whitespace only) string.", "prefix");
			}
			List<string> list = new List<string>(assembly.GetManifestResourceNames());
			for (int i = 0; i < list.Count; i++)
			{
				string text = list[i];
				string text2 = text;
				text2 = text2.Replace('/', Path.DirectorySeparatorChar);
				text2 = text2.Replace('\\', Path.DirectorySeparatorChar);
				if (!text2.Contains(bankName))
				{
					continue;
				}
				text2 = text2.Substring(text2.IndexOf(bankName));
				if (text2.LastIndexOf(".bnk") == text2.Length - ".bnk".Length)
				{
					text2 = text2.Substring(0, text2.Length - ".bnk".Length);
					if (text2.IndexOf(Path.DirectorySeparatorChar) == 0)
					{
						text2 = text2.Substring(1);
					}
					text2 = prefix + ":" + text2;
					Debug.Log((object)$"{typeof(ResourceLoaderSoundbanks)}: Soundbank found, attempting to autoload: name='{text2}' resource='{text}'");
					using Stream stream = assembly.GetManifestResourceStream(text);
					LoadSoundbankFromStream(stream, text2);
				}
			}
		}

		public void AutoloadFromPath(string path, string prefix)
		{
			if (string.IsNullOrEmpty(path))
			{
				throw new ArgumentNullException("path", "Path cannot be null.");
			}
			if (string.IsNullOrEmpty(prefix))
			{
				throw new ArgumentNullException("prefix", "Prefix name cannot be null.");
			}
			prefix = prefix.Trim();
			if (string.IsNullOrEmpty(prefix))
			{
				throw new ArgumentException("Prefix name cannot be an empty (or whitespace only) string.", "prefix");
			}
			path = path.Replace('/', Path.DirectorySeparatorChar);
			path = path.Replace('\\', Path.DirectorySeparatorChar);
			if (!Directory.Exists(path))
			{
				Debug.LogError((object)$"{typeof(ResourceLoaderSoundbanks)}: No autoload directory in path, not autoloading anything. Path='{path}'.");
				return;
			}
			List<string> list = new List<string>(Directory.GetFiles(path, "*.bnk", SearchOption.AllDirectories));
			for (int i = 0; i < list.Count; i++)
			{
				string text = list[i];
				string text2 = text;
				text2 = text2.Replace('/', Path.DirectorySeparatorChar);
				text2 = text2.Replace('\\', Path.DirectorySeparatorChar);
				text2 = text2.Substring(text2.IndexOf(path) + path.Length);
				text2 = text2.Substring(0, text2.Length - ".bnk".Length);
				if (text2.IndexOf(Path.DirectorySeparatorChar) == 0)
				{
					text2 = text2.Substring(1);
				}
				text2 = prefix + ":" + text2;
				Debug.Log((object)$"{typeof(ResourceLoaderSoundbanks)}: Soundbank found, attempting to autoload: name='{text2}' file='{text}'");
				using FileStream stream = File.OpenRead(text);
				LoadSoundbankFromStream(stream, text2);
			}
		}

		private void LoadSoundbankFromStream(Stream stream, string name)
		{
			//IL_0027: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			byte[] array = StreamToByteArray(stream);
			IntPtr intPtr = Marshal.AllocHGlobal(array.Length);
			try
			{
				Marshal.Copy(array, 0, intPtr, array.Length);
				uint num = default(uint);
				AKRESULT val = AkSoundEngine.LoadAndDecodeBankFromMemory(intPtr, (uint)array.Length, false, name, false, ref num);
				Debug.Log((object)$"Result of soundbank load: {val}.");
			}
			finally
			{
				Marshal.FreeHGlobal(intPtr);
			}
		}

		public static byte[] StreamToByteArray(Stream input)
		{
			byte[] array = new byte[16384];
			using MemoryStream memoryStream = new MemoryStream();
			int count;
			while ((count = input.Read(array, 0, array.Length)) > 0)
			{
				memoryStream.Write(array, 0, count);
			}
			return memoryStream.ToArray();
		}
	}
	public static class Easing
	{
		public enum Ease
		{
			IN,
			OUT,
			IN_OUT,
			NONE,
			EASE_IN_AND_BACK
		}

		public static float DoLerpT(float t, Ease ease = Ease.IN_OUT)
		{
			return ease switch
			{
				Ease.IN => EaseIn(t), 
				Ease.OUT => EaseOut(t), 
				Ease.IN_OUT => EaseInOut(t), 
				Ease.NONE => t, 
				Ease.EASE_IN_AND_BACK => EaseInAndBack(t), 
				_ => t, 
			};
		}

		public static float EaseIn(float t)
		{
			return t * t;
		}

		public static float EaseInInverse(float t)
		{
			return 1f - t * t;
		}

		public static float Flip(float t)
		{
			return 1f - t;
		}

		public static float EaseOut(float t)
		{
			return Flip(EaseIn(Flip(t)));
		}

		public static float EaseInOut(float t)
		{
			return Mathf.Lerp(EaseIn(t), EaseOut(t), t);
		}

		public static float EaseInAndBack(float t)
		{
			return Mathf.Lerp(EaseIn(t), EaseInInverse(t), t);
		}
	}
	public class Leek : PlayerItem
	{
		public static int ID;

		public static VFXPool Impact;

		public static string ImpactSFX;

		public static GameObject LeekObject;

		private MikuHarmony mikuHarmony;

		public static void Init()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_0064: 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_00c5: Expected O, but got Unknown
			//IL_0133: 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)
			string text = "Leek";
			GameObject val = new GameObject(text);
			Leek leek = val.AddComponent<Leek>();
			tk2dSpriteCollectionData mikuItemAndGunCollection = StaticSpriteCollections.MikuItemAndGunCollection;
			ItemBuilder.AddSpriteToObjectAssetbundle(text, mikuItemAndGunCollection.GetSpriteIdByName("leek"), mikuItemAndGunCollection, val);
			string text2 = "Spin To Win! (Not Guaranteed)";
			string text3 = "Spins items into other items. Gets more effective spins with higher Harmony.\n\nA leek..? How does a leek of all things work like that?";
			ItemBuilder.SetupItem((PickupObject)(object)leek, text2, text3, "miku");
			ItemBuilder.SetCooldownType((PlayerItem)(object)leek, (CooldownType)2, 5f);
			((PlayerItem)leek).consumable = false;
			((PickupObject)leek).quality = (ItemQuality)(-50);
			ItemBuilder.AddPassiveStatModifier((PickupObject)(object)leek, (StatType)8, 1f, (ModifyMethod)0);
			((PickupObject)leek).CanBeDropped = false;
			GameObject val2 = PrefabBuilder.BuildObject("leek");
			tk2dSprite val3 = val2.gameObject.AddComponent<tk2dSprite>();
			((tk2dBaseSprite)val3).SetSprite(StaticSpriteCollections.MikuItemAndGunCollection, "takingaleek");
			((BraveBehaviour)val3).renderer.material = new Material(ShaderCache.Acquire("Sprites/Default"));
			((tk2dBaseSprite)val3).SortingOrder = 4;
			GameObjectExtensions.SetLayerRecursively(((Component)val3).gameObject, LayerMask.NameToLayer("FG_Critical"));
			((BraveBehaviour)val3).renderer.sortingLayerName = "Foreground";
			DepthLookupManager.AssignRendererToSortingLayer(((BraveBehaviour)val3).renderer, (GungeonSortingLayer)2);
			ImprovedAfterImage val4 = val2.AddComponent<ImprovedAfterImage>();
			((BraveBehaviour)val4).sprite = (tk2dBaseSprite)(object)val3;
			val4.shadowLifetime = 0.333f;
			val4.shadowTimeDelay = 0.0333f;
			val4.dashColor = Color.white;
			val4.targetHeight = 1f;
			LeekObject = val2;
			HarmonyPatches.OnActiveItemDropped = (Action<PlayerItem, PlayerController>)Delegate.Combine(HarmonyPatches.OnActiveItemDropped, new Action<PlayerItem, PlayerController>(OnThisActiveDropped));
			ID = ((PickupObject)leek).PickupObjectId;
		}

		public static void OnThisActiveDropped(PlayerItem active, PlayerController player)
		{
			if (((PickupObject)active).PickupObjectId == ID)
			{
				((PickupObject)active).Pickup(player);
			}
		}

		public static IEnumerator DoLeekToss(tk2dSpriteAnimator tk2DSpriteAnimator, tk2dSpriteAnimationFrame tk2DSpriteAnimationFrame)
		{
			AttachPoint[] attachPoints = tk2DSpriteAnimationFrame.spriteCollection.spriteDefinitions[tk2DSpriteAnimationFrame.spriteId].GetAttachPoints(tk2DSpriteAnimationFrame.spriteCollection, tk2DSpriteAnimationFrame.spriteId);
			Vector3 attachPoint_start = ((BraveBehaviour)tk2DSpriteAnimator).transform.position + Array.Find(attachPoints, (AttachPoint a) => a.name == "throwpoint_leek").position;
			Vector3 attachPoint_end = ((BraveBehaviour)tk2DSpriteAnimator).transform.position + Array.Find(attachPoints, (AttachPoint a) => a.name == "headlandspot").position;
			GameObject onject = Object.Instantiate<GameObject>(LeekObject, attachPoint_start, Quaternion.identity);
			float uiyferw = Random.Range(540, 1080);
			float e = 0f;
			AkSoundEngine.PostEvent("Play_OBJ_item_throw_01", onject.gameObject);
			while (e < 1f)
			{
				e += Time.deltaTime * 0.666f;
				onject.transform.position = Vector2.op_Implicit(Vector2.Lerp(Vector2.op_Implicit(attachPoint_start), Vector2.op_Implicit(attachPoint_end), e) + new Vector2(0f, Mathf.Lerp(0f, 5f, Easing.DoLerpT(e, Easing.Ease.EASE_IN_AND_BACK))));
				onject.transform.Rotate(new Vector3(0f, 0f, uiyferw * Time.deltaTime));
				yield return null;
			}
			if (((Component)tk2DSpriteAnimator).gameObject.activeSelf)
			{
				Impact.SpawnAtPosition(attachPoint_end, 0f, (Transform)null, (Vector2?)null, (Vector2?)null, (float?)null, false, (SpawnMethod)null, (tk2dBaseSprite)null, false);
				AkSoundEngine.PostEvent("Play_WPN_" + ImpactSFX + "_impact_01", onject.gameObject);
			}
			((Behaviour)onject.GetComponent<ImprovedAfterImage>()).enabled = false;
			DebrisObject orAddComponent = GameObjectExtensions.GetOrAddComponent<DebrisObject>(onject);
			orAddComponent.angularVelocity = Random.Range(90, 120);
			orAddComponent.angularVelocityVariance = Random.Range(10, 60);
			orAddComponent.decayOnBounce = 0.5f;
			orAddComponent.bounceCount = 1;
			orAddComponent.canRotate = true;
			orAddComponent.shouldUseSRBMotion = true;
			orAddComponent.AssignFinalWorldDepth(-0.5f);
			((BraveBehaviour)orAddComponent).sprite = onject.GetComponent<tk2dBaseSprite>();
			orAddComponent.animatePitFall = true;
			orAddComponent.Trigger(Vector2.op_Implicit(Toolbox.GetUnitOnCircle(BraveUtility.RandomAngle(), Random.Range(0.5f, 2f))), 3.5f, 1f);
			orAddComponent.audioEventName = "Play_PET_junk_splat_01";
		}

		public override void Pickup(PlayerController player)
		{
			((PlayerItem)this).Pickup(player);
			SetHarmonyInst();
		}

		private void SetHarmonyInst()
		{
			if ((Object)(object)base.LastOwner == (Object)null || (Object)(object)mikuHarmony != (Object)null)
			{
				return;
			}
			foreach (PassiveItem passiveItem in base.LastOwner.passiveItems)
			{
				if (passiveItem is MikuHarmony)
				{
					mikuHarmony = (MikuHarmony)(object)passiveItem;
					break;
				}
			}
		}

		public override bool CanBeUsed(PlayerController user)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Invalid comparison between Unknown and I4
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Invalid comparison between Unknown and I4
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Invalid comparison between Unknown and I4
			if ((Object)(object)user == (Object)null)
			{
				return false;
			}
			IPlayerInteractable lastInteractable = user.GetLastInteractable();
			if (lastInteractable != null)
			{
				PickupObject val = (PickupObject)(object)((lastInteractable is PickupObject) ? lastInteractable : null);
				if (val != null && (int)val.quality != -100 && (int)val.quality != -50 && (int)val.quality > 0)
				{
					return true;
				}
			}
			return false;
		}

		public override void DoEffect(PlayerController user)
		{
			SetHarmonyInst();
			((MonoBehaviour)user).StartCoroutine(LeekAllOverThePlace(user));
		}

		private IEnumerator LeekAllOverThePlace(PlayerController user)
		{
			PickupObject pickupObject = null;
			IPlayerInteractable lastInteractable = user.GetLastInteractable();
			int num;
			if (lastInteractable != null)
			{
				PickupObject interactablePickup = (PickupObject)(object)((lastInteractable is PickupObject) ? lastInteractable : null);
				num = ((interactablePickup != null) ? 1 : 0);
			}
			else
			{
				num = 0;
			}
			if (num != 0)
			{
				pickupObject = (PickupObject)lastInteractable;
			}
			if ((Object)(object)pickupObject == (Object)null)
			{
				yield break;
			}
			((PickupObject)this).CanBeDropped = false;
			((PlayerItem)this).IsCurrentlyActive = true;
			base.m_activeElapsed = 0f;
			base.m_activeDuration = 5f;
			user.CurrentRoom.DeregisterInteractable(lastInteractable);
			user.ToggleGunRenderers(false, "Leeking");
			user.ToggleHandRenderers(false, "Leeking");
			user.SetInputOverride("Leeking");
			user.ZeroVelocityThisFrame = true;
			user.m_handlingQueuedAnimation = true;
			((BraveBehaviour)user).spriteAnimator.PlayForDuration("select_leek_start", 0.5f, "select_leek_loop", false);
			PassiveItem passive = (PassiveItem)(object)((pickupObject is PassiveItem) ? pickupObject : null);
			if (passive != null)
			{
				passive.OnExitRange(user);
			}
			Gun gun = (Gun)(object)((pickupObject is Gun) ? pickupObject : null);
			if (gun != null)
			{
				gun.OnExitRange(user);
			}
			PlayerItem active = (PlayerItem)(object)((pickupObject is PlayerItem) ? pickupObject : null);
			if (active != null)
			{
				active.OnExitRange(user);
			}
			Vector2 v = ((BraveBehaviour)pickupObject).sprite.WorldCenter;
			_ = ((BraveBehaviour)pickupObject).transform.position;
			SquishyBounceWiggler p2 = ((Component)pickupObject).GetComponent<SquishyBounceWiggler>();
			if (Object.op_Implicit((Object)(object)p2))
			{
				((Behaviour)p2).enabled = false;
			}
			float particle = 40f;
			float delay = 1f / particle;
			float a = 0f;
			float e3 = 0f;
			float offsetAngleApplied2 = 0f;
			AkSoundEngine.PostEvent("Play_OBJ_item_throw_01", ((Component)base.LastOwner).gameObject);
			AkSoundEngine.PostEvent("Play_OBJ_rope_escape_01", ((Component)base.LastOwner).gameObject);
			SpriteOutlineManager.RemoveOutlineFromSprite(((BraveBehaviour)pickupObject).sprite, false);
			while (e3 < 1f)
			{
				e3 += Time.deltaTime * 0.66f;
				a += Time.deltaTime;
				float angleApplied = Mathf.Lerp(0f, 7223f, e3 * e3) * Time.deltaTime;
				((BraveBehaviour)pickupObject).transform.position = Vector2.op_Implicit(v);
				((BraveBehaviour)pickupObject).transform.Rotate(new Vector3(0f, 0f, angleApplied));
				Vector3 v_ = Vector2Extensions.ToVector3ZUp(((BraveBehaviour)pickupObject).sprite.WorldCenter, 120f) - ((BraveBehaviour)pickupObject).transform.position;
				offsetAngleApplied2 += angleApplied;
				Transform transform = ((BraveBehaviour)pickupObject).transform;
				transform.position -= v_;
				((BraveBehaviour)pickupObject).transform.position = Vector3Extensions.WithZ(((BraveBehaviour)pickupObject).transform.position, 120f);
				if (a > delay)
				{
					a = 0f;
					particle += 1f;
					delay = 1f / particle;
					GlobalSparksDoer.DoSingleParticle(Vector2.op_Implicit(((BraveBehaviour)pickupObject).sprite.WorldCenter), Vector2.op_Implicit(Toolbox.GetUnitOnCircle(BraveUtility.RandomAngle(), Mathf.Min(12f, particle * 0.075f))), (float?)0.125f, (float?)0.5f, (Color?)Color.white, (SparksType)2);
					GlobalSparksDoer.DoSingleParticle(Vector2.op_Implicit(((BraveBehaviour)pickupObject).sprite.WorldCenter), Vector2.op_Implicit(Toolbox.GetUnitOnCircle(BraveUtility.RandomAngle(), Mathf.Min(8f, particle * 0.05f))), (float?)0.125f, (float?)1f, (Color?)Color.white, (SparksType)2);
				}
				yield return null;
			}
			AkSoundEngine.PostEvent("Play_BOSS_dragun_spin_01", ((Component)base.LastOwner).gameObject);
			e3 = 0f;
			while (e3 < 1f)
			{
				e3 += Time.deltaTime * 1f;
				a += Time.deltaTime;
				((BraveBehaviour)pickupObject).transform.position = Vector2.op_Implicit(v);
				((BraveBehaviour)pickupObject).transform.Rotate(new Vector3(0f, 0f, 7223f * Time.deltaTime));
				Vector3 v_2 = Vector2Extensions.ToVector3ZUp(((BraveBehaviour)pickupObject).sprite.WorldCenter, 120f) - ((BraveBehaviour)pickupObject).transform.position;
				offsetAngleApplied2 += 7200f * Time.deltaTime;
				Transform transform2 = ((BraveBehaviour)pickupObject).transform;
				transform2.position -= v_2;
				((BraveBehaviour)pickupObject).transform.position = Vector3Extensions.WithZ(((BraveBehaviour)pickupObject).transform.position, 120f);
				if (a > delay)
				{
					a = 0f;
					delay = 1f / particle;
					GlobalSparksDoer.DoSingleParticle(Vector2.op_Implicit(((BraveBehaviour)pickupObject).sprite.WorldCenter), Vector2.op_Implicit(Toolbox.GetUnitOnCircle(BraveUtility.RandomAngle(), Mathf.Min(12f, particle * 0.075f))), (float?)0.125f, (float?)0.5f, (Color?)Color.white, (SparksType)2);
					GlobalSparksDoer.DoSingleParticle(Vector2.op_Implicit(((BraveBehaviour)pickupObject).sprite.WorldCenter), Vector2.op_Implicit(Toolbox.GetUnitOnCircle(BraveUtility.RandomAngle(), Mathf.Min(8f, particle * 0.05f))), (float?)0.125f, (float?)1f, (Color?)Color.white, (SparksType)2);
				}
				yield return null;
			}
			int oldPickup = pickupObject.PickupObjectId;
			int SuccessfulRoll = 0;
			int newID = ((!(pickupObject is Gun)) ? ((PickupObject)PickupObjectDatabase.GetRandomGunOfQualities(new Random(), new List<int> { oldPickup }, (ItemQuality[])(object)new ItemQuality[1] { (ItemQuality)(int)DetermineNewQuality(pickupObject, ref SuccessfulRoll) })).PickupObjectId : ((!(Random.value > 0.15f)) ? ((PickupObject)Toolbox.GetRandomActiveOfQualities(new Random(), new List<int> { oldPickup }, (ItemQuality)(int)DetermineNewQuality(pickupObject, ref SuccessfulRoll))).PickupObjectId : ((PickupObject)PickupObjectDatabase.GetRandomPassiveOfQualities(new Random(), new List<int>
			{
				303, 243, 244, 245, 246, 247, 248, 72, 219, 222,
				oldPickup
			}, (ItemQuality[])(object)new ItemQuality[1] { (ItemQuality)(int)DetermineNewQuality(pickupObject, ref SuccessfulRoll) })).PickupObjectId));
			GameObject silencerVFX = (GameObject)ResourceCache.Acquire("Global VFX/BlankVFX_Ghost");
			GameObject blankObj = Object.Instantiate<GameObject>(silencerVFX.gameObject, Vector2.op_Implicit(v), Quaternion.identity);
			blankObj.transform.localScale = Vector3.one * 0.5f;
			Object.Destroy((Object)(object)blankObj, 2f);
			AkSoundEngine.PostEvent("Play_NPC_faerie_heal_01", ((Component)base.LastOwner).gameObject);
			switch (SuccessfulRoll)
			{
			case 0:
			{
				AkSoundEngine.PostEvent("Play_OBJ_prize_won_01", ((Component)base.LastOwner).gameObject);
				for (int i = 0; i < 18; i++)
				{
					ParticleBase.EmitNoiselessParticle(v, 2, 9f * Random.Range(0.8f, 1.2f), 20 * i, 1f);
				}
				break;
			}
			case 1:
			{
				AkSoundEngine.PostEvent("Play_NPC_magic_blessing_01", ((Component)base.LastOwner).gameObject);
				for (int j = 0; j < 36; j++)
				{
					ParticleBase.EmitNoiselessParticle(v, 4, 11.5f * Random.Range(0.8f, 1.2f), 10 * j, 1f);
				}
				break;
			}
			case -1:
			{
				AkSoundEngine.PostEvent("Play_NPC_Blessing_Slow_Tonic_01", ((Component)base.LastOwner).gameObject);
				for (int k = 0; k < 24; k++)
				{
					GlobalSparksDoer.DoSingleParticle(Vector2.op_Implicit(((BraveBehaviour)pickupObject).sprite.WorldCenter), Vector2.op_Implicit(Toolbox.GetUnitOnCircle(15 * k, 5.5f * Random.Range(0.8f, 1.2f))), (float?)0.2f, (float?)3f, (Color?)Color.red, (SparksType)6);
				}
				break;
			}
			}
			if ((Object)(object)((Component)pickupObject).GetComponent<DebrisObject>() != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)pickupObject).GetComponent<DebrisObject>());
			}
			if ((Object)(object)((Component)pickupObject).GetComponentInParent<DebrisObject>() != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)pickupObject).GetComponentInParent<DebrisObject>());
			}
			offsetAngleApplied2 = Mathf.Min(1463f, offsetAngleApplied2);
			DebrisObject newPickup = LootEngine.SpawnItem(((Component)PickupObjectDatabase.GetById(newID)).gameObject, Vector2.op_Implicit(v), Vector2.zero, 0f, false, false, false);
			Exploder.DoDistortionWave(v, 0.5f, 0.1f, 50f, 0.333f);
			Object.Destroy((Object)(object)((Component)pickupObject).gameObject);
			yield return null;
			p2 = ((Component)newPickup).GetComponent<SquishyBounceWiggler>();
			if (Object.op_Implicit((Object)(object)p2))
			{
				((Behaviour)p2).enabled = false;
			}
			bool b = false;
			e3 = 0f;
			while (e3 < 1f)
			{
				if (e3 > 0.375f && !b)
				{
					b = true;
					((BraveBehaviour)user).spriteAnimator.Play("select_leek_start_reverse");
				}
				e3 += Time.deltaTime * 0.5f;
				((BraveBehaviour)newPickup).transform.position = Vector2.op_Implicit(v);
				((BraveBehaviour)newPickup).transform.localRotation = Quaternion.Euler(0f, 0f, Mathf.Lerp(offsetAngleApplied2, 0f, Easing.DoLerpT(e3, Easing.Ease.OUT)));
				Transform transform3 = ((BraveBehaviour)newPickup).transform;
				transform3.position -= Vector2Extensions.ToVector3ZUp(((BraveBehaviour)newPickup).sprite.WorldCenter, 120f) - ((BraveBehaviour)newPickup).transform.position;
				((BraveBehaviour)newPickup).transform.position = Vector3Extensions.WithZ(((BraveBehaviour)newPickup).transform.position, 120f);
				SpeculativeRigidbody specRigidbody = ((BraveBehaviour)newPickup).specRigidbody;
				if (specRigidbody != null)
				{
					specRigidbody.Reinitialize();
				}
				yield return null;
			}
			if (Object.op_Implicit((Object)(object)p2))
			{
				((Behaviour)p2).enabled = true;
			}
			((BraveBehaviour)newPickup).transform.position = Vector2.op_Implicit(v);
			((PickupObject)this).CanBeDropped = true;
			user.ToggleGunRenderers(true, "Leeking");
			user.ToggleHandRenderers(true, "Leeking");
			user.ClearInputOverride("Leeking");
			((PlayerItem)this).IsCurrentlyActive = false;
		}

		private ItemQuality DetermineNewQuality(PickupObject pickupObject, ref int RollType)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			RollType = 0;
			if ((int)pickupObject.quality > 1 && Random.value < DetermineHarmonyChance(positive: false))
			{
				RollType = -1;
				return (ItemQuality)(pickupObject.quality - 1);
			}
			if ((int)pickupObject.quality < 5 && Random.value < DetermineHarmonyChance(positive: true))
			{
				RollType = 1;
				return (ItemQuality)(pickupObject.quality + 1);
			}
			return pickupObject.quality;
		}

		public float DetermineHarmonyChance(bool positive)
		{
			SetHarmonyInst();
			if ((Object)(object)mikuHarmony == (Object)null)
			{
				return 0f;
			}
			return mikuHarmony.CurrentHarmonyLevel switch
			{
				0 => positive ? 0f : 0.15f, 
				1 => positive ? 0.0125f : 0.075f, 
				2 => positive ? 0.075f : 0.025f, 
				3 => positive ? 0.125f : 0.0125f, 
				4 => positive ? 0.15f : 0f, 
				_ => 0f, 
			};
		}

		static Leek()
		{
			PickupObject byId = PickupObjectDatabase.GetById(539);
			Impact = ((Gun)((byId is Gun) ? byId : null)).DefaultModule.chargeProjectiles[0].Projectile.hitEffects.enemy;
			PickupObject byId2 = PickupObjectDatabase.GetById(539);
			ImpactSFX = ((Gun)((byId2 is Gun) ? byId2 : null)).DefaultModule.chargeProjectiles[0].Projectile.enemyImpactEventName;
		}
	}
	public class MikuMikuBeam : GunBehaviour
	{
		public class FancyTipParticles : MonoBehaviour
		{
			public float TimeBetweenParticles = 0.1f;

			private float elapsed;

			private Vector2 StoredBonePosition;

			public bool ignoreQueues;

			public float tickDelay;

			private Projectile projectile;

			private BasicBeamController basicBeamController;

			public Vector2 Velocity;

			public bool isEmber = false;

			public EmitParams emitParams;

			public FancyTipParticles()
			{
				tickDelay = 0.05f;
				ignoreQueues = true;
			}

			private void Start()
			{
				projectile = ((Component)this).GetComponent<Projectile>();
				basicBeamController = ((Component)this).GetComponent<BasicBeamController>();
			}

			private void Update()
			{
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
				DoTick();
				elapsed += BraveTime.DeltaTime;
				if (elapsed > TimeBetweenParticles)
				{
					elapsed = 0f;
					((EmitParams)(ref emitParams)).position = Vector2.op_Implicit(StoredBonePosition);
					if (((Vector2)(ref Velocity)).magnitude > 0f)
					{
						((EmitParams)(ref emitParams)).velocity = Vector2.op_Implicit(Toolbox.GetUnitOnCircle(BraveUtility.RandomAngle(), Random.Range(Velocity.x, Velocity.y)));
					}
					elapsed = 0f;
					if (isEmber)
					{
						ParticleBase.MikuBeam_2.Emit(emitParams, 1);
					}
					else
					{
						ParticleBase.Chaff_BG.Emit(emitParams, 1);
					}
				}
			}

			private void DoTick()
			{
				//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_0027: 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)
				LinkedList<BeamBone> bones = basicBeamController.m_bones;
				LinkedListNode<BeamBone> last = bones.Last;
				Vector2 bonePosition = basicBeamController.GetBonePosition(last.Value);
				StoredBonePosition = bonePosition;
			}

			public void OnDestroy()
			{
			}
		}

		public static Projectile[] BeamProjectiles;

		public static void Add()
		{
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1299: Unknown result type (might be due to invalid IL or missing references)
			//IL_12a0: Expected O, but got Unknown
			//IL_12bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_12c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_052e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0542: Unknown result type (might be due to invalid IL or missing references)
			//IL_0552: Unknown result type (might be due to invalid IL or missing references)
			//IL_060f: Unknown result type (might be due to invalid IL or missing references)
			//IL_061e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0632: Unknown result type (might be due to invalid IL or missing references)
			//IL_0646: Unknown result type (might be due to invalid IL or missing references)
			//IL_065f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0673: Unknown result type (might be due to invalid IL or missing references)
			//IL_068c: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0730: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0827: Unknown result type (might be due to invalid IL or missing references)
			//IL_082f: Unknown result type (might be due to invalid IL or missing references)
			//IL_08db: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0908: Unknown result type (might be due to invalid IL or missing references)
			//IL_090d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0921: Unknown result type (might be due to invalid IL or missing references)
			//IL_0926: Unknown result type (might be due to invalid IL or missing references)
			//IL_093f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0944: Unknown result type (might be due to invalid IL or missing references)
			//IL_0958: Unknown result type (might be due to invalid IL or missing references)
			//IL_095d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0976: Unknown result type (might be due to invalid IL or missing references)
			//IL_097b: Unknown result type (might be due to invalid IL or missing references)
			//IL_098f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0994: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a17: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a38: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b0b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b34: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b39: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b51: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b53: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b64: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b69: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c07: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c0c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c1b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c20: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c34: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c39: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c4d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c52: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c6b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c70: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c84: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c89: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ca2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ca7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cbb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cc0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d50: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dfa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e0e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e16: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e4f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e78: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e7d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e95: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e97: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ea8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ead: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fb2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fc1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fd5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fe9: Unknown result type (might be due to invalid IL or missing references)
			//IL_1002: Unknown result type (might be due to invalid IL or missing references)
			//IL_1016: Unknown result type (might be due to invalid IL or missing references)
			//IL_102f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1043: Unknown result type (might be due to invalid IL or missing references)
			//IL_10d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_112f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1137: Unknown result type (might be due to invalid IL or missing references)
			//IL_1162: Unknown result type (might be due to invalid IL or missing references)
			//IL_118b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1190: Unknown result type (might be due to invalid IL or missing references)
			//IL_11a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_11aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_11bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_11c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_1223: Unknown result type (might be due to invalid IL or missing references)
			//IL_1370: Unknown result type (might be due to invalid IL or missing references)
			//IL_1377: Expected O, but got Unknown
			//IL_13c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_13e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_1413: Unknown result type (might be due to invalid IL or missing references)
			//IL_1432: Unknown result type (might be due to invalid IL or missing references)
			//IL_1437: Unknown result type (might be due to invalid IL or missing references)
			//IL_1451: Unknown result type (might be due to invalid IL or missing references)
			Gun val = Databases.Items.NewGun("Miku (Miku) Beam!!!", "MikuMikuBeam");
			Game.Items.Rename("outdated_gun_mods:miku_(miku)_beam!!!", "miku:miku_(miku)_beam!!!");
			MikuMikuBeam mikuMikuBeam = ((Component)val).gameObject.AddComponent<MikuMikuBeam>();
			GunExt.SetShortDescription((PickupObject)(object)val, "M@gical Cure, Love Shot!");
			GunExt.SetLongDescription((PickupObject)(object)val, "Sing to your hearts content!\n\nGreatly empowered with Harmony.");
			BeamProjectiles = (Projectile[])(object)new Projectile[5];
			((Component)val).GetComponent<tk2dSpriteAnimator>().GetClipByName(val.reloadAnimation).frames[0].eventAudio = "Play_WPN_blackhole_impact_01";
			((Component)val).GetComponent<tk2dSpriteAnimator>().GetClipByName(val.reloadAnimation).frames[0].triggerEvent = true;
			GunInt.SetupSprite(val, StaticSpriteCollections.MikuItemAndGunCollection, "microphone_ammonomicon", 0, (string)null);
			val.m_sprite.Collection = StaticSpriteCollections.MikuItemAndGunCollection;
			((BraveBehaviour)val).spriteAnimator.Library = StaticSpriteCollections.ItemAndWeaponAnimation;
			((BraveBehaviour)val).sprite.SortingOrder = 1;
			val.idleAnimation = "mic_idle";
			val.shootAnimation = "mic_fire";
			val.reloadAnimation = "mic_reload";
			val.emptyAnimation = "mic_empty";
			((PickupObject)val).CanBeDropped = false;
			val.gunHandedness = (GunHandedness)2;
			val.m_defaultSpriteID = StaticSpriteCollections.MikuItemAndGunCollection.GetSpriteIdByName("microphone_idle_001");
			int num = (val.DefaultSpriteID = StaticSpriteCollections.MikuItemAndGunCollection.GetSpriteIdByName("microphone_idle_001"));
			int num2 = num;
			((BraveBehaviour)val).sprite.SetSprite(StaticSpriteCollections.MikuItemAndGunCollection, num2);
			Shader val2 = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTiltedCutoutEmissive");
			Material val3 = new Material(val2);
			val3.mainTexture = StaticSpriteCollections.ProjectileAndBeamCollection.material.mainTexture;
			val3.EnableKeyword("BRIGHTNESS_CLAMP_ON");
			val3.SetFloat("_EmissivePower", 20f);
			val3.SetFloat("_EmissiveColorPower", 5f);
			tk2dSpriteDefinition[] spriteDefinitions = StaticSpriteCollections.ProjectileAndBeamCollection.spriteDefinitions;
			foreach (tk2dSpriteDefinition val4 in spriteDefinitions)
			{
				val4.material = val3;
			}
			val.Volley.ModulesAreTiers = true;
			val.isAudioLoop = true;
			val.gunSwitchGroup = string.Empty;
			for (int j = 0; j < 5; j++)
			{
				PickupObject byId = PickupObjectDatabase.GetById(86);
				GunExt.AddProjectileModuleFrom(val, (Gun)(object)((byId is Gun) ? byId : null), true, false);
			}
			for (int k = 0; k < val.Volley.projectiles.Count; k++)
			{
				ProjectileModule val5 = val.Volley.projectiles[k];
				val5.ammoCost = 10;
				val5.shootStyle = (ShootStyle)2;
				val5.sequenceStyle = (ProjectileSequenceStyle)0;
				val5.cooldownTime = 1f;
				val5.numberOfShotsInClip = 50;
				val5.angleVariance = 0f;
				val5.ammoType = (AmmoType)2;
				EmitParams emitParams;
				switch (k)
				{
				case 0:
				{
					PickupObject byId10 = PickupObjectDatabase.GetById(86);
					Projectile val15 = Object.Instantiate<Projectile>(((Gun)((byId10 is Gun) ? byId10 : null)).DefaultModule.projectiles[0]);
					((Component)val15).gameObject.SetActive(false);
					val15.shouldRotate = true;
					((Object)val15).name = "MikuBeam_1";
					FakePrefab.MarkAsFakePrefab(((Component)val15).gameObject);
					Object.DontDestroyOnLoad((Object)(object)val15);
					BasicBeamController val16 = BeamBuilders.GenerateBeamPrefabBundle(val15, "mikubeam_tier1_impact_001", StaticSpriteCollections.ProjectileAndBeamCollection, StaticSpriteCollections.ProjectileAndBeamAnimation, "mikubeam_1_main_idle", new Vector2(4f, 4f), new Vector2(0f, 0f), "mikubeam_1_impact", (Vector2?)new Vector2(4f, 4f), (Vector2?)new Vector2(0f, 0f), "mikubeam_1_main_idle", (Vector2?)new Vector2(4f, 4f), (Vector2?)new Vector2(0f, 0f), "mikubeam_1_start_idle", (Vector2?)new Vector2(4f, 4f), (Vector2?)new Vector2(0f, 0f), false, true, "mikubeam_1_main_start", "mikubeam_1_start_start", "mikubeam_1_main_start", 0.25f, true, "mikubeam_1_main_dissipate", "mikubeam_1_start_dissipate", "mikubeam_1_main_dissipate", 0.1f);
					val15.baseData.damage = 16.66f;
					val15.baseData.force = 18f;
					val15.baseData.range = 1000f;
					val15.baseData.speed = 25f;
					((BraveBehaviour)val15).specRigidbody.CollideWithOthers = false;
					val16.boneType = (BeamBoneType)2;
					ref string startAudioEvent3 = ref val16.startAudioEvent;
					PickupObject byId11 = PickupObjectDatabase.GetById(87);
					startAudioEvent3 = ((Component)((Gun)((byId11 is Gun) ? byId11 : null)).DefaultModule.projectiles[0]).GetComponent<BasicBeamController>().startAudioEvent;
					ref string endAudioEvent3 = ref val16.endAudioEvent;
					PickupObject byId12 = PickupObjectDatabase.GetById(87);
					endAudioEvent3 = ((Component)((Gun)((byId12 is Gun) ? byId12 : null)).DefaultModule.projectiles[0]).GetComponent<BasicBeamController>().endAudioEvent;
					((BraveBehaviour)val16).projectile.baseData.damage = 16.66f;
					val16.reflections = 0;
					((BeamController)val16).IsReflectedBeam = false;
					val16.DispersalParticleSystemPrefab = ((Component)ParticleBase.MikuBeam_1).gameObject;
					val16.UsesDispersalParticles = true;
					val16.DispersalMinCoherency = 0.1f;
					val16.DispersalMaxCoherency = 0.2f;
					val16.DispersalDensity = 0.0001f;
					val16.DispersalExtraImpactFactor = 3f;
					val16.usesTelegraph = false;
					val16.collisionType = (BeamCollisionType)0;
					val16.collisionRadius = 0.25f;
					val16.TileType = (BeamTileType)0;
					val16.interpolateStretchedBones = false;
					val16.endType = (BeamEndType)0;
					((BeamController)val16).usesChargeDelay = false;
					val16.ContinueBeamArtToWall = true;
					((BraveBehaviour)val16).sprite.usesOverrideMaterial = true;
					val5.projectiles[0] = val15;
					BeamProjectiles[0] = val15;
					break;
				}
				case 1:
				{
					PickupObject byId7 = PickupObjectDatabase.GetById(86);
					Projectile val13 = Object.Instantiate<Projectile>(((Gun)((byId7 is Gun) ? byId7 : null)).DefaultModule.projectiles[0]);
					val13.shouldRotate = true;
					((Object)val13).name = "MikuBeam_2";
					((Component)val13).gameObject.SetActive(false);
					FakePrefab.MarkAsFakePrefab(((Component)val13).gameObject);
					Object.DontDestroyOnLoad((Object)(object)val13);
					BasicBeamController val14 = BeamBuilders.GenerateBeamPrefabBundle(val13, "mikubeam_tier2_impact_001", StaticSpriteCollections.ProjectileAndBeamCollection, StaticSpriteCollections.ProjectileAndBeamAnimation, "mikubeam_2_main_idle", new Vector2(8f, 8f), new Vector2(0f, 0f), "mikubeam_2_impact", (Vector2?)new Vector2(8f, 8f), (Vector2?)new Vector2(0f, 0f), "mikubeam_2_main_idle", (Vector2?)new Vector2(8f, 8f), (Vector2?)new Vector2(0f, 0f), "mikubeam_2_start_idle", (Vector2?)new Vector2(8f, 8f), (Vector2?)new Vector2(0f, 0f), false, true, "mikubeam_2_main_start", "mikubeam_2_start_start", "mikubeam_2_main_start", 0.25f, true, "mikubeam_2_main_dissipate", "mikubeam_2_start_dissipate", "mikubeam_2_main_dissipate", 0.125f);
					val13.baseData.damage = 20f;
					val13.baseData.force = 22.5f;
					val13.baseData.range = 1000f;
					val13.baseData.speed = 37.5f;
					((BraveBehaviour)val13).specRigidbody.CollideWithOthers = false;
					val14.boneType = (BeamBoneType)2;
					ref string startAudioEvent2 = ref val14.startAudioEvent;
					PickupObject byId8 = PickupObjectDatabase.GetById(40);
					startAudioEvent2 = ((Component)((Gun)((byId8 is Gun) ? byId8 : null)).DefaultModule.projectiles[0]).GetComponent<BasicBeamController>().startAudioEvent;
					ref string endAudioEvent2 = ref val14.endAudioEvent;
					PickupObject byId9 = PickupObjectDatabase.GetById(40);
					endAudioEvent2 = ((Component)((Gun)((byId9 is Gun) ? byId9 : null)).DefaultModule.projectiles[0]).GetComponent<BasicBeamController>().endAudioEvent;
					((BraveBehaviour)val14).projectile.baseData.damage = 20f;
					val14.reflections = 0;
					((BeamController)val14).IsReflectedBeam = false;
					val14.ContinueBeamArtToWall = true;
					val14.collisionType = (BeamCollisionType)0;
					val14.collisionRadius = 0.5f;
					val14.usesTelegraph = false;
					val14.DispersalParticleSystemPrefab = ((Component)ParticleBase.MikuBeam_2).gameObject;
					val14.UsesDispersalParticles = true;
					val14.DispersalMinCoherency = 0.04f;
					val14.DispersalMaxCoherency = 0.1f;
					val14.DispersalDensity = 1E-05f;
					val14.DispersalExtraImpactFactor = 3f;
					val14.TileType = (BeamTileType)0;
					val14.endType = (BeamEndType)0;
					((BraveBehaviour)val14).sprite.usesOverrideMaterial = true;
					val5.projectiles[0] = val13;
					BeamProjectiles[1] = val13;
					break;
				}
				case 2:
				{
					PickupObject byId13 = PickupObjectDatabase.GetById(86);
					Projectile val17 = Object.Instantiate<Projectile>(((Gun)((byId13 is Gun) ? byId13 : null)).DefaultModule.projectiles[0]);
					((Object)val17).name = "MikuBeam_3";
					val17.shouldRotate = true;
					((Component)val17).gameObject.SetActive(false);
					FakePrefab.MarkAsFakePrefab(((Component)val17).gameObject);
					Object.DontDestroyOnLoad((Object)(object)val17);
					BasicBeamController val18 = BeamBuilders.GenerateBeamPrefabBundle(val17, "mikubeam_tier3_impact_001", StaticSpriteCollections.ProjectileAndBeamCollection, StaticSpriteCollections.ProjectileAndBeamAnimation, "mikubeam_3_main_idle", Vector2.op_Implicit(new Vector3(10f, 10f)), Vector2.op_Implicit(new Vector3(0f, 0f)), "mikubeam_3_impact", (Vector2?)Vector2.op_Implicit(new Vector3(10f, 10f)), (Vector2?)Vector2.op_Implicit(new Vector3(0f, 0f)), "mikubeam_3_main_idle", (Vector2?)Vector2.op_Implicit(new Vector3(10f, 10f)), (Vector2?)Vector2.op_Implicit(new Vector3(0f, 0f)), "mikubeam_3_start_idle", (Vector2?)Vector2.op_Implicit(new Vector3(10f, 10f)), (Vector2?)Vector2.op_Implicit(new Vector3(0f, 0f)), false, true, "mikubeam_3_main_start", "mikubeam_3_start_start", "mikubeam_3_main_start", 0.4f, true, "mikubeam_3_main_dissipate", "mikubeam_3_start_dissipate", "mikubeam_3_main_dissipate", 0.15f);
					val17.baseData.damage = 24f;
					val17.baseData.force = 35f;
					val17.baseData.range = 1000f;
					val17.baseData.speed = 40f;
					val18.collisionType = (BeamCollisionType)0;
					val18.collisionRadius = 1f;
					((BraveBehaviour)val17).specRigidbody.CollideWithOthers = false;
					val18.boneType = (BeamBoneType)0;
					ref string startAudioEvent4 = ref val18.startAudioEvent;
					PickupObject byId14 = PickupObjectDatabase.GetById(40);
					startAudioEvent4 = ((Component)((Gun)((byId14 is Gun) ? byId14 : null)).DefaultModule.projectiles[0]).GetComponent<BasicBeamController>().startAudioEvent;
					ref string endAudioEvent4 = ref val18.endAudioEvent;
					PickupObject byId15 = PickupObjectDatabase.GetById(40);
					endAudioEvent4 = ((Component)((Gun)((byId15 is Gun) ? byId15 : null)).DefaultModule.projectiles[0]).GetComponent<BasicBeamController>().endAudioEvent;
					((BraveBehaviour)val18).projectile.baseData.damage = 24f;
					val18.reflections = 0;
					((BeamController)val18).IsReflectedBeam = false;
					val18.ContinueBeamArtToWall = true;
					((BraveBehaviour)val18).sprite.usesOverrideMaterial = true;
					val18.TileType = (BeamTileType)0;
					val18.endType = (BeamEndType)0;
					FancyTipParticles fancyTipParticles3 = ((Component)val18).gameObject.AddComponent<FancyTipParticles>();
					fancyTipParticles3.isEmber = false;
					fancyTipParticles3.TimeBetweenParticles = 0.02f;
					emitParams = default(EmitParams);
					((EmitParams)(ref emitParams)).startLifetime = 1f;
					((EmitParams)(ref emitParams)).startColor = Color32.op_Implicit(new Color(0f, 0.9f, 0.9f, 1f));
					((EmitParams)(ref emitParams)).startSize = 0.1f;
					fancyTipParticles3.emitParams = emitParams;
					fancyTipParticles3.Velocity = new Vector2(0.75f, 1.25f);
					val5.projectiles[0] = val17;
					BeamProjectiles[2] = val17;
					break;
				}
				case 3:
				{
					PickupObject byId4 = PickupObjectDatabase.GetById(86);
					Projectile val9 = Object.Instantiate<Projectile>(((Gun)((byId4 is Gun) ? byId4 : null)).DefaultModule.projectiles[0]);
					((Object)val9).name = "MikuBeam_4";
					val9.shouldRotate = true;
					((Component)val9).gameObject.SetActive(false);
					FakePrefab.MarkAsFakePrefab(((Component)val9).gameObject);
					Object.DontDestroyOnLoad((Object)(object)val9);
					BasicBeamController val10 = BeamBuilders.GenerateBeamPrefabBundle(val9, "mikubeam_tier4_impact_001", StaticSpriteCollections.ProjectileAndBeamCollection, StaticSpriteCollections.ProjectileAndBeamAnimation, "mikubeam_4_main_idle", Vector4.op_Implicit(new Vector4(18f, 12f)), Vector4.op_Implicit(new Vector4(0f, 3f)), "mikubeam_4_impact", (Vector2?)Vector4.op_Implicit(new Vector4(18f, 12f)), (Vector2?)Vector4.op_Implicit(new Vector4(0f, 3f)), "mikubeam_4_main_idle", (Vector2?)Vector4.op_Implicit(new Vector4(18f, 12f)), (Vector2?)Vector4.op_Implicit(new Vector4(0f, 3f)), "mikubeam_4_start_idle", (Vector2?)Vector4.op_Implicit(new Vector4(18f, 12f)), (Vector2?)Vector4.op_Implicit(new Vector4(0f, 3f)), false, true, "mikubeam_4_main_start", "mikubeam_4_start_start", "mikubeam_4_main_start", 0.55f, true, "mikubeam_4_main_dissipate", "mikubeam_4_start_dissipate", "mikubeam_4_main_dissipate", 0.2f);
					val9.baseData.damage = 30f;
					val9.baseData.force = 55f;
					val9.baseData.range = 1000f;
					val9.baseData.speed = 40f;
					((BraveBehaviour)val9).specRigidbody.CollideWithOthers = false;
					val10.boneType = (BeamBoneType)0;
					ref string startAudioEvent = ref val10.startAudioEvent;
					PickupObject byId5 = PickupObjectDatabase.GetById(40);
					startAudioEvent = ((Component)((Gun)((byId5 is Gun) ? byId5 : null)).DefaultModule.projectiles[0]).GetComponent<BasicBeamController>().startAudioEvent;
					ref string endAudioEvent = ref val10.endAudioEvent;
					PickupObject byId6 = PickupObjectDatabase.GetById(40);
					endAudioEvent = ((Component)((Gun)((byId6 is Gun) ? byId6 : null)).DefaultModule.projectiles[0]).GetComponent<BasicBeamController>().endAudioEvent;
					((BraveBehaviour)val10).projectile.baseData.damage = 30f;
					val10.reflections = 0;
					((BeamController)val10).IsReflectedBeam = false;
					val10.ContinueBeamArtToWall = true;
					val10.startAudioEvent = "Play_ENM_deathray_shot_01";
					val10.endAudioEvent = "Stop_ENM_deathray_loop_01";
					val10.collisionType = (BeamCollisionType)0;
					val10.collisionRadius = 1.25f;
					val10.TileType = (BeamTileType)0;
					val10.endType = (BeamEndType)0;
					((BraveBehaviour)val10).sprite.usesOverrideMaterial = true;
					FancyTipParticles fancyTipParticles2 = ((Component)val10).gameObject.AddComponent<FancyTipParticles>();
					fancyTipParticles2.isEmber = false;
					fancyTipParticles2.TimeBetweenParticles = 0.02f;
					emitParams = default(EmitParams);
					((EmitParams)(ref emitParams)).startLifetime = 0.75f;
					((EmitParams)(ref emitParams)).startColor = Color32.op_Implicit(new Color(0f, 0.6f, 0.9f, 1f));
					((EmitParams)(ref emitParams)).startSize = 0.2f;
					fancyTipParticles2.emitParams = emitParams;
					fancyTipParticles2.Velocity = new Vector2(2.5f, 3.25f);
					AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid("b98b10fca77d469e80fb45f3c5badec5");
					Component[] componentsInChildren = ((Component)orLoadByGuid).GetComponentsInChildren(typeof(Component));
					foreach (Component val11 in componentsInChildren)
					{
						BossFinalRogueLaserGun val12 = (BossFinalRogueLaserGun)(object)((val11 is BossFinalRogueLaserGun) ? val11 : null);
						if (val12 != null && Object.op_Implicit((Object)(object)val12.beamProjectile))
						{
							break;
						}
					}
					val5.projectiles[0] = val9;
					BeamProjectiles[3] = val9;
					break;
				}
				case 4:
				{
					PickupObject byId2 = PickupObjectDatabase.GetById(86);
					Projectile val6 = Object.Instantiate<Projectile>(((Gun)((byId2 is Gun) ? byId2 : null)).DefaultModule.projectiles[0]);
					((Component)val6).gameObject.SetActive(false);
					val6.shouldRotate = true;
					((Object)val6).name = "MikuBeam_5";
					FakePrefab.MarkAsFakePrefab(((Component)val6).gameObject);
					Object.DontDestroyOnLoad((Object)(object)val6);
					BasicBeamController val7 = BeamBuilders.GenerateBeamPrefabBundle(val6, "mikubeam_tier5_impact_001", StaticSpriteCollections.ProjectileAndBeamCollection, StaticSpriteCollections.ProjectileAndBeamAnimation, "mikubeam_5_main_idle", new Vector2(28f, 20f), new Vector2(0f, 4f), "mikubeam_5_impact", (Vector2?)new Vector2(28f, 20f), (Vector2?)new Vector2(0f, 4f), "mikubeam_5_main_idle", (Vector2?)new Vector2(28f, 20f), (Vector2?)new Vector2(0f, 4f), "mikubeam_5_start_idle", (Vector2?)new Vector2(28f, 20f), (Vector2?)new Vector2(0f, 4f), false, true, "mikubeam_5_main_start", "mikubeam_5_start_start", "mikubeam_5_main_start", 1.33f, true, "mikubeam_5_main_dissipate", "mikubeam_5_start_dissipate", "mikubeam_5_main_dissipate", 0.2f);
					val6.baseData.damage = 45f;
					val6.baseData.force = 90f;
					val6.baseData.range = 1000f;
					val6.baseData.speed = 40f;
					((BraveBehaviour)val6).specRigidbody.CollideWithOthers = false;
					val7.boneType = (BeamBoneType)0;
					((BraveBehaviour)val7).projectile.baseData.damage = 45f;
					((BraveBehaviour)val7).projectile.baseData.force = 90f;
					val7.reflections = 0;
					((BeamController)val7).IsReflectedBeam = false;
					val7.ContinueBeamArtToWall = true;
					((BraveBehaviour)val7).sprite.usesOverrideMaterial = true;
					val7.TileType = (BeamTileType)0;
					val7.endType = (BeamEndType)0;
					FancyTipParticles fancyTipParticles = ((Component)val7).gameObject.AddComponent<FancyTipParticles>();
					fancyTipParticles.isEmber = false;
					fancyTipParticles.TimeBetweenParticles = 0.01666f;
					emitParams = default(EmitParams);
					((EmitParams)(ref emitParams)).startLifetime = 0.625f;
					((EmitParams)(ref emitParams)).startColor = Color32.op_Implicit(new Color(0f, 1f, 1f, 1f));
					((EmitParams)(ref emitParams)).startSize = 0.5f;
					fancyTipParticles.emitParams = emitParams;
					fancyTipParticles.Velocity = new Vector2(4.5f, 6.75f);
					PickupObject byId3 = PickupObjectDatabase.GetById(519);
					CombineEvaporateEffect component = ((Component)((Gun)((byId3 is Gun) ? byId3 : null)).alternateVolley.projectiles[0].projectiles[0]).GetComponent<CombineEvaporateEffect>();
					CombineEvaporateEffect val8 = ((Component)val7).gameObject.AddComponent<CombineEvaporateEffect>();
					val8.ParticleSystemToSpawn = component.ParticleSystemToSpawn;
					val8.FallbackShader = component.FallbackShader;
					val7.collisionType = (BeamCollisionType)0;
					val7.collisionRadius = 1.66f;
					BeamProjectiles[4] = val6;
					val5.projectiles[0] = val6;
					break;
				}
				}
			}
			((BraveBehaviour)val).sprite.usesOverrideMaterial = true;
			Material val19 = new Material(((BraveBehaviour)((BraveBehaviour)EnemyDatabase.GetOrLoadByName("GunNut")).sprite).renderer.material);
			val19.SetColor("_EmissiveColor", Color32.op_Implicit(new Color32(byte.MaxValue, (byte)225, byte.MaxValue, byte.MaxValue)));
			val19.SetFloat("_EmissiveColorPower", 1.55f);
			val19.SetFloat("_EmissivePower", 100f);
			val19.SetFloat("_EmissiveThresholdSensitivity", 0.2f);
			MeshRenderer component2 = ((Component)val).GetComponent<MeshRenderer>();
			if (!Object.op_Implicit((Object)(object)component2))
			{
				return;
			}
			Material[] array = ((Renderer)component2).sharedMaterials;
			for (int m = 0; m < array.Length; m++)
			{
				if ((Object)(object)array[m].shader == (Object)(object)val19)
				{
					return;
				}
			}
			Array.Resize(ref array, array.Length + 1);
			Material val20 = new Material(val19);
			val20.SetTexture("_MainTex", array[0].GetTexture("_MainTex"));
			array[^1] = val20;
			((Renderer)component2).sharedMaterials = array;
			val.doesScreenShake = false;
			val.InfiniteAmmo = true;
			val.reloadTime = 1.3f;
			val.muzzleFlashEffects.type = (VFXPoolType)0;
			((Component)val.barrelOffset).transform.localPosition = new Vector3(1.125f, 0.5f, 0f);
			val.SetBaseMaxAmmo(360);
			val.ammo = 360;
			val.PreventNormalFireAudio = true;
			val.gunClass = (GunClass)20;
			ref string gunSwitchGroup = ref val.gunSwitchGroup;
			PickupObject byId16 = PickupObjectDatabase.GetById(87);
			gunSwitchGroup = ((Gun)((byId16 is Gun) ? byId16 : null)).gunSwitchGroup;
			val.carryPixelOffset = new IntVector2(3, 0);
			Databases.Items.Add((PickupObject)(object)val, false, "ANY");
			((PickupObject)val).quality = (ItemQuality)(-50);
		}

		public void ToggleInfinityClip(bool value)
		{
			if (value)
			{
				base.gun.ForceImmediateReload(true);
			}
			for (int i = 0; i < base.gun.Volley.projectiles.Count; i++)
			{
				int num = (base.gun.Volley.projectiles[i].ammoCost = ((!value) ? 10 : 0));
			}
		}

		public void OnTierSwitched(int Tier)
		{
			if (base.gun.IsFiring)
			{
				base.gun.CeaseAttack(false, (ProjectileData)null);
			}
			base.gun.ForceImmediateReload(true);
			switch (Tier)
			{
			case 0:
			{
				base.gun.CurrentStrengthTier = 0;
				ref string gunSwitchGroup5 = ref base.gun.gunSwitchGroup;
				PickupObject byId5 = PickupObjectDatabase.GetById(87);
				gunSwitchGroup5 = ((Gun)((byId5 is Gun) ? byId5 : null)).gunSwitchGroup;
				base.gun.m_hasReinitializedAudioSwitch = false;
				break;
			}
			case 1:
			{
				base.gun.CurrentStrengthTier = 1;
				ref string gunSwitchGroup4 = ref base.gun.gunSwitchGroup;
				PickupObject byId4 = PickupObjectDatabase.GetById(40);
				gunSwitchGroup4 = ((Gun)((byId4 is Gun) ? byId4 : null)).gunSwitchGroup;
				base.gun.m_hasReinitializedAudioSwitch = false;
				break;
			}
			case 2:
			{
				base.gun.CurrentStrengthTier = 2;
				ref string gunSwitchGroup3 = ref base.gun.gunSwitchGroup;
				PickupObject byId3 = PickupObjectDatabase.GetById(179);
				gunSwitchGroup3 = ((Gun)((byId3 is Gun) ? byId3 : null)).gunSwitchGroup;
				base.gun.m_hasReinitializedAudioSwitch = false;
				break;
			}
			case 3:
			{
				base.gun.CurrentStrengthTier = 3;
				ref string gunSwitchGroup2 = ref base.gun.gunSwitchGroup;
				PickupObject byId2 = PickupObjectDatabase.GetById(328);
				gunSwitchGroup2 = ((Gun)((byId2 is Gun) ? byId2 : null)).gunSwitchGroup;
				base.gun.m_hasReinitializedAudioSwitch = false;
				break;
			}
			case 4:
			{
				base.gun.CurrentStrengthTier = 4;
				ref string gunSwitchGroup = ref base.gun.gunSwitchGroup;
				PickupObject byId = PickupObjectDatabase.GetById(518);
				gunSwitchGroup = ((Gun)((byId is Gun) ? byId : null)).gunSwitchGroup;
				base.gun.m_hasReinitializedAudioSwitch = false;
				break;
			}
			}
		}

		public override void OnReloadPressed(PlayerController player, Gun gun, bool bSOMETHING)
		{
			if (gun.IsFiring)
			{
				gun.CeaseAttack(false, (ProjectileData)null);
			}
			if (gun.IsReloading)
			{
				gun.CeaseAttack(false, (ProjectileData)null);
				AkSoundEngine.PostEvent("Stop_WPN_All", ((Component)this).gameObject);
				((GunBehaviour)this).OnReloadPressed(player, gun, bSOMETHING);
			}
		}

		public override void Update()
		{
			((GunBehaviour)this).Update();
			base.gun.ammo = 360;
			if (base.gun.ClipShotsRemaining <= 0 && base.gun.IsFiring)
			{
				base.gun.CeaseAttack(false, (ProjectileData)null);
			}
		}
	}
	public class ParticleBase : MonoBehaviour
	{
		public static ParticleSystem ParticleSystem_Note_1;

		public static ParticleSystem ParticleSystem_Note_2;

		public static ParticleSystem ParticleSystem_Note_3;

		public static ParticleSystem ParticleSystem_Note_4;

		public static ParticleSystem ParticleSystem_Note_1_Noiseless;

		public static ParticleSystem ParticleSystem_Note_2_Noiseless;

		public static ParticleSystem ParticleSystem_Note_3_Noiseless;

		public static ParticleSystem ParticleSystem_Note_4_Noiseless;

		public static ParticleSystem MikuBeam_1;

		public static ParticleSystem MikuBeam_2;

		public static ParticleSystem MikuBeam_3;

		public static ParticleSystem MikuBeam_4;

		public static ParticleSystem MikuBeam_5;

		public static ParticleSystem Ember_BG;

		public static ParticleSystem Chaff_BG;

		public static void Init()
		{
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystem_Note_1 = Object.Instantiate<GameObject>(StaticSpriteCollections.MikuBundle.LoadAsset<GameObject>("MusicNoteSystem1")).GetComponent<ParticleSystem>();
			ParticleSystem_Note_2 = Object.Instantiate<GameObject>(StaticSpriteCollections.MikuBundle.LoadAsset<GameObject>("MusicNoteSystem2")).GetComponent<ParticleSystem>();
			ParticleSystem_Note_3 = Object.Instantiate<GameObject>(StaticSpriteCollections.MikuBundle.LoadAsset<GameObject>("MusicNoteSystem3")).GetComponent<ParticleSystem>();
			ParticleSystem_Note_4 = Object.Instantiate<GameObject>(StaticSpriteCollections.MikuBundle.LoadAsset<GameObject>("MusicNoteSystem4")).GetComponent<ParticleSystem>();
			ParticleSystem_Note_1_Noiseless = Object.Instantiate<GameObject>(StaticSpriteCollections.MikuBundle.LoadAsset<GameObject>("MusicNoteSystem1_Noiseless")).GetComponent<ParticleSystem>();
			ParticleSystem_Note_2_Noiseless = Object.Instantiate<GameObject>(StaticSpriteCollections.MikuBundle.LoadAsset<GameObject>("MusicNoteSystem2_Noiseless")).GetComponent<ParticleSystem>();
			ParticleSystem_Note_3_Noiseless = Object.Instantiate<GameObject>(StaticSpriteCollections.MikuBundle.LoadAsset<GameObject>("MusicNoteSystem3_Noiseless")).GetComponent<ParticleSystem>();
			ParticleSystem_Note_4_Noiseless = Object.Instantiate<GameObject>(StaticSpriteCollections.MikuBundle.LoadAsset<GameObject>("MusicNoteSystem4_Noiseless")).GetComponent<ParticleSystem>();
			MikuBeam_1 = Object.Instantiate<GameObject>(StaticSpriteCollections.MikuBundle.LoadAsset<GameObject>("MikuBeamParticle_1")).GetComponent<ParticleSystem>();
			MikuBeam_2 = Object.Instantiate<GameObject>(StaticSpriteCollections.MikuBundle.LoadAsset<GameObject>("MikuBeamParticle_2")).GetComponent<ParticleSystem>();
			MikuBeam_3 = Object.Instantiate<GameObject>(StaticSpriteCollections.MikuBundle.LoadAsset<GameObject>("MikuBeamParticle_3")).GetComponent<ParticleSystem>();
			MikuBeam_4 = Object.Instantiate<GameObject>(StaticSpriteCollections.MikuBundle.LoadAsset<GameObject>("MikuBeamParticle_4")).GetComponent<ParticleSystem>();
			MikuBeam_5 = Object.Instantiate<GameObject>(StaticSpriteCollections.MikuBundle.LoadAsset<GameObject>("MikuBeamParticle_5")).GetComponent<ParticleSystem>();
			Object.DontDestroyOnLoad((Object)(object)ParticleSystem_Note_1);
			Object.DontDestroyOnLoad((Object)(object)ParticleSystem_Note_2);
			Object.DontDestroyOnLoad((Object)(object)ParticleSystem_Note_3);
			Object.DontDestroyOnLoad((Object)(object)ParticleSystem_Note_4);
			Object.DontDestroyOnLoad((Object)(object)ParticleSystem_Note_1_Noiseless);
			Object.DontDestroyOnLoad((Object)(object)ParticleSystem_Note_2_Noiseless);
			Object.DontDestroyOnLoad((Object)(object)ParticleSystem_Note_3_Noiseless);
			Object.DontDestroyOnLoad((Object)(object)ParticleSystem_Note_4_Noiseless);
			Object.DontDestroyOnLoad((Object)(object)MikuBeam_1);
			Object.DontDestroyOnLoad((Object)(object)MikuBeam_2);
			Object.DontDestroyOnLoad((Object)(object)MikuBeam_3);
			Object.DontDestroyOnLoad((Object)(object)MikuBeam_4);
			Object.DontDestroyOnLoad((Object)(object)MikuBeam_5);
			Object obj = Object.Instantiate(ResourceCache.Acquire("Global VFX/EmberSystem"), Vector3.zero, Quaternion.identity);
			Ember_BG = ((GameObject)((obj is GameObject) ? obj : null)).GetComponent<ParticleSystem>();
			Object obj2 = Object.Instantiate(ResourceCache.Acquire("Global VFX/ChaffSystem"), Vector3.zero, Quaternion.identity);
			Chaff_BG = ((GameObject)((obj2 is GameObject) ? obj2 : null)).GetComponent<ParticleSystem>();
			Object.DontDestroyOnLoad((Object)(object)Ember_BG);
			Object.DontDestroyOnLoad((Object)(object)Chaff_BG);
		}

		public static void EmitParticle(Vector2 Position, int Level)
		{
			//IL_0048: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystem val = ParticleSystem_Note_1;
			switch (Level)
			{
			case 1:
				val = ParticleSystem_Note_1;
				break;
			case 2:
				val = ParticleSystem_Note_2;
				break;
			case 3:
				val = ParticleSystem_Note_3;
				break;
			case 4:
				val = ParticleSystem_Note_4;
				break;
			}
			ParticleSystem obj = val;
			EmitParams val2 = default(EmitParams);
			((EmitParams)(ref val2)).position = Vector2.op_Implicit(Position);
			obj.Emit(val2, 1);
		}

		public static void EmitNoiselessParticle(Vector2 Position, int Level, float Speed, float Angle, float Lifetime)
		{
			//IL_0048: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystem val = ParticleSystem_Note_1;
			switch (Level)
			{
			case 1:
				val = ParticleSystem_Note_1_Noiseless;
				break;
			case 2:
				val = ParticleSystem_Note_2_Noiseless;
				break;
			case 3:
				val = ParticleSystem_Note_3_Noiseless;
				break;
			case 4:
				val = ParticleSystem_Note_4_Noiseless;
				break;
			}
			ParticleSystem obj = val;
			EmitParams val2 = default(EmitParams);
			((EmitParams)(ref val2)).position = Vector2.op_Implicit(Position);
			((EmitParams)(ref val2)).velocity = Vector2.op_Implicit(Toolbox.GetUnitOnCircle(Angle, Speed));
			((EmitParams)(ref val2)).startLifetime = Lifetime;
			obj.Emit(val2, 1);
		}
	}
	public class MikuHarmony : PassiveItem
	{
		public static ProjectileModule[] MikuPolarisModules;

		private static int itemID;

		public static tk2dSpriteAnimator TextDisplay;

		public int CurrentHarmonyLevel = 0;

		public int Kills;

		public List<tk2dSpriteAnimator> currentEffectsActive = new List<tk2dSpriteAnimator>();

		private StatModifier CoolnessMod;

		private StatModifier AccuracyMod;

		private StatModifier ReloadSpeedMod;

		private StatModifier ChargeSpeedMod;

		public static string[] BlackList = new string[3]
		{
			EnemyGUIDs.Blobulin_GUID,
			EnemyGUIDs.Poisbulin_GUID,
			EnemyGUIDs.Large_Spent_GUID
		};

		public Action<MikuHarmony> OnlevelUp;

		public float durationBetweenNotes = -1f;

		private float E_Note;

		public static void Init()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_0050: 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_00b1: Expected O, but got Unknown
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			string text = "Musical Harmony";
			GameObject val = new GameObject(text);
			MikuHarmony mikuHarmony = val.AddComponent<MikuHarmony>();
			tk2dSpriteCollectionData mikuItemAndGunCollection = StaticSpriteCollections.MikuItemAndGunCollection;
			ItemBuilder.AddSpriteToObjectAssetbundle(text, mikuItemAndGunCollection.GetSpriteIdByName("mikupassive"), mikuItemAndGunCollection, val);
			string text2 = "The Power Of Music";
			string text3 = "Empowers your abilities with Harmony!\n\nHarmony is increased through enough kills, granting stat boosts and other benefits to your starting gear, and is decreased when hurt.\n\nKeep it up!";
			ItemBuilder.SetupItem((PickupObject)(object)mikuHarmony, text2, text3, "miku");
			((PickupObject)mikuHarmony).quality = (ItemQuality)(-50);
			((PickupObject)mikuHarmony).CanBeDropped = false;
			GameObject val2 = PrefabBuilder.BuildObject("TextDisplay");
			tk2dSprite val3 = val2.gameObject.AddComponent<tk2dSprite>();
			((tk2dBaseSprite)val3).SetSprite(StaticSpriteCollections.MikuItemAndGunCollection, "TIER_001");
			tk2dSpriteAnimator val4 = val2.gameObject.AddComponent<tk2dSpriteAnimator>();
			((BraveBehaviour)val3).renderer.material = new Material(ShaderCache.Acquire("Sprites/Default"));
			TextDisplay = val4;
			val4.library = StaticSpriteCollections.ItemAndWeaponAnimation;
			CustomSynergies.Add("Auditory Attenuation", new List<string> { "miku:musical_harmony" }, new List<string> { "metronome" }, false);
			CustomSynergies.Add("Stunning Performance", new List<string> { "miku:musical_harmony" }, new List<string> { "aged_bell" }, false);
			CustomSynergies.Add("War Horn", new List<string> { "miku:musical_harmony" }, new List<string> { "charm_horn" }, false);
			CustomSynergies.Add("Stars Alike, Shine Bright", new List<string> { "miku:musical_harmony" }, new List<string> { "stuffed_star" }, false);
			CustomSynergies.Add("You're Gonna Need A Bigger Lute", new List<string> { "miku:musical_harmony" }, new List<string> { "really_special_lute" }, false);
			CustomSynergies.Add("Bringing Back The Classics", new List<string> { "miku:musical_harmony" }, new List<string> { "gunzheng" }, false);
			CustomSynergies.Add("Mechanical Love", new List<string> { "miku:musical_harmony" }, new List<string> { "face_melter" }, false);
			CustomSynergies.Add("Star Example", new List<string> { "miku:musical_harmony" }, new List<string> { "polaris" }, false);
			CustomSynergies.Add("Rise To Stardom", new List<string> { "miku:musical_harmony" }, new List<string> { "master_round_1", "master_round_2", "master_round_3", "master_round_4", "master_round_5" }, false);
			ItemsCore.AddChangeSpawnItem((Func<PickupObject, GameObject>)ReturnObj);
			itemID = ((PickupObject)mikuHarmony).PickupObjectId;
			new Hook((MethodBase)typeof(TemporaryInvulnerabilityPlayerItem).GetMethod("HandleDuration", BindingFlags.Instance | BindingFlags.NonPublic), typeof(MikuHarmony).GetMethod("HandleDuration", BindingFlags.Static | BindingFlags.Public));
			PickupObject byId = PickupObjectDatabase.GetById(506);
			LuteUpTheNight luteUpTheNight = ((Component)((byId is Gun) ? byId : null)).gameObject.AddComponent<LuteUpTheNight>();
			luteUpTheNight.AuraRadius = 3.5f;
			luteUpTheNight.CharmEffect = ((Component)PickupObjectDatabase.GetById(527)).GetComponent<BulletStatusEffectItem>().CharmModifierEffect;
			PickupObject byId2 = PickupObjectDatabase.GetById(482);
			((Component)((byId2 is Gun) ? byId2 : null)).gameObject.AddComponent<GunzhengTuah>();
			PickupObject byId3 = PickupObjectDatabase.GetById(149);
			((Component)((byId3 is Gun) ? byId3 : null)).gameObject.AddComponent<FaceMelterLaser>();
			MikuPolarisModules = (ProjectileModule[])(object)new ProjectileModule[4];
			InitNewPolarisModule1();
			InitNewPolarisModule2();
			InitNewPolarisModule3();
			InitNewPolarisModule4();
			PickupObject byId4 = PickupObjectDatabase.GetById(97);
			GunExt.AddProjectileModule((Gun)(object)((byId4 is Gun) ? byId4 : null), MikuPolarisModules[0]);
			PickupObject byId5 = PickupObjectDatabase.GetById(97);
			GunExt.AddProjectileModule((Gun)(object)((byId5 is Gun) ? byId5 : null), MikuPolarisModules[1]);
			PickupObject byId6 = PickupObjectDatabase.GetById(718);
			GunExt.AddProjectileModule((Gun)(object)((byId6 is Gun) ? byId6 : null), MikuPolarisModules[2]);
			PickupObject byId7 = PickupObjectDatabase.GetById(718);
			GunExt.AddProjectileModule((Gun)(object)((byId7 is Gun) ? byId7 : null), MikuPolarisModules[3]);
		}

		public static void InitNewPolarisModule1()
		{
			//IL_0115: 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)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: 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_0159: 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_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Expected O, but got Unknown
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Expected O, but got Unknown
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			PickupObject byId = PickupObjectDatabase.GetById(97);
			ProjectileModule defaultModule = ((Gun)((byId is Gun) ? byId : null)).DefaultModule;
			ProjectileModule val = ProjectileModule.CreateClone(defaultModule, false, -1);
			val.chargeProjectiles = new List<ChargeProjectile>(defaultModule.chargeProjectiles);
			val.projectiles = new List<Projectile>(defaultModule.projectiles);
			PickupObject byId2 = PickupObjectDatabase.GetById(97);
			Projectile val2 = Object.Instantiate<Projectile>(((Gun)((byId2 is Gun) ? byId2 : null)).DefaultModule.projectiles[0]);
			((Component)val2).gameObject.SetActive(false);
			FakePrefab.MarkAsFakePrefab(((Component)val2).gameObject);
			Object.DontDestroyOnLoad((Object)(object)val2);
			val2.baseData.damage = 27f;
			val2.baseData.speed = 55f;
			val2.baseData.force = 60f;
			val2.shouldRotate = true;
			val2.pierceMinorBreakables = true;
			ProjectileBuilders.SetProjectileCollisionRight(val2, "mikuStar_001", StaticSpriteCollections.ProjectileAndBeamCollection, 22, 15, false, (Anchor)4, (int?)22, (int?)15, true, false, (int?)1, (int?)3, (Projectile)null);
			GameObject val3 = ETGMod.AddChild(((Component)val2).gameObject, "trail object", new Type[0]);
			val3.transform.position = Vector2.op_Implicit(((BraveBehaviour)val2).sprite.WorldTopLeft + new Vector2(0.25f, -0.25f));
			val3.transform.localPosition = Vector2.op_Implicit(((BraveBehaviour)val2).sprite.WorldTopLeft + new Vector2(0.25f, -0.25f));
			TrailRenderer val4 = val3.AddComponent<TrailRenderer>();
			((Renderer)val4).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)val4).receiveShadows = false;
			Material val6 = (((Renderer)val4).material = new Material(Shader.Find("Sprites/Default")));
			val4.minVertexDistance = 0.01f;
			val4.numCapVertices = 640;
			Color val7 = default(Color);
			((Color)(ref val7))..ctor(0f, 2f, 2f, 2f);
			val6.SetColor("_Color", val7);
			val4.startColor = val7;
			val4.endColor = new Color(0f, 1f, 1f, 0.5f);
			val4.time = 0.25f;
			val4.startWidth = 0.1875f;
			val4.endWidth = 0f;
			val4.autodestruct = false;
			ProjectileTrailRendererController val8 = ((Component)val2).gameObject.AddComponent<ProjectileTrailRendererController>();
			val8.trailRenderer = val4;
			val8.desiredLength = 6f;
			GameObject val9 = ETGMod.AddChild(((Component)val2).gameObject, "trail object", new Type[0]);
			val9.transform.position = Vector2.op_Implicit(((BraveBehaviour)val2).sprite.WorldBottomLeft + new Vector2(0.25f, 0.25f));
			val9.transform.localPosition = Vector2.op_Implicit(((BraveBehaviour)val2).sprite.WorldBottomLeft + new Vector2(0.25f, 0.25f));
			TrailRenderer val10 = val9.AddComponent<TrailRenderer>();
			((Renderer)val10).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)val10).receiveShadows = false;
			Material val12 = (((Renderer)val10).material = new Material(Shader.Find("Sprites/Default")));
			val10.minVertexDistance = 0.01f;
			val10.numCapVertices = 640;
			val12.SetColor("_Color", val7);
			val10.startColor = val7;
			val10.endColor = new Color(0.8f, 1f, 1f, 0f);
			val10.time = 0.25f;
			val10.startWidth = 0.1875f;
			val10.endWidth = 0f;
			val10.autodestruct = false;
			ProjectileTrailRendererController val13 = ((Component)val2).gameObject.AddComponent<ProjectileTrailRendererController>();
			val13.trailRenderer = val10;
			val13.desiredLength = 6f;
			val.projectiles[0] = val2;
			MikuPolarisModules[0] = val;
		}

		public static void InitNewPolarisModule2()
		{
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Expected O, but got Unknown
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: 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_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Expected O, but got Unknown
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0413: Unknown result type (might be due to invalid IL or missing references)
			//IL_0422: Unknown result type (might be due to invalid IL or missing references)
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_045c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0463: Expected O, but got Unknown
			//IL_048e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0498: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
			PickupObject byId = PickupObjectDatabase.GetById(97);
			ProjectileModule defaultModule = ((Gun)((byId is Gun) ? byId : null)).DefaultModule;
			ProjectileModule val = ProjectileModule.CreateClone(defaultModule, false, -1);
			val.chargeProjectiles = new List<ChargeProjectile>(defaultModule.chargeProjectiles);
			val.projectiles = new List<Projectile>(defaultModule.projectiles);
			PickupObject byId2 = PickupObjectDatabase.GetById(97);
			Projectile val2 = Object.Instantiate<Projectile>(((Gun)((byId2 is Gun) ? byId2 : null)).DefaultModule.projectiles[0]);
			((Component)val2).gameObject.SetActive(false);
			FakePrefab.MarkAsFakePrefab(((Component)val2).gameObject);
			Object.DontDestroyOnLoad((Object)(object)val2);
			val2.baseData.damage = 32f;
			val2.baseData.speed = 65f;
			val2.baseData.force = 100f;
			val2.shouldRotate = true;
			val2.pierceMinorBreakables = true;
			ProjectileBuilders.SetProjectileCollisionRight(val2, "mikuStar_002", StaticSpriteCollections.ProjectileAndBeamCollection, 28, 19, false, (Anchor)4, (int?)28, (int?)19, true, false, (int?)null, (int?)null, (Projectile)null);
			GameObject val3 = ETGMod.AddChild(((Component)val2).gameObject, "trail object", new Type[0]);
			val3.transform.position = Vector2.op_Implicit(((BraveBehaviour)val2).sprite.WorldTopLeft - new Vector2(0.25f, 0.25f));
			val3.transform.localPosition = Vector2.op_Implicit(((BraveBehaviour)val2).sprite.WorldTopLeft - new Vector2(0.25f, 0.25f));
			TrailRenderer val4 = val3.AddComponent<TrailRenderer>();
			((Renderer)val4).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)val4).receiveShadows = false;
			Material val6 = (((Renderer)val4).material = new Material(Shader.Find("Sprites/Default")));
			val4.minVertexDistance = 0.01f;
			val4.numCapVertices = 640;
			Color val7 = default(Color);
			((Color)(ref val7))..ctor(0f, 2f, 2f, 2f);
			val6.SetColor("_Color", val7);
			val4.startColor = val7;
			val4.endColor = new Color(0f, 1f, 1f, 0.5f);
			val4.time = 0.25f;
			val4.startWidth = 0.1875f;
			val4.endWidth = 0f;
			val4.autodestruct = false;
			ProjectileTrailRendererController val8 = ((Component)val2).gameObject.AddComponent<ProjectileTrailRendererController>();
			val8.trailRenderer = val4;
			val8.desiredLength = 6f;
			GameObject val9 = ETGMod.AddChild(((Component)val2).gameObject, "trail object", new Type[0]);
			val9.transform.position = Vector2.op_Implicit(((BraveBehaviour)val2).sprite.WorldBottomLeft + new Vector2(0.25f, 0.25f));
			val9.transform.localPosition = Vector2.op_Implicit(((BraveBehaviour)val2).sprite.WorldBottomLeft + new Vector2(0.25f, 0.25f));
			TrailRenderer val10 = val9.AddComponent<TrailRenderer>();
			((Renderer)val10).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)val10).receiveShadows = false;
			Material val12 = (((Renderer)val10).material = new Material(Shader.Find("Sprites/Default")));
			val10.minVertexDistance = 0.01f;
			val10.numCapVertices = 640;
			val12.SetColor("_Color", val7);
			val10.startColor = val7;
			val10.endColor = new Color(0.8f, 1f, 1f, 0f);
			val10.time = 0.25f;
			val10.startWidth = 0.1875f;
			val10.endWidth = 0f;
			val10.autodestruct = false;
			ProjectileTrailRendererController val13 = ((Component)val2).gameObject.AddComponent<ProjectileTrailRendererController>();
			val13.trailRenderer = val10;
			val13.desiredLength = 6f;
			GameObject val14 = ETGMod.AddChild(((Component)val2).gameObject, "trail object", new Type[0]);
			val14.transform.position = Vector2.op_Implicit(((BraveBehaviour)val2).sprite.WorldCenter - new Vector2(0.5f, 0f));
			val14.transform.localPosition = Vector2.op_Implicit(((BraveBehaviour)val2).sprite.WorldCenter - new Vector2(0.5f, 0f));
			TrailRenderer val15 = val14.AddComponent<TrailRenderer>();
			((Renderer)val15).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)val15).receiveShadows = false;
			Material val17 = (((Renderer)val15).material = new Material(Shader.Find("Sprites/Default")));
			val15.minVertexDistance = 0.01f;
			val15.numCapVertices = 640;
			val17.SetColor("_Color", val7);
			val15.startColor = val7;
			val15.endColor = new Color(0.8f, 1f, 1f, 0f);
			val15.time = 0.3125f;
			val15.startWidth = 0.25f;
			val15.endWidth = 0f;
			val15.autodestruct = false;
			ProjectileTrailRendererController val18 = ((Component)val2).gameObject.AddComponent<ProjectileTrailRendererController>();
			val18.trailRenderer = val15;
			val18.desiredLength = 8f;
			PierceProjModifier orAddComponent = GameObjectExtensions.GetOrAddComponent<PierceProjModifier>(((Component)val2).gameObject);
			orAddComponent.penetration = 1;
			orAddComponent.penetratesBreakables = true;
			val.projectiles[0] = val2;
			MikuPolarisModules[1] = val;
		}

		public static void InitNewPolarisModule3()
		{
			//IL_0123: 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_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Expected O, but got Unknown
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: 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_0292: 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_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Expected O, but got Unknown
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			PickupObject byId = PickupObjectDatabase.GetById(718);
			ProjectileModule val = ((Gun)((byId is Gun) ? byId : null)).Volley.projectiles[2];
			ProjectileModule val2 = ProjectileModule.CreateClone(val, false, -1);
			val2.chargeProjectiles = new List<ChargeProjectile>(val.chargeProjectiles);
			val2.projectiles = new List<Projectile>(val.projectiles);
			PickupObject byId2 = PickupObjectDatabase.GetById(97);
			Projectile val3 = Object.Instantiate<Projectile>(((Gun)((byId2 is Gun) ? byId2 : null)).DefaultModule.projectiles[0]);
			((Component)val3).gameObject.SetActive(false);
			FakePrefab.MarkAsFakePrefab(((Component)val3).gameObject);
			Object.DontDestroyOnLoad((Object)(object)val3);
			val3.baseData.damage = 35f;
			val3.baseData.speed = 55f;
			val3.baseData.force = 60f;
			val3.shouldRotate = true;
			val3.pierceMinorBreakables = true;
			ProjectileBuilders.SetProjectileCollisionRight(val3, "mikuStar_001", StaticSpriteCollections.ProjectileAndBeamCollection, 22, 15, false, (Anchor)4, (int?)22, (int?)15, true, false, (int?)1, (int?)3, (Projectile)null);
			GameObject val4 = ETGMod.AddChild(((Component)val3).gameObject, "trail object", new Type[0]);
			val4.transform.position = Vector2.op_Implicit(((BraveBehaviour)val3).sprite.WorldTopLeft + new Vector2(0.25f, -0.25f));
			val4.transform.localPosition = Vector2.op_Implicit(((BraveBehaviour)val3).sprite.WorldTopLeft + new Vector2(0.25f, -0.25f));
			TrailRenderer val5 = val4.AddComponent<TrailRenderer>();
			((Renderer)val5).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)val5).receiveShadows = false;
			Material val7 = (((Renderer)val5).material = new Material(Shader.Find("Sprites/Default")));
			val5.minVertexDistance = 0.01f;
			val5.numCapVertices = 640;
			Color val8 = default(Color);
			((Color)(ref val8))..ctor(0f, 2f, 2f, 2f);
			val7.SetColor("_Color", val8);
			val5.startColor = val8;
			val5.endColor = new Color(0f, 1f, 1f, 0.5f);
			val5.time = 0.25f;
			val5.startWidth = 0.1875f;
			val5.endWidth = 0f;
			val5.autodestruct = false;
			ProjectileTrailRendererController val9 = ((Component)val3).gameObject.AddComponent<ProjectileTrailRendererController>();
			val9.trailRenderer = val5;
			val9.desiredLength = 6f;
			GameObject val10 = ETGMod.AddChild(((Component)val3).gameObject, "trail object", new Type[0]);
			val10.transform.position = Vector2.op_Implicit(((BraveBehaviour)val3).sprite.WorldBottomLeft + new Vector2(0.25f, 0.25f));
			val10.transform.localPosition = Vector2.op_Implicit(((BraveBehaviour)val3).sprite.WorldBottomLeft + new Vector2(0.25f, 0.25f));
			TrailRenderer val11 = val10.AddComponent<TrailRenderer>();
			((Renderer)val11).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)val11).receiveShadows = false;
			Material val13 = (((Renderer)val11).material = new Material(Shader.Find("Sprites/Default")));
			val11.minVertexDistance = 0.01f;
			val11.numCapVertices = 640;
			val13.SetColor("_Color", val8);
			val11.startColor = val8;
			val11.endColor = new Color(0.8f, 1f, 1f, 0f);
			val11.time = 0.25f;
			val11.startWidth = 0.1875f;
			val11.endWidth = 0f;
			val11.autodestruct = false;
			ProjectileTrailRendererController val14 = ((Component)val3).gameObject.AddComponent<ProjectileTrailRendererController>();
			val14.trailRenderer = val11;
			val14.desiredLength = 6f;
			val2.projectiles[0] = val3;
			MikuPolarisModules[2] = val2;
		}

		public static void InitNewPolarisModule4()
		{
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: 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_01aa: Expected O, but got Unknown
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: 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_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Expected O, but got Unknown
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: Unknown result type (might be due to invalid IL or missing references)
			//IL_0409: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_046a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0471: Expected O, but got Unknown
			//IL_049c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
			PickupObject byId = PickupObjectDatabase.GetById(718);
			ProjectileModule val = ((Gun)((byId is Gun) ? byId : null)).Volley.projectiles[2];
			ProjectileModule val2 = ProjectileModule.CreateClone(val, false, -1);
			val2.chargeProjectiles = new List<ChargeProjectile>(val.chargeProjectiles);
			val2.projectiles = new List<Projectile>(val.projectiles);
			PickupObject byId2 = PickupObjectDatabase.GetById(97);
			Projectile val3 = Object.Instantiate<Projectile>(((Gun)((byId2 is Gun) ? byId2 : null)).DefaultModule.projectiles[0]);
			((Component)val3).gameObject.SetActive(false);
			FakePrefab.MarkAsFakePrefab(((Component)val3).gameObject);
			Object.DontDestroyOnLoad((Object)(object)val3);
			val3.baseData.damage = 40f;
			val3.baseData.speed = 70f;
			val3.baseData.force = 100f;
			val3.shouldRotate = true;
			val3.pierceMinorBreakables = true;
			ProjectileBuilders.SetProjectileCollisionRight(val3, "mikuStar_002", StaticSpriteCollections.ProjectileAndBeamCollection, 28, 19, false, (Anchor)4, (int?)28, (int?)19, true, false, (int?)null, (int?)null, (Projectile)null);
			GameObject val4 = ETGMod.AddChild(((Component)val3).gameObject, "trail object", new Type[0]);
			val4.transform.position = Vector2.op_Implicit(((BraveBehaviour)val3).sprite.WorldTopLeft - new Vector2(0.25f, 0.25f));
			val4.transform.localPosition = Vector2.op_Implicit(((BraveBehaviour)val3).sprite.WorldTopLeft - new Vector2(0.25f, 0.25f));
			TrailRenderer val5 = val4.AddComponent<TrailRenderer>();
			((Renderer)val5).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)val5).receiveShadows = false;
			Material val7 = (((Renderer)val5).material = new Material(Shader.Find("Sprites/Default")));
			val5.minVertexDistance = 0.01f;
			val5.numCapVertices = 640;
			Color val8 = default(Color);
			((Color)(ref val8))..ctor(0f, 2f, 2f, 2f);
			val7.SetColor("_Color", val8);
			val5.startColor = val8;
			val5.endColor = new Color(0f, 1f, 1f, 0.5f);
			val5.time = 0.25f;
			val5.startWidth = 0.1875f;
			val5.endWidth = 0f;
			val5.autodestruct = false;
			ProjectileTrailRendererController val9 = ((Component)val3).gameObject.AddComponent<ProjectileTrailRendererController>();
			val9.trailRenderer = val5;
			val9.desiredLength = 6f;
			GameObject val10 = ETGMod.AddChild(((Component)val3).gameObject, "trail object", new Type[0]);
			val10.transform.position = Vector2.op_Implicit(((BraveBehaviour)val3).sprite.WorldBottomLeft + new Vector2(0.25f, 0.25f));
			val10.transform.localPosition = Vector2.op_Implicit(((BraveBehaviour)val3).sprite.WorldBottomLeft + new Vector2(0.25f, 0.25f));
			TrailRenderer val11 = val10.AddComponent<TrailRenderer>();
			((Renderer)val11).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)val11).receiveShadows = false;
			Material val13 = (((Renderer)val11).material = new Material(Shader.Find("Sprites/Default")));
			val11.minVertexDistance = 0.01f;
			val11.numCapVertices = 640;
			val13.SetColor("_Color", val8);
			val11.startColor = val8;
			val11.endColor = new Color(0.8f, 1f, 1f, 0f);
			val11.time = 0.25f;
			val11.startWidth = 0.1875f;
			val11.endWidth = 0f;
			val11.autodestruct = false;
			ProjectileTrailRendererController val14 = ((Component)val3).gameObject.AddComponent<ProjectileTrailRendererController>();
			val14.trailRenderer = val11;
			val14.desiredLength = 6f;
			GameObject val15 = ETGMod.AddChild(((Component)val3).gameObject, "trail object", new Type[0]);
			val15.transform.position = Vector2.op_Implicit(((BraveBehaviour)val3).sprite.WorldCenter - new Vector2(0.5f, 0f));
			val15.transform.localPosition = Vector2.op_Implicit(((BraveBehaviour)val3).sprite.WorldCenter - new Vector2(0.5f, 0f));
			TrailRenderer val16 = val15.AddComponent<TrailRenderer>();
			((Renderer)val16).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)val16).receiveShadows = false;
			Material val18 = (((Renderer)val16).material = new Material(Shader.Find("S