Decompiled source of Luffy Survivor v1.0.1

LuffyMod.dll

Decompiled 20 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using HG.BlendableTypes;
using HG.Reflection;
using KinematicCharacterController;
using LuffyMod.Modules;
using LuffyMod.Survivor;
using LuffyMod.Survivor.Components;
using LuffyMod.Survivor.SkillStates;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Achievements;
using RoR2.ConVar;
using RoR2.ContentManagement;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: IgnoresAccessChecksTo("RoR2")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LuffyMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LuffyMod")]
[assembly: AssemblyTitle("LuffyMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace LuffyMod
{
	internal static class Log
	{
		private static ManualLogSource _log;

		internal static void Init(ManualLogSource log)
		{
			_log = log;
		}

		internal static void Debug(object data)
		{
			if (_log != null)
			{
				_log.LogDebug(data);
			}
		}

		internal static void Info(object data)
		{
			if (_log != null)
			{
				_log.LogInfo(data);
			}
		}

		internal static void Message(object data)
		{
			if (_log != null)
			{
				_log.LogMessage(data);
			}
		}

		internal static void Warning(object data)
		{
			if (_log != null)
			{
				_log.LogWarning(data);
			}
		}

		internal static void Error(object data)
		{
			if (_log != null)
			{
				_log.LogError(data);
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.luffymodteam.LuffyMod", "LuffyMod", "1.0.1")]
	public class LuffyPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.luffymodteam.LuffyMod";

		public const string MODNAME = "LuffyMod";

		public const string MODVERSION = "1.0.1";

		public const string DEVELOPER_PREFIX = "LUFFYMOD";

		public static LuffyPlugin instance;

		private void Awake()
		{
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			try
			{
				LuffyConfig.Init(((BaseUnityPlugin)this).Config);
				LuffyAudio.Init();
				LuffyAssets.Init();
				LuffySurvivor.Initialize();
			}
			catch (Exception ex)
			{
				Log.Error("LuffyMod failed to initialise; Luffy will be unavailable.\n" + ex);
			}
			new ContentPacks().Initialize();
		}
	}
}
namespace LuffyMod.Survivor
{
	internal static class LuffyBuffs
	{
		internal static BuffDef gear2Buff;

		internal static void Init()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			gear2Buff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)gear2Buff).name = "bdLuffyGear2";
			gear2Buff.buffColor = LuffyAssets.gear2Tint;
			gear2Buff.canStack = false;
			gear2Buff.isDebuff = false;
			gear2Buff.isCooldown = false;
			gear2Buff.isHidden = false;
			gear2Buff.eliteDef = null;
			gear2Buff.iconSprite = Icons.Buff();
			ContentPacks.buffDefs.Add(gear2Buff);
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(OnGetStatCoefficients);
		}

		private static void OnGetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)gear2Buff) && sender.HasBuff(gear2Buff))
			{
				args.moveSpeedMultAdd += 0.75f;
				args.attackSpeedMultAdd += 1f;
				args.damageMultAdd += 0.2f;
			}
		}
	}
	internal static class LuffyModel
	{
		internal const string BundleFileName = "luffybundle";

		internal const string ModelAssetName = "mdlLuffy";

		internal static AssetBundle bundle;

		internal static GameObject modelPrefab;

		internal static bool applied;

		private static Shader hopooShader;

		private static readonly Dictionary<Material, Material> convertedMaterials = new Dictionary<Material, Material>();

		private static readonly string[,] childMap = new string[24, 2]
		{
			{ "Base", "world_joint|root ground" },
			{ "Root", "hip_joint|root hips" },
			{ "Pelvis", "hip_joint|pelvis" },
			{ "Stomach", "spine1_joint|spine lower" },
			{ "Chest", "spine2_joint|spine upper" },
			{ "Neck", "neck_joint|head neck lower" },
			{ "Head", "Head_Face|head neck upper" },
			{ "HeadCenter", "Head_Face|head neck upper" },
			{ "Hat", "hat_joint|Straw Hat" },
			{ "UpperArmL", "l_shoulder_joint|arm *side* shoulder 2.L" },
			{ "LowerArmL", "l_elbow_joint|arm *side* elbow.L" },
			{ "HandL", "l_hand_joint|arm *side* palm.L" },
			{ "MuzzleLeft", "l_hand_joint|arm *side* palm.L" },
			{ "UpperArmR", "r_shoulder_joint|arm *side* shoulder 2.R" },
			{ "LowerArmR", "r_elbow_joint|arm *side* elbow.R" },
			{ "HandR", "r_hand_joint|arm *side* palm.R" },
			{ "MuzzleRight", "r_hand_joint|arm *side* palm.R" },
			{ "ThighL", "l_leg1_ik_joint|leg *side* thigh.L" },
			{ "CalfL", "l_leg2_ik_joint|leg *side* knee.L" },
			{ "FootL", "l_leg3_ik_joint|leg *side* ankle.L" },
			{ "ThighR", "r_leg1_ik_joint|leg *side* thigh.R" },
			{ "CalfR", "r_leg2_ik_joint|leg *side* knee.R" },
			{ "FootR", "r_leg3_ik_joint|leg *side* ankle.R" },
			{ "MainHurtbox", "MainHurtbox" }
		};

		private static ItemDisplayRuleSet emptyIdrs;

		internal static void LoadBundle()
		{
			if (!LuffyConfig.UseLuffyModel)
			{
				Log.Info("LuffyMod: Model.UseLuffyModel = false - keeping the Loader placeholder model.");
				return;
			}
			try
			{
				string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)LuffyPlugin.instance).Info.Location);
				string[] array = new string[2]
				{
					Path.Combine(directoryName, "AssetBundles", "luffybundle"),
					Path.Combine(directoryName, "luffybundle")
				};
				foreach (string text in array)
				{
					if (File.Exists(text))
					{
						bundle = AssetBundle.LoadFromFile(text);
						if (Object.op_Implicit((Object)(object)bundle))
						{
							Log.Info("LuffyMod: loaded asset bundle " + text);
							break;
						}
					}
				}
				if (!Object.op_Implicit((Object)(object)bundle))
				{
					Log.Warning("LuffyMod: luffybundle not found next to LuffyMod.dll - using the Loader placeholder model.");
					return;
				}
				modelPrefab = bundle.LoadAsset<GameObject>("mdlLuffy");
				if (!Object.op_Implicit((Object)(object)modelPrefab))
				{
					Log.Warning("LuffyMod: mdlLuffy is not in luffybundle - using the Loader placeholder model.");
				}
			}
			catch (Exception ex)
			{
				Log.Error("LuffyMod: failed to load luffybundle - using the Loader placeholder model.\n" + ex);
				bundle = null;
				modelPrefab = null;
			}
		}

		internal static bool ApplyToBody(GameObject bodyPrefab)
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)modelPrefab))
			{
				return false;
			}
			ModelLocator component = bodyPrefab.GetComponent<ModelLocator>();
			if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.modelTransform))
			{
				Log.Error("LuffyMod: LuffyBody has no ModelLocator/model - keeping placeholder.");
				return false;
			}
			hopooShader = FindHopooShader(component.modelTransform);
			Transform modelTransform = component.modelTransform;
			Transform val = (Object.op_Implicit((Object)(object)component.modelBaseTransform) ? component.modelBaseTransform : modelTransform.parent);
			GameObject val2 = Object.Instantiate<GameObject>(modelPrefab, val, false);
			((Object)val2).name = "mdlLuffy";
			val2.transform.localRotation = Quaternion.identity;
			val2.transform.localScale = Vector3.one;
			val2.transform.localPosition = FeetOffset(bodyPrefab, val);
			Log.Info(string.Format(CultureInfo.InvariantCulture, "LuffyMod: model swap - ModelBase local={0} old model local={1} new model local={2}", val.localPosition, modelTransform.localPosition, val2.transform.localPosition));
			Object.DestroyImmediate((Object)(object)((Component)modelTransform).gameObject);
			component.modelTransform = val2.transform;
			component.modelBaseTransform = val;
			Animator component2 = val2.GetComponent<Animator>();
			CharacterDirection component3 = bodyPrefab.GetComponent<CharacterDirection>();
			if (Object.op_Implicit((Object)(object)component3))
			{
				component3.targetTransform = val;
				component3.overrideAnimatorForwardTransform = null;
				component3.rootMotionAccumulator = null;
				component3.modelAnimator = component2;
				component3.driveFromRootRotation = false;
			}
			ChildLocator locator = SetupChildLocator(val2);
			CharacterModel val3 = SetupCharacterModel(val2, bodyPrefab.GetComponent<CharacterBody>(), locator);
			SetupHurtboxes(val2, bodyPrefab, locator);
			LuffySkins.Init(val2, val3);
			val2.AddComponent<ModelSkinController>().skins = LuffySkins.skins.ToArray();
			Log.Info(Object.op_Implicit((Object)(object)LuffyArmRig.Setup(val2)) ? "LuffyMod: stretch-arm rig ready (model's own stretch arms)." : "LuffyMod: model has no stretch-arm parts; using line arms.");
			Log.Info(Object.op_Implicit((Object)(object)LuffyAimTwist.Setup(val2)) ? "LuffyMod: upper/lower body aim twist ready." : "LuffyMod: model lacks hip/spine joints; no aim twist.");
			RagdollController val4 = LuffyRagdoll.Setup(val2);
			Log.Info(Object.op_Implicit((Object)(object)val4) ? ("LuffyMod: ragdoll ready (" + val4.bones.Length + " bones).") : "LuffyMod: no ragdoll (bones missing).");
			ReportBrokenReferences(bodyPrefab);
			applied = true;
			Log.Info("LuffyMod: real Luffy model in use (" + val3.baseRendererInfos.Length + " renderers, " + LuffySkins.skins.Count + " skin(s)).");
			return true;
		}

		internal static GameObject CreateDisplay()
		{
			if (!Object.op_Implicit((Object)(object)modelPrefab) || !applied)
			{
				return null;
			}
			GameObject val = (Object.op_Implicit((Object)(object)bundle) ? bundle.LoadAsset<GameObject>("LuffyDisplay") : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				GameObject val2 = PrefabAPI.InstantiateClone(val, "LuffyDisplay", false);
				GameObject val3 = ((val2.transform.childCount > 0) ? ((Component)val2.transform.GetChild(0)).gameObject : val2);
				CharacterModel obj = val3.AddComponent<CharacterModel>();
				obj.autoPopulateLightInfos = true;
				obj.baseRendererInfos = BuildRendererInfos(val3);
				obj.itemDisplayRuleSet = EmptyItemDisplays();
				if (LuffySkins.skins.Count > 1 && Object.op_Implicit((Object)(object)FindDeep(val3.transform, "pre_body")))
				{
					val3.AddComponent<ModelSkinController>().skins = LuffySkins.skins.ToArray();
				}
				val2.AddComponent<LuffyDisplayVoice>();
				return val2;
			}
			GameObject val4 = PrefabAPI.InstantiateClone(modelPrefab, "LuffyDisplay", false);
			Transform val5 = val4.transform.Find("MainHurtbox");
			if (Object.op_Implicit((Object)(object)val5))
			{
				Object.DestroyImmediate((Object)(object)((Component)val5).gameObject);
			}
			CharacterModel obj2 = val4.AddComponent<CharacterModel>();
			obj2.autoPopulateLightInfos = true;
			obj2.baseRendererInfos = BuildRendererInfos(val4);
			obj2.itemDisplayRuleSet = EmptyItemDisplays();
			val4.AddComponent<ModelSkinController>().skins = LuffySkins.skins.ToArray();
			return val4;
		}

		private static Vector3 FeetOffset(GameObject bodyPrefab, Transform modelBase)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			CapsuleCollider component = bodyPrefab.GetComponent<CapsuleCollider>();
			float num = (Object.op_Implicit((Object)(object)component) ? (component.center.y - component.height * 0.5f) : (-0.91f));
			return new Vector3(0f, num - modelBase.localPosition.y, 0f);
		}

		private static Transform FindDeep(Transform t, string name)
		{
			if (((Object)t).name == name)
			{
				return t;
			}
			for (int i = 0; i < t.childCount; i++)
			{
				Transform val = FindDeep(t.GetChild(i), name);
				if (Object.op_Implicit((Object)(object)val))
				{
					return val;
				}
			}
			return null;
		}

		private static ChildLocator SetupChildLocator(GameObject model)
		{
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			ChildLocator val = model.GetComponent<ChildLocator>();
			if (!Object.op_Implicit((Object)(object)val))
			{
				val = model.AddComponent<ChildLocator>();
			}
			List<NameTransformPair> list = new List<NameTransformPair>();
			for (int i = 0; i < childMap.GetLength(0); i++)
			{
				Transform val2 = null;
				string[] array = childMap[i, 1].Split('|');
				foreach (string name in array)
				{
					val2 = FindDeep(model.transform, name);
					if (Object.op_Implicit((Object)(object)val2))
					{
						break;
					}
				}
				if (!Object.op_Implicit((Object)(object)val2))
				{
					Log.Warning("LuffyMod: bone '" + childMap[i, 1] + "' not found for ChildLocator '" + childMap[i, 0] + "'");
				}
				else
				{
					list.Add(new NameTransformPair
					{
						name = childMap[i, 0],
						transform = val2
					});
				}
			}
			val.transformPairs = list.ToArray();
			return val;
		}

		private static CharacterModel SetupCharacterModel(GameObject model, CharacterBody body, ChildLocator locator)
		{
			CharacterModel val = model.AddComponent<CharacterModel>();
			val.body = body;
			val.autoPopulateLightInfos = true;
			val.baseRendererInfos = BuildRendererInfos(model);
			val.itemDisplayRuleSet = EmptyItemDisplays();
			Transform val2 = FindDeep(model.transform, "pre_body") ?? FindDeep(model.transform, "body") ?? FindDeep(model.transform, "LuffyBody");
			if (Object.op_Implicit((Object)(object)val2))
			{
				val.mainSkinnedMeshRenderer = ((Component)val2).GetComponent<SkinnedMeshRenderer>();
			}
			return val;
		}

		internal static RendererInfo[] BuildRendererInfos(GameObject model)
		{
			//IL_004b: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			List<RendererInfo> list = new List<RendererInfo>();
			SkinnedMeshRenderer[] componentsInChildren = model.GetComponentsInChildren<SkinnedMeshRenderer>(true);
			foreach (SkinnedMeshRenderer val in componentsInChildren)
			{
				Material[] sharedMaterials = ((Renderer)val).sharedMaterials;
				for (int j = 0; j < sharedMaterials.Length; j++)
				{
					sharedMaterials[j] = ToHopoo(sharedMaterials[j]);
				}
				((Renderer)val).sharedMaterials = sharedMaterials;
				list.Add(new RendererInfo
				{
					renderer = (Renderer)(object)val,
					defaultMaterial = ((sharedMaterials.Length != 0) ? sharedMaterials[0] : null),
					defaultShadowCastingMode = (ShadowCastingMode)1,
					ignoreOverlays = false,
					hideOnDeath = false
				});
			}
			return list.ToArray();
		}

		private static ItemDisplayRuleSet EmptyItemDisplays()
		{
			if (Object.op_Implicit((Object)(object)emptyIdrs))
			{
				return emptyIdrs;
			}
			emptyIdrs = ScriptableObject.CreateInstance<ItemDisplayRuleSet>();
			((Object)emptyIdrs).name = "idrsLuffy";
			emptyIdrs.keyAssetRuleGroups = (KeyAssetRuleGroup[])(object)new KeyAssetRuleGroup[0];
			return emptyIdrs;
		}

		private static void SetupHurtboxes(GameObject model, GameObject bodyPrefab, ChildLocator locator)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			Transform val = locator.FindChild("MainHurtbox");
			if (!Object.op_Implicit((Object)(object)val))
			{
				Log.Error("LuffyMod: MainHurtbox missing on mdlLuffy - the body would be unhittable.");
				return;
			}
			HealthComponent component = bodyPrefab.GetComponent<HealthComponent>();
			HurtBoxGroup val2 = model.AddComponent<HurtBoxGroup>();
			((Component)val).gameObject.layer = LayerIndex.entityPrecise.intVal;
			HurtBox val3 = ((Component)val).gameObject.AddComponent<HurtBox>();
			val3.healthComponent = component;
			val3.isBullseye = true;
			val3.isSniperTarget = true;
			val3.damageModifier = (DamageModifier)0;
			val3.hurtBoxGroup = val2;
			val3.indexInGroup = 0;
			val2.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val3 };
			val2.mainHurtBox = val3;
			val2.bullseyeCount = 1;
		}

		private static Shader FindHopooShader(Transform loaderModel)
		{
			Renderer[] componentsInChildren = ((Component)loaderModel).GetComponentsInChildren<Renderer>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Material sharedMaterial = componentsInChildren[i].sharedMaterial;
				if (Object.op_Implicit((Object)(object)sharedMaterial) && Object.op_Implicit((Object)(object)sharedMaterial.shader) && ((Object)sharedMaterial.shader).name.IndexOf("HGStandard", StringComparison.OrdinalIgnoreCase) >= 0)
				{
					Log.Info("LuffyMod: using shader " + ((Object)sharedMaterial.shader).name + " from Loader's materials.");
					return sharedMaterial.shader;
				}
			}
			Log.Warning("LuffyMod: HGStandard shader not found on Loader's model; Luffy keeps Unity Standard materials.");
			return null;
		}

		internal static Material ToHopoo(Material src)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)src) || !Object.op_Implicit((Object)(object)hopooShader))
			{
				return src;
			}
			if (convertedMaterials.TryGetValue(src, out var value))
			{
				return value;
			}
			Material val = new Material(hopooShader)
			{
				name = ((Object)src).name
			};
			val.SetColor("_Color", src.color);
			if (Object.op_Implicit((Object)(object)src.mainTexture))
			{
				val.SetTexture("_MainTex", src.mainTexture);
			}
			if (src.IsKeywordEnabled("_ALPHATEST_ON"))
			{
				SetFloatIfPresent(val, "_EnableCutout", 1f);
				val.EnableKeyword("CUTOUT");
				SetFloatIfPresent(val, "_Cutoff", src.HasProperty("_Cutoff") ? src.GetFloat("_Cutoff") : 0.5f);
			}
			SetFloatIfPresent(val, "_SpecularStrength", 0.1f);
			SetFloatIfPresent(val, "_SpecularExponent", 4f);
			val.EnableKeyword("DITHER");
			convertedMaterials[src] = val;
			return val;
		}

		private static void SetFloatIfPresent(Material m, string prop, float v)
		{
			if (m.HasProperty(prop))
			{
				m.SetFloat(prop, v);
			}
		}

		private static void ReportBrokenReferences(GameObject bodyPrefab)
		{
			int num = 0;
			Component[] components = bodyPrefab.GetComponents<Component>();
			foreach (Component val in components)
			{
				if (!Object.op_Implicit((Object)(object)val))
				{
					continue;
				}
				FieldInfo[] fields = ((object)val).GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				foreach (FieldInfo fieldInfo in fields)
				{
					if (typeof(Object).IsAssignableFrom(fieldInfo.FieldType))
					{
						object value;
						try
						{
							value = fieldInfo.GetValue(val);
						}
						catch
						{
							continue;
						}
						Object val2 = (Object)((value is Object) ? value : null);
						if (val2 != null && !Object.op_Implicit(val2))
						{
							num++;
							Log.Warning("LuffyMod: " + ((object)val).GetType().Name + "." + fieldInfo.Name + " still referenced the removed Loader model.");
						}
					}
				}
			}
			if (num == 0)
			{
				Log.Info("LuffyMod: no body references to the old model remain.");
			}
		}
	}
	internal static class LuffySkins
	{
		internal static readonly List<SkinDef> skins = new List<SkinDef>();

		internal static SkinDef defaultSkin;

		internal static readonly string[] PreTimeskipParts = new string[6] { "pre_body", "pre_l_leg", "pre_r_leg", "pre_l_arm", "pre_r_arm", "pre_face_smile" };

		internal static readonly string[] MarinefordParts = new string[6] { "body", "face_normal", "l_arm", "r_arm", "l_hand_close", "r_hand_close" };

		internal static readonly string[] AlabastaParts = new string[8] { "alab_body", "alab_face_normal", "alab_l_arm", "alab_r_arm", "alab_l_hand_close", "alab_r_hand_close", "alab_l_leg", "alab_r_leg" };

		internal static readonly string[] StampedeParts = new string[15]
		{
			"stam_body", "stam_backpack", "stam_helmet", "stam_hat", "stam_hat_hair", "stam_face_normal", "stam_shirts", "stam_shirts_ura", "stam_waist_cloth", "stam_l_arm",
			"stam_r_arm", "stam_l_hand_close", "stam_r_hand_close", "stam_l_leg", "stam_r_leg"
		};

		internal static readonly string[] AfroParts = new string[7] { "afro_body", "afro_hair", "afro_face_normal", "afro_l_arm", "afro_r_arm", "afro_l_hand_close", "afro_r_hand_close" };

		internal static void Init(GameObject model, CharacterModel characterModel)
		{
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: 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)
			skins.Clear();
			if ((Object)(object)FindDeep(model.transform, "pre_body") != (Object)null)
			{
				defaultSkin = CreateSkin("skinLuffyDefault", "LUFFYMOD_LUFFY_DEFAULT_SKIN_NAME", SkinIcon(new Color(0.85f, 0.1f, 0.08f), new Color(0.15f, 0.3f, 0.9f), new Color(1f, 0.8f, 0.2f)), model, characterModel.baseRendererInfos, null, Activations(model, PreTimeskipParts));
				skins.Add(defaultSkin);
				AddIfPresent(model, characterModel, "body", "skinLuffyMarineford", "MARINEFORD_SKIN_NAME", MarinefordParts, new Color(0.95f, 0.8f, 0.25f), new Color(0.8f, 0.12f, 0.1f), new Color(0.2f, 0.2f, 0.2f));
				AddIfPresent(model, characterModel, "alab_body", "skinLuffyAlabasta", "ALABASTA_SKIN_NAME", AlabastaParts, new Color(0.55f, 0.15f, 0.25f), new Color(0.25f, 0.45f, 0.85f), new Color(0.85f, 0.75f, 0.55f), LuffyUnlocks.meridianUnlock);
				AddIfPresent(model, characterModel, "stam_body", "skinLuffyStampede", "STAMPEDE_SKIN_NAME", StampedeParts, new Color(0.8f, 0.1f, 0.1f), new Color(0.12f, 0.12f, 0.12f), new Color(0.9f, 0.6f, 0.15f), LuffyUnlocks.mementoUnlock);
				AddIfPresent(model, characterModel, "afro_body", "skinLuffyMastery", "MASTERY_SKIN_NAME", AfroParts, new Color(0.08f, 0.08f, 0.08f), new Color(0.6f, 0.1f, 0.12f), new Color(0.95f, 0.15f, 0.15f), LuffyUnlocks.masteryUnlock);
			}
			else
			{
				defaultSkin = CreateSkin("skinLuffyDefault", "LUFFYMOD_LUFFY_DEFAULT_SKIN_NAME", SkinIcon(new Color(0.85f, 0.1f, 0.08f), new Color(0.15f, 0.3f, 0.9f), new Color(1f, 0.8f, 0.2f)), model, characterModel.baseRendererInfos, null, null);
				skins.Add(defaultSkin);
			}
		}

		private static void AddIfPresent(GameObject model, CharacterModel cm, string marker, string name, string token, string[] partsShown, Color a, Color b, Color c, UnlockableDef unlock = null)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)FindDeep(model.transform, marker) == (Object)null))
			{
				Sprite val = SkinIcon(a, b, c);
				if (Object.op_Implicit((Object)(object)unlock) && !Object.op_Implicit((Object)(object)unlock.achievementIcon))
				{
					unlock.achievementIcon = val;
				}
				skins.Add(CreateSkin(name, "LUFFYMOD_LUFFY_" + token, val, model, cm.baseRendererInfos, null, Activations(model, partsShown), unlock));
			}
		}

		private static GameObjectActivation[] Activations(GameObject model, string[] visible)
		{
			//IL_0019: 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)
			List<GameObjectActivation> list = new List<GameObjectActivation>();
			SkinnedMeshRenderer[] componentsInChildren = model.GetComponentsInChildren<SkinnedMeshRenderer>(true);
			foreach (SkinnedMeshRenderer val in componentsInChildren)
			{
				list.Add(new GameObjectActivation
				{
					gameObject = ((Component)val).gameObject,
					shouldActivate = (Array.IndexOf(visible, ((Object)((Component)val).gameObject).name) >= 0)
				});
			}
			return list.ToArray();
		}

		private static Transform FindDeep(Transform t, string name)
		{
			if (((Object)t).name == name)
			{
				return t;
			}
			for (int i = 0; i < t.childCount; i++)
			{
				Transform val = FindDeep(t.GetChild(i), name);
				if (Object.op_Implicit((Object)(object)val))
				{
					return val;
				}
			}
			return null;
		}

		internal static SkinDef CreateSkin(string name, string nameToken, Sprite icon, GameObject rootObject, RendererInfo[] rendererInfos, MeshReplacement[] meshReplacements, GameObjectActivation[] activations, UnlockableDef unlock = null)
		{
			SkinDef obj = ScriptableObject.CreateInstance<SkinDef>();
			((Object)obj).name = name;
			obj.nameToken = nameToken;
			obj.icon = icon;
			obj.rootObject = rootObject;
			obj.baseSkins = (SkinDef[])(object)new SkinDef[0];
			obj.unlockableDef = unlock;
			obj.rendererInfos = CloneInfos(rendererInfos);
			obj.meshReplacements = (MeshReplacement[])(((object)meshReplacements) ?? ((object)new MeshReplacement[0]));
			obj.gameObjectActivations = (GameObjectActivation[])(((object)activations) ?? ((object)new GameObjectActivation[0]));
			obj.projectileGhostReplacements = (ProjectileGhostReplacement[])(object)new ProjectileGhostReplacement[0];
			obj.minionSkinReplacements = (MinionSkinReplacement[])(object)new MinionSkinReplacement[0];
			SkinDefParams val = SkinDefParams.FromSkinDef(obj);
			((Object)val).name = name + "Params";
			obj.skinDefParams = val;
			obj.optimizedSkinDefParams = val;
			return obj;
		}

		internal static RendererInfo[] CloneInfos(RendererInfo[] src)
		{
			RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[src.Length];
			Array.Copy(src, array, src.Length);
			return array;
		}

		internal static void SetMaterial(RendererInfo[] infos, string rendererName, Material m)
		{
			for (int i = 0; i < infos.Length; i++)
			{
				if (Object.op_Implicit((Object)(object)infos[i].renderer) && ((Object)infos[i].renderer).name == rendererName)
				{
					infos[i].defaultMaterial = m;
				}
			}
		}

		private static Sprite SkinIcon(Color top, Color bottom, Color accent)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false);
			for (int i = 0; i < 128; i++)
			{
				for (int j = 0; j < 128; j++)
				{
					Color val2 = ((i > 64) ? top : bottom);
					if (Mathf.Abs(i - 64) < 6)
					{
						val2 = accent;
					}
					val.SetPixel(j, i, val2);
				}
			}
			val.Apply();
			return Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f));
		}
	}
	internal static class LuffyStaticValues
	{
		public const float pistolDamageCoefficient = 5f;

		public const float pistolRange = 30f;

		public const float pistolBaseDuration = 1.2f;

		public const float pistolSwingDuration = 0.55f;

		public const float pistolFirePercent = 0.3f;

		public const float pistolRadius = 1.2f;

		public const float pistolImpactRadius = 3f;

		public const float pistolProcCoefficient = 1f;

		public const float pistolAimAssistAngle = 4f;

		public const float gatlingDuration = 5f;

		public const float gatlingPunchesPerSecond = 12f;

		public const float gatlingDamageCoefficient = 0.5f;

		public const float gatlingProcCoefficient = 0.25f;

		public const float gatlingRange = 25f;

		public const float gatlingCooldown = 10f;

		public const float gatlingFlySpeed = 5f;

		public const float gatlingFlyAcceleration = 45f;

		public const float rocketRange = 60f;

		public const float rocketMinDamageCoefficient = 3f;

		public const float rocketMaxDamageCoefficient = 9f;

		public const float rocketFullDamageSpeed = 55f;

		public const float rocketMinImpactSpeed = 12f;

		public const float rocketBlastRadius = 6f;

		public const float rocketCooldown = 7f;

		public const float rocketMaxGripDuration = 4f;

		public const float rocketPullMultiplier = 1.6f;

		public const float rocketSteerMultiplier = 0.5f;

		public const float rocketInitialPull = 8f;

		public const float gear2Duration = 20f;

		public const float gear2Cooldown = 30f;

		public const float gear2ActivationDuration = 0.2f;

		public const float gear2MoveSpeedBonus = 0.75f;

		public const float gear2AttackSpeedBonus = 1f;

		public const float gear2DamageBonus = 0.2f;

		public const float giantChargeDealt = 0.6f;

		public const float giantChargeTaken = 1.2f;

		public const float giantMaxChargePerHit = 5f;

		public const float giantWindup = 0.56f;

		public const float giantBarrageDuration = 4f;

		public const float giantHitsPerSecond = 8f;

		public const float giantBarrageDamageCoefficient = 2.125f;

		public const float giantBarrageRadius = 9f;

		public const float giantBarrageProcCoefficient = 0.5f;

		public const float giantReach = 16f;
	}
	internal static class LuffySurvivor
	{
		public const string BODY_NAME = "LuffyBody";

		public const string MASTER_NAME = "LuffyMonsterMaster";

		internal static GameObject bodyPrefab;

		internal static GameObject displayPrefab;

		internal static GameObject masterPrefab;

		internal static SurvivorDef survivorDef;

		internal static void Initialize()
		{
			if (!Object.op_Implicit((Object)(object)LuffyAssets.loaderBody))
			{
				Log.Error("LuffyMod: Loader body could not be loaded; Luffy will not be registered.");
				return;
			}
			LuffyTokens.Init();
			LuffyBuffs.Init();
			LuffyUnlocks.Init();
			RegisterStates();
			CreateBody();
			CreateStateMachines();
			CreateSkills();
			LuffyModel.LoadBundle();
			if (!LuffyModel.ApplyToBody(bodyPrefab))
			{
				RestrictSkins();
			}
			CreateDisplay();
			CreateSurvivorDef();
			CreateMaster();
		}

		private static void RegisterStates()
		{
			ContentPacks.entityStates.Add(typeof(GumGumPistol));
			ContentPacks.entityStates.Add(typeof(GumGumGatling));
			ContentPacks.entityStates.Add(typeof(GumGumRocket));
			ContentPacks.entityStates.Add(typeof(Gear2));
			ContentPacks.entityStates.Add(typeof(GumGumGiantGatling));
		}

		private static void CreateBody()
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: 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)
			bodyPrefab = PrefabAPI.InstantiateClone(LuffyAssets.loaderBody, "LuffyBody", true);
			LoaderStaticChargeComponent[] componentsInChildren = bodyPrefab.GetComponentsInChildren<LoaderStaticChargeComponent>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren[i]);
			}
			CharacterBody component = bodyPrefab.GetComponent<CharacterBody>();
			component.baseNameToken = "LUFFYMOD_LUFFY_NAME";
			component.subtitleNameToken = "LUFFYMOD_LUFFY_SUBTITLE";
			component.portraitIcon = (Texture)(object)Icons.Portrait();
			component.bodyColor = new Color(0.85f, 0.12f, 0.12f);
			component._defaultCrosshairPrefab = (Object.op_Implicit((Object)(object)LuffyAssets.standardCrosshair) ? LuffyAssets.standardCrosshair : component._defaultCrosshairPrefab);
			component.hideCrosshair = false;
			if (Object.op_Implicit((Object)(object)LuffyAssets.survivorPod))
			{
				component.preferredPodPrefab = LuffyAssets.survivorPod;
			}
			component.bodyFlags = (BodyFlags)(component.bodyFlags | 1);
			component.baseMaxHealth = MultHealth();
			component.baseRegen = 1.5f;
			component.baseArmor = 10f;
			component.baseMaxShield = 0f;
			component.baseDamage = 12f;
			component.baseAttackSpeed = 1f;
			component.baseCrit = 1f;
			component.baseMoveSpeed = 7f;
			component.baseJumpPower = 16f;
			component.baseJumpCount = 1;
			component.autoCalculateLevelStats = true;
			component.levelMaxHealth = Mathf.Round(component.baseMaxHealth * 0.3f);
			component.levelMaxShield = 0f;
			component.levelRegen = component.baseRegen * 0.2f;
			component.levelDamage = component.baseDamage * 0.2f;
			component.levelArmor = 0f;
			component.levelAttackSpeed = 0f;
			component.levelCrit = 0f;
			component.levelMoveSpeed = 0f;
			component.levelJumpPower = 0f;
			if (!Object.op_Implicit((Object)(object)bodyPrefab.GetComponent<Gear2Controller>()))
			{
				bodyPrefab.AddComponent<Gear2Controller>();
			}
			if (!Object.op_Implicit((Object)(object)bodyPrefab.GetComponent<LuffyUltimate>()))
			{
				bodyPrefab.AddComponent<LuffyUltimate>();
			}
			ContentPacks.bodyPrefabs.Add(bodyPrefab);
		}

		private static float MultHealth()
		{
			float result = 200f;
			try
			{
				GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/ToolbotBody");
				CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<CharacterBody>() : null);
				if (Object.op_Implicit((Object)(object)val2) && val2.baseMaxHealth > 1f)
				{
					result = val2.baseMaxHealth;
				}
				Log.Info("LuffyMod: base health " + result + (Object.op_Implicit((Object)(object)val2) ? " (MUL-T's)" : " (fallback, MUL-T not found)"));
			}
			catch (Exception ex)
			{
				Log.Warning("LuffyMod: could not read MUL-T's health, using 200: " + ex.Message);
			}
			return result;
		}

		private static void CreateStateMachines()
		{
			StateMachines.ClearEntityStateMachines(bodyPrefab);
			StateMachines.AddMainEntityStateMachine(bodyPrefab, "Body", typeof(GenericCharacterMain), typeof(SpawnTeleporterState));
			StateMachines.AddEntityStateMachine(bodyPrefab, "Weapon");
			StateMachines.AddEntityStateMachine(bodyPrefab, "Weapon2");
			StateMachines.AddEntityStateMachine(bodyPrefab, "Hook");
			StateMachines.AddEntityStateMachine(bodyPrefab, "Gear");
		}

		private static void CreateSkills()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: 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_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: 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_028e: 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_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: 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)
			Skills.ClearGenericSkills(bodyPrefab);
			bodyPrefab.GetComponent<SkillLocator>().passiveSkill = new PassiveSkill
			{
				enabled = true,
				skillNameToken = "LUFFYMOD_LUFFY_PASSIVE_NAME",
				skillDescriptionToken = "LUFFYMOD_LUFFY_PASSIVE_DESCRIPTION",
				icon = Icons.Passive()
			};
			GenericSkill obj = Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, (SkillSlot)0);
			SteppedSkillDef val = Skills.CreateSkillDef<SteppedSkillDef>(new SkillDefInfo
			{
				skillName = "LuffyGumGumPistol",
				skillNameToken = "LUFFYMOD_LUFFY_PRIMARY_PISTOL_NAME",
				skillDescriptionToken = "LUFFYMOD_LUFFY_PRIMARY_PISTOL_DESCRIPTION",
				skillIcon = Icons.Pistol(),
				activationState = new SerializableEntityStateType(typeof(GumGumPistol)),
				activationStateMachineName = "Weapon",
				interruptPriority = (InterruptPriority)0,
				baseRechargeInterval = 0f,
				baseMaxStock = 1,
				rechargeStock = 1,
				requiredStock = 0,
				stockToConsume = 0,
				isCombatSkill = true,
				mustKeyPress = false,
				cancelSprintingOnActivation = true
			});
			val.stepCount = 2;
			val.stepGraceDuration = 0.4f;
			Skills.AddSkillToFamily(obj.skillFamily, (SkillDef)(object)val);
			GenericSkill obj2 = Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, (SkillSlot)1);
			Skills.AddSkillToFamily(skillDef: Skills.CreateSkillDef<SkillDef>(new SkillDefInfo
			{
				skillName = "LuffyGumGumGatling",
				skillNameToken = "LUFFYMOD_LUFFY_SECONDARY_GATLING_NAME",
				skillDescriptionToken = "LUFFYMOD_LUFFY_SECONDARY_GATLING_DESCRIPTION",
				skillIcon = Icons.Gatling(),
				activationState = new SerializableEntityStateType(typeof(GumGumGatling)),
				activationStateMachineName = "Weapon",
				interruptPriority = (InterruptPriority)1,
				baseRechargeInterval = 10f,
				beginSkillCooldownOnSkillEnd = true,
				isCombatSkill = true,
				mustKeyPress = true,
				cancelSprintingOnActivation = true
			}), skillFamily: obj2.skillFamily);
			GenericSkill obj3 = Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, (SkillSlot)2);
			Skills.AddSkillToFamily(skillDef: Skills.CreateSkillDef<SkillDef>(new SkillDefInfo
			{
				skillName = "LuffyGumGumRocket",
				skillNameToken = "LUFFYMOD_LUFFY_UTILITY_ROCKET_NAME",
				skillDescriptionToken = "LUFFYMOD_LUFFY_UTILITY_ROCKET_DESCRIPTION",
				skillIcon = Icons.Rocket(),
				activationState = new SerializableEntityStateType(typeof(GumGumRocket)),
				activationStateMachineName = "Hook",
				interruptPriority = (InterruptPriority)2,
				baseRechargeInterval = 7f,
				beginSkillCooldownOnSkillEnd = true,
				isCombatSkill = false,
				mustKeyPress = true,
				cancelSprintingOnActivation = false
			}), skillFamily: obj3.skillFamily);
			GenericSkill obj4 = Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, (SkillSlot)3);
			Skills.AddSkillToFamily(skillDef: Skills.CreateSkillDef<SkillDef>(new SkillDefInfo
			{
				skillName = "LuffyGearSecond",
				skillNameToken = "LUFFYMOD_LUFFY_SPECIAL_GEAR2_NAME",
				skillDescriptionToken = "LUFFYMOD_LUFFY_SPECIAL_GEAR2_DESCRIPTION",
				skillIcon = Icons.Gear2(),
				activationState = new SerializableEntityStateType(typeof(Gear2)),
				activationStateMachineName = "Gear",
				interruptPriority = (InterruptPriority)2,
				baseRechargeInterval = 30f,
				isCombatSkill = false,
				mustKeyPress = true,
				cancelSprintingOnActivation = false
			}), skillFamily: obj4.skillFamily);
			GenericSkill obj5 = Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, "Ultimate");
			obj5.loadoutTitleToken = "LUFFYMOD_LUFFY_ULTIMATE_SLOT";
			SkillDef skillDef = Skills.CreateSkillDef<SkillDef>(new SkillDefInfo
			{
				skillName = "LuffyGumGumGiantGatling",
				skillNameToken = "LUFFYMOD_LUFFY_ULTIMATE_GIANTGATLING_NAME",
				skillDescriptionToken = "LUFFYMOD_LUFFY_ULTIMATE_GIANTGATLING_DESCRIPTION",
				skillIcon = Icons.GiantGatling(),
				activationState = new SerializableEntityStateType(typeof(GumGumGiantGatling)),
				activationStateMachineName = "Body",
				interruptPriority = (InterruptPriority)2,
				baseRechargeInterval = 0f,
				baseMaxStock = 1,
				rechargeStock = 0,
				requiredStock = 1,
				stockToConsume = 1,
				fullRestockOnAssign = false,
				isCombatSkill = true,
				mustKeyPress = true,
				cancelSprintingOnActivation = true
			});
			Skills.AddSkillToFamily(obj5.skillFamily, skillDef);
			LuffyUltimate.skillDef = skillDef;
		}

		private static void RestrictSkins()
		{
			ModelLocator component = bodyPrefab.GetComponent<ModelLocator>();
			if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.modelTransform))
			{
				ModelSkinController component2 = ((Component)component.modelTransform).GetComponent<ModelSkinController>();
				if (Object.op_Implicit((Object)(object)component2) && component2.skins != null && component2.skins.Length > 1)
				{
					component2.skins = (SkinDef[])(object)new SkinDef[1] { component2.skins[0] };
				}
			}
		}

		private static void CreateDisplay()
		{
			displayPrefab = LuffyModel.CreateDisplay();
			if (!Object.op_Implicit((Object)(object)displayPrefab) && Object.op_Implicit((Object)(object)LuffyAssets.loaderDisplay))
			{
				displayPrefab = PrefabAPI.InstantiateClone(LuffyAssets.loaderDisplay, "LuffyDisplay", false);
				CharacterSelectSurvivorPreviewDisplayController[] componentsInChildren = displayPrefab.GetComponentsInChildren<CharacterSelectSurvivorPreviewDisplayController>(true);
				foreach (CharacterSelectSurvivorPreviewDisplayController obj in componentsInChildren)
				{
					obj.bodyPrefab = bodyPrefab;
					obj.skillChangeResponses = (SkillChangeResponse[])(object)new SkillChangeResponse[0];
					obj.skinChangeResponses = (SkinChangeResponse[])(object)new SkinChangeResponse[0];
				}
			}
		}

		private static void CreateSurvivorDef()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			survivorDef = ScriptableObject.CreateInstance<SurvivorDef>();
			survivorDef.bodyPrefab = bodyPrefab;
			survivorDef.displayPrefab = displayPrefab;
			survivorDef.primaryColor = new Color(0.85f, 0.12f, 0.12f);
			survivorDef.cachedName = "Luffy";
			survivorDef.displayNameToken = "LUFFYMOD_LUFFY_NAME";
			survivorDef.descriptionToken = "LUFFYMOD_LUFFY_DESCRIPTION";
			survivorDef.outroFlavorToken = "LUFFYMOD_LUFFY_OUTRO_FLAVOR";
			survivorDef.mainEndingEscapeFailureFlavorToken = "LUFFYMOD_LUFFY_OUTRO_FAILURE";
			survivorDef.desiredSortPosition = 100.5f;
			survivorDef.unlockableDef = null;
			survivorDef.hidden = false;
			ContentPacks.survivorDefs.Add(survivorDef);
		}

		private static void CreateMaster()
		{
			if (Object.op_Implicit((Object)(object)LuffyAssets.loaderMaster))
			{
				masterPrefab = PrefabAPI.InstantiateClone(LuffyAssets.loaderMaster, "LuffyMonsterMaster", true);
				CharacterMaster component = masterPrefab.GetComponent<CharacterMaster>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.bodyPrefab = bodyPrefab;
				}
				ContentPacks.masterPrefabs.Add(masterPrefab);
			}
		}
	}
	internal static class LuffyTokens
	{
		public const string PREFIX = "LUFFYMOD_LUFFY_";

		private static string Pct(float coefficient)
		{
			return (coefficient * 100f).ToString("0", CultureInfo.InvariantCulture) + "%";
		}

		private static string Num(float v)
		{
			return v.ToString("0.##", CultureInfo.InvariantCulture);
		}

		private static string Dmg(string s)
		{
			return "<style=cIsDamage>" + s + "</style>";
		}

		private static string Util(string s)
		{
			return "<style=cIsUtility>" + s + "</style>";
		}

		internal static void Init()
		{
			string text = "Luffy is a rubber-bodied brawler who stretches his limbs to fight at range and swing across the stage.<color=#CCD3E0>\n\n< ! > Gum-Gum Pistol has no cooldown - keep punching from a safe distance.\n\n< ! > Gum-Gum Gatling lets you keep moving; aim it at the biggest crowd.\n\n< ! > Gum-Gum Rocket hits harder the faster you are travelling - grapple from far away for full damage.\n\n< ! > Gear Second boosts every other skill: faster Pistol and Gatling, a faster and stronger Rocket.\n\n< ! > Dealing and taking damage fills the Gum-Gum Giant Gatling meter. Press the Ultimate key (default X) when it is full.</color>\n\n";
			LanguageAPI.Add("LUFFYMOD_LUFFY_NAME", "Monkey D. Luffy");
			LanguageAPI.Add("LUFFYMOD_LUFFY_DESCRIPTION", text);
			LanguageAPI.Add("LUFFYMOD_LUFFY_SUBTITLE", "Captain of the Straw Hats");
			LanguageAPI.Add("LUFFYMOD_LUFFY_LORE", "A rubber man in a straw hat, who swore he would become King of the Pirates.");
			LanguageAPI.Add("LUFFYMOD_LUFFY_OUTRO_FLAVOR", "..and so he left, already shouting about the next adventure.");
			LanguageAPI.Add("LUFFYMOD_LUFFY_OUTRO_FAILURE", "..and so he vanished, his hat drifting on the wind.");
			LanguageAPI.Add("LUFFYMOD_LUFFY_DEFAULT_SKIN_NAME", "Straw Hat");
			LanguageAPI.Add("LUFFYMOD_LUFFY_MARINEFORD_SKIN_NAME", "Marineford");
			LanguageAPI.Add("LUFFYMOD_LUFFY_ALABASTA_SKIN_NAME", "Alabasta");
			LanguageAPI.Add("LUFFYMOD_LUFFY_STAMPEDE_SKIN_NAME", "Stampede");
			LanguageAPI.Add("LUFFYMOD_LUFFY_MASTERY_SKIN_NAME", "Long Ring Long Land");
			LanguageAPI.Add("LUFFYMOD_LUFFY_PASSIVE_NAME", "Rubber Body");
			LanguageAPI.Add("LUFFYMOD_LUFFY_PASSIVE_DESCRIPTION", "Luffy's rubber body is " + Util("immune to fall damage") + ".");
			LanguageAPI.Add("LUFFYMOD_LUFFY_PRIMARY_PISTOL_NAME", "Gum-Gum Pistol");
			LanguageAPI.Add("LUFFYMOD_LUFFY_PRIMARY_PISTOL_DESCRIPTION", "Stretch an arm forward up to " + Util(Num(30f) + "m") + ". The fist hits the first enemy and everything around it for " + Dmg(Pct(LuffyConfig.PistolDamageCoefficient) + " damage") + ". Alternates arms. Attack speed increases punch rate.");
			LanguageAPI.Add("LUFFYMOD_LUFFY_SECONDARY_GATLING_NAME", "Gum-Gum Gatling");
			LanguageAPI.Add("LUFFYMOD_LUFFY_SECONDARY_GATLING_DESCRIPTION", "Unleash an aimed barrage for " + Util(Num(5f) + " seconds") + ", throwing " + Dmg(Num(12f) + " punches per second") + " for " + Dmg(Pct(0.5f) + " damage") + " each. " + Util("Attack speed adds more punches") + " without shortening the barrage. " + Util("Fly freely with your movement keys while punching") + ". Cooldown starts when the barrage ends.");
			LanguageAPI.Add("LUFFYMOD_LUFFY_UTILITY_ROCKET_NAME", "Gum-Gum Rocket");
			LanguageAPI.Add("LUFFYMOD_LUFFY_UTILITY_ROCKET_DESCRIPTION", "Fire both arms up to " + Util(Num(60f) + "m") + " to grab terrain or an enemy and " + Util("launch yourself") + " toward it. On impact, deal " + Dmg(Pct(3f) + "-" + Pct(9f) + " damage") + " in an area, depending on your speed. " + Util("Hold to stay attached") + ".");
			LanguageAPI.Add("LUFFYMOD_LUFFY_SPECIAL_GEAR2_NAME", "Gear Second");
			LanguageAPI.Add("LUFFYMOD_LUFFY_SPECIAL_GEAR2_DESCRIPTION", "Instantly pump your blood into overdrive for " + Util(Num(20f) + " seconds") + ", gaining " + Util("+" + Pct(0.75f) + " movement speed") + ", " + Dmg("+" + Pct(1f) + " attack speed") + " and " + Dmg("+" + Pct(0.2f) + " damage") + ".");
			LanguageAPI.Add("LUFFYMOD_LUFFY_ULTIMATE_SLOT", "Ultimate");
			LanguageAPI.Add("LUFFYMOD_LUFFY_ULTIMATE_GIANTGATLING_NAME", "Gum-Gum Giant Gatling");
			LanguageAPI.Add("LUFFYMOD_LUFFY_ULTIMATE_GIANTGATLING_DESCRIPTION", "<style=cIsUtility>Ultimate.</style> Charges as you " + Dmg("deal") + " and " + Util("take") + " damage; press " + Util("[" + LuffyConfig.UltimateKeyName + "]") + " when full. Inflate both arms into giant fists and become " + Util("invincible") + ", pounding the aimed area " + Dmg(Num(8f) + " times per second") + " for " + Util(Num(4f) + " seconds") + " (" + Dmg(Pct(2.125f) + " damage") + " each) while giant fists rain down on it.");
		}
	}
	internal static class LuffyUnlocks
	{
		internal static UnlockableDef masteryUnlock;

		internal static UnlockableDef meridianUnlock;

		internal static UnlockableDef mementoUnlock;

		internal static void Init()
		{
			masteryUnlock = Create("Skins.LuffyMod.Mastery", "LuffyModMastery", "Luffy: Mastery", "As Luffy, beat the game or obliterate on Monsoon.");
			meridianUnlock = Create("Skins.LuffyMod.PrimeMeridian", "LuffyModPrimeMeridian", "Luffy: Prime Meridian", "As Luffy, defeat the False Son.");
			mementoUnlock = Create("Skins.LuffyMod.MementoMori", "LuffyModMementoMori", "Luffy: Memento Mori", "As Luffy, defeat the secret boss behind the Reincarnation door.");
		}

		internal static string NameToken(string id)
		{
			return "ACHIEVEMENT_" + id.ToUpperInvariant() + "_NAME";
		}

		internal static string DescToken(string id)
		{
			return "ACHIEVEMENT_" + id.ToUpperInvariant() + "_DESCRIPTION";
		}

		private static UnlockableDef Create(string unlockId, string achievementId, string name, string desc)
		{
			LanguageAPI.Add(NameToken(achievementId), name);
			LanguageAPI.Add(DescToken(achievementId), desc);
			UnlockableDef val = ScriptableObject.CreateInstance<UnlockableDef>();
			val.cachedName = unlockId;
			val.nameToken = NameToken(achievementId);
			ContentPacks.unlockableDefs.Add(val);
			return val;
		}
	}
	public abstract class LuffyBaseAchievement : BaseAchievement
	{
		public override BodyIndex LookUpRequiredBodyIndex()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return BodyCatalog.FindBodyIndex("LuffyBody");
		}
	}
	[RegisterAchievement("LuffyModMastery", "Skins.LuffyMod.Mastery", null, 10u, null)]
	public class LuffyMasteryAchievement : LuffyBaseAchievement
	{
		public const string identifier = "LuffyModMastery";

		public const string unlockableIdentifier = "Skins.LuffyMod.Mastery";

		public override void OnBodyRequirementMet()
		{
			((BaseAchievement)this).OnBodyRequirementMet();
			Run.onClientGameOverGlobal += OnClientGameOverGlobal;
		}

		public override void OnBodyRequirementBroken()
		{
			Run.onClientGameOverGlobal -= OnClientGameOverGlobal;
			((BaseAchievement)this).OnBodyRequirementBroken();
		}

		private void OnClientGameOverGlobal(Run run, RunReport report)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Invalid comparison between Unknown and I4
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Invalid comparison between Unknown and I4
			if (!Object.op_Implicit((Object)(object)report.gameEnding) || !report.gameEnding.isWin)
			{
				return;
			}
			DifficultyIndex val = report.ruleBook.FindDifficulty();
			DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(val);
			if (difficultyDef != null)
			{
				bool num = difficultyDef.countsAsHardMode && difficultyDef.scalingValue >= 3f;
				bool flag = (int)val >= 3 && (int)val <= 10;
				if (num || flag || difficultyDef.nameToken == "INFERNO_NAME")
				{
					((BaseAchievement)this).Grant();
				}
			}
		}
	}
	public abstract class LuffyBossKillAchievement : LuffyBaseAchievement
	{
		protected abstract bool IsTarget(string bodyName);

		public override void OnBodyRequirementMet()
		{
			((BaseAchievement)this).OnBodyRequirementMet();
			GlobalEventManager.onCharacterDeathGlobal += OnDeath;
		}

		public override void OnBodyRequirementBroken()
		{
			GlobalEventManager.onCharacterDeathGlobal -= OnDeath;
			((BaseAchievement)this).OnBodyRequirementBroken();
		}

		private void OnDeath(DamageReport report)
		{
			if (report != null && Object.op_Implicit((Object)(object)report.victimBody))
			{
				string bodyName = ((Object)report.victimBody).name.Replace("(Clone)", "");
				if (IsTarget(bodyName))
				{
					((BaseAchievement)this).Grant();
				}
			}
		}
	}
	[RegisterAchievement("LuffyModPrimeMeridian", "Skins.LuffyMod.PrimeMeridian", null, 10u, null)]
	public class LuffyMeridianAchievement : LuffyBossKillAchievement
	{
		public const string identifier = "LuffyModPrimeMeridian";

		public const string unlockableIdentifier = "Skins.LuffyMod.PrimeMeridian";

		protected override bool IsTarget(string n)
		{
			return n.StartsWith("FalseSonBossBodyBrokenLunarShard");
		}
	}
	[RegisterAchievement("LuffyModMementoMori", "Skins.LuffyMod.MementoMori", null, 10u, null)]
	public class LuffyMementoMoriAchievement : LuffyBossKillAchievement
	{
		public const string identifier = "LuffyModMementoMori";

		public const string unlockableIdentifier = "Skins.LuffyMod.MementoMori";

		protected override bool IsTarget(string n)
		{
			return n == "SolusHeartBody";
		}
	}
}
namespace LuffyMod.Survivor.SkillStates
{
	public class Gear2 : BaseSkillState
	{
		public static float duration = 0.2f;

		public static float buffDuration = 20f;

		public override void OnEnter()
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && Object.op_Implicit((Object)(object)LuffyBuffs.gear2Buff))
			{
				((EntityState)this).characterBody.ClearTimedBuffs(LuffyBuffs.gear2Buff);
				((EntityState)this).characterBody.AddTimedBuff(LuffyBuffs.gear2Buff, buffDuration);
			}
			LuffyAudio.Play("gear2", Object.op_Implicit((Object)(object)((EntityState)this).characterBody) ? ((EntityState)this).characterBody.corePosition : ((EntityState)this).transform.position);
			SpawnSteamBurst(5f);
			SpawnSteamBurst(3f);
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			ParticleSystem val = Gear2Controller.CreateActivationSteam(Object.op_Implicit((Object)(object)modelTransform) ? modelTransform : ((EntityState)this).transform);
			if (Object.op_Implicit((Object)(object)val))
			{
				MainModule main = val.main;
				((MainModule)(ref main)).startSpeed = new MinMaxCurve(8f, 18f);
				val.Emit(250);
				val.Stop(true, (ParticleSystemStopBehavior)1);
				((Component)val).transform.SetParent((Transform)null, true);
				Object.Destroy((Object)(object)((Component)val).gameObject, 2.5f);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void SpawnSteamBurst(float scale)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)LuffyAssets.steamBurstEffect) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				EffectManager.SpawnEffect(LuffyAssets.steamBurstEffect, new EffectData
				{
					origin = ((EntityState)this).characterBody.corePosition + Random.insideUnitSphere * 0.4f,
					scale = scale
				}, false);
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}
	}
	public class GumGumGatling : BaseSkillState
	{
		public static float duration = 5f;

		public static float punchesPerSecond = 12f;

		public static float damageCoefficient = 0.5f;

		public static float procCoefficient = 0.25f;

		public static float range = 25f;

		public static float radius = 1.5f;

		public static float spreadDegrees = 3f;

		public static int maxPunchesPerTick = 8;

		public static float flySpeed = 5f;

		public static float flyAcceleration = 45f;

		private float punchStopwatch;

		private Vector3 flyVelocity;

		private int punchCount;

		private ChildLocator childLocator;

		private LuffyAudio.Voice sound;

		public override void OnEnter()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			if (LuffyModel.applied)
			{
				((EntityState)this).PlayAnimation("Gesture, Additive", "Empty");
				((EntityState)this).PlayAnimation("Gesture, Override", "Empty");
			}
			childLocator = ((EntityState)this).GetModelChildLocator();
			punchStopwatch = CurrentInterval();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				flyVelocity = ((EntityState)this).characterMotor.velocity;
			}
			sound = LuffyAudio.Play("gatling", Object.op_Implicit((Object)(object)((EntityState)this).characterBody) ? ((EntityState)this).characterBody.corePosition : ((EntityState)this).transform.position);
			if (((EntityState)this).isAuthority)
			{
				LuffyAdrenaline.Begin(((EntityState)this).characterBody, ((EntityState)this).cameraTargetParams);
			}
		}

		public override void OnExit()
		{
			LuffyAudio.Stop(sound, 0.4f);
			if (((EntityState)this).isAuthority)
			{
				LuffyAdrenaline.End(((EntityState)this).characterBody, ((EntityState)this).cameraTargetParams);
			}
			((EntityState)this).OnExit();
		}

		private float CurrentAttackSpeed()
		{
			if (!Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				return Mathf.Max(0.1f, ((BaseState)this).attackSpeedStat);
			}
			return Mathf.Max(0.1f, ((EntityState)this).characterBody.attackSpeed);
		}

		private float CurrentInterval()
		{
			return 1f / (punchesPerSecond * CurrentAttackSpeed());
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((EntityState)this).characterBody.isSprinting = false;
			}
			((BaseState)this).StartAimMode(0.5f, false);
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge < duration)
			{
				Fly();
			}
			if (((EntityState)this).fixedAge < duration)
			{
				punchStopwatch += Time.fixedDeltaTime;
				float num = CurrentInterval();
				int num2 = 0;
				while (punchStopwatch >= num && num2 < maxPunchesPerTick)
				{
					punchStopwatch -= num;
					Punch(num);
					num2++;
				}
				if (punchStopwatch > num)
				{
					punchStopwatch = num;
				}
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void Fly()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && Object.op_Implicit((Object)(object)((EntityState)this).inputBank))
			{
				Vector3 aimDirection = ((EntityState)this).inputBank.aimDirection;
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(aimDirection.x, 0f, aimDirection.z);
				if (((Vector3)(ref val)).sqrMagnitude < 0.0001f)
				{
					val = (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) ? ((EntityState)this).characterDirection.forward : Vector3.forward);
				}
				((Vector3)(ref val)).Normalize();
				Vector3 val2 = Vector3.Cross(Vector3.up, val);
				Vector3 moveVector = ((EntityState)this).inputBank.moveVector;
				float num = Vector3.Dot(moveVector, val);
				float num2 = Vector3.Dot(moveVector, val2);
				Vector3 val3 = aimDirection * num + val2 * num2;
				if (((EntityState)this).inputBank.jump.down)
				{
					val3 += Vector3.up;
				}
				if (((Vector3)(ref val3)).sqrMagnitude > 1f)
				{
					((Vector3)(ref val3)).Normalize();
				}
				float num3 = Mathf.Max(flySpeed, Object.op_Implicit((Object)(object)((EntityState)this).characterBody) ? ((EntityState)this).characterBody.moveSpeed : flySpeed);
				Vector3 val4 = val3 * num3;
				flyVelocity = Vector3.MoveTowards(flyVelocity, val4, flyAcceleration * Time.fixedDeltaTime);
				if (flyVelocity.y > 0.2f)
				{
					((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f);
				}
				((EntityState)this).characterMotor.velocity = flyVelocity;
				((EntityState)this).characterMotor.moveDirection = Vector3.zero;
			}
		}

		private void Punch(float interval)
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: 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_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: 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_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Expected O, but got Unknown
			bool flag = punchCount % 2 == 0;
			punchCount++;
			if (!LuffyModel.applied)
			{
				string text = (flag ? "SwingFistRight" : "SwingFistLeft");
				float num = Mathf.Max(0.06f, interval * 2f);
				((EntityState)this).PlayCrossfade("Gesture, Additive", text, "SwingFist.playbackRate", num, 0.02f);
				((EntityState)this).PlayCrossfade("Gesture, Override", text, "SwingFist.playbackRate", num, 0.02f);
			}
			Ray aimRay = ((BaseState)this).GetAimRay();
			Vector3 val = Random.insideUnitSphere * Mathf.Tan(spreadDegrees * (MathF.PI / 180f));
			Vector3 origin = ((Ray)(ref aimRay)).origin;
			Vector3 val2 = ((Ray)(ref aimRay)).direction + val;
			Ray aimRay2 = default(Ray);
			((Ray)(ref aimRay2))..ctor(origin, ((Vector3)(ref val2)).normalized);
			float num2 = Mathf.Clamp(interval * 0.6f, 0.025f, 0.07f);
			StretchArm arm = LuffyArmHelper.SpawnPunchArm(childLocator, ((EntityState)this).characterBody, flag, LuffyArmHelper.VisualEndPoint(aimRay2, range), num2, 0.02f, num2, flurry: true);
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			float damage = damageCoefficient * (Object.op_Implicit((Object)(object)((EntityState)this).characterBody) ? ((EntityState)this).characterBody.damage : ((BaseState)this).damageStat);
			new BulletAttack
			{
				owner = ((EntityState)this).gameObject,
				weapon = ((EntityState)this).gameObject,
				origin = ((Ray)(ref aimRay)).origin,
				aimVector = ((Ray)(ref aimRay2)).direction,
				minSpread = 0f,
				maxSpread = 0f,
				bulletCount = 1u,
				damage = damage,
				damageType = DamageTypeCombo.GenericSecondary,
				procCoefficient = procCoefficient,
				force = 150f,
				falloffModel = (FalloffModel)0,
				maxDistance = range,
				radius = radius,
				smartCollision = true,
				isCrit = ((BaseState)this).RollCrit(),
				hitMask = CommonMasks.bullet,
				hitEffectPrefab = LuffyAssets.punchImpactEffect,
				tracerEffectPrefab = null,
				queryTriggerInteraction = (QueryTriggerInteraction)0,
				hitCallback = (HitCallback)delegate(BulletAttack attack, ref BulletHit hit)
				{
					//IL_0015: Unknown result type (might be due to invalid IL or missing references)
					if (Object.op_Implicit((Object)(object)arm))
					{
						arm.SetTarget(hit.point);
					}
					return BulletAttack.defaultHitCallback.Invoke(attack, ref hit);
				}
			}.Fire();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}
	}
	public class GumGumGiantGatling : BaseState
	{
		private const float BarrageRate = 1.15f;

		private float windup;

		private float barrage;

		private float total;

		private float hitInterval;

		private float hitStopwatch;

		private bool barrageStarted;

		private LuffyArmRig armRig;

		private Animator animator;

		private LuffyAudio.Voice sound;

		private CameraParamsOverrideHandle camHandle;

		private bool hasCam;

		private GameObject shaker;

		public override void OnEnter()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Expected O, but got Unknown
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			windup = 0.56f;
			barrage = 4f;
			total = windup + barrage;
			hitInterval = 0.125f;
			sound = LuffyAudio.Play("giantgatling", Object.op_Implicit((Object)(object)((EntityState)this).characterBody) ? ((EntityState)this).characterBody.corePosition : ((EntityState)this).transform.position);
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			armRig = (Object.op_Implicit((Object)(object)modelTransform) ? ((Component)modelTransform).GetComponent<LuffyArmRig>() : null);
			animator = ((EntityState)this).GetModelAnimator();
			if (Object.op_Implicit((Object)(object)armRig))
			{
				armRig.SetGiant(on: true);
			}
			if (LuffyModel.applied && Object.op_Implicit((Object)(object)animator))
			{
				((EntityState)this).PlayAnimation("Gesture, Additive", "Empty");
				((EntityState)this).PlayAnimation("Gesture, Override", "Empty");
				((EntityState)this).PlayAnimation("Grapple", "Empty");
				animator.SetFloat("GiantGatling.playbackRate", 1f);
				((EntityState)this).PlayAnimation("FullBody, Override", "GiantGatlingStart");
			}
			if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((EntityState)this).characterBody.AddTimedBuff(Buffs.HiddenInvincibility, total + 0.3f);
			}
			if (((EntityState)this).isAuthority)
			{
				string[] array = new string[3] { "Weapon", "Weapon2", "Hook" };
				foreach (string text in array)
				{
					EntityStateMachine val = EntityStateMachine.FindByCustomName(((EntityState)this).gameObject, text);
					if (Object.op_Implicit((Object)(object)val) && !(val.state is Idle))
					{
						val.SetNextStateToMain();
					}
				}
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
				{
					((EntityState)this).characterMotor.velocity = Vector3.zero;
				}
				CameraPullBack();
			}
			shaker = new GameObject("LuffyGiantGatlingShake");
			shaker.transform.SetParent(((EntityState)this).transform, false);
			ShakeEmitter obj = shaker.AddComponent<ShakeEmitter>();
			obj.wave = new Wave
			{
				amplitude = 0.6f,
				frequency = 18f,
				cycleOffset = 0f
			};
			obj.duration = total;
			obj.radius = 40f;
			obj.amplitudeTimeDecay = false;
			obj.scaleShakeRadiusWithLocalScale = false;
			obj.shakeOnStart = true;
		}

		private void CameraPullBack()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).cameraTargetParams) && Object.op_Implicit((Object)(object)((EntityState)this).cameraTargetParams.cameraParams))
				{
					CharacterCameraParamsData data = ((EntityState)this).cameraTargetParams.cameraParams.data;
					data.fov = new BlendableFloat
					{
						value = 68f,
						alpha = 1f
					};
					data.idealLocalCameraPos = new BlendableVector3
					{
						value = data.idealLocalCameraPos.value * 1.7f + new Vector3(0f, 1.2f, 0f),
						alpha = 1f
					};
					camHandle = ((EntityState)this).cameraTargetParams.AddParamsOverride(new CameraParamsOverrideRequest
					{
						cameraParamsData = data,
						priority = 2f
					}, 0.4f);
					hasCam = true;
				}
			}
			catch (Exception ex)
			{
				Log.Warning("LuffyMod: Giant Gatling camera failed: " + ex.Message);
			}
		}

		private Vector3 AimDirection()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)((EntityState)this).inputBank))
			{
				return ((EntityState)this).transform.forward;
			}
			return ((EntityState)this).inputBank.aimDirection;
		}

		public override void FixedUpdate()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
				((EntityState)this).characterMotor.moveDirection = Vector3.zero;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				Vector3 val = AimDirection();
				val.y = 0f;
				if (((Vector3)(ref val)).sqrMagnitude > 0.0001f)
				{
					((EntityState)this).characterDirection.forward = ((Vector3)(ref val)).normalized;
				}
				((EntityState)this).characterDirection.moveVector = Vector3.zero;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((EntityState)this).characterBody.isSprinting = false;
			}
			((BaseState)this).StartAimMode(0.5f, false);
			if (!barrageStarted && ((EntityState)this).fixedAge >= windup)
			{
				barrageStarted = true;
				if (Object.op_Implicit((Object)(object)animator))
				{
					animator.SetFloat("GiantGatling.playbackRate", 1.15f);
				}
				hitStopwatch = hitInterval;
			}
			if (barrageStarted && ((EntityState)this).fixedAge < total)
			{
				hitStopwatch += Time.fixedDeltaTime;
				int num = 0;
				while (hitStopwatch >= hitInterval && num < 3)
				{
					hitStopwatch -= hitInterval;
					BarrageHit();
					num++;
				}
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= total)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private Vector3 ImpactPoint(out Vector3 dir)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			Ray aimRay = ((BaseState)this).GetAimRay();
			dir = ((Ray)(ref aimRay)).direction;
			float num = 16f;
			Ray val = aimRay;
			LayerIndex world = LayerIndex.world;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val, ref val2, num, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
			{
				return ((Ray)(ref aimRay)).GetPoint(Mathf.Max(3f, ((RaycastHit)(ref val2)).distance));
			}
			return ((Ray)(ref aimRay)).GetPoint(num * 0.75f);
		}

		private void BarrageHit()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//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_0026: 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_002d: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: 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_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: 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_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: 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_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: 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_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: 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_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: 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_0133: 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_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_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: 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_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: 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_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: 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_023e: Unknown result type (might be due to invalid IL or missing references)
			Vector3 dir;
			Vector3 val = ImpactPoint(out dir);
			float num = 9f;
			if (Object.op_Implicit((Object)(object)LuffyAssets.punchImpactEffect))
			{
				EffectManager.SpawnEffect(LuffyAssets.punchImpactEffect, new EffectData
				{
					origin = val + Random.insideUnitSphere * num * 0.6f,
					scale = 4f,
					rotation = Util.QuaternionSafeLookRotation(-dir)
				}, false);
			}
			if (Object.op_Implicit((Object)(object)LuffyAssets.punchImpactEffect) && Random.value < 0.6f)
			{
				EffectManager.SpawnEffect(LuffyAssets.punchImpactEffect, new EffectData
				{
					origin = val + Random.insideUnitSphere * num * 0.8f,
					scale = 3f,
					rotation = Util.QuaternionSafeLookRotation(-dir)
				}, false);
			}
			if (Object.op_Implicit((Object)(object)armRig))
			{
				Vector3 val2 = Vector3.Cross(Vector3.up, dir);
				if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f)
				{
					val2 = ((EntityState)this).transform.right;
				}
				((Vector3)(ref val2)).Normalize();
				Vector3 val3 = (Object.op_Implicit((Object)(object)((EntityState)this).characterBody) ? ((EntityState)this).characterBody.corePosition : ((EntityState)this).transform.position);
				float num2 = Vector3.Distance(val3, val);
				int num3 = Random.Range(2, 6);
				for (int i = 0; i < num3; i++)
				{
					Vector3 val4 = val2 * Random.Range(-3.8f, 3.8f) + Vector3.up * Random.Range(0.3f, 4.5f) + dir * Random.Range(-0.5f, num2 * 0.45f);
					Vector3 val5 = val + val2 * Random.Range(-1f, 1f) * num * 0.8f + dir * Random.Range(-0.4f, 0.4f) * num - (val3 + val4);
					Vector3 val6 = ((Vector3)(ref val5)).normalized + Vector3.down * Random.Range(0.1f, 0.5f);
					armRig.SpawnGiantGhost(val4, ((Vector3)(ref val6)).normalized * Random.Range(8f, 18f), Random.Range(0.7f, 1.1f), Random.Range(0.1f, 0.3f));
				}
			}
			if (((EntityState)this).isAuthority)
			{
				new BlastAttack
				{
					attacker = ((EntityState)this).gameObject,
					inflictor = ((EntityState)this).gameObject,
					teamIndex = ((BaseState)this).GetTeam(),
					attackerFiltering = (AttackerFiltering)2,
					position = val,
					radius = num,
					falloffModel = (FalloffModel)0,
					baseDamage = 2.125f * base.damageStat,
					baseForce = 400f,
					bonusForce = dir * 300f,
					crit = ((BaseState)this).RollCrit(),
					damageType = DamageTypeCombo.GenericSpecial,
					procCoefficient = 0.5f
				}.Fire();
			}
		}

		public override void OnExit()
		{
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)armRig))
			{
				armRig.SetGiant(on: false);
			}
			if (LuffyModel.applied && Object.op_Implicit((Object)(object)animator))
			{
				animator.SetFloat("GiantGatling.playbackRate", 1f);
				((EntityState)this).PlayCrossfade("FullBody, Override", "Empty", 0.3f);
			}
			LuffyAudio.Stop(sound, 0.6f);
			if (hasCam && Object.op_Implicit((Object)(object)((EntityState)this).cameraTargetParams))
			{
				((EntityState)this).cameraTargetParams.RemoveParamsOverride(camHandle, 0.6f);
			}
			hasCam = false;
			if (Object.op_Implicit((Object)(object)shaker))
			{
				Object.Destroy((Object)(object)shaker);
			}
			if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((EntityState)this).characterBody.ClearTimedBuffs(Buffs.HiddenInvincibility);
			}
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)9;
		}
	}
	public class GumGumPistol : BaseSkillState, IStepSetter
	{
		public static float firePercent = 0.3f;

		public static float range = 30f;

		public static float radius = 1.2f;

		public static float procCoefficient = 1f;

		public static float force = 600f;

		private static float lastPunchTime = -1f;

		private static int punchCounter;

		private int step;

		private float duration;

		private float swingDuration;

		private float fireTime;

		private float damageCoefficient;

		private bool hasFired;

		private StretchArm arm;

		private HealthComponent damagedTarget;

		private string firstHitName;

		private float firstHitDistance;

		private Vector3 impactPoint;

		private int blastHitCount;

		private bool IsRightHand => step % 2 == 0;

		public void SetStep(int i)
		{
			step = i;
		}

		public override void OnEnter()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			float num = Mathf.Max(0.1f, ((BaseState)this).attackSpeedStat);
			duration = LuffyConfig.PistolBaseDuration / num;
			swingDuration = Mathf.Min(duration, 0.55f / num);
			fireTime = firePercent * swingDuration;
			damageCoefficient = LuffyConfig.PistolDamageCoefficient;
			LuffyAudio.Play("pistol", Object.op_Implicit((Object)(object)((EntityState)this).characterBody) ? ((EntityState)this).characterBody.corePosition : ((EntityState)this).transform.position);
			((BaseState)this).StartAimMode(2f, false);
			string text = (IsRightHand ? "SwingFistRight" : "SwingFistLeft");
			((EntityState)this).PlayCrossfade("Gesture, Additive", text, "SwingFist.playbackRate", swingDuration, 0.1f);
			((EntityState)this).PlayCrossfade("Gesture, Override", text, "SwingFist.playbackRate", swingDuration, 0.1f);
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (!hasFired && ((EntityState)this).fixedAge >= fireTime)
			{
				Fire();
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void Fire()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: 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_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: 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_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: 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_0153: 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_0160: 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_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: 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_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: 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_01c0: Ex