Decompiled source of PepsimanSurvivor v1.0.1

plugins/PepsimanSurvivor/PepsimanSurvivor.dll

Decompiled 2 days 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.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using HG.BlendableTypes;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.ConVar;
using RoR2.ContentManagement;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI.MainMenu;
using RoR2BepInExPack.GameAssetPathsBetter;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PepsimanSurvivor")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PepsimanSurvivor")]
[assembly: AssemblyTitle("PepsimanSurvivor")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 PepsimanSurvivor
{
	internal static class Log
	{
		private static ManualLogSource source;

		internal static void Init(ManualLogSource s)
		{
			source = s;
		}

		internal static void Info(object d)
		{
			ManualLogSource obj = source;
			if (obj != null)
			{
				obj.LogInfo(d);
			}
		}

		internal static void Warning(object d)
		{
			ManualLogSource obj = source;
			if (obj != null)
			{
				obj.LogWarning(d);
			}
		}

		internal static void Error(object d)
		{
			ManualLogSource obj = source;
			if (obj != null)
			{
				obj.LogError(d);
			}
		}
	}
	internal static class PepsiConfig
	{
		internal static ConfigEntry<bool> AbsurdMode;

		internal static ConfigEntry<bool> ShowHud;

		internal static ConfigEntry<bool> Music;

		internal static ConfigEntry<bool> MuteGameMusic;

		internal static bool Testing;

		internal static ConfigEntry<float> MusicVolume;

		internal static ConfigEntry<float> ModelScale;

		internal static ConfigEntry<float> LobbyScale;

		internal static ConfigEntry<float> AttackSpeed;

		internal static ConfigEntry<float> MeterPerHit;

		internal static float S => ModelScale.Value;

		internal static float SA => 1f + (ModelScale.Value - 1f) * 0.5f;

		internal static void Init(ConfigFile c)
		{
			AbsurdMode = c.Bind<bool>("Gameplay", "Absurd mode", true, "R-Pepsi Man (Rivals of Aether) mode: no cooldowns, absurd damage. Off = reasonable cooldowns and damage.");
			AttackSpeed = c.Bind<float>("Gameplay", "Animation speed", 1.6f, "Playback speed of the attacks (before attack speed).");
			MeterPerHit = c.Bind<float>("Gameplay", "Super meter per hit", 4f, "Super meter gained per enemy hit (100 = Super Laser ready), more during combos.");
			ShowHud = c.Bind<bool>("Visuals", "Super meter HUD", true, "Show the Super meter above the health bar.");
			Music = c.Bind<bool>("Music", "Pepsiman theme", true, "If a PepsimanMusic.bnk sound bank sits beside the plugin (not included), Pepsiman plays his theme, heard around him.");
			MusicVolume = c.Bind<float>("Music", "Theme volume", 0.6f, "Volume of the Pepsiman theme (0 to 1).");
			MuteGameMusic = c.Bind<bool>("Music", "Mute game music", true, "Silence Risk of Rain 2's own music while the theme plays.");
			ModelScale = c.Bind<float>("Visuals", "Model scale", 2.4f, "Pepsiman size in game (1 = 1.84 m). Hitboxes and effects follow.");
			LobbyScale = c.Bind<float>("Visuals", "Lobby scale", 1f, "Pepsiman size on the character select screen.");
		}

		internal static float Cd(float normal, float absurd = 0.15f)
		{
			if (!AbsurdMode.Value)
			{
				return normal;
			}
			return absurd;
		}

		internal static float Dmg(float normal, float absurdMultiplier = 4f)
		{
			if (!AbsurdMode.Value)
			{
				return normal;
			}
			return normal * absurdMultiplier;
		}
	}
	internal static class Content
	{
		private sealed class Provider : IContentPackProvider
		{
			private readonly ContentPack pack = new ContentPack();

			public string identifier => "com.abyssano78.pepsimansurvivor";

			public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
			{
				pack.identifier = identifier;
				pack.bodyPrefabs.Add(Bodies.ToArray());
				pack.projectilePrefabs.Add(Projectiles.ToArray());
				pack.networkedObjectPrefabs.Add(Networked.ToArray());
				pack.survivorDefs.Add(Survivors.ToArray());
				pack.skillDefs.Add(Skills.ToArray());
				pack.skillFamilies.Add(Families.ToArray());
				pack.entityStateTypes.Add(States.ToArray());
				pack.buffDefs.Add(Buffs.ToArray());
				pack.effectDefs.Add(Effects.ToArray());
				args.ReportProgress(1f);
				yield break;
			}

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

			public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
			{
				args.ReportProgress(1f);
				yield break;
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static CollectContentPackProvidersDelegate <>9__9_0;

			internal void <Register>b__9_0(AddContentPackProviderDelegate add)
			{
				add.Invoke((IContentPackProvider)(object)new Provider());
			}
		}

		internal static readonly List<GameObject> Bodies = new List<GameObject>();

		internal static readonly List<GameObject> Projectiles = new List<GameObject>();

		internal static readonly List<GameObject> Networked = new List<GameObject>();

		internal static readonly List<SurvivorDef> Survivors = new List<SurvivorDef>();

		internal static readonly List<SkillDef> Skills = new List<SkillDef>();

		internal static readonly List<SkillFamily> Families = new List<SkillFamily>();

		internal static readonly List<Type> States = new List<Type>();

		internal static readonly List<BuffDef> Buffs = new List<BuffDef>();

		internal static readonly List<EffectDef> Effects = new List<EffectDef>();

		internal static void Register()
		{
			//IL_0014: 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)
			//IL_001f: Expected O, but got Unknown
			object obj = <>c.<>9__9_0;
			if (obj == null)
			{
				CollectContentPackProvidersDelegate val = delegate(AddContentPackProviderDelegate add)
				{
					add.Invoke((IContentPackProvider)(object)new Provider());
				};
				<>c.<>9__9_0 = val;
				obj = (object)val;
			}
			ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)obj;
		}
	}
	internal static class PepsiAssets
	{
		internal static AssetBundle Bundle;

		internal static GameObject Visual;

		internal static GameObject VendingMachine;

		internal static GameObject PepsiCan;

		internal static GameObject DewCan;

		internal static Material FlowBeam;

		internal static Material FlowDewColumn;

		internal static Material FlowDewRibbon;

		internal static Material Aura;

		internal static readonly List<(string name, Material mat, bool ultimate)> Skins = new List<(string, Material, bool)>();

		internal static readonly string[] SkinNames = new string[15]
		{
			"Pepsi", "Coke", "SevenUp", "MountainDew", "Reverse", "Starbucks", "Fanta", "SierraMist", "Brisk", "Monster",
			"GrapeSoda", "PepsiMax", "Invert", "T1000", "GoldenExperience"
		};

		internal const int FirstUltimate = 11;

		private static Shader hg;

		internal static Shader HG => hg;

		internal static T Load<T>(string key)
		{
			//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)
			return Addressables.LoadAssetAsync<T>((object)key).WaitForCompletion();
		}

		internal static bool Init(string dir)
		{
			string text = Path.Combine(dir, "pepsimanassets");
			if (!File.Exists(text))
			{
				Log.Error("pepsimanassets not found beside the plugin");
				return false;
			}
			Bundle = AssetBundle.LoadFromFile(text);
			if ((Object)(object)Bundle == (Object)null)
			{
				Log.Error("pepsimanassets failed to load");
				return false;
			}
			hg = Load<Shader>(RoR2_Base_Shaders.HGStandard_shader);
			Visual = Bundle.LoadAsset<GameObject>("PepsimanVisual");
			VendingMachine = Bundle.LoadAsset<GameObject>("VendingMachine");
			PepsiCan = Bundle.LoadAsset<GameObject>("PepsiCan");
			DewCan = Bundle.LoadAsset<GameObject>("DewCan");
			FlowBeam = Bundle.LoadAsset<Material>("PepsiFlow_Beam");
			FlowDewColumn = Bundle.LoadAsset<Material>("PepsiFlow_DewColumn");
			FlowDewRibbon = Bundle.LoadAsset<Material>("PepsiFlow_DewRibbon");
			Aura = Bundle.LoadAsset<Material>("PepsiAura_Gold");
			for (int i = 0; i < SkinNames.Length; i++)
			{
				Material val = Bundle.LoadAsset<Material>("PepsimanSkin_" + SkinNames[i]);
				if ((Object)(object)val == (Object)null)
				{
					Log.Warning("skin material missing: " + SkinNames[i]);
				}
				else
				{
					Skins.Add((SkinNames[i], Chrome(val, SkinNames[i]), i >= 11));
				}
			}
			GameObject[] array = (GameObject[])(object)new GameObject[3] { VendingMachine, PepsiCan, DewCan };
			foreach (GameObject val2 in array)
			{
				if ((Object)(object)val2 != (Object)null)
				{
					Renderer[] componentsInChildren = val2.GetComponentsInChildren<Renderer>(true);
					foreach (Renderer obj in componentsInChildren)
					{
						obj.sharedMaterials = Array.ConvertAll(obj.sharedMaterials, Prop);
					}
				}
			}
			Log.Info($"bundle: visual={(Object)(object)Visual != (Object)null} skins={Skins.Count} machine={(Object)(object)VendingMachine != (Object)null} cans={(Object)(object)PepsiCan != (Object)null}/{(Object)(object)DewCan != (Object)null}");
			if ((Object)(object)Visual != (Object)null)
			{
				return Skins.Count > 0;
			}
			return false;
		}

		private static Material Chrome(Material src, string name)
		{
			//IL_0014: 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)
			//IL_002b: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)hg == (Object)null)
			{
				return src;
			}
			Material val = new Material(hg)
			{
				name = "matPepsiman" + name
			};
			val.SetTexture("_MainTex", src.GetTexture("_MainTex"));
			val.SetColor("_Color", Color.white);
			Texture texture = src.GetTexture("_BumpMap");
			if ((Object)(object)texture != (Object)null)
			{
				val.SetTexture("_NormalTex", texture);
				val.SetFloat("_NormalStrength", 0.8f);
			}
			val.SetFloat("_Smoothness", 0.75f);
			val.SetFloat("_SpecularStrength", (name == "T1000" || name == "GoldenExperience") ? 1f : 0.7f);
			val.SetFloat("_SpecularExponent", 9f);
			return val;
		}

		private static Material Prop(Material src)
		{
			//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_0038: 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_0050: 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_0076: 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: Expected O, but got Unknown
			if ((Object)(object)hg == (Object)null || (Object)(object)src == (Object)null)
			{
				return src;
			}
			Material val = new Material(hg)
			{
				name = ((Object)src).name + "HG"
			};
			val.SetTexture("_MainTex", src.mainTexture);
			val.SetColor("_Color", src.color);
			val.SetFloat("_Smoothness", src.GetFloat("_Glossiness") * 0.8f);
			val.SetFloat("_SpecularStrength", 0.5f + src.GetFloat("_Metallic") * 0.5f);
			val.SetFloat("_SpecularExponent", 6f);
			return val;
		}

		internal static Transform FindDeep(Transform t, string name)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			if (((Object)t).name == name)
			{
				return t;
			}
			foreach (Transform item in t)
			{
				Transform val = FindDeep(item, name);
				if ((Object)(object)val != (Object)null)
				{
					return val;
				}
			}
			return null;
		}
	}
	internal sealed class PepsiAnimator : MonoBehaviour
	{
		internal const string Idle = "Base_FightingIdle";

		internal const string Run = "Loco_Run";

		internal const string Sprint = "Base_Sprint";

		private const string JumpUp = "Base_JumpingUp";

		private const string Fall = "Base_FallingIdle";

		private const string Land = "Base_FallingToLanding";

		private CharacterBody body;

		private CharacterMotor motor;

		private Animator animator;

		private string current;

		private float lockedUntil;

		private int air;

		private float airborneFor;

		private Transform propVending;

		private Transform propCan;

		private GameObject machine;

		private GameObject can;

		private float checkAt = -1f;

		internal Animator Animator
		{
			get
			{
				if (!((Object)(object)animator != (Object)null))
				{
					return Resolve();
				}
				return animator;
			}
		}

		internal Transform Model
		{
			get
			{
				if (!((Object)(object)Animator != (Object)null))
				{
					return null;
				}
				return ((Component)animator).transform;
			}
		}

		private Animator Resolve()
		{
			ModelLocator component = ((Component)this).GetComponent<ModelLocator>();
			if ((Object)(object)component != (Object)null && (Object)(object)component.modelTransform != (Object)null)
			{
				animator = ((Component)component.modelTransform).GetComponentInChildren<Animator>(true);
			}
			if ((Object)(object)animator != (Object)null)
			{
				propVending = ((Component)animator).transform.Find("prop_vending");
				propCan = ((Component)animator).transform.Find("prop_can");
			}
			return animator;
		}

		private void Awake()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
			motor = ((Component)this).GetComponent<CharacterMotor>();
			Resolve();
		}

		internal float ClipLength(string state)
		{
			Animator val = Animator;
			if ((Object)(object)val == (Object)null || (Object)(object)val.runtimeAnimatorController == (Object)null)
			{
				return 0f;
			}
			AnimationClip[] animationClips = val.runtimeAnimatorController.animationClips;
			foreach (AnimationClip val2 in animationClips)
			{
				if (((Object)val2).name == state)
				{
					return val2.length;
				}
			}
			return 0f;
		}

		internal void PlayAction(string state, float startSeconds, float speed, float lockSeconds, float fade = 0.08f)
		{
			if (!((Object)(object)Animator == (Object)null))
			{
				animator.speed = 1f;
				air = 0;
				animator.SetFloat("ActionSpeed", speed);
				animator.CrossFadeInFixedTime(state, fade, 0, startSeconds / Mathf.Max(0.01f, speed));
				current = state;
				lockedUntil = Time.time + lockSeconds;
				if (PepsiConfig.Testing)
				{
					Log.Info($"[anim] play {state} at {startSeconds:F2} x{speed:F2} lock {lockSeconds:F2} has={animator.HasState(0, Animator.StringToHash(state))}");
					checkAt = Time.time + 0.12f;
				}
			}
		}

		internal void Release()
		{
			lockedUntil = 0f;
			current = null;
			air = 0;
		}

		private bool Jump()
		{
			bool flag = (Object)(object)motor == (Object)null || motor.isGrounded;
			airborneFor = (flag ? 0f : (airborneFor + Time.deltaTime));
			if (air == 0)
			{
				if (airborneFor < 0.1f)
				{
					return false;
				}
				bool flag2 = (Object)(object)motor != (Object)null && motor.velocity.y > 1f;
				if (flag2)
				{
					PepsiSound.Play("jump", ((Component)this).gameObject);
				}
				Cross(flag2 ? "Base_JumpingUp" : "Base_FallingIdle", 1f, 0.08f);
				air = (flag2 ? 1 : 2);
				return true;
			}
			if (!flag)
			{
				if (air == 1 && (current != "Base_JumpingUp" || motor.velocity.y < 2f))
				{
					Cross("Base_FallingIdle", 1f, 0.2f);
					air = 2;
				}
				return true;
			}
			air = 0;
			PepsiSound.Play("land", ((Component)this).gameObject);
			Cross("Base_FallingToLanding", 1.6f, 0.06f, 0.15f);
			lockedUntil = Time.time + 0.3f;
			return true;
		}

		private void Cross(string state, float speed, float fade, float start = 0f)
		{
			animator.speed = 1f;
			animator.SetFloat("ActionSpeed", speed);
			animator.CrossFadeInFixedTime(state, fade, 0, start / Mathf.Max(0.01f, speed));
			current = state;
		}

		private void Update()
		{
			//IL_0043: 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_0051: 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_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			if (checkAt > 0f && Time.time >= checkAt && (Object)(object)Animator != (Object)null)
			{
				checkAt = -1f;
				AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
				AnimatorStateInfo nextAnimatorStateInfo = animator.GetNextAnimatorStateInfo(0);
				Log.Info(string.Format("[anim] now: wanted {0} cur={1} next={2} t={3:F2} speed={4:F2} actionSpeed={5:F2}", current, ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName(current ?? "") ? "yes" : "no", ((AnimatorStateInfo)(ref nextAnimatorStateInfo)).IsName(current ?? "") ? "yes" : "no", ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime, animator.speed, animator.GetFloat("ActionSpeed")));
			}
			UpdateProps();
			if (!((Object)(object)Animator == (Object)null) && !((Object)(object)body == (Object)null) && !(Time.time < lockedUntil) && !Jump())
			{
				Vector3 val = (((Object)(object)motor != (Object)null) ? motor.velocity : Vector3.zero);
				val.y = 0f;
				float num = (Object.op_Implicit((Object)(object)Model) ? Model.lossyScale.x : 1f);
				float magnitude = ((Vector3)(ref val)).magnitude;
				float num2 = 1f;
				string text;
				if (magnitude < 0.3f)
				{
					text = "Base_FightingIdle";
				}
				else if (body.isSprinting)
				{
					text = "Base_Sprint";
					num2 = Mathf.Clamp(magnitude / (7f * num), 0.9f, 2f);
				}
				else
				{
					text = "Loco_Run";
					num2 = Mathf.Clamp(magnitude / (5f * num), 0.85f, 1.8f);
				}
				animator.speed = ((text == "Base_FightingIdle") ? 1f : num2);
				if (!(text == current))
				{
					animator.SetFloat("ActionSpeed", 1f);
					animator.CrossFadeInFixedTime(text, 0.15f, 0);
					current = text;
				}
			}
		}

		private void UpdateProps()
		{
			if (!((Object)(object)Animator == (Object)null))
			{
				Follow(propVending, ref machine, PepsiAssets.VendingMachine, current == "Custom_VendingSlam");
				Follow(propCan, ref can, PepsiAssets.PepsiCan, current == "Custom_Puddle" || current == "Custom_PepsiBreak");
			}
		}

		private void Follow(Transform attach, ref GameObject obj, GameObject prefab, bool allowed)
		{
			//IL_0018: 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_0077: 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_00ad: 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)
			if ((Object)(object)attach == (Object)null || (Object)(object)prefab == (Object)null)
			{
				return;
			}
			bool flag = allowed && attach.localScale.x > 0.5f && Time.time < lockedUntil;
			if (flag && (Object)(object)obj == (Object)null)
			{
				obj = Object.Instantiate<GameObject>(prefab);
			}
			if (!((Object)(object)obj == (Object)null))
			{
				if (obj.activeSelf != flag)
				{
					obj.SetActive(flag);
				}
				if (flag)
				{
					obj.transform.SetPositionAndRotation(attach.position, attach.rotation);
				}
				obj.transform.localScale = Vector3.one * (Object.op_Implicit((Object)(object)Model) ? Model.lossyScale.x : 1f);
			}
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)machine))
			{
				Object.Destroy((Object)(object)machine);
			}
			if (Object.op_Implicit((Object)(object)can))
			{
				Object.Destroy((Object)(object)can);
			}
		}
	}
	internal sealed class PepsiLobbyAnim : MonoBehaviour
	{
		private static readonly string[] Gestures = new string[3] { "Lobby_MutantFlexing", "Lobby_Victory", "Lobby_Laughing" };

		private static readonly string[] Bored = new string[3] { "Lobby_Bored", "Lobby_Yawn", "Custom_PointingAtWrist" };

		private Animator a;

		private float next;

		private float shoutAt = -1f;

		private float screechAt = -1f;

		private float boomAt = -1f;

		private int i;

		private Renderer main;

		private Material lastMat;

		private void OnEnable()
		{
			a = ((Component)this).GetComponent<Animator>();
			main = (Renderer)(object)((Component)this).GetComponentInChildren<SkinnedMeshRenderer>(true);
			lastMat = null;
			shoutAt = Time.time + 0.15f;
			if (!((Object)(object)a == (Object)null))
			{
				a.SetFloat("ActionSpeed", 1f);
				a.Play(Gestures[Random.Range(0, Gestures.Length)], 0, 0f);
				next = Time.time + 3.5f;
			}
		}

		private void Shout(string s)
		{
			if (AkSoundEngine.PostEvent("Play_Pepsi_" + s, ((Component)this).gameObject) == 0)
			{
				Log.Warning("lobby sound failed: " + s);
			}
		}

		private void Update()
		{
			if (shoutAt > 0f && Time.time >= shoutAt)
			{
				shoutAt = -1f;
				Shout("selected");
			}
			Material val = (Object.op_Implicit((Object)(object)main) ? main.sharedMaterial : null);
			if ((Object)(object)val != (Object)(object)lastMat)
			{
				bool flag = (Object)(object)lastMat == (Object)null;
				lastMat = val;
				bool num = (Object)(object)val != (Object)null && (((Object)val).name.Contains("PepsiMax") || ((Object)val).name.Contains("Invert") || ((Object)val).name.Contains("T1000") || ((Object)val).name.Contains("GoldenExperience"));
				if (!flag)
				{
					shoutAt = Time.time + 0.05f;
				}
				if (num)
				{
					screechAt = Time.time + 0.25f;
					boomAt = Time.time + 0.6f;
				}
			}
			if (screechAt > 0f && Time.time >= screechAt)
			{
				screechAt = -1f;
				Shout("screech");
			}
			if (boomAt > 0f && Time.time >= boomAt)
			{
				boomAt = -1f;
				Shout("explosionshake");
			}
			if ((Object)(object)a == (Object)null || Time.time < next)
			{
				return;
			}
			string text = Bored[this.i++ % Bored.Length];
			a.CrossFadeInFixedTime(text, 0.3f, 0);
			float num2 = 4f;
			AnimationClip[] animationClips = a.runtimeAnimatorController.animationClips;
			foreach (AnimationClip val2 in animationClips)
			{
				if (((Object)val2).name == text)
				{
					num2 = val2.length;
				}
			}
			next = Time.time + Mathf.Max(3f, num2);
		}
	}
	public class PepsiDeath : GenericCharacterDeath
	{
		public override bool shouldAutoDestroy => false;

		public override void OnEnter()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			((GenericCharacterDeath)this).OnEnter();
			PepsiAnimator component = ((EntityState)this).GetComponent<PepsiAnimator>();
			if ((Object)(object)component != (Object)null)
			{
				component.PlayAction("Base_FlyingBackDeath", 0f, 1f, 999f, 0.1f);
			}
			PepsiSound.Play("voicedeath", ((EntityState)this).gameObject);
			if (PepsiBody.IsUltimate(((EntityState)this).characterBody))
			{
				PepsiFx.NukeVisual(((EntityState)this).characterBody.corePosition);
			}
		}

		public override void FixedUpdate()
		{
			((GenericCharacterDeath)this).FixedUpdate();
			if (NetworkServer.active && ((EntityState)this).fixedAge > 4f)
			{
				((GenericCharacterDeath)this).DestroyBodyAsapServer();
			}
		}
	}
	internal sealed class PepsiAutoTest : MonoBehaviour
	{
		private string dir;

		private int shot;

		internal static void Start(string dir)
		{
			//IL_0005: 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_0010: Expected O, but got Unknown
			GameObject val = new GameObject("PepsiAutoTest");
			Object.DontDestroyOnLoad((Object)val);
			val.AddComponent<PepsiAutoTest>().dir = dir;
		}

		private unsafe IEnumerator Start()
		{
			Log.Info("[autotest] waiting for the title screen");
			float t0 = Time.realtimeSinceStartup;
			while ((Object)(object)Console.instance == (Object)null || (Object)(object)MainMenuController.instance == (Object)null)
			{
				yield return (object)new WaitForSecondsRealtime(1f);
			}
			yield return (object)new WaitForSecondsRealtime(6f);
			Log.Info("[autotest] title screen after " + (Time.realtimeSinceStartup - t0).ToString("F0") + " s, hosting");
			Console.instance.SubmitCmd((NetworkUser)null, "host 0", false);
			while ((Object)(object)PreGameController.instance == (Object)null || NetworkUser.readOnlyLocalPlayersList.Count == 0)
			{
				yield return (object)new WaitForSecondsRealtime(0.5f);
			}
			yield return (object)new WaitForSecondsRealtime(2f);
			BodyIndex val = BodyCatalog.FindBodyIndex(PepsiBody.BodyPrefab);
			NetworkUser.readOnlyLocalPlayersList[0].CallCmdSetBodyPreference(val);
			Log.Info("[autotest] lobby, body preference set: " + ((object)(*(BodyIndex*)(&val))/*cast due to .constrained prefix*/).ToString());
			yield return (object)new WaitForSecondsRealtime(4f);
			Shot("lobby");
			PreGameController.instance.StartLaunch();
			CharacterBody pepsi = null;
			while ((Object)(object)pepsi == (Object)null)
			{
				LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
				pepsi = ((firstLocalUser != null) ? firstLocalUser.cachedBody : null);
				yield return (object)new WaitForSecondsRealtime(0.5f);
			}
			Log.Info("[autotest] in run: " + ((Object)pepsi).name + " skin " + pepsi.skinIndex);
			yield return (object)new WaitForSecondsRealtime(4f);
			if ((Object)(object)pepsi.currentVehicle != (Object)null)
			{
				pepsi.currentVehicle.EjectPassenger(((Component)pepsi).gameObject);
				Log.Info("[autotest] ejected from the pod");
			}
			yield return (object)new WaitForSecondsRealtime(6f);
			if (Object.op_Implicit((Object)(object)pepsi.healthComponent))
			{
				pepsi.healthComponent.godMode = true;
			}
			Shot("idle");
			EntityStateMachine weapon = EntityStateMachine.FindByCustomName(((Component)pepsi).gameObject, "Weapon");
			float until = Time.time + 4f;
			int shotsDone = 0;
			while (Time.time < until)
			{
				pepsi.skillLocator.primary.ExecuteIfReady();
				if (Time.time > until - 4f + 0.7f * (float)(shotsDone + 1) && shotsDone < 4)
				{
					PepsiAutoTest pepsiAutoTest = this;
					int num = shotsDone + 1;
					shotsDone = num;
					pepsiAutoTest.Shot("combo" + num);
				}
				yield return (object)new WaitForSecondsRealtime(0.05f);
			}
			yield return (object)new WaitForSecondsRealtime(1f);
			Log.Info("[autotest] dew via skill");
			pepsi.skillLocator.special.ExecuteIfReady();
			yield return (object)new WaitForSecondsRealtime(0.15f);
			Shot("dew_skill");
			yield return (object)new WaitForSecondsRealtime(2.5f);
			(string, Func<EntityState>, float)[] array = new(string, Func<EntityState>, float)[7]
			{
				("vending", () => (EntityState)(object)new VendingSlam(), 0.75f),
				("puddle", () => (EntityState)(object)new PepsiPuddleThrow(), 0.45f),
				("cutter", () => (EntityState)(object)new GenocideCutter(), 0.3f),
				("express", () => (EntityState)(object)new PepsiExpress(), 0.35f),
				("dew", () => (EntityState)(object)new MountainDew(), 0.3f),
				("break", () => (EntityState)(object)new PepsiBreak(), 0.4f),
				("laser", () => (EntityState)(object)new SuperLaser(), 1.2f)
			};
			(string name, Func<EntityState> make, float wait)[] array2 = array;
			for (int num2 = 0; num2 < array2.Length; num2++)
			{
				var (name, func, num3) = array2[num2];
				Log.Info($"[autotest] state {name} t={Time.time:F2}");
				weapon.SetInterruptState(func(), (InterruptPriority)7);
				yield return (object)new WaitForSecondsRealtime(num3);
				Shot(name);
				if (name == "dew")
				{
					yield return (object)new WaitForSecondsRealtime(1.2f);
					Shot("dewpillar");
				}
				yield return (object)new WaitForSecondsRealtime(2.5f);
			}
			((BaseCharacterController)pepsi.characterMotor).Motor.ForceUnground(0.1f);
			pepsi.characterMotor.velocity = Vector3.up * 25f;
			yield return (object)new WaitForSecondsRealtime(0.45f);
			weapon.SetInterruptState((EntityState)(object)new PepsiPuddleThrow(), (InterruptPriority)7);
			yield return (object)new WaitForSecondsRealtime(1.2f);
			Shot("puddle_air");
			yield return (object)new WaitForSecondsRealtime(1.5f);
			Log.Info($"[autotest] after sky puddle: grounded={pepsi.characterMotor.isGrounded} y={pepsi.footPosition.y:F1}");
			yield return (object)new WaitForSecondsRealtime(1.5f);
			weapon.SetInterruptState((EntityState)(object)new PepsiBreak(), (InterruptPriority)7);
			yield return (object)new WaitForSecondsRealtime(0.3f);
			CharacterBody val2 = null;
			foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList)
			{
				if ((Object)(object)readOnlyInstances != (Object)null && Object.op_Implicit((Object)(object)readOnlyInstances.teamComponent) && (int)readOnlyInstances.teamComponent.teamIndex == 2 && readOnlyInstances.healthComponent.alive)
				{
					val2 = readOnlyInstances;
					break;
				}
			}
			if ((Object)(object)val2 != (Object)null)
			{
				pepsi.healthComponent.TakeDamage(new DamageInfo
				{
					attacker = ((Component)val2).gameObject,
					damage = 10f,
					position = pepsi.corePosition,
					procCoefficient = 0f
				});
				yield return (object)new WaitForSecondsRealtime(0.4f);
				Shot("obliterate");
			}
			else
			{
				Log.Info("[autotest] no monster for the counter test");
			}
			yield return (object)new WaitForSecondsRealtime(3f);
			GameObject val3 = ((!Object.op_Implicit((Object)(object)PepsiDew.Projectile)) ? null : PepsiDew.Projectile.GetComponent<ProjectileImpactExplosion>()?.impactEffect);
			if ((Object)(object)val3 != (Object)null)
			{
				Vector3 val4 = (Object.op_Implicit((Object)(object)pepsi.inputBank) ? pepsi.inputBank.aimDirection : pepsi.transform.forward);
				val4.y = 0f;
				((Vector3)(ref val4)).Normalize();
				EffectManager.SpawnEffect(val3, new EffectData
				{
					origin = pepsi.footPosition + val4 * 8f,
					scale = 1f
				}, true);
				yield return (object)new WaitForSecondsRealtime(0.5f);
				Shot("dewimpact");
				yield return (object)new WaitForSecondsRealtime(2f);
			}
			PepsiMeter meter = PepsiMeter.Of(pepsi);
			if ((Object)(object)meter != (Object)null)
			{
				meter.meter = 0f;
				yield return (object)new WaitForSecondsRealtime(0.2f);
				meter.meter = 55f;
				yield return (object)new WaitForSecondsRealtime(1.2f);
				Shot("aura_half");
				meter.meter = 100f;
				yield return (object)new WaitForSecondsRealtime(1.2f);
				Shot("aura_full");
			}
			yield return (object)new WaitForSecondsRealtime(2f);
			PepsiFx.NukeVisual(pepsi.corePosition + pepsi.transform.forward * 10f);
			yield return (object)new WaitForSecondsRealtime(0.7f);
			Shot("nuke_blackhole");
			yield return (object)new WaitForSecondsRealtime(1.3f);
			Shot("nuke_explosion");
			yield return (object)new WaitForSecondsRealtime(4f);
			ModelSkinController msc = ((Component)pepsi.modelLocator.modelTransform).GetComponent<ModelSkinController>();
			int[] array3 = new int[4] { 1, 6, 11, 14 };
			for (int num2 = 0; num2 < array3.Length; num2++)
			{
				int s = array3[num2];
				msc.ApplySkin(s);
				yield return (object)new WaitForSecondsRealtime(1f);
				Shot("skin" + s);
			}
			Log.Info("[autotest] done");
		}

		private void Shot(string name)
		{
			string text = Path.Combine(dir, $"autotest_{shot++:00}_{name}.png");
			ScreenCapture.CaptureScreenshot(text);
			Log.Info("[autotest] screenshot " + text);
		}
	}
	internal static class PepsiBody
	{
		internal static GameObject BodyPrefab;

		internal static GameObject DisplayPrefab;

		internal const string VisualName = "PepsimanVisual";

		internal static readonly Color BodyColor = new Color(0.05f, 0.25f, 0.75f);

		private static readonly string[] SkinTitles = new string[15]
		{
			"Pepsi", "Coke", "7 UP", "Mountain Dew", "Reverse", "Starbucks", "Fanta", "Sierra Mist", "Brisk", "Monster",
			"Grape Soda", "PEPSI MAX", "INVERT", "T-1000", "GOLDEN EXPERIENCE"
		};

		internal static bool Initialize()
		{
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Expected O, but got Unknown
			//IL_00d9: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PepsiAssets.Load<GameObject>(RoR2_Base_Commando.CommandoBody_prefab);
			if ((Object)(object)val == (Object)null)
			{
				Log.Error("CommandoBody missing");
				return false;
			}
			BodyPrefab = PrefabAPI.InstantiateClone(val, "PepsimanBody", true);
			CharacterBody component = BodyPrefab.GetComponent<CharacterBody>();
			ModelLocator component2 = BodyPrefab.GetComponent<ModelLocator>();
			CharacterDirection component3 = BodyPrefab.GetComponent<CharacterDirection>();
			Transform modelTransform = component2.modelTransform;
			if ((Object)(object)modelTransform != (Object)null)
			{
				Renderer[] componentsInChildren = ((Component)modelTransform).GetComponentsInChildren<Renderer>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					componentsInChildren[i].enabled = false;
				}
				((Component)modelTransform).gameObject.SetActive(false);
			}
			GameObject val2 = new GameObject("PepsimanModelRoot");
			Transform transform = val2.transform;
			transform.SetParent(component2.modelBaseTransform, false);
			GameObject obj = Object.Instantiate<GameObject>(PepsiAssets.Visual, transform);
			((Object)obj).name = "PepsimanVisual";
			obj.transform.localPosition = Vector3.zero;
			obj.transform.localRotation = Quaternion.identity;
			obj.transform.localScale = Vector3.one * PepsiConfig.ModelScale.Value;
			component2.modelTransform = transform;
			Animator component4 = obj.GetComponent<Animator>();
			component4.applyRootMotion = false;
			component4.cullingMode = (AnimatorCullingMode)0;
			if ((Object)(object)component3 != (Object)null)
			{
				component3.targetTransform = component2.modelBaseTransform;
				component3.overrideAnimatorForwardTransform = null;
				component3.rootMotionAccumulator = null;
				component3.modelAnimator = component4;
				component3.driveFromRootRotation = false;
				component3.turnSpeed = 900f;
			}
			CapsuleCollider component5 = BodyPrefab.GetComponent<CapsuleCollider>();
			if ((Object)(object)component5 != (Object)null)
			{
				float s = PepsiConfig.S;
				float num = component5.center.y - component5.height * 0.5f;
				component5.radius = Mathf.Clamp(0.4f * s, component5.radius, 0.9f);
				component5.height = Mathf.Clamp(1.75f * s, component5.height, 4f);
				component5.center = new Vector3(0f, num + component5.height * 0.5f, 0f);
				KinematicCharacterMotor component6 = BodyPrefab.GetComponent<KinematicCharacterMotor>();
				if ((Object)(object)component6 != (Object)null)
				{
					component6.SetCapsuleDimensions(component5.radius, component5.height, component5.center.y);
				}
			}
			HurtBox(transform, modelTransform, component);
			CameraAndAim(component);
			CharacterModel(val2, component);
			BodyPrefab.AddComponent<PepsiAnimator>();
			BodyPrefab.AddComponent<PepsiMeter>();
			BodyPrefab.AddComponent<PepsiMax>();
			BodyPrefab.AddComponent<PepsiBreakWatcher>();
			BodyPrefab.AddComponent<PepsiAura>();
			BodyPrefab.AddComponent<PepsiThemeEmitter>();
			EntityStateMachine[] components = BodyPrefab.GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val3 in components)
			{
				if (val3.customName == "Body")
				{
					val3.initialStateType = new SerializableEntityStateType(typeof(GenericCharacterMain));
				}
			}
			CharacterDeathBehavior component7 = BodyPrefab.GetComponent<CharacterDeathBehavior>();
			if ((Object)(object)component7 != (Object)null)
			{
				component7.deathState = new SerializableEntityStateType(typeof(PepsiDeath));
				Content.States.Add(typeof(PepsiDeath));
			}
			component.baseNameToken = "PEPSIMAN_NAME";
			component.subtitleNameToken = "PEPSIMAN_SUBTITLE";
			component.bodyColor = BodyColor;
			component.baseMaxHealth = 160f;
			component.levelMaxHealth = 48f;
			component.baseRegen = 2.5f;
			component.levelRegen = 0.5f;
			component.baseDamage = 13f;
			component.levelDamage = 2.6f;
			component.baseMoveSpeed = (8.5f + 0.8f * (PepsiConfig.S - 1f)) * 1.85f;
			component.baseAcceleration = 160f;
			component.baseJumpPower = 18f + 2.5f * (PepsiConfig.S - 1f);
			component.baseJumpCount = 2;
			component.baseArmor = 20f;
			component.baseCrit = 5f;
			component.sprintingSpeedMultiplier = 1.6f;
			Sprite val4 = PepsiIcons.Get("Portrait") ?? PepsiIcons.Get("Combo");
			if ((Object)(object)val4 != (Object)null)
			{
				component.portraitIcon = (Texture)(object)val4.texture;
			}
			if (!Display())
			{
				return false;
			}
			Transform obj2 = DisplayPrefab.transform.Find("PepsimanDisplayRoot");
			Skins(val2, (obj2 != null) ? ((Component)obj2).gameObject : null);
			Content.Bodies.Add(BodyPrefab);
			return true;
		}

		private static void HurtBox(Transform root, Transform vanilla, CharacterBody body)
		{
			//IL_005d: 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_0072: 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_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)
			if ((Object)(object)vanilla != (Object)null)
			{
				HurtBox[] componentsInChildren = ((Component)vanilla).GetComponentsInChildren<HurtBox>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					((Component)componentsInChildren[i]).gameObject.SetActive(false);
				}
				HurtBoxGroup[] componentsInChildren2 = ((Component)vanilla).GetComponentsInChildren<HurtBoxGroup>(true);
				for (int i = 0; i < componentsInChildren2.Length; i++)
				{
					Object.DestroyImmediate((Object)(object)componentsInChildren2[i]);
				}
			}
			GameObject val = new GameObject("PepsimanHurtBox")
			{
				layer = LayerIndex.entityPrecise.intVal
			};
			val.transform.SetParent(root, false);
			float value = PepsiConfig.ModelScale.Value;
			val.transform.localPosition = new Vector3(0f, 0.95f * value, 0f);
			CapsuleCollider obj = val.AddComponent<CapsuleCollider>();
			obj.direction = 1;
			obj.radius = 0.35f * value;
			obj.height = 1.85f * value;
			HurtBox val2 = val.AddComponent<HurtBox>();
			val2.healthComponent = ((Component)body).GetComponent<HealthComponent>();
			val2.isBullseye = true;
			val2.isSniperTarget = true;
			HurtBoxGroup val3 = ((Component)root).gameObject.AddComponent<HurtBoxGroup>();
			val3.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val2 };
			val3.mainHurtBox = val2;
			val3.bullseyeCount = 1;
			val2.hurtBoxGroup = val3;
			val2.indexInGroup = 0;
		}

		private static void CameraAndAim(CharacterBody body)
		{
			//IL_005c: 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_009d: 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_00ed: 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_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: 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_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: 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_015c: Unknown result type (might be due to invalid IL or missing references)
			float value = PepsiConfig.ModelScale.Value;
			Transform val = PepsiAssets.FindDeep(BodyPrefab.transform, "AimOrigin");
			if ((Object)(object)val == (Object)null)
			{
				val = new GameObject("AimOrigin").transform;
				val.SetParent(BodyPrefab.transform, false);
			}
			val.localPosition = new Vector3(0f, 1.45f * value, 0f);
			body.aimOriginTransform = val;
			Transform val2 = PepsiAssets.FindDeep(BodyPrefab.transform, "CameraPivot");
			if ((Object)(object)val2 != (Object)null)
			{
				val2.localPosition = new Vector3(0f, 1.6f * value, 0f);
			}
			CameraTargetParams component = BodyPrefab.GetComponent<CameraTargetParams>();
			if ((Object)(object)component != (Object)null && value > 1.2f)
			{
				CharacterCameraParams val3 = ScriptableObject.CreateInstance<CharacterCameraParams>();
				((Object)val3).name = "ccpPepsiman";
				val3.data.minPitch = BlendableFloat.op_Implicit(-70f);
				val3.data.maxPitch = BlendableFloat.op_Implicit(70f);
				val3.data.wallCushion = BlendableFloat.op_Implicit(0.1f);
				val3.data.pivotVerticalOffset = BlendableFloat.op_Implicit(0f);
				val3.data.idealLocalCameraPos = BlendableVector3.op_Implicit(new Vector3(0f, 0.6f, -6.5f - 3f * value));
				component.cameraParams = val3;
			}
		}

		private static RendererInfo[] Renderers(GameObject root, Material mat, out SkinnedMeshRenderer main)
		{
			//IL_002e: 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_005d: 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)
			main = null;
			SkinnedMeshRenderer[] componentsInChildren = root.GetComponentsInChildren<SkinnedMeshRenderer>(true);
			RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[componentsInChildren.Length];
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				if ((Object)(object)mat != (Object)null)
				{
					((Renderer)componentsInChildren[i]).sharedMaterial = mat;
				}
				array[i] = new RendererInfo
				{
					renderer = (Renderer)(object)componentsInChildren[i],
					defaultMaterial = ((Renderer)componentsInChildren[i]).sharedMaterial,
					defaultShadowCastingMode = (ShadowCastingMode)1,
					ignoreOverlays = false
				};
				if ((Object)(object)main == (Object)null)
				{
					main = componentsInChildren[i];
				}
			}
			return array;
		}

		private static void CharacterModel(GameObject root, CharacterBody body)
		{
			CharacterModel obj = root.GetComponent<CharacterModel>() ?? root.AddComponent<CharacterModel>();
			obj.body = body;
			obj.baseRendererInfos = Renderers(root, PepsiAssets.Skins[0].mat, out var main);
			obj.mainSkinnedMeshRenderer = main;
		}

		private static bool Display()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			//IL_0094: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PepsiAssets.Load<GameObject>(RoR2_Base_Commando.CommandoDisplay_prefab);
			if ((Object)(object)val == (Object)null)
			{
				Log.Error("CommandoDisplay missing");
				return false;
			}
			DisplayPrefab = PrefabAPI.InstantiateClone(val, "PepsimanDisplay", false);
			CharacterModel componentInChildren = DisplayPrefab.GetComponentInChildren<CharacterModel>(true);
			if ((Object)(object)componentInChildren != (Object)null)
			{
				((Component)componentInChildren).gameObject.SetActive(false);
			}
			GameObject val2 = new GameObject("PepsimanDisplayRoot");
			val2.transform.SetParent(DisplayPrefab.transform, false);
			GameObject obj = Object.Instantiate<GameObject>(PepsiAssets.Visual, val2.transform);
			((Object)obj).name = "PepsimanVisual";
			obj.transform.localRotation = Quaternion.identity;
			obj.transform.localScale = Vector3.one * PepsiConfig.LobbyScale.Value;
			Animator component = obj.GetComponent<Animator>();
			if ((Object)(object)component != (Object)null)
			{
				component.applyRootMotion = false;
				component.cullingMode = (AnimatorCullingMode)0;
			}
			obj.AddComponent<PepsiLobbyAnim>();
			CharacterModel obj2 = val2.AddComponent<CharacterModel>();
			obj2.baseRendererInfos = Renderers(val2, PepsiAssets.Skins[0].mat, out var main);
			obj2.mainSkinnedMeshRenderer = main;
			return true;
		}

		private static void Skins(GameObject bodyRoot, GameObject displayRoot)
		{
			CharacterModel component = bodyRoot.GetComponent<CharacterModel>();
			SkinDef[] array = (SkinDef[])(object)new SkinDef[PepsiAssets.Skins.Count];
			for (int i = 0; i < array.Length; i++)
			{
				(string, Material, bool) tuple = PepsiAssets.Skins[i];
				string item = tuple.Item1;
				Material mat = tuple.Item2;
				bool item2 = tuple.Item3;
				SkinDefParams val = ScriptableObject.CreateInstance<SkinDefParams>();
				((Object)val).name = "PepsimanSkinParams" + item;
				val.rendererInfos = component.baseRendererInfos.Select(delegate(RendererInfo ri)
				{
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					ri.defaultMaterial = mat;
					return ri;
				}).ToArray();
				SkinDef val2 = ScriptableObject.CreateInstance<SkinDef>();
				((Object)val2).name = "PepsimanSkin" + item;
				val2.nameToken = "PEPSIMAN_SKIN_" + item.ToUpperInvariant();
				val2.icon = PepsiIcons.Swatch(mat, item2);
				val2.rootObject = bodyRoot;
				val2.skinDefParams = val;
				LanguageAPI.Add(val2.nameToken, SkinTitles[i] + (item2 ? "  (ultimate mode)" : ""));
				array[i] = val2;
			}
			bodyRoot.AddComponent<ModelSkinController>().skins = array;
			if (!((Object)(object)displayRoot != (Object)null))
			{
				return;
			}
			CharacterModel dcm = displayRoot.GetComponent<CharacterModel>();
			SkinDef[] skins = array.Select(delegate(SkinDef s)
			{
				SkinDefParams val3 = ScriptableObject.CreateInstance<SkinDefParams>();
				val3.rendererInfos = dcm.baseRendererInfos.Select(delegate(RendererInfo ri)
				{
					//IL_0022: Unknown result type (might be due to invalid IL or missing references)
					ri.defaultMaterial = s.skinDefParams.rendererInfos[0].defaultMaterial;
					return ri;
				}).ToArray();
				SkinDef obj = ScriptableObject.CreateInstance<SkinDef>();
				obj.nameToken = s.nameToken;
				obj.icon = s.icon;
				obj.rootObject = displayRoot;
				obj.skinDefParams = val3;
				return obj;
			}).ToArray();
			displayRoot.AddComponent<ModelSkinController>().skins = skins;
		}

		internal static bool IsPepsiman(CharacterBody b)
		{
			//IL_0017: 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)
			if ((Object)(object)b != (Object)null && (Object)(object)BodyPrefab != (Object)null)
			{
				return b.bodyIndex == BodyCatalog.FindBodyIndex(BodyPrefab);
			}
			return false;
		}

		internal static bool IsUltimate(CharacterBody b)
		{
			if (IsPepsiman(b))
			{
				return b.skinIndex >= 11;
			}
			return false;
		}
	}
	internal static class PepsiIcons
	{
		private static readonly Dictionary<string, Sprite> loaded = new Dictionary<string, Sprite>();

		internal static void Load(string dir)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			string[] files = Directory.GetFiles(dir, "PepsimanIcon_*.png");
			foreach (string path in files)
			{
				Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true);
				if (ImageConversion.LoadImage(val, File.ReadAllBytes(path)))
				{
					((Texture)val).wrapMode = (TextureWrapMode)1;
					loaded[Path.GetFileNameWithoutExtension(path).Substring(13)] = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f);
				}
			}
			Log.Info(loaded.Count + " icons");
		}

		internal static Sprite Get(string id)
		{
			if (!loaded.TryGetValue(id, out var value))
			{
				return null;
			}
			return value;
		}

		internal static Sprite Skill(string id)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0054: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			Sprite val = Get(id);
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
			Texture2D val2 = new Texture2D(64, 64, (TextureFormat)4, false);
			int hashCode = id.GetHashCode();
			Color val3 = default(Color);
			((Color)(ref val3))..ctor(0.05f, 0.25f, 0.75f);
			Color val4 = (Color)(((hashCode & 1) == 0) ? new Color(0.85f, 0.1f, 0.15f) : Color.white);
			for (int i = 0; i < 64; i++)
			{
				for (int j = 0; j < 64; j++)
				{
					float num = Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(32f, 32f));
					val2.SetPixel(j, i, (Color)((num < 24f) ? (((float)i > 32f + 6f * Mathf.Sin((float)j / 10f)) ? val4 : val3) : new Color(0.08f, 0.1f, 0.2f)));
				}
			}
			val2.Apply();
			return Sprite.Create(val2, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f));
		}

		internal static Sprite Swatch(Material m, bool ultimate)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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_00be: Expected O, but got Unknown
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
			Texture texture = m.GetTexture("_MainTex");
			Texture2D val = (Texture2D)(object)((texture is Texture2D) ? texture : null);
			Texture2D val2 = new Texture2D(64, 64, (TextureFormat)4, false);
			Color val3 = Color.white;
			Color pixel = default(Color);
			((Color)(ref pixel))..ctor(0.1f, 0.3f, 0.8f);
			if ((Object)(object)val != (Object)null)
			{
				RenderTexture temporary = RenderTexture.GetTemporary(64, 64);
				Graphics.Blit((Texture)(object)val, temporary);
				RenderTexture active = RenderTexture.active;
				RenderTexture.active = temporary;
				Texture2D val4 = new Texture2D(64, 64, (TextureFormat)4, false);
				val4.ReadPixels(new Rect(0f, 0f, 64f, 64f), 0, 0);
				val4.Apply();
				RenderTexture.active = active;
				RenderTexture.ReleaseTemporary(temporary);
				val3 = val4.GetPixel(14, 60);
				pixel = val4.GetPixel(40, 40);
				Object.Destroy((Object)val4);
			}
			for (int i = 0; i < 64; i++)
			{
				for (int j = 0; j < 64; j++)
				{
					bool flag = ultimate && (j < 3 || i < 3 || j > 60 || i > 60);
					val2.SetPixel(j, i, (Color)(flag ? new Color(1f, 0.85f, 0.2f) : ((j + i < 64) ? val3 : pixel)));
				}
			}
			val2.Apply();
			return Sprite.Create(val2, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f));
		}
	}
	internal static class PepsiFx
	{
		private static GameObject slam;

		private static GameObject warp;

		private static GameObject freeze;

		private static GameObject nuke;

		private static GameObject dewExplosion;

		internal static GameObject DewExplosionEffect => dewExplosion;

		private static float S => PepsiConfig.S;

		internal static void Init()
		{
			slam = PepsiAssets.Load<GameObject>(RoR2_Base_Loader.LoaderGroundSlam_prefab);
			warp = PepsiAssets.Load<GameObject>(RoR2_Base_Huntress.HuntressBlinkEffect_prefab);
			freeze = PepsiAssets.Load<GameObject>(RoR2_Base_Mage.MageIceExplosion_prefab);
			nuke = PepsiAssets.Load<GameObject>(RoR2_Base_RoboBallBoss.OmniExplosionVFXRoboBallBossDeath_prefab);
			dewExplosion = PepsiAssets.Load<GameObject>(RoR2_Base_Golem.ExplosionGolem_prefab);
			Log.Info($"fx: slam={(Object)(object)slam != (Object)null} warp={(Object)(object)warp != (Object)null} freeze={(Object)(object)freeze != (Object)null} nuke={(Object)(object)nuke != (Object)null} dew={(Object)(object)dewExplosion != (Object)null} flow={(Object)(object)PepsiAssets.FlowBeam != (Object)null}/{(Object)(object)PepsiAssets.FlowDewColumn != (Object)null}/{(Object)(object)PepsiAssets.FlowDewRibbon != (Object)null}");
		}

		private static void Spawn(GameObject prefab, Vector3 pos, float scale, bool transmit = true)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			if (!((Object)(object)prefab == (Object)null))
			{
				EffectManager.SpawnEffect(prefab, new EffectData
				{
					origin = pos,
					scale = scale,
					rotation = Quaternion.identity
				}, transmit);
			}
		}

		internal static void Slam(Vector3 pos, float radius, Vector3 forward)
		{
			//IL_0005: 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_0007: 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)
			if ((Object)(object)PepsiVfx.Spawn("Slam", pos, Util.QuaternionSafeLookRotation(forward), radius / 6.5f) == (Object)null)
			{
				Spawn(slam, pos, radius, transmit: false);
			}
		}

		internal static void Warp(Vector3 pos)
		{
			//IL_0005: 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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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)
			Spawn(warp, pos + Vector3.up * S, 1.5f * S, transmit: false);
			PepsiVfx.Spawn("Warp", pos, Quaternion.identity, 0.8f * S);
		}

		internal static void CounterFlash(Vector3 pos)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Spawn(warp, pos, 2f * S, transmit: false);
		}

		internal static void Rising(CharacterBody b, Vector3 forward)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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)
			if (!((Object)(object)b == (Object)null))
			{
				PepsiVfx.Spawn("Rising", b.footPosition, Util.QuaternionSafeLookRotation(forward), 0.8f * S, 0f, b.transform);
			}
		}

		internal static void NukeVisual(Vector3 pos)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_008a: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			if (PepsiVfx.Has("BlackHole"))
			{
				PepsiVfx.Spawn("BlackHole", pos, Quaternion.identity, 2f, 1.6f);
				PepsiVfx.SpawnLater(1.2f, "HugeExplosion", pos, Quaternion.identity, 2.5f);
			}
			else
			{
				for (int i = 0; i < 3; i++)
				{
					Spawn(nuke, pos + Random.insideUnitSphere * 3f, 25f, transmit: false);
				}
			}
			GameObject val = new GameObject("PepsiNukeSound");
			val.transform.position = pos;
			PepsiSound.Play("goldenexplode", val);
			Object.Destroy((Object)(object)val, 8f);
		}

		internal static void MeterFull(CharacterBody b)
		{
			PepsiSound.Play("supermeter", ((Component)b).gameObject);
			PepsiSound.Play("demonlaugh", ((Component)b).gameObject);
		}

		internal static void DewPillar(Vector3 pos)
		{
			//IL_0005: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PepsiVfx.Spawn("DewPillar", pos, Quaternion.identity, 1.3f * PepsiConfig.SA, 1.2f, null, 0.25f);
			if (Object.op_Implicit((Object)(object)val))
			{
				Object.Destroy((Object)(object)val, 1.7f);
			}
			PepsiDewColumn.Spawn(pos, PepsiDew.Radius * 0.55f);
		}

		internal static void FreezeEveryone(CharacterBody pepsi, float seconds)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_007c: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || (Object)(object)pepsi == (Object)null)
			{
				return;
			}
			TeamIndex val = (TeamIndex)((!Object.op_Implicit((Object)(object)pepsi.teamComponent)) ? 1 : ((int)pepsi.teamComponent.teamIndex));
			int num = 0;
			foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList)
			{
				if ((Object)(object)readOnlyInstances == (Object)null || (Object)(object)readOnlyInstances == (Object)(object)pepsi || readOnlyInstances.isPlayerControlled || (Object.op_Implicit((Object)(object)readOnlyInstances.teamComponent) && readOnlyInstances.teamComponent.teamIndex == val))
				{
					continue;
				}
				Vector3 val2 = readOnlyInstances.corePosition - pepsi.corePosition;
				if (!(((Vector3)(ref val2)).sqrMagnitude > 90000f))
				{
					SetStateOnHurt component = ((Component)readOnlyInstances).GetComponent<SetStateOnHurt>();
					if ((Object)(object)component != (Object)null && component.canBeFrozen)
					{
						component.SetFrozen(seconds);
						num++;
					}
					else if (Object.op_Implicit((Object)(object)readOnlyInstances.healthComponent))
					{
						readOnlyInstances.AddTimedBuff(Buffs.Slow80, seconds);
					}
					Spawn(freeze, readOnlyInstances.corePosition, 1f + readOnlyInstances.radius);
				}
			}
			Log.Info($"Super Laser froze {num} enemies");
		}

		internal static Mesh Tube(float[] dist, Func<float, float> radius, int segs, bool alongY, Func<float, float> alpha)
		{
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: 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_01e0: 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_01f0: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_0077: 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_008d: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: 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)
			List<Vector3> list = new List<Vector3>();
			List<Vector2> list2 = new List<Vector2>();
			List<Vector3> list3 = new List<Vector3>();
			List<Color> list4 = new List<Color>();
			List<int> list5 = new List<int>();
			Vector2 val = default(Vector2);
			foreach (float num in dist)
			{
				float num2 = radius(num);
				float num3 = alpha(num);
				for (int j = 0; j <= segs; j++)
				{
					float num4 = (float)j / (float)segs * MathF.PI * 2f;
					((Vector2)(ref val))..ctor(Mathf.Cos(num4), Mathf.Sin(num4));
					list.Add(alongY ? new Vector3(val.x * num2, num, val.y * num2) : new Vector3(val.x * num2, val.y * num2, num));
					list3.Add(alongY ? new Vector3(val.x, 0f, val.y) : new Vector3(val.x, val.y, 0f));
					list2.Add(new Vector2((float)j / (float)segs * 2f, num));
					list4.Add(new Color(1f, 1f, 1f, num3));
				}
			}
			int num5 = segs + 1;
			for (int k = 0; k < dist.Length - 1; k++)
			{
				for (int l = 0; l < segs; l++)
				{
					int num6 = k * num5 + l;
					int num7 = num6 + 1;
					int num8 = num6 + num5;
					int num9 = num8 + 1;
					list5.AddRange(new int[6] { num6, num8, num7, num7, num8, num9 });
				}
			}
			Mesh val2 = new Mesh
			{
				name = "PepsiTube"
			};
			val2.SetVertices(list);
			val2.SetNormals(list3);
			val2.SetUVs(0, list2);
			val2.SetColors(list4);
			val2.SetTriangles(list5, 0);
			val2.RecalculateBounds();
			return val2;
		}

		internal static GameObject MeshObject(string name, Transform parent, Mesh mesh, Material mat)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			GameObject val = new GameObject(name);
			if (Object.op_Implicit((Object)(object)parent))
			{
				val.transform.SetParent(parent, false);
			}
			val.AddComponent<MeshFilter>().sharedMesh = mesh;
			MeshRenderer obj = val.AddComponent<MeshRenderer>();
			((Renderer)obj).sharedMaterial = mat;
			((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)obj).receiveShadows = false;
			return val;
		}
	}
	internal sealed class PepsiBeam : MonoBehaviour
	{
		private Transform finger;

		private CharacterBody body;

		private MeshRenderer outer;

		private MeshRenderer core;

		private MaterialPropertyBlock block;

		private float stopAt = -1f;

		private float born;

		internal Vector3 Origin
		{
			get
			{
				//IL_003a: 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_0022: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)finger != (Object)null))
				{
					if (!((Object)(object)body != (Object)null))
					{
						return ((Component)this).transform.position;
					}
					return body.aimOrigin;
				}
				return finger.position;
			}
		}

		internal static PepsiBeam Create(PepsiAnimator driver, CharacterBody body, Vector3 dir, float range)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Expected O, but got Unknown
			GameObject val = new GameObject("PepsiBeam");
			PepsiBeam pepsiBeam = val.AddComponent<PepsiBeam>();
			pepsiBeam.body = body;
			pepsiBeam.born = Time.time;
			pepsiBeam.finger = (((Object)(object)driver != (Object)null && (Object)(object)driver.Model != (Object)null) ? PepsiAssets.FindDeep(driver.Model, "index3.r") : null);
			val.transform.SetPositionAndRotation(pepsiBeam.Origin, Util.QuaternionSafeLookRotation(dir));
			float s = PepsiConfig.S;
			float[] array = new float[34];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = range * Mathf.Pow((float)i / (float)(array.Length - 1), 2.4f);
			}
			Material flowBeam = PepsiAssets.FlowBeam;
			pepsiBeam.outer = PepsiFx.MeshObject("Outer", val.transform, PepsiFx.Tube(array, R, 28, alongY: false, A), flowBeam).GetComponent<MeshRenderer>();
			pepsiBeam.core = PepsiFx.MeshObject("Core", val.transform, PepsiFx.Tube(array, (float d) => R(d) * 0.5f, 20, alongY: false, A), flowBeam).GetComponent<MeshRenderer>();
			pepsiBeam.block = new MaterialPropertyBlock();
			return pepsiBeam;
			float A(float d)
			{
				return Mathf.Clamp01(d / (0.5f * s)) * Mathf.Clamp01((range - d) / (range * 0.15f));
			}
			float R(float d)
			{
				return Mathf.Min(0.2f * s + d * 0.12f, 6f * s);
			}
		}

		internal void Stop()
		{
			if (stopAt < 0f)
			{
				stopAt = Time.time;
			}
		}

		private void LateUpdate()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)body == (Object)null && stopAt < 0f)
			{
				Stop();
			}
			((Component)this).transform.position = Origin;
			float num = Mathf.Clamp01((Time.time - born) / 0.12f);
			float num2 = ((stopAt < 0f) ? 1f : (1f - Mathf.Clamp01((Time.time - stopAt) / 0.25f)));
			float num3 = num * num2 * (1f + 0.07f * Mathf.Sin(Time.time * 37f) + 0.04f * Mathf.Sin(Time.time * 61f));
			((Component)this).transform.localScale = new Vector3(num3, num3, 1f);
			if (stopAt >= 0f && num2 <= 0f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	internal sealed class PepsiDewColumn : MonoBehaviour
	{
		private const float Height = 600f;

		private const float Life = 1.7f;

		private Transform column;

		private Transform ribbons;

		private MeshRenderer[] ribbonRenderers;

		private MeshRenderer columnRenderer;

		private MaterialPropertyBlock block;

		private float born;

		private float radius;

		internal static void Spawn(Vector3 pos, float radius)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_001f: 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: Expected O, but got Unknown
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)PepsiAssets.FlowDewColumn == (Object)null))
			{
				GameObject val = new GameObject("PepsiDewColumn");
				val.transform.position = pos;
				PepsiDewColumn pepsiDewColumn = val.AddComponent<PepsiDewColumn>();
				pepsiDewColumn.born = Time.time;
				pepsiDewColumn.radius = radius;
				pepsiDewColumn.block = new MaterialPropertyBlock();
				float[] dist = new float[6] { 0f, 1f, 4f, 20f, 100f, 600f };
				pepsiDewColumn.column = PepsiFx.MeshObject("Column", val.transform, PepsiFx.Tube(dist, (float d) => 1f, 32, alongY: true, (float d) => (!(d < 1f)) ? 1f : d), PepsiAssets.FlowDewColumn).transform;
				pepsiDewColumn.columnRenderer = ((Component)pepsiDewColumn.column).GetComponent<MeshRenderer>();
				pepsiDewColumn.ribbons = new GameObject("Ribbons").transform;
				pepsiDewColumn.ribbons.SetParent(val.transform, false);
				pepsiDewColumn.ribbonRenderers = (MeshRenderer[])(object)new MeshRenderer[3];
				for (int num = 0; num < 3; num++)
				{
					pepsiDewColumn.ribbonRenderers[num] = PepsiFx.MeshObject("Ribbon" + num, pepsiDewColumn.ribbons, Helix((float)num * 120f, 160f), PepsiAssets.FlowDewRibbon ?? PepsiAssets.FlowDewColumn).GetComponent<MeshRenderer>();
				}
				Object.Destroy((Object)(object)val, 1.8000001f);
			}
		}

		private static Mesh Helix(float phase, float height)
		{
			//IL_00a5: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: 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_01c2: 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_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: 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_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Expected O, but got Unknown
			List<Vector3> list = new List<Vector3>();
			List<Vector2> list2 = new List<Vector2>();
			List<Vector3> list3 = new List<Vector3>();
			List<Color> list4 = new List<Color>();
			List<int> list5 = new List<int>();
			Vector3 val = default(Vector3);
			for (int i = 0; i <= 160; i++)
			{
				float num = height * (float)i / 160f;
				float num2 = (phase + num * 0.11f * 360f) * (MathF.PI / 180f);
				((Vector3)(ref val))..ctor(Mathf.Cos(num2), 0f, Mathf.Sin(num2));
				float num3 = 1f + 0.12f * Mathf.Sin(num * 0.7f + phase);
				float num4 = Mathf.Clamp01(num / 2f) * Mathf.Clamp01((height - num) / (height * 0.4f));
				list.Add(val * num3 + Vector3.up * (num - 0.9f));
				list.Add(val * num3 + Vector3.up * (num + 0.9f));
				list3.Add(val);
				list3.Add(val);
				list2.Add(new Vector2(0f, num));
				list2.Add(new Vector2(1f, num));
				list4.Add(new Color(1f, 1f, 1f, num4));
				list4.Add(new Color(1f, 1f, 1f, num4));
				if (i < 160)
				{
					int num5 = i * 2;
					list5.AddRange(new int[6]
					{
						num5,
						num5 + 2,
						num5 + 1,
						num5 + 1,
						num5 + 2,
						num5 + 3
					});
				}
			}
			Mesh val2 = new Mesh
			{
				name = "PepsiHelix"
			};
			val2.SetVertices(list);
			val2.SetNormals(list3);
			val2.SetUVs(0, list2);
			val2.SetColors(list4);
			val2.SetTriangles(list5, 0);
			val2.RecalculateBounds();
			return val2;
		}

		private void Update()
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: 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_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			float num = Time.time - born;
			float num2 = num / 1.7f;
			float num3 = radius * ((num < 0.08f) ? (num / 0.08f) : Mathf.Lerp(1f, 0.15f, Mathf.Clamp01((num2 - 0.3f) / 0.5f)));
			column.localScale = new Vector3(num3, 1f, num3);
			block.SetFloat("_Alpha", 0.9f * (1f - Mathf.Clamp01((num2 - 0.75f) / 0.25f)));
			((Renderer)columnRenderer).SetPropertyBlock(block);
			float num4 = Mathf.Clamp01((num2 - 0.15f) / 0.15f) * (1f - Mathf.Clamp01((num2 - 0.7f) / 0.3f));
			ribbons.localScale = new Vector3(radius * (1.05f + 0.25f * num2), 1f, radius * (1.05f + 0.25f * num2));
			ribbons.localRotation = Quaternion.Euler(0f, num * 220f, 0f);
			ribbons.localPosition = Vector3.up * num * 6f;
			block.SetFloat("_Alpha", 0.95f * num4);
			MeshRenderer[] array = ribbonRenderers;
			for (int i = 0; i < array.Length; i++)
			{
				((Renderer)array[i]).SetPropertyBlock(block);
			}
		}
	}
	internal sealed class PepsiAura : MonoBehaviour
	{
		private static Mesh hull;

		private CharacterBody body;

		private Transform root;

		private MeshRenderer inner;

		private MeshRenderer outer;

		private MaterialPropertyBlock block;

		private float shown;

		private void Start()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			body = ((Component)this).GetComponent<CharacterBody>();
			block = new MaterialPropertyBlock();
		}

		private static Mesh Hull()
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_011f: 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_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: 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_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Expected O, but got Unknown
			List<Vector3> list = new List<Vector3>();
			List<Vector2> list2 = new List<Vector2>();
			List<int> list3 = new List<int>();
			for (int i = 0; i <= 28; i++)
			{
				float num = (float)i / 28f;
				float num2 = Mathf.Pow(Mathf.Sin(MathF.PI * Mathf.Pow(num, 0.62f)), 0.85f);
				for (int j = 0; j <= 36; j++)
				{
					float num3 = (float)j / 36f * MathF.PI * 2f;
					list.Add(new Vector3(Mathf.Cos(num3) * num2, num, Mathf.Sin(num3) * num2));
					list2.Add(new Vector2((float)j / 36f, num));
				}
			}
			int num4 = 37;
			for (int k = 0; k < 28; k++)
			{
				for (int l = 0; l < 36; l++)
				{
					int num5 = k * num4 + l;
					list3.AddRange(new int[6]
					{
						num5,
						num5 + num4,
						num5 + 1,
						num5 + 1,
						num5 + num4,
						num5 + num4 + 1
					});
				}
			}
			Mesh val = new Mesh
			{
				name = "PepsiAuraHull"
			};
			val.SetVertices(list);
			val.SetUVs(0, list2);
			val.SetTriangles(list3, 0);
			val.RecalculateNormals();
			val.RecalculateBounds();
			val.bounds = new Bounds(new Vector3(0f, 0.5f, 0f), new Vector3(3f, 2f, 3f));
			return val;
		}

		private MeshRenderer Layer(string name, float width, float height)
		{
			//IL_001f: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = PepsiFx.MeshObject(name, root, hull, PepsiAssets.Aura);
			obj.transform.localScale = new Vector3(width, height, width);
			obj.transform.localPosition = Vector3.down * 0.15f;
			return obj.GetComponent<MeshRenderer>();
		}

		private void Update()
		{
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)body == (Object)null || !PepsiBody.IsPepsiman(body) || (Object)(object)PepsiAssets.Aura == (Object)null)
			{
				return;
			}
			bool num = Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive;
			float num2 = (PepsiBody.IsUltimate(body) ? 1f : (body.hasEffectiveAuthority ? ((PepsiMeter.Of(body)?.meter ?? 0f) / 100f) : 0f));
			if (!num)
			{
				num2 = 0f;
			}
			shown = Mathf.MoveTowards(shown, num2, Time.deltaTime * 1.5f);
			bool flag = shown > 0.1f;
			if (flag && (Object)(object)root == (Object)null)
			{
				if ((Object)(object)hull == (Object)null)
				{
					hull = Hull();
				}
				root = new GameObject("PepsiAura").transform;
				float num3 = 1.84f * PepsiConfig.S;
				inner = Layer("Inner", 0.36f * num3, 1.12f * num3);
				outer = Layer("Outer", 0.46f * num3, 1.3f * num3);
			}
			if (!((Object)(object)root == (Object)null))
			{
				((Component)root).gameObject.SetActive(flag);
				if (flag)
				{
					root.position = body.footPosition;
					root.localScale = Vector3.one * (0.8f + 0.2f * shown);
					float num4 = 0.9f + 0.1f * Mathf.Sin(Time.time * 23f) * Mathf.Sin(Time.time * 7f);
					bool flag2 = PepsiBody.IsUltimate(body);
					block.SetColor("_Color", flag2 ? new Color(1f, 0.62f, 0.04f) : new Color(0.05f, 0.4f, 1f));
					block.SetColor("_CoreColor", flag2 ? new Color(1f, 0.92f, 0.45f) : new Color(0.7f, 0.9f, 1f));
					block.SetFloat("_Intensity", (0.2f + 0.6f * shown) * num4 * (flag2 ? 1f : 1.35f));
					block.SetFloat("_Spike", 0.12f + 0.3f * shown);
					block.SetFloat("_Speed", 1.6f + 1.4f * shown);
					((Renderer)inner).SetPropertyBlock(block);
					block.SetFloat("_Intensity", (0.08f + 0.35f * shown) * num4 * (flag2 ? 1f : 1.35f));
					block.SetFloat("_Spike", 0.2f + 0.4f * shown);
					((Renderer)outer).SetPropertyBlock(block);
				}
			}
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)root))
			{
				Object.Destroy((Object)(object)((Component)root).gameObject);
			}
		}
	}
	internal static class PepsiHud
	{
		private static Texture2D frame;

		private static Texture2D bar;

		private static Texture2D flash;

		private static Texture2D inputs;

		private static GUIStyle comboStyle;

		private static bool loaded;

		private static readonly string[] Glyph_F = new string[5] { "111", "100", "110", "100", "100" };

		private static readonly string[] Glyph_I = new string[5] { "111", "010", "010", "010", "111" };

		private static readonly string[] Glyph_Z = new string[5] { "111", "001", "010", "100", "111" };

		private static readonly string[] Glyph_R = new string[5] { "110", "101", "110", "101", "101" };

		private static readonly string[] Glyph_T = new string[5] { "111", "010", "010", "010", "010" };

		private static readonly string[] Glyph_L = new string[5] { "100", "100", "100", "100", "111" };

		private static readonly string[] Pill = new string[11]
		{
			"...AAAAAAAAA...", "..ACCCCCCCCCA..", ".ACCAAAAAAACCA.", "ACCAgggggggACCA", "ACCAgggggggACCA", "ACCAgggggggACCA", "ACCAgggggggACCA", "ACCAgggggggACCA", ".ACCAAAAAAACCA.", "..ACCCCCCCCCA..",
			"...AAAAAAAAA..."
		};

		private static readonly string[] Plus = new string[7] { "..AAA..", "..ADA..", "AAADAAA", "ADDDDDA", "AAADAAA", "..ADA..", "..AAA.." };

		private static void Load()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			loaded = true;
			frame = Tex("spmeter") ?? Frame();
			bar = Tex("spmeter_bar") ?? Solid(new Color32((byte)102, (byte)228, byte.MaxValue, byte.MaxValue));
			flash = Tex("spmeter_flash") ?? Solid(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue));
			inputs = Inputs();
		}

		private static Texture2D Tex(string name)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			string path = Path.Combine(Plugin.Dir, "PepsimanHud_" + name + ".png");
			if (!File.Exists(path))
			{
				return null;
			}
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
			if (!ImageConversion.LoadImage(val, File.ReadAllBytes(path)))
			{
				return null;
			}
			((Texture)val).filterMode = (FilterMode)0;
			((Texture)val).wrapMode = (TextureWrapMode)1;
			return val;
		}

		private static Texture2D New(int w, int h)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0026: Expected O, but got Unknown
			Texture2D val = new Texture2D(w, h, (TextureFormat)4, false)
			{
				filterMode = (FilterMode)0,
				wrapMode = (TextureWrapMode)1
			};
			val.SetPixels32((Color32[])(object)new Color32[w * h]);
			return val;
		}

		private static Texture2D Solid(Color32 c)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = New(67, 3);
			Color32[] array = (Color32[])(object)new Color32[201];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = c;
			}
			val.SetPixels32(array);
			val.Apply();
			return val;
		}

		private static Texture2D Frame()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_003d: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			Texture2D t = New(81, 11);
			Color black = Color.black;
			Color white = Color.white;
			Color c = Color32.op_Implicit(new Color32((byte)116, (byte)122, (byte)134, byte.MaxValue));
			for (int i = 0; i <= 12; i++)
			{
				Px(i, 2, black);
			}
			for (int j = 3; j <= 8; j++)
			{
				for (int k = 0; k <= 80; k++)
				{
					Px(k, j, black);
				}
			}
			for (int l = 4; l <= 6; l++)
			{
				for (int m = 13; m <= 79; m++)
				{
					Px(m, l, c);
				}
			}
			string[][] array = new string[3][] { Glyph_F, Glyph_I, Glyph_Z };
			for (int n = 0; n < 3; n++)
			{
				for (int num = 0; num < 5; num++)
				{
					for (int num2 = 0; num2 < 3; num2++)
					{
						if (array[n][num][num2] == '1')
						{
							Px(1 + n * 4 + num2, 3 + num, white);
						}
					}
				}
			}
			t.Apply();
			return t;
			void Px(int x, int row, Color val)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				t.SetPixel(x, 10 - row, val);
			}
		}

		private static Texture2D Inputs()
		{
			//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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0039: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//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_00ad: 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)
			Texture2D t = new Texture2D(81, 11, (TextureFormat)4, false)
			{
				filterMode = (FilterMode)0,
				wrapMode = (TextureWrapMode)1
			};
			Color32[] pixels = (Color32[])(object)new Color32[891];
			t.SetPixels32(pixels);
			Color black = Color.black;
			Color white = Color.white;
			Button(26, Glyph_R, Glyph_T, Color32.op_Implicit(new Color32((byte)62, (byte)221, (byte)49, byte.MaxValue)));
			for (int i = 0; i < 7; i++)
			{
				for (int j = 0; j < 7; j++)
				{
					char c = Plus[i][j];
					if (c != '.')
					{
						Px(43 + j, 2 + i, (c == 'D') ? white : black);
					}
				}
			}
			Button(52, Glyph_L, Glyph_T, Color32.op_Implicit(new Color32((byte)46, (byte)92, (byte)206, byte.MaxValue)));
			t.Apply();
			return t;
			void Button(int x0, string[] a, string[] b, Color ring)
			{
				//IL_002d: 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_0069: 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)
				for (int k = 0; k < 11; k++)
				{
					for (int l = 0; l < 15; l++)
					{
						char c2 = Pill[k][l];
						if (c2 != '.')
						{
							Px(x0 + l, k, (c2 == 'C') ? ring : black);
						}
					}
				}
				for (int m = 0; m < 5; m++)
				{
					for (int n = 0; n < 3; n++)
					{
						if (a[m][n] == '1')
						{
							Px(x0 + 4 + n, 3 + m, white);
						}
						if (b[m][n] == '1')
						{
							Px(x0 + 8 + n, 3 + m, white);
						}
					}
				}
			}
			void Px(int x, int row, Color val)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				t.SetPixel(x, 10 - row, val);
			}
		}

		internal static void Draw(float meter, int combo, float sinceHit)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: 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_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Expected O, but got Unknown
			if (!loaded)
			{
				Load();
			}
			if ((Object)(object)frame == (Object)null || (Object)(object)bar == (Object)null)
			{
				return;
			}
			float num = Mathf.Max(2, Mathf.RoundToInt((float)Screen.height / 240f));
			float num2 = (float)Screen.width * 0.064f;
			float num3 = (float)Screen.height * 0.872f - 11f * num;
			bool num4 = meter >= 100f;
			GUI.color = Color.white;
			GUI.DrawTexture(new Rect(num2, num3, 81f * num, 11f * num), (Texture)(object)frame);
			float num5 = 67f * num * Mathf.Clamp01(meter / 100f);
			if (num5 > 0f)
			{
				GUI.DrawTexture(new Rect(num2 + 13f * num, num3 + 4f * num, num5, 3f * num), (Texture)(object)bar);
			}
			if (num4)
			{
				if ((Object)(object)flash != (Object)null)
				{
					GUI.color = new Color(1f, 1f, 1f, Mathf.Abs(Mathf.Sin(Time.time * 5f)));
					GUI.DrawTexture(new Rect(num2 + 13f * num, num3 + 4f * num, num5, 3f * num), (Texture)(object)flash);
					GUI.color = Color.white;
				}
				if ((Object)(object)inputs != (Object)null)
				{
					GUI.DrawTexture(new Rect(num2, num3, 81f * num, 11f * num), (Texture)(object)inputs);
				}
			}
			if (combo > 1 && sinceHit < 1.5f)
			{
				if (comboStyle == null)
				{
					comboStyle = new GUIStyle(GUI.skin.label)
					{
						fontStyle = (FontStyle)1,
						alignment = (TextAnchor)6
					};
				}
				comboStyle.fontSize = Mathf.RoundToInt(5f * num);
				Rect val = default(Rect);
				((Rect)(ref val))..ctor(num2 + 13f * num, num3 - 7f * num, 60f * num, 7f * num);
				GUI.color = new Color(0f, 0f, 0f, 0.7f);
				GUI.Label(new Rect(((Rect)(ref val)).x + 2f, ((Rect)(ref val)).y + 2f, ((Rect)(ref val)).width, ((Rect)(ref val)).height), combo + "x Combo", comboStyle);
				GUI.color = Color.white;
				GUI.Label(val, combo + "x Combo", comboStyle);
			}
		}
	}
	internal static class PepsiMusic
	{
		internal static bool Loaded;

		private static bool gameMusicMuted;

		internal unsafe static void Init(string dir)
		{
			string path = Path.Combine(Paths.ConfigPath, "PepsimanMusic.bnk");
			if (!File.Exists(path))
			{
				path = Path.Combine(dir, "PepsimanMusic.bnk");
			}
			if (!File.Exists(path))
			{
				Log.Info("PepsimanMusic.bnk not found (BepInEx/config or the plugin folder): no Pepsiman theme");
				return;
			}
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
			{
				//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_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Invalid comparison between Unknown and I4
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Invalid comparison between Unknown and I4
				uint num = default(uint);
				AKRESULT val = AkSoundEngine.LoadBank(path, ref num);
				Loaded = (int)val == 1 || (int)val == 69;
				Log.Info(Loaded ? "Loaded PepsimanMusic" : ("Could not load PepsimanMusic.bnk: " + ((object)(*(AKRESULT*)(&val))/*cast due to .constrained prefix*/).ToString()));
			});
		}

		internal static float SfxVolume()
		{
			float result = 100f;
			if (AudioManager.cvVolumeSfx != null)
			{
				float.TryParse(((BaseConVar)AudioManager.cvVolumeSfx).GetString(), NumberStyles.Float, CultureInfo.InvariantCulture, out result);
			}
			return result;
		}

		internal static void MuteGameMusic(bool mute)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (mute != gameMusicMuted)
			{
				gameMusicMuted = mute;
				float result = 100f;
				if (!mute && AudioManager.cvVolumeMsx != null)
				{
					float.TryParse(((BaseConVar)AudioManager.cvVolumeMsx).GetString(), NumberStyles.Float, CultureInfo.InvariantCulture, out result);
				}
				AkSoundEngine.SetRTPCValue("Volume_MSX", mute ? 0f : result);
			}
		}
	}
	internal sealed class PepsiThemeEmitter : MonoBehaviour
	{
		private CharacterBody body;

		private GameObject emitter;

		private uint playing;

		private string playingEvent;

		private float volume = -1f;

		private bool local;

		private void Start()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
		}

		private void Update()
		{
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			if ((Object)(object)body == (Object)null)
			{
				return;
			}
			bool flag = Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive;
			string text = ((!(PepsiMusic.Loaded && PepsiConfig.Music.Value && flag) || !PepsiBody.IsPepsiman(body)) ? null : (PepsiBody.IsUltimate(body) ? "Play_PepsiMusic_ThemeMax" : "Play_PepsiMusic_Theme"));
			if (text != playingEvent)
			{
				Stop(1500);
				if (text != null)
				{
					if ((Object)(object)emitter == (Object)null)
					{
						emitter = new GameObject("PepsiTheme");
						emitter.transform.SetParent(((Component)this).transform, false);
					}
					volume = -1f;
					SetVolume();
					playing = AkSoundEngine.PostEvent(text, emitter);
					if (playing == 0)
					{
						Log.Warning("Pepsiman theme: could not post " + text);
					}
				}
				playingEvent = text;
			}
			if (playingEvent != null)
			{
				SetVolume();
			}
			if (body.hasEffectiveAuthority && body.isPlayerControlled)
			{
				local = true;
				PepsiMusic.MuteGameMusic(playingEvent != null && PepsiConfig.MuteGameMusic.Value);
			}
		}

		private void SetVolume()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			float num = PepsiMusic.SfxVolume() * Mathf.Clamp01(PepsiConfig.MusicVolume.Value);
			if (!(Mathf.Abs(num - volume) < 0.5f) && !((Object)(object)emitter == (Object)null))
			{
				volume = num;
				AkSoundEngine.SetRTPCValue("Volume_SFX", num, emitter);
			}
		}

		private void Stop(int fadeMs)
		{
			if (playing != 0)
			{
				AkSoundEngine.StopPlayingID(playing, fadeMs, (AkCurveInterpolation)4);
			}
			playing = 0u;
		}

		private void OnDestroy()
		{
			Stop(800);
			if (local)
			{
				PepsiMusic.MuteGameMusic(mute: false);
			}
		}
	}
	internal sealed class PepsiPuddle : NetworkBehaviour
	{
		internal static GameObject Prefab;

		private static Material material;

		private