Decompiled source of LaserTweaks v1.0.2

LaserTweaks.dll

Decompiled 2 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.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.MajorConstruct.Weapon;
using EntityStates.RoboBallMini.Weapon;
using EntityStates.TitanMonster;
using LaserTweaks.Tweaks;
using LaserTweaks.Tweaks.States;
using Microsoft.CodeAnalysis;
using On.EntityStates.MajorConstruct.Weapon;
using On.EntityStates.TitanMonster;
using R2API;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.ContentManagement;
using RoR2.Skills;
using RoR2BepInExPack.GameAssetPathsBetter;
using UnityEngine;
using UnityEngine.AddressableAssets;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LaserTweaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0b7aca910110abe036f0028b48eed8b8d0643082")]
[assembly: AssemblyProduct("LaserTweaks")]
[assembly: AssemblyTitle("LaserTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LaserTweaks
{
	public class Assets
	{
		public static AssetBundle assetBundle;

		public static GameObject roboBallLaser;

		public static GameObject roboBallCharge;

		public static GameObject megaConstructLaser;

		public static Sprite icon;

		public static void Init()
		{
			GetAssetBundle();
			CreateRoboBallPrefabs();
			CreateMegaConstructPrefabs();
			icon = assetBundle.LoadAsset<Sprite>("icon");
		}

		private static void CreateRoboBallPrefabs()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: 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_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			roboBallLaser = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Golem.LaserGolem_prefab).WaitForCompletion(), "RoboBallLaser");
			LineRenderer component = roboBallLaser.GetComponent<LineRenderer>();
			Gradient colorGradient = component.colorGradient;
			GradientColorKey[] colorKeys = colorGradient.colorKeys;
			colorKeys[0].color = new Color(0f, 0.95f, 1f);
			colorKeys[1].color = new Color(0.11f, 0.3f, 0.36f);
			colorGradient.colorKeys = colorKeys;
			component.colorGradient = colorGradient;
			Material val = new Material(((Renderer)roboBallLaser.GetComponent<LineRenderer>()).sharedMaterial);
			val.SetTexture("_RemapTex", Addressables.LoadAssetAsync<Texture>((object)RoR2_Base_Common_ColorRamps.texRampWispSoul_png).WaitForCompletion());
			((Renderer)roboBallLaser.GetComponent<LineRenderer>()).sharedMaterial = val;
			roboBallCharge = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Golem.ChargeGolem_prefab).WaitForCompletion(), "RoboBallCharge");
			((Component)roboBallCharge.transform.Find("Point light")).GetComponent<Light>().color = new Color(0.27f, 0.97f, 1f);
			Transform val2 = roboBallCharge.transform.Find("Particles/Glow");
			ColorOverLifetimeModule colorOverLifetime = ((Component)val2).GetComponent<ParticleSystem>().colorOverLifetime;
			MinMaxGradient color = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color;
			colorGradient = ((MinMaxGradient)(ref color)).gradient;
			colorKeys = colorGradient.colorKeys;
			colorKeys[0].color = new Color(0f, 0.85f, 1f);
			colorKeys[1].color = new Color(0f, 0.38f, 0.62f);
			colorKeys[1].color = new Color(0.49f, 0.89f, 1f);
			colorGradient.colorKeys = colorKeys;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(colorGradient);
			Transform val3 = roboBallCharge.transform.Find("Particles/Sparks");
			colorOverLifetime = ((Component)val3).GetComponent<ParticleSystem>().colorOverLifetime;
			color = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color;
			colorGradient = ((MinMaxGradient)(ref color)).gradient;
			colorKeys = colorGradient.colorKeys;
			colorKeys[0].color = new Color(0.14f, 1f, 1f);
			colorKeys[1].color = new Color(0.03f, 0.77f, 1f);
			colorKeys[1].color = new Color(0.03f, 0.69f, 1f);
			colorGradient.colorKeys = colorKeys;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(colorGradient);
		}

		private static void CreateMegaConstructPrefabs()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			megaConstructLaser = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Golem.LaserGolem_prefab).WaitForCompletion(), "RoboBallLaser");
			LineRenderer component = megaConstructLaser.GetComponent<LineRenderer>();
			Gradient colorGradient = component.colorGradient;
			GradientColorKey[] colorKeys = colorGradient.colorKeys;
			colorKeys[0].color = new Color(0.79f, 0.51f, 0.02f);
			colorKeys[1].color = new Color(1f, 0.64f, 0f);
			colorGradient.colorKeys = colorKeys;
			component.colorGradient = colorGradient;
			Material val = new Material(((Renderer)megaConstructLaser.GetComponent<LineRenderer>()).sharedMaterial);
			val.SetTexture("_RemapTex", Addressables.LoadAssetAsync<Texture>((object)RoR2_DLC1_Common_ColorRamps.texRampConstructLaser_png).WaitForCompletion());
			((Renderer)megaConstructLaser.GetComponent<LineRenderer>()).sharedMaterial = val;
		}

		private static void GetAssetBundle()
		{
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LaserTweaks.lasertweaks");
			if (stream != null)
			{
				assetBundle = AssetBundle.LoadFromStream(stream);
			}
		}
	}
	internal class ContentPacks : IContentPackProvider
	{
		[CompilerGenerated]
		private sealed class <FinalizeAsync>d__8 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public FinalizeAsyncArgs args;

			public ContentPacks <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <FinalizeAsync>d__8(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				args.ReportProgress(1f);
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <GenerateContentPackAsync>d__7 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public GetContentPackAsyncArgs args;

			public ContentPacks <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <GenerateContentPackAsync>d__7(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				ContentPack.Copy(<>4__this.contentPack, args.output);
				args.ReportProgress(1f);
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <LoadStaticContentAsync>d__6 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public LoadStaticContentAsyncArgs args;

			public ContentPacks <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LoadStaticContentAsync>d__6(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				<>4__this.contentPack.identifier = <>4__this.identifier;
				<>4__this.contentPack.entityStateTypes.Add(entityStates.ToArray());
				args.ReportProgress(1f);
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		internal ContentPack contentPack = new ContentPack();

		public static List<Type> entityStates = new List<Type>();

		public string identifier => "com.Miyowi.LaserTweaks";

		public void Initialize()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
		}

		private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
		{
			addContentPackProvider.Invoke((IContentPackProvider)(object)this);
		}

		[IteratorStateMachine(typeof(<LoadStaticContentAsync>d__6))]
		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadStaticContentAsync>d__6(0)
			{
				<>4__this = this,
				args = args
			};
		}

		[IteratorStateMachine(typeof(<GenerateContentPackAsync>d__7))]
		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GenerateContentPackAsync>d__7(0)
			{
				<>4__this = this,
				args = args
			};
		}

		[IteratorStateMachine(typeof(<FinalizeAsync>d__8))]
		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FinalizeAsync>d__8(0)
			{
				<>4__this = this,
				args = args
			};
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("mwmw.LaserTweaks", "LaserTweaks", "1.0.2")]
	public class LaserTweaksPlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "mwmw.LaserTweaks";

		public const string PluginAuthor = "mwmw";

		public const string PluginName = "LaserTweaks";

		public const string PluginVersion = "1.0.2";

		public static ConfigFile config;

		public static BaseUnityPlugin plugin;

		public void Awake()
		{
			Log.Init(((BaseUnityPlugin)this).Logger);
			config = ((BaseUnityPlugin)this).Config;
			plugin = (BaseUnityPlugin)(object)this;
			Assets.Init();
			States.Register();
			Options.Init();
			TitanTweaks.Init();
			RoboBallTweaks.Init();
			MegaConstructTweaks.Init();
			RoR2Application.onLoadFinished = (Action)Delegate.Combine(RoR2Application.onLoadFinished, new Action(OnLoadFinished));
			new ContentPacks().Initialize();
		}

		private void OnLoadFinished()
		{
			Options.OnLoadFinished();
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	public class Options
	{
		private static bool? _rooEnabled;

		public static bool rooEnabled
		{
			get
			{
				if (!_rooEnabled.HasValue)
				{
					_rooEnabled = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
				}
				return _rooEnabled.Value;
			}
		}

		public static ConfigEntry<bool> disableTitanLockOn { get; set; }

		public static void Init()
		{
			disableTitanLockOn = LaserTweaksPlugin.config.Bind<bool>("Stone Titan", "Disable Laser Lock-On", true, "Prevents the Stone Titan's laser from locking onto the player if it's within a certain range.");
			if (rooEnabled)
			{
				RoOInit();
			}
		}

		private static void RoOInit()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(disableTitanLockOn, new CheckBoxConfig()));
			ModSettingsManager.SetModDescription("Laser tweaks.");
			ModSettingsManager.SetModIcon(Assets.icon);
		}

		public static void OnLoadFinished()
		{
		}
	}
	public static class States
	{
		public static void Register()
		{
			ContentPacks.entityStates.Add(typeof(RoboBallChargeLaser));
			ContentPacks.entityStates.Add(typeof(MegaConstructChargeLaser));
		}
	}
}
namespace LaserTweaks.Tweaks
{
	public class MegaConstructTweaks
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_OnEnter <0>__SetupVisual;
		}

		public static void Init()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			AddNewStateMachine();
			object obj = <>O.<0>__SetupVisual;
			if (obj == null)
			{
				hook_OnEnter val = SetupVisual;
				<>O.<0>__SetupVisual = val;
				obj = (object)val;
			}
			ChargeLaser.OnEnter += (hook_OnEnter)obj;
		}

		private static void AddNewStateMachine()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC1_MajorAndMinorConstruct.MegaConstructBody_prefab).WaitForCompletion();
			EntityStateMachine val2 = val.AddComponent<EntityStateMachine>();
			val2.customName = "LaserCharge";
			val2.initialStateType = new SerializableEntityStateType(typeof(Idle));
			val2.mainStateType = new SerializableEntityStateType(typeof(Idle));
			NetworkStateMachine component = val.GetComponent<NetworkStateMachine>();
			component.stateMachines = component.stateMachines.Append(val2).ToArray();
			CharacterDeathBehavior component2 = val.GetComponent<CharacterDeathBehavior>();
			component2.idleStateMachine = component2.idleStateMachine.Append(val2).ToArray();
		}

		private static void SetupVisual(orig_OnEnter orig, ChargeLaser self)
		{
			orig.Invoke(self);
			MegaConstructChargeLaser megaConstructChargeLaser = new MegaConstructChargeLaser();
			megaConstructChargeLaser.localBaseDuration = self.duration;
			EntityStateMachine.FindByCustomName(((EntityState)self).gameObject, "LaserCharge").SetNextState((EntityState)(object)megaConstructChargeLaser);
		}
	}
	public class RoboBallTweaks
	{
		private static Xoroshiro128Plus rng;

		public static void Init()
		{
			ChangeActivationState();
		}

		private static void ChangeActivationState()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			SkillDef skillDef = Addressables.LoadAssetAsync<SkillFamily>((object)RoR2_Base_RoboBallBoss.RoboBallMiniPrimaryFamily_asset).WaitForCompletion().variants[0].skillDef;
			skillDef.activationState = new SerializableEntityStateType(typeof(RoboBallChargeLaser));
		}
	}
	public class TitanTweaks
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_UpdateLockOn <0>__PreventLockOn;
		}

		private static Xoroshiro128Plus rng;

		public static void Init()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__PreventLockOn;
			if (obj == null)
			{
				hook_UpdateLockOn val = PreventLockOn;
				<>O.<0>__PreventLockOn = val;
				obj = (object)val;
			}
			FireMegaLaser.UpdateLockOn += (hook_UpdateLockOn)obj;
		}

		private static void PreventLockOn(orig_UpdateLockOn orig, FireMegaLaser self)
		{
			orig.Invoke(self);
			if (Options.disableTitanLockOn.Value)
			{
				self.foundAnyTarget = false;
				self.lockedOnHurtBox = null;
			}
		}
	}
}
namespace LaserTweaks.Tweaks.States
{
	internal class MegaConstructChargeLaser : RoboBallChargeLaser
	{
		public override float localBaseDuration => 0.8f;

		public override float localLaserMaxWidth => 0.8f;

		public override GameObject localEffectPrefab => null;

		public override GameObject localLaserPrefab => Assets.megaConstructLaser;

		public override EntityState nextState => null;
	}
	internal class RoboBallChargeLaser : ChargeMegaLaser
	{
		private float _localBaseDuration = 2f;

		public virtual float localBaseDuration
		{
			get
			{
				return _localBaseDuration;
			}
			set
			{
				_localBaseDuration = value;
			}
		}

		public virtual float localLaserMaxWidth => 0.15f;

		public virtual GameObject localEffectPrefab => Assets.roboBallCharge;

		public virtual GameObject localLaserPrefab => Assets.roboBallLaser;

		public virtual EntityState nextState => (EntityState)new FireEyeBeam();

		public override void OnEnter()
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((BaseState)this).attackSpeedStat = ((EntityState)this).characterBody.attackSpeed;
				((BaseState)this).damageStat = ((EntityState)this).characterBody.damage;
				((BaseState)this).critStat = ((EntityState)this).characterBody.crit;
				((BaseState)this).moveSpeedStat = ((EntityState)this).characterBody.moveSpeed;
			}
			base.effectPrefab = localEffectPrefab;
			base.laserPrefab = localLaserPrefab;
			base.duration = localBaseDuration / ((BaseState)this).attackSpeedStat;
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			Ray aimRay = ((BaseState)this).GetAimRay();
			base.enemyFinder = new BullseyeSearch();
			base.enemyFinder.maxDistanceFilter = 2000f;
			base.enemyFinder.maxAngleFilter = ChargeMegaLaser.lockOnAngle;
			base.enemyFinder.searchOrigin = ((Ray)(ref aimRay)).origin;
			base.enemyFinder.searchDirection = ((Ray)(ref aimRay)).direction;
			base.enemyFinder.filterByLoS = false;
			base.enemyFinder.sortMode = (SortMode)2;
			base.enemyFinder.teamMaskFilter = TeamMask.allButNeutral;
			if (Object.op_Implicit((Object)(object)((EntityState)this).teamComponent))
			{
				((TeamMask)(ref base.enemyFinder.teamMaskFilter)).RemoveTeam(((EntityState)this).teamComponent.teamIndex);
			}
			if (!Object.op_Implicit((Object)(object)modelTransform))
			{
				return;
			}
			ChildLocator component = ((Component)modelTransform).GetComponent<ChildLocator>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			Transform val = component.FindChild("Muzzle");
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)base.effectPrefab))
			{
				if (!EffectManager.ShouldUsePooledEffect(base.effectPrefab))
				{
					base.chargeEffect = Object.Instantiate<GameObject>(base.effectPrefab, val.position, val.rotation);
				}
				else
				{
					base._emh_chargeEffect = EffectManager.GetAndActivatePooledEffect(base.effectPrefab, val.position, val.rotation);
					base.chargeEffect = ((Component)base._emh_chargeEffect).gameObject;
				}
				base.chargeEffect.transform.parent = val;
				ScaleParticleSystemDuration component2 = base.chargeEffect.GetComponent<ScaleParticleSystemDuration>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					component2.newDuration = base.duration;
				}
			}
			if (Object.op_Implicit((Object)(object)base.laserPrefab))
			{
				if (!EffectManager.ShouldUsePooledEffect(base.laserPrefab))
				{
					base.laserEffect = Object.Instantiate<GameObject>(base.laserPrefab, val.position, val.rotation);
				}
				else
				{
					base._emh_laserEffect = EffectManager.GetAndActivatePooledEffect(base.laserPrefab, val.position, val.rotation);
					base.laserEffect = ((Component)base._emh_laserEffect).gameObject;
				}
				base.laserEffect.transform.parent = val;
				base.laserLineComponent = base.laserEffect.GetComponent<LineRenderer>();
			}
		}

		public override void Update()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).age = ((EntityState)this).age + Time.deltaTime;
			if (!Object.op_Implicit((Object)(object)base.laserEffect) || !Object.op_Implicit((Object)(object)base.laserLineComponent))
			{
				return;
			}
			float num = 1000f;
			Ray aimRay = ((BaseState)this).GetAimRay();
			base.enemyFinder.RefreshCandidates();
			base.lockedOnHurtBox = base.enemyFinder.GetResults().FirstOrDefault();
			if (Object.op_Implicit((Object)(object)base.lockedOnHurtBox))
			{
				((Ray)(ref aimRay)).direction = ((Component)base.lockedOnHurtBox).transform.position - ((Ray)(ref aimRay)).origin;
			}
			Vector3 position = base.laserEffect.transform.parent.position;
			Vector3 point = ((Ray)(ref aimRay)).GetPoint(num);
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(aimRay, ref val, num, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(CommonMasks.characterBodiesOrDefault)))
			{
				point = ((RaycastHit)(ref val)).point;
			}
			base.laserLineComponent.SetPosition(0, position);
			base.laserLineComponent.SetPosition(1, point);
			float num2;
			if (base.duration - ((EntityState)this).age > 0.5f)
			{
				num2 = ((EntityState)this).age / base.duration;
			}
			else
			{
				base.flashTimer -= Time.deltaTime;
				if (base.flashTimer <= 0f)
				{
					base.laserOn = !base.laserOn;
					base.flashTimer = 1f / 30f;
				}
				num2 = (base.laserOn ? 1f : 0f);
			}
			num2 *= localLaserMaxWidth;
			base.laserLineComponent.startWidth = num2;
			base.laserLineComponent.endWidth = num2;
		}

		public override void FixedUpdate()
		{
			((EntityState)this).fixedAge = ((EntityState)this).fixedAge + ((EntityState)this).GetDeltaTime();
			if (((EntityState)this).fixedAge >= base.duration && ((EntityState)this).isAuthority)
			{
				if (nextState != null)
				{
					((EntityState)this).outer.SetNextState(nextState);
				}
				else
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}
	}
}