Decompiled source of BungusSuperForms v2.0.0

plugins/BungusSuperFormsMod.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AncientScepter;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using BungusSuperFormsMod.Internal;
using BungusSuperFormsMod.MyEntityStates;
using EntityStates;
using HG.BlendableTypes;
using HG.Reflection;
using HedgehogUtils;
using HedgehogUtils.Boost;
using HedgehogUtils.Boost.EntityStates;
using HedgehogUtils.Forms;
using HedgehogUtils.Forms.EntityStates;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.ContentManagement;
using RoR2.Skills;
using RoR2BepInExPack.GameAssetPaths.Version_1_39_0;
using SonicTheHedgehog.Modules;
using SonicTheHedgehog.Modules.Survivors;
using SonicTheHedgehog.SkillStates;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BungusSuperFormsMod
{
	public static class AncientScepter
	{
		public static GameObject scepterWungusBoostFlash;

		public static GameObject scepterWungusBoostAura;

		public static RequiresFormBoostSkillDef scepterWungusBoost;

		public static void Initialize()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			scepterWungusBoostFlash = Assets.CreateBoostFlashEffect("DS_GAMING_BUNGUS_SUPER_FORMS_SCEPTER_WUNGUS_BOOST_FLASH", AssetAsyncReferenceManager<Texture>.LoadAsset(new AssetReferenceT<Texture>(RoR2_DLC1_VoidSurvivor.texRampVoidSurvivorCorrupted1_png), (AsyncReferenceHandleUnloadType)2).WaitForCompletion(), new Color(1f, 0.2f, 0f));
			scepterWungusBoostAura = Assets.CreateBoostAuraEffect("DS_GAMING_BUNGUS_SUPER_FORMS_SCEPTER_WUNGUS_BOOST_AURA", AssetAsyncReferenceManager<Texture>.LoadAsset(new AssetReferenceT<Texture>(RoR2_DLC1_VoidSurvivor.texRampVoidSurvivorCorrupted1_png), (AsyncReferenceHandleUnloadType)2).WaitForCompletion(), new Color(1f, 0.2f, 0f));
			Assets.AddScepterToBoostFlash(scepterWungusBoostFlash);
			CreateScepterWungusBoost();
			ItemBase<AncientScepterItem>.instance.RegisterScepterSkill((SkillDef)(object)scepterWungusBoost, "SonicTheHedgehog", (SkillDef)(object)SkillDefs.wungusBoost);
		}

		private static void CreateScepterWungusBoost()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			scepterWungusBoost = Helpers.CopyBoostSkillDef<RequiresFormBoostSkillDef>(SkillDefs.wungusBoost);
			((SkillDef)scepterWungusBoost).skillName = "DS_GAMING_BUNGUS_SUPER_FORMS_UTILITY_WUNGUS_BOOST_NAME";
			((SkillDef)scepterWungusBoost).skillNameToken = "DS_GAMING_BUNGUS_SUPER_FORMS_UTILITY_WUNGUS_BOOST_NAME";
			((SkillDef)scepterWungusBoost).skillDescriptionToken = "DS_GAMING_BUNGUS_SUPER_FORMS_UTILITY_WUNGUS_BOOST_DESCRIPTION";
			((SkillDef)scepterWungusBoost).icon = Assets.mainAssetBundle.LoadAsset<Sprite>("texWungusBoostIcon");
			scepterWungusBoost.requiredForm = FormDefs.wungusSuperFormDef;
			((SkillDef)scepterWungusBoost).activationState = new SerializableEntityStateType(typeof(ScepterWungusBoost));
		}
	}
	public static class Assets
	{
		private const string assetbundleName = "bungussuperformsbundle";

		private const string dllName = "BungusSuperFormsMod.dll";

		internal static AssetBundle mainAssetBundle;

		public static GameObject bungusAura;

		public static Material bungusSuperFormOverlay;

		public static Material bungusOutlineOverlay;

		public static GameObject wungusAura;

		public static Material wungusSuperFormOverlay;

		public static Material wungusOutlineOverlay;

		public static GameObject wungusBoostFlash;

		public static GameObject wungusBoostAura;

		public static void Initialize()
		{
			LoadAssetBundle();
			CreateMaterials();
			CreateAuras();
		}

		internal static void LoadAssetBundle()
		{
			try
			{
				if ((Object)(object)mainAssetBundle == (Object)null)
				{
					mainAssetBundle = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("BungusSuperFormsMod.dll", "bungussuperformsbundle"));
				}
			}
			catch (Exception ex)
			{
				Log.Error("Failed to load assetbundle. Make sure your assetbundle name is setup correctly\n" + ex);
			}
		}

		public static void CreateMaterials()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//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_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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_008e: 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_00dc: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Expected O, but got Unknown
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: 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_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: 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_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			bungusSuperFormOverlay = new Material(Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/EliteVoid/matEliteVoidOverlay.mat").WaitForCompletion());
			bungusSuperFormOverlay.SetTexture("_RemapTex", Addressables.LoadAssetAsync<Texture>((object)"RoR2/Base/Common/ColorRamps/texRampLoaderSwing.png").WaitForCompletion());
			bungusSuperFormOverlay.SetFloat("_AlphaBoost", 4f);
			bungusOutlineOverlay = new Material(Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/LunarGolem/matLunarGolemShield.mat").WaitForCompletion());
			bungusOutlineOverlay.SetColor("_TintColor", new Color(0.25f, 1f, 0.6f, 1f));
			bungusOutlineOverlay.SetColor("_EmissionColor", new Color(0.25f, 1f, 0.6f, 0.5f));
			bungusOutlineOverlay.SetFloat("_OffsetAmount", 0.01f);
			wungusSuperFormOverlay = new Material(Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/EliteVoid/matEliteVoidOverlay.mat").WaitForCompletion());
			wungusOutlineOverlay = new Material(bungusOutlineOverlay);
			wungusOutlineOverlay.SetColor("_TintColor", new Color(0.9f, 0.1f, 0.75f, 1f));
			wungusOutlineOverlay.SetColor("_EmissionColor", new Color(0.9f, 0.1f, 0.75f, 0.5f));
			wungusBoostAura = Assets.CreateBoostAuraEffect("DS_GAMING_BUNGUS_SUPER_FORMS_WUNGUS_BOOST_AURA", AssetAsyncReferenceManager<Texture>.LoadAsset(new AssetReferenceT<Texture>(RoR2_DLC1_VoidSurvivor.texRampVoidSurvivorBase1_png), (AsyncReferenceHandleUnloadType)2).WaitForCompletion(), new Color(0.9f, 0.1f, 1f));
			wungusBoostFlash = Assets.CreateBoostFlashEffect("DS_GAMING_BUNGUS_SUPER_FORMS_WUNGUS_BOOST_FLASH", AssetAsyncReferenceManager<Texture>.LoadAsset(new AssetReferenceT<Texture>(RoR2_DLC1_VoidSurvivor.texRampVoidSurvivorBase1_png), (AsyncReferenceHandleUnloadType)2).WaitForCompletion(), new Color(0.9f, 0.1f, 1f));
		}

		public static void CreateAuras()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			bungusAura = Assets.CreateSuperAura("BungusAura", new Color(0.1f, 1f, 0.5f));
			AsyncOperationHandle<Texture> val = AssetAsyncReferenceManager<Texture>.LoadAsset(new AssetReferenceT<Texture>(RoR2_DLC1_VoidSurvivor.texRampVoidSurvivorBase1_png), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<Texture> x)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				wungusAura = Assets.CreateSuperAura("WungusAura", new Color(0.8f, 0.4f, 0.8f), x.Result);
			};
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.ds_gaming.BungusSuperForms", "BungusSuperForms", "2.0.0")]
	public class BungusSuperFormsPlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "com.ds_gaming.BungusSuperForms";

		public const string PluginAuthor = "ds_gaming";

		public const string PluginName = "BungusSuperForms";

		public const string PluginVersion = "2.0.0";

		public const string Prefix = "DS_GAMING_BUNGUS_SUPER_FORMS_";

		public static bool sonicModLoaded;

		public static bool ancientScepterLoaded;

		public void Awake()
		{
			sonicModLoaded = Chainloader.PluginInfos.ContainsKey("com.ds_gaming.SonicTheHedgehog");
			ancientScepterLoaded = Chainloader.PluginInfos.ContainsKey("com.DestroyedClone.AncientScepter");
			Log.Init(((BaseUnityPlugin)this).Logger);
			Assets.Initialize();
			FormBuffs.RegisterBuffs();
			FormDefs.Initialize();
			SkillDefs.Initialize();
			Stats.Initialize();
			Language.Initialize();
			States.RegisterStates();
			new ContentPacks().Initialize();
		}
	}
	public static class FormBuffs
	{
		internal static BuffDef bungusFormBuff;

		internal static BuffDef wungusFormBuff;

		internal static BuffDef wungusBoostBuff;

		internal static void RegisterBuffs()
		{
			//IL_0024: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			bungusFormBuff = AddNewBuff("bdBungusForm", Assets.mainAssetBundle.LoadAsset<Sprite>("texBungusBuffIcon"), new Color(0.1f, 1f, 0.5f), canStack: false, isDebuff: false);
			wungusFormBuff = AddNewBuff("bdWungusForm", Assets.mainAssetBundle.LoadAsset<Sprite>("texWungusBuffIcon"), new Color(0.8f, 0.4f, 0.8f), canStack: false, isDebuff: false);
			wungusBoostBuff = AddNewBuff("bdWungusBoost", LegacyResourcesAPI.Load<BuffDef>("BuffDefs/CloakSpeed").iconSprite, new Color(0.8f, 0.4f, 0.8f), canStack: false, isDebuff: false);
		}

		internal static BuffDef AddNewBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
			((Object)val).name = buffName;
			val.buffColor = buffColor;
			val.canStack = canStack;
			val.isDebuff = isDebuff;
			val.eliteDef = null;
			val.iconSprite = buffIcon;
			Content.AddBuffDef(val);
			return val;
		}
	}
	public static class FormDefs
	{
		public static FormDef bungusSuperFormDef;

		public static FormDef wungusSuperFormDef;

		public static void Initialize()
		{
			//IL_0021: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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)
			bungusSuperFormDef = Forms.CreateFormDef("DS_GAMING_BUNGUS_SUPER_FORMS_BUNGUS_SUPER_FORM", FormBuffs.bungusFormBuff, 30f, true, false, false, 1, false, false, false, new SerializableEntityStateType(typeof(BungusState)), new SerializableEntityStateType(typeof(TransformationAnimation)), (Dictionary<SkinDef, RenderReplacements>)null, typeof(FormHandler), new AllowedBodyList
			{
				whitelist = false,
				bodyNames = Array.Empty<string>()
			}, (KeyCode)98);
			wungusSuperFormDef = Forms.CreateFormDef("DS_GAMING_BUNGUS_SUPER_FORMS_WUNGUS_SUPER_FORM", FormBuffs.wungusFormBuff, 30f, true, false, false, 1, false, true, true, new SerializableEntityStateType(typeof(WungusState)), default(SerializableEntityStateType), (Dictionary<SkinDef, RenderReplacements>)null, typeof(FormHandler), new AllowedBodyList
			{
				whitelist = false,
				bodyNames = Array.Empty<string>()
			}, (KeyCode)98);
			FormCatalog.AddFormDefs((FormDef[])(object)new FormDef[2] { bungusSuperFormDef, wungusSuperFormDef });
			if (BungusSuperFormsPlugin.sonicModLoaded)
			{
				CreateSonicRenderDictionary();
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static void CreateSonicRenderDictionary()
		{
			//IL_000d: 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)
			wungusSuperFormDef.AddSkinForForm("DS_GAMING_SONIC_THE_HEDGEHOG_DEFAULT_SKIN", new RenderReplacements
			{
				rendererInfo = null,
				mesh = (Mesh[])(object)new Mesh[1] { Assets.superSonicMesh }
			});
		}

		[SystemInitializer(new Type[] { typeof(ItemCatalog) })]
		public static void InitializeFormItemRequirements()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			bungusSuperFormDef.neededItems = (NeededItem[])(object)new NeededItem[1]
			{
				new NeededItem
				{
					item = Items.Mushroom.itemIndex,
					count = 7
				}
			};
			wungusSuperFormDef.neededItems = (NeededItem[])(object)new NeededItem[1]
			{
				new NeededItem
				{
					item = Items.MushroomVoid.itemIndex,
					count = 7
				}
			};
		}
	}
	public static class Language
	{
		public static void Initialize()
		{
			LanguageAPI.Add("DS_GAMING_BUNGUS_SUPER_FORMS_BUNGUS_SUPER_FORM", "Bungus");
			LanguageAPI.Add("DS_GAMING_BUNGUS_SUPER_FORMS_BUNGUS_SUPER_FORM_PREFIX", "Bustling {0}");
			LanguageAPI.Add("DS_GAMING_BUNGUS_SUPER_FORMS_WUNGUS_SUPER_FORM", "Wungus");
			LanguageAPI.Add("DS_GAMING_BUNGUS_SUPER_FORMS_WUNGUS_SUPER_FORM_PREFIX", "Weeping {0}");
			LanguageAPI.Add("DS_GAMING_BUNGUS_SUPER_FORMS_UTILITY_WUNGUS_BOOST_NAME", "Weeping Boost");
			LanguageAPI.Add("DS_GAMING_BUNGUS_SUPER_FORMS_UTILITY_WUNGUS_BOOST_DESCRIPTION", "<style=cIsUtility>Move 65% faster</style> than normal.");
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

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

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

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

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

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

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

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	public static class SkillDefs
	{
		public static RequiresFormBoostSkillDef wungusBoost;

		public static void Initialize()
		{
			if (BungusSuperFormsPlugin.sonicModLoaded)
			{
				CreateSonicWungusBoost();
			}
		}

		private static void CreateSonicWungusBoost()
		{
			//IL_0065: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			wungusBoost = Helpers.CopyBoostSkillDef<RequiresFormBoostSkillDef>(SonicTheHedgehogCharacter.boostSkillDef);
			((SkillDef)wungusBoost).skillName = "DS_GAMING_BUNGUS_SUPER_FORMS_UTILITY_WUNGUS_BOOST_NAME";
			((SkillDef)wungusBoost).skillNameToken = "DS_GAMING_BUNGUS_SUPER_FORMS_UTILITY_WUNGUS_BOOST_NAME";
			((SkillDef)wungusBoost).skillDescriptionToken = "DS_GAMING_BUNGUS_SUPER_FORMS_UTILITY_WUNGUS_BOOST_DESCRIPTION";
			((SkillDef)wungusBoost).icon = Assets.mainAssetBundle.LoadAsset<Sprite>("texWungusBoostIcon");
			((SkillDef)wungusBoost).activationState = new SerializableEntityStateType(typeof(WungusBoost));
			wungusBoost.requiredForm = FormDefs.wungusSuperFormDef;
			((BoostSkillDef)wungusBoost).boostHUDColor = new Color(0.8f, 0.4f, 0.8f);
			if (BungusSuperFormsPlugin.ancientScepterLoaded)
			{
				AncientScepter.Initialize();
			}
		}
	}
	public class SkillReplacer : MonoBehaviour
	{
		private FormComponent formComponent;

		private CharacterBody body;

		[SystemInitializer(new Type[] { typeof(BodyCatalog) })]
		internal static void AddSkillReplacerComponent()
		{
			if (BungusSuperFormsPlugin.sonicModLoaded)
			{
				BodyCatalog.FindBodyPrefab("SonicTheHedgehog").AddComponent<SkillReplacer>();
			}
		}

		public void Start()
		{
			formComponent = ((Component)this).GetComponent<FormComponent>();
			if (Object.op_Implicit((Object)(object)formComponent))
			{
				body = ((Component)this).GetComponent<CharacterBody>();
				formComponent.OnFormChanged += FormChanged;
			}
			else
			{
				Object.Destroy((Object)(object)this);
			}
		}

		public void OnDestroy()
		{
			formComponent.OnFormChanged -= FormChanged;
		}

		public void FormChanged(FormDef previous, FormDef active)
		{
			if (Util.HasEffectiveAuthority(((Component)this).gameObject) && (Object)(object)active == (Object)(object)FormDefs.wungusSuperFormDef)
			{
				SkillOverrides();
			}
		}

		public void SkillOverrides()
		{
			if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.skillLocator) && Object.op_Implicit((Object)(object)body.skillLocator.utility) && (Object)(object)body.skillLocator.utility.baseSkill == (Object)(object)SonicTheHedgehogCharacter.boostSkillDef)
			{
				body.skillLocator.utility.SetSkillOverride((object)this, (SkillDef)(object)SkillDefs.wungusBoost, (SkillOverridePriority)2);
			}
		}
	}
	public static class States
	{
		internal static void RegisterStates()
		{
			Content.AddEntityState(typeof(BungusState));
			Content.AddEntityState(typeof(WungusState));
			Content.AddEntityState(typeof(TransformationAnimation));
			if (BungusSuperFormsPlugin.sonicModLoaded)
			{
				RegisterSonicStates();
				if (BungusSuperFormsPlugin.ancientScepterLoaded)
				{
					RegisterScepterStates();
				}
			}
		}

		internal static void RegisterSonicStates()
		{
			Content.AddEntityState(typeof(WungusBoost));
		}

		internal static void RegisterScepterStates()
		{
			Content.AddEntityState(typeof(ScepterWungusBoost));
		}
	}
	public static class Stats
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static StatHookEventHandler <0>__RecalculateStats;

			public static hook_RecalculateStats <1>__RecalcStatAPIDoesntHaveAcceleration;
		}

		public static void Initialize()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			object obj = <>O.<0>__RecalculateStats;
			if (obj == null)
			{
				StatHookEventHandler val = RecalculateStats;
				<>O.<0>__RecalculateStats = val;
				obj = (object)val;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj;
			object obj2 = <>O.<1>__RecalcStatAPIDoesntHaveAcceleration;
			if (obj2 == null)
			{
				hook_RecalculateStats val2 = RecalcStatAPIDoesntHaveAcceleration;
				<>O.<1>__RecalcStatAPIDoesntHaveAcceleration = val2;
				obj2 = (object)val2;
			}
			CharacterBody.RecalculateStats += (hook_RecalculateStats)obj2;
		}

		public static void RecalculateStats(CharacterBody self, StatHookEventArgs stats)
		{
			if (self.HasBuff(FormBuffs.bungusFormBuff))
			{
				stats.moveSpeedReductionMultAdd += 0.5f;
				stats.armorAdd += 200f;
				stats.healthMultAdd += 1f;
				if (Object.op_Implicit((Object)(object)self.inventory))
				{
					stats.damageMultAdd += 0.06f * (float)self.inventory.GetItemCount(Items.Mushroom);
				}
			}
			if (self.HasBuff(FormBuffs.wungusFormBuff))
			{
				stats.sprintSpeedAdd += 0.5f;
				stats.healthMultAdd += 1f;
				if (Object.op_Implicit((Object)(object)self.inventory))
				{
					stats.damageMultAdd += 0.04f * (float)self.inventory.GetItemCount(Items.MushroomVoid);
				}
			}
			if (self.HasBuff(FormBuffs.wungusBoostBuff))
			{
				BoostLogic.BoostStats(self, stats, 0.65f);
				stats.armorAdd += 50f;
			}
		}

		private static void RecalcStatAPIDoesntHaveAcceleration(orig_RecalculateStats orig, CharacterBody self)
		{
			orig.Invoke(self);
			if (self.HasBuff(FormBuffs.wungusFormBuff))
			{
				self.acceleration *= 3f;
			}
		}
	}
}
namespace BungusSuperFormsMod.MyEntityStates
{
	public class BungusState : FormStateBase
	{
		private TemporaryOverlayInstance temporaryOverlay;

		private GameObject aura;

		public override void OnEnter()
		{
			((FormStateBase)this).OnEnter();
			((FormStateBase)this).Heal(1f);
			((FormStateBase)this).ApplyOverlay(ref temporaryOverlay, Assets.bungusSuperFormOverlay);
			((FormStateBase)this).Flash(0.5f);
			Transform val = ((BaseState)this).FindModelChild("Chest");
			if (Object.op_Implicit((Object)(object)val))
			{
				aura = Object.Instantiate<GameObject>(Assets.bungusAura, val);
			}
		}

		public override void OnExit()
		{
			((FormStateBase)this).RemoveOverlay(ref temporaryOverlay);
			((FormStateBase)this).Flash(0.5f);
			if (Object.op_Implicit((Object)(object)aura))
			{
				EntityState.Destroy((Object)(object)aura);
			}
			((FormStateBase)this).OnExit();
		}

		public override void FixedUpdate()
		{
			((FormStateBase)this).FixedUpdate();
		}
	}
	public class ScepterWungusBoost : ScepterBoostBase
	{
		protected override BuffDef buff => FormBuffs.wungusBoostBuff;

		public override GameObject GetFlashPrefab()
		{
			return AncientScepter.scepterWungusBoostFlash;
		}

		public override GameObject GetAuraPrefab()
		{
			return AncientScepter.scepterWungusBoostAura;
		}

		public override Material GetOverlayMaterial()
		{
			return null;
		}
	}
	public class TransformationAnimation : GenericTransformationBase
	{
		private static float cameraDistance = -7f;

		private CharacterCameraParamsData cameraParams = new CharacterCameraParamsData
		{
			maxPitch = BlendableFloat.op_Implicit(70f),
			minPitch = BlendableFloat.op_Implicit(-70f),
			pivotVerticalOffset = BlendableFloat.op_Implicit(0.5f),
			idealLocalCameraPos = BlendableVector3.op_Implicit(new Vector3(0f, 0f, cameraDistance)),
			wallCushion = BlendableFloat.op_Implicit(0.1f)
		};

		private CameraParamsOverrideHandle camOverrideHandle;

		protected override float duration => 1.4f;

		protected override float transformationDurationPercent => 0.5f;

		public override void OnEnter()
		{
			//IL_002c: 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_004b: 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)
			((GenericTransformationBase)this).OnEnter();
			if (((TransformationBase)this).fromTeamSuper || ((EntityState)this).isAuthority)
			{
			}
			camOverrideHandle = ((EntityState)this).cameraTargetParams.AddParamsOverride(new CameraParamsOverrideRequest
			{
				cameraParamsData = cameraParams,
				priority = 1f
			}, ((GenericTransformationBase)this).duration / 2f);
		}

		public override void Transform()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			((GenericTransformationBase)this).Transform();
			Util.PlaySound("Play_hedgehogutils_super_transform", ((EntityState)this).gameObject);
			((EntityState)this).cameraTargetParams.RemoveParamsOverride(camOverrideHandle, 0.2f);
		}
	}
	public class WungusBoost : Boost
	{
		protected override BuffDef buff => FormBuffs.wungusBoostBuff;

		public override void OnEnter()
		{
			((Boost)this).OnEnter();
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				((EntityState)this).modelLocator.normalizeToFloor = true;
			}
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				((EntityState)this).modelLocator.normalizeToFloor = false;
			}
			((Boost)this).OnExit();
		}

		public override GameObject GetFlashPrefab()
		{
			return Assets.wungusBoostFlash;
		}

		public override GameObject GetAuraPrefab()
		{
			return Assets.wungusBoostAura;
		}

		public override Material GetOverlayMaterial()
		{
			return null;
		}
	}
	public class WungusState : FormStateBase
	{
		private TemporaryOverlayInstance temporaryOverlay;

		private GameObject aura;

		protected BoostLogic boostLogic;

		public override void OnEnter()
		{
			((FormStateBase)this).OnEnter();
			Util.PlaySound("Play_item_void_critGlasses", ((EntityState)this).gameObject);
			((FormStateBase)this).Heal(1f);
			((FormStateBase)this).ApplyOverlay(ref temporaryOverlay, Assets.wungusSuperFormOverlay);
			((FormStateBase)this).Flash(0.5f);
			Transform val = ((BaseState)this).FindModelChild("Chest");
			if (Object.op_Implicit((Object)(object)val))
			{
				aura = Object.Instantiate<GameObject>(Assets.wungusAura, val);
			}
			boostLogic = ((EntityState)this).GetComponent<BoostLogic>();
			if (Object.op_Implicit((Object)(object)boostLogic))
			{
				boostLogic.alwaysMaxBoost = true;
			}
		}

		public override void OnExit()
		{
			((FormStateBase)this).RemoveOverlay(ref temporaryOverlay);
			if (Object.op_Implicit((Object)(object)aura))
			{
				EntityState.Destroy((Object)(object)aura);
			}
			((FormStateBase)this).Flash(0.5f);
			if (Object.op_Implicit((Object)(object)boostLogic))
			{
				boostLogic.alwaysMaxBoost = false;
			}
			((FormStateBase)this).OnExit();
		}

		public override void FixedUpdate()
		{
			((FormStateBase)this).FixedUpdate();
		}
	}
}
namespace BungusSuperFormsMod.Internal
{
	internal class ContentPacks : IContentPackProvider
	{
		internal ContentPack contentPack = new ContentPack();

		public static List<GameObject> bodyPrefabs = new List<GameObject>();

		public static List<GameObject> masterPrefabs = new List<GameObject>();

		public static List<GameObject> projectilePrefabs = new List<GameObject>();

		public static List<GameObject> networkedObjectPrefabs = new List<GameObject>();

		public static List<SurvivorDef> survivorDefs = new List<SurvivorDef>();

		public static List<UnlockableDef> unlockableDefs = new List<UnlockableDef>();

		public static List<SkillFamily> skillFamilies = new List<SkillFamily>();

		public static List<SkillDef> skillDefs = new List<SkillDef>();

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

		public static List<BuffDef> buffDefs = new List<BuffDef>();

		public static List<EffectDef> effectDefs = new List<EffectDef>();

		public static List<ItemTierDef> itemTierDefs = new List<ItemTierDef>();

		public static List<ItemDef> itemDefs = new List<ItemDef>();

		public static List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>();

		public string identifier => "com.ds_gaming.BungusSuperForms";

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

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

		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			contentPack.identifier = identifier;
			contentPack.bodyPrefabs.Add(bodyPrefabs.ToArray());
			contentPack.masterPrefabs.Add(masterPrefabs.ToArray());
			contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray());
			contentPack.networkedObjectPrefabs.Add(networkedObjectPrefabs.ToArray());
			contentPack.survivorDefs.Add(survivorDefs.ToArray());
			contentPack.unlockableDefs.Add(unlockableDefs.ToArray());
			contentPack.skillDefs.Add(skillDefs.ToArray());
			contentPack.skillFamilies.Add(skillFamilies.ToArray());
			contentPack.entityStateTypes.Add(entityStates.ToArray());
			contentPack.buffDefs.Add(buffDefs.ToArray());
			contentPack.effectDefs.Add(effectDefs.ToArray());
			contentPack.itemTierDefs.Add(itemTierDefs.ToArray());
			contentPack.itemDefs.Add(itemDefs.ToArray());
			contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray());
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			ContentPack.Copy(contentPack, args.output);
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			args.ReportProgress(1f);
			yield break;
		}
	}
	internal class Content
	{
		public static void AddCharacterBodyPrefab(GameObject bprefab)
		{
			ContentPacks.bodyPrefabs.Add(bprefab);
		}

		public static void AddMasterPrefab(GameObject prefab)
		{
			ContentPacks.masterPrefabs.Add(prefab);
		}

		public static void AddProjectilePrefab(GameObject prefab)
		{
			ContentPacks.projectilePrefabs.Add(prefab);
		}

		public static void AddNetworkedObjectPrefab(GameObject prefab)
		{
			ContentPacks.networkedObjectPrefabs.Add(prefab);
		}

		public static void AddSurvivorDef(SurvivorDef survivorDef)
		{
			ContentPacks.survivorDefs.Add(survivorDef);
		}

		public static void AddUnlockableDef(UnlockableDef unlockableDef)
		{
			ContentPacks.unlockableDefs.Add(unlockableDef);
		}

		public static void AddSkillDef(SkillDef skillDef)
		{
			ContentPacks.skillDefs.Add(skillDef);
		}

		public static void AddSkillFamily(SkillFamily skillFamily)
		{
			ContentPacks.skillFamilies.Add(skillFamily);
		}

		public static void AddEntityState(Type entityState)
		{
			ContentPacks.entityStates.Add(entityState);
		}

		public static void AddBuffDef(BuffDef buffDef)
		{
			ContentPacks.buffDefs.Add(buffDef);
		}

		public static void AddEffectDef(EffectDef effectDef)
		{
			ContentPacks.effectDefs.Add(effectDef);
		}

		public static void AddItemDef(ItemDef itemDef)
		{
			ContentPacks.itemDefs.Add(itemDef);
		}

		public static void AddItemTierDef(ItemTierDef itemDef)
		{
			ContentPacks.itemTierDefs.Add(itemDef);
		}

		public static void AddNetworkSoundEventDef(NetworkSoundEventDef networkSoundEventDef)
		{
			ContentPacks.networkSoundEventDefs.Add(networkSoundEventDef);
		}
	}
}