Decompiled source of DevilMayClimb v0.4.0

plugins/com.github.Scoops.DevilMayClimb.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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 DevilMayClimb.Monobehavior;
using DevilMayClimb.Patch;
using DevilMayClimb.Service;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Peak.Afflictions;
using Photon.Pun;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.Scoops.DevilMayClimb")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.4.0.0")]
[assembly: AssemblyInformationalVersion("0.4.0+fddb9a662fb4df0d22e952bbb5e59391711de5a5")]
[assembly: AssemblyProduct("com.github.Scoops.DevilMayClimb")]
[assembly: AssemblyTitle("DevilMayClimb")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.4.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.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]
	[Microsoft.CodeAnalysis.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]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace DevilMayClimb
{
	public class Config
	{
		public static ConfigEntry<float> styleVolume;

		public static ConfigEntry<float> decayMult;

		public static ConfigEntry<float> rankMult;

		public static ConfigEntry<bool> comboScaling;

		public Config(ConfigFile cfg)
		{
			styleVolume = cfg.Bind<float>("General", "styleVolume", 0.5f, "The volume of the Style audio (0-1).");
			decayMult = cfg.Bind<float>("General", "decayMult", 1f, "The multplier for Style Decay. Higher numbers = Faster decay.");
			rankMult = cfg.Bind<float>("General", "rankMult", 1f, "The multplier for Style Rank size. Higher numbers means more points needed to hit the next Style Rank. 1 = 100pts to rank up.");
			comboScaling = cfg.Bind<bool>("General", "comboScaling", true, "Enable combo scaling, so longer combos are worth more bonuses.");
		}
	}
	[BepInPlugin("com.github.Scoops.DevilMayClimb", "DevilMayClimb", "0.4.0")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("com.github.Scoops.DevilMayClimb");

		internal static AssetBundle DMCAssets;

		public const string Id = "com.github.Scoops.DevilMayClimb";

		public static Config DMCConfig { get; internal set; }

		internal static ManualLogSource Log { get; private set; }

		public static string Name => "DevilMayClimb";

		public static string Version => "0.4.0";

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)("Loading " + Name + " Version " + Version));
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			string text = Path.Combine(directoryName, "devilmayclimbassets");
			DMCAssets = AssetBundle.LoadFromFile(text);
			DMCConfig = new Config(((BaseUnityPlugin)this).Config);
			DMCAssetManager.Init();
			Log.LogInfo((object)"Applying patches...");
			ApplyPluginPatch();
			Log.LogInfo((object)"Patches applied");
		}

		private void ApplyPluginPatch()
		{
			_harmony.PatchAll(typeof(PlayerPatch));
		}
	}
}
namespace DevilMayClimb.Service
{
	public class DMCAssetManager
	{
		public static AudioClip wipeout;

		public static AudioClip fail;

		public static AudioClip minorTrick_0;

		public static AudioClip trick_0;

		public static AudioClip trick_1;

		public static AudioClip trick_2;

		public static AudioClip trick_3;

		public static AudioClip trick_4;

		public static Sprite dRank;

		public static Sprite cRank;

		public static Sprite bRank;

		public static Sprite aRank;

		public static Sprite sRank;

		public static Sprite ssRank;

		public static Sprite sssRank;

		public static Sprite dRankFill;

		public static Sprite cRankFill;

		public static Sprite bRankFill;

		public static Sprite aRankFill;

		public static Sprite sRankFill;

		public static Sprite ssRankFill;

		public static Sprite sssRankFill;

		public static Sprite dTitle;

		public static Sprite cTitle;

		public static Sprite bTitle;

		public static Sprite aTitle;

		public static Sprite sTitle;

		public static Sprite ssTitle;

		public static Sprite sssTitle;

		public static GameObject styleUIPrefab;

		public static GameObject trickUIPanelPrefab;

		public static AudioClip[] trickChain;

		public static Sprite[] ranks;

		public static Sprite[] fills;

		public static Sprite[] titles;

		public static void Init()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Expected O, but got Unknown
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Expected O, but got Unknown
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Expected O, but got Unknown
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Expected O, but got Unknown
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Expected O, but got Unknown
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Expected O, but got Unknown
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Expected O, but got Unknown
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Expected O, but got Unknown
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Expected O, but got Unknown
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Expected O, but got Unknown
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Expected O, but got Unknown
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Expected O, but got Unknown
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Expected O, but got Unknown
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Expected O, but got Unknown
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Expected O, but got Unknown
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Expected O, but got Unknown
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Expected O, but got Unknown
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Expected O, but got Unknown
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Expected O, but got Unknown
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Expected O, but got Unknown
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Expected O, but got Unknown
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Expected O, but got Unknown
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Expected O, but got Unknown
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Expected O, but got Unknown
			Plugin.Log.LogInfo((object)"Loading Assets...");
			styleUIPrefab = (GameObject)Plugin.DMCAssets.LoadAsset("StyleGroup");
			trickUIPanelPrefab = (GameObject)Plugin.DMCAssets.LoadAsset("TrickUIPrefab");
			dRank = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("DRank")[1];
			cRank = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("CRank")[1];
			bRank = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("BRank")[1];
			aRank = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("ARank")[1];
			sRank = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("SRank")[1];
			ssRank = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("SSRank")[1];
			sssRank = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("SSSRank")[1];
			dRankFill = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("DRankFill")[1];
			cRankFill = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("CRankFill")[1];
			bRankFill = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("BRankFill")[1];
			aRankFill = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("ARankFill")[1];
			sRankFill = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("SRankFill")[1];
			ssRankFill = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("SSRankFill")[1];
			sssRankFill = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("SSSRankFill")[1];
			dTitle = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("DTitle")[1];
			cTitle = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("CTitle")[1];
			bTitle = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("BTitle")[1];
			aTitle = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("ATitle")[1];
			sTitle = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("STitle")[1];
			ssTitle = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("SSTitle")[1];
			sssTitle = (Sprite)Plugin.DMCAssets.LoadAssetWithSubAssets("SSSTitle")[1];
			wipeout = (AudioClip)Plugin.DMCAssets.LoadAsset("Wipeout");
			fail = (AudioClip)Plugin.DMCAssets.LoadAsset("Fail");
			minorTrick_0 = (AudioClip)Plugin.DMCAssets.LoadAsset("MinorTrick_0");
			trick_0 = (AudioClip)Plugin.DMCAssets.LoadAsset("Trick_0");
			trick_1 = (AudioClip)Plugin.DMCAssets.LoadAsset("Trick_1");
			trick_2 = (AudioClip)Plugin.DMCAssets.LoadAsset("Trick_2");
			trick_3 = (AudioClip)Plugin.DMCAssets.LoadAsset("Trick_3");
			trick_4 = (AudioClip)Plugin.DMCAssets.LoadAsset("Trick_4");
			trickChain = (AudioClip[])(object)new AudioClip[5] { trick_0, trick_1, trick_2, trick_3, trick_4 };
			ranks = (Sprite[])(object)new Sprite[7] { dRank, cRank, bRank, aRank, sRank, ssRank, sssRank };
			fills = (Sprite[])(object)new Sprite[7] { dRankFill, cRankFill, bRankFill, aRankFill, sRankFill, ssRankFill, sssRankFill };
			titles = (Sprite[])(object)new Sprite[7] { dTitle, cTitle, bTitle, aTitle, sTitle, ssTitle, sssTitle };
		}

		private static Sprite ConvertToSprite(Texture2D tex)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			return Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), new Vector2(0.5f, 0.5f), 100f, 1u, (SpriteMeshType)1);
		}
	}
	public struct StyleMod
	{
		public string Descriptor;

		public float Modifier;

		public StyleMod(string descriptor, float modifier)
		{
			Descriptor = descriptor;
			Modifier = modifier;
		}
	}
	public static class StyleManager
	{
		private static Character? LocalCharacter;

		private static GameObject StyleUI;

		private static Transform TrickHistory;

		private static AudioSource StyleAudio;

		private static Image rankImage;

		private static Image rankFillImage;

		private static Image titleImage;

		private static Transform ComboPanel;

		private static TextMeshProUGUI ComboNumber;

		private static TextMeshProUGUI ComboPoints;

		private static int comboCounterTotalPoints = 0;

		private static int previousStyleRank = 0;

		private static float lastTrickTime;

		private static int trickChain = 0;

		private static Color32 SUCCESS_COLOR = new Color32((byte)86, (byte)197, (byte)0, byte.MaxValue);

		private static Color32 FAILURE_COLOR = new Color32((byte)195, (byte)12, (byte)21, byte.MaxValue);

		private static string[] FAIL_LINES = new string[3] { "Oof", "Ouch", "Owie" };

		private static bool init = false;

		private static Item lastThrownItem;

		private static Vector3 lastThrownItemPos;

		private static void Init()
		{
			GlobalEvents.OnItemConsumed = (Action<Item, Character>)Delegate.Combine(GlobalEvents.OnItemConsumed, new Action<Item, Character>(CheckItemEaten));
			GlobalEvents.OnLuggageOpened = (Action<Luggage, Character>)Delegate.Combine(GlobalEvents.OnLuggageOpened, new Action<Luggage, Character>(CheckLuggageOpened));
			GlobalEvents.OnItemThrown = (Action<Item>)Delegate.Combine(GlobalEvents.OnItemThrown, new Action<Item>(CheckItemThrown));
			GlobalEvents.OnItemRequested = (Action<Item, Character>)Delegate.Combine(GlobalEvents.OnItemRequested, new Action<Item, Character>(CheckItemCaught));
			init = true;
		}

		public static void RegisterPlayer(Player localPlayer)
		{
			if (!init)
			{
				Init();
			}
			AttachHUD();
		}

		public static void RegisterCharacter(Character localCharacter)
		{
			if ((Object)(object)LocalCharacter != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)LocalCharacter).gameObject.GetComponent<StyleTracker>());
			}
			LocalCharacter = localCharacter;
			((Component)LocalCharacter).gameObject.AddComponent<StyleTracker>();
		}

		public static void AttachHUD()
		{
			StyleUI = Object.Instantiate<GameObject>(DMCAssetManager.styleUIPrefab, ((Component)GUIManager.instance.hudCanvas).transform);
			TrickHistory = StyleUI.transform.Find("StylePanel/TrickHistory");
			StyleAudio = StyleUI.GetComponent<AudioSource>();
			StyleAudio.volume = Config.styleVolume.Value;
			rankImage = ((Component)StyleUI.transform.Find("StylePanel/Rank")).GetComponent<Image>();
			rankFillImage = ((Component)StyleUI.transform.Find("StylePanel/Rank/RankFill")).GetComponent<Image>();
			titleImage = ((Component)StyleUI.transform.Find("StylePanel/Title")).GetComponent<Image>();
			((Component)rankFillImage).gameObject.AddComponent<FillBounce>();
			ComboPanel = StyleUI.transform.Find("StylePanel/ComboPanel");
			ComboNumber = ((Component)ComboPanel.Find("ComboNumber")).GetComponent<TextMeshProUGUI>();
			ComboPoints = ((Component)ComboPanel.Find("ComboPoints")).GetComponent<TextMeshProUGUI>();
		}

		public static void ApplyStyleAction(string action, int points, float time, int comboCount)
		{
			//IL_00bb: 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)
			if (points < 0)
			{
				StyleAudio.PlayOneShot(DMCAssetManager.fail);
			}
			else if (points < 50)
			{
				StyleAudio.PlayOneShot(DMCAssetManager.minorTrick_0);
			}
			else
			{
				float num = time - lastTrickTime;
				lastTrickTime = time;
				if (num < 5f)
				{
					trickChain++;
					if (trickChain > 4)
					{
						trickChain = 4;
					}
					StyleAudio.PlayOneShot(DMCAssetManager.trickChain[trickChain]);
				}
				else
				{
					trickChain = 0;
					StyleAudio.PlayOneShot(DMCAssetManager.trick_0);
				}
			}
			if (points < 0)
			{
				AddTrickHistory(action + "! " + points, FAILURE_COLOR);
			}
			else
			{
				AddTrickHistory(action + "! +" + points, SUCCESS_COLOR);
			}
			UpdateComboCounter(points, comboCount);
		}

		public static void ApplyFailure()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			StyleAudio.PlayOneShot(DMCAssetManager.fail);
			AddTrickHistory(FAIL_LINES[Random.Range(0, 3)] + "! -" + 100f * Config.rankMult.Value, FAILURE_COLOR);
		}

		public static void ApplyWipeout(int points)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			StyleAudio.PlayOneShot(DMCAssetManager.wipeout);
			AddTrickHistory("Wipeout! -" + points, FAILURE_COLOR);
		}

		public static void UpdateComboCounter(int points, int comboCount)
		{
			if (comboCount == 2)
			{
				((Component)ComboPanel).GetComponent<Animator>().Play("ComboAppear");
			}
			((TMP_Text)ComboNumber).text = comboCount.ToString();
			comboCounterTotalPoints += points;
			((TMP_Text)ComboPoints).text = comboCounterTotalPoints + " pts";
		}

		public static void DropCombo()
		{
			((Component)ComboPanel).GetComponent<Animator>().Play("ComboDisappear");
			comboCounterTotalPoints = 0;
		}

		public static void UpdateStyleRank(int rank)
		{
			rankImage.sprite = DMCAssetManager.ranks[rank];
			rankFillImage.sprite = DMCAssetManager.fills[rank];
			titleImage.sprite = DMCAssetManager.titles[rank];
			if (previousStyleRank < rank)
			{
				rankFillImage.fillAmount = 0f;
			}
			if (previousStyleRank > rank)
			{
				rankFillImage.fillAmount = 1f;
			}
			((Component)rankImage).GetComponent<Animator>().Play("RankAnimation");
			((Component)titleImage).GetComponent<Animator>().Play("TitleAnimation");
			previousStyleRank = rank;
		}

		public static void UpdateStyleFill(float percent)
		{
			if (percent != rankFillImage.fillAmount && percent - rankFillImage.fillAmount > 0.1f)
			{
				((Component)rankFillImage).GetComponent<FillBounce>().SetGoal(percent);
			}
			else
			{
				rankFillImage.fillAmount = percent;
			}
		}

		private static void AddTrickHistory(string text, Color32 color)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(DMCAssetManager.trickUIPanelPrefab, TrickHistory);
			((TMP_Text)((Component)val.transform.Find("TrickText")).GetComponent<TextMeshProUGUI>()).text = text;
			((Graphic)((Component)val.transform.Find("TrickText")).GetComponent<TextMeshProUGUI>()).color = Color32.op_Implicit(color);
			val.AddComponent<TrickFadout>();
		}

		private static void CheckItemEaten(Item item, Character character)
		{
			if (character.IsLocal && Object.op_Implicit((Object)(object)StyleTracker.localStyleTracker))
			{
				StyleTracker.localStyleTracker.ItemEaten(item);
			}
		}

		private static void CheckLuggageOpened(Luggage luggage, Character character)
		{
			if (character.IsLocal && Object.op_Implicit((Object)(object)StyleTracker.localStyleTracker))
			{
				StyleTracker.localStyleTracker.LuggageOpened(luggage);
			}
		}

		private static void CheckItemThrown(Item item)
		{
			//IL_000c: 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)
			lastThrownItem = item;
			lastThrownItemPos = ((Component)item).transform.position;
		}

		public static void CheckItemCaught(Item item, Character character)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)StyleTracker.localStyleTracker) && !((Object)(object)lastThrownItem != (Object)(object)item))
			{
				StyleTracker.localStyleTracker.ItemCaught(item, character, lastThrownItemPos);
			}
		}
	}
}
namespace DevilMayClimb.Patch
{
	public class PlayerPatch
	{
		[HarmonyPatch(typeof(Player), "Awake")]
		[HarmonyPostfix]
		public static void PlayerAwake(ref Player __instance)
		{
			if (!((Object)(object)__instance.view == (Object)null) && __instance.view.IsMine)
			{
				StyleManager.RegisterPlayer(__instance);
			}
		}

		[HarmonyPatch(typeof(Character), "Awake")]
		[HarmonyPostfix]
		public static void CharacterAwake(ref Character __instance)
		{
			if (__instance.IsLocal)
			{
				StyleManager.RegisterCharacter(__instance);
			}
		}

		[HarmonyPatch(typeof(CharacterAfflictions), "AddStatus")]
		[HarmonyPostfix]
		public static void CharacterAddStatus(ref CharacterAfflictions __instance, STATUSTYPE statusType, float amount, bool fromRPC)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.character.IsLocal && Object.op_Implicit((Object)(object)StyleTracker.localStyleTracker) && amount > 0f && (int)statusType == 0)
			{
				StyleTracker.localStyleTracker.Fail();
			}
		}

		[HarmonyPatch(typeof(CharacterMovement), "CheckFallDamage")]
		[HarmonyPostfix]
		public static void CharacterCheckFallDamage(ref CharacterMovement __instance)
		{
			if (__instance.character.IsLocal && Object.op_Implicit((Object)(object)StyleTracker.localStyleTracker) && __instance.FallTime() <= __instance.fallDamageTime && __instance.FallTime() > __instance.fallDamageTime - 0.4f)
			{
				StyleTracker.localStyleTracker.CloseFall();
			}
		}

		[HarmonyPatch(typeof(GUIManager), "Grasp")]
		[HarmonyPostfix]
		public static void GUIGrasp(ref GUIManager __instance)
		{
			if (Object.op_Implicit((Object)(object)StyleTracker.localStyleTracker))
			{
				StyleTracker.localStyleTracker.Grasp();
			}
		}

		[HarmonyPatch(typeof(CharacterMovement), "CheckForPalJump")]
		[HarmonyPrefix]
		public static void CharacterCheckFallDamage(ref CharacterMovement __instance, Character c)
		{
			if ((__instance.character.IsLocal || c.IsLocal) && Object.op_Implicit((Object)(object)StyleTracker.localStyleTracker) && __instance.character.data.sinceStandOnPlayer < 0.3f && c.data.sinceJump < 0.3f)
			{
				if (__instance.character.IsLocal)
				{
					StyleTracker.localStyleTracker.FriendBoosted();
				}
				else if (c.IsLocal)
				{
					StyleTracker.localStyleTracker.FriendBooster();
				}
			}
		}

		[HarmonyPatch(typeof(Campfire), "Light_Rpc")]
		[HarmonyPostfix]
		public static void CampfireLight(ref Campfire __instance)
		{
			if (Object.op_Implicit((Object)(object)StyleTracker.localStyleTracker))
			{
				StyleTracker.localStyleTracker.Campfire();
			}
		}

		[HarmonyPatch(typeof(ItemCooking), "FinishCooking")]
		[HarmonyPostfix]
		public static void ItemFinishCooking(ref ItemCooking __instance)
		{
			if (Object.op_Implicit((Object)(object)StyleTracker.localStyleTracker) && Object.op_Implicit((Object)(object)((ItemComponent)__instance).item.holderCharacter) && (Object)(object)((ItemComponent)__instance).item.holderCharacter == (Object)(object)Character.localCharacter)
			{
				StyleTracker.localStyleTracker.Cooked(__instance.timesCookedLocal);
			}
		}

		[HarmonyPatch(typeof(RespawnChest), "SpawnItems")]
		[HarmonyPrefix]
		public static void RespawnChestSpawnItems(ref RespawnChest __instance, List<Transform> spawnSpots)
		{
			if (Object.op_Implicit((Object)(object)StyleTracker.localStyleTracker))
			{
				StyleTracker.localStyleTracker.RespawnChestActivated();
			}
		}

		[HarmonyPatch(typeof(ScoutEffigy), "FinishConstruction")]
		[HarmonyPrefix]
		public static void EffigyFinish(ref ScoutEffigy __instance)
		{
			if (Object.op_Implicit((Object)(object)StyleTracker.localStyleTracker) && !((Object)(object)((ItemComponent)__instance).item.holderCharacter != (Object)(object)Character.localCharacter))
			{
				StyleTracker.localStyleTracker.EffigyActivated();
			}
		}

		[HarmonyPatch(typeof(Character), "FeedItem")]
		[HarmonyPrefix]
		public static void CharacterFeed(ref Character __instance, Item item)
		{
			if (Object.op_Implicit((Object)(object)StyleTracker.localStyleTracker) && !((Object)(object)item.holderCharacter != (Object)(object)Character.localCharacter))
			{
				StyleTracker.localStyleTracker.FedItem(item);
			}
		}

		[HarmonyPatch(typeof(ThornOnMe), "Interact_CastFinished")]
		[HarmonyPostfix]
		public static void ThornInteract(ref ThornOnMe __instance, Character interactor)
		{
			if (Object.op_Implicit((Object)(object)StyleTracker.localStyleTracker) && !((Object)(object)interactor != (Object)(object)Character.localCharacter))
			{
				StyleTracker.localStyleTracker.RemovedThorn();
			}
		}

		[HarmonyPatch(typeof(Scorpion), "InflictAttack")]
		[HarmonyPostfix]
		public static void ScorpionAttack(ref Scorpion __instance, Character character)
		{
			if (Object.op_Implicit((Object)(object)StyleTracker.localStyleTracker) && !((Object)(object)character != (Object)(object)Character.localCharacter))
			{
				StyleTracker.localStyleTracker.ScorpionSting();
			}
		}

		[HarmonyPatch(typeof(SlipperyJellyfish), "Trigger")]
		[HarmonyPostfix]
		public static void JellyfishSlip(ref SlipperyJellyfish __instance, int targetID)
		{
			if (Object.op_Implicit((Object)(object)StyleTracker.localStyleTracker))
			{
				Character component = ((Component)PhotonView.Find(targetID)).GetComponent<Character>();
				if (!((Object)(object)component == (Object)null) && !((Object)(object)component != (Object)(object)Character.localCharacter))
				{
					StyleTracker.localStyleTracker.JellyfishSlip();
				}
			}
		}

		[HarmonyPatch(typeof(TumbleWeed), "OnCollisionEnter")]
		[HarmonyPostfix]
		public static void TumbleWeedCollide(ref TumbleWeed __instance, Collision collision)
		{
			//IL_0041: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)StyleTracker.localStyleTracker))
			{
				return;
			}
			Character componentInParent = collision.gameObject.GetComponentInParent<Character>();
			if (Object.op_Implicit((Object)(object)componentInParent) && componentInParent.IsLocal && !__instance.ignored.Contains(componentInParent))
			{
				float num = ((Component)__instance).transform.localScale.x / __instance.originalScale;
				if (__instance.originalScale == 0f)
				{
					num = 1f;
				}
				num = Mathf.Clamp01(num);
				Vector3 linearVelocity = __instance.rig.linearVelocity;
				float num2 = Mathf.Clamp01(((Vector3)(ref linearVelocity)).magnitude * num * __instance.powerMultiplier);
				if (__instance.testFullPower)
				{
					num2 = 1f;
				}
				if (!(num2 < 0.2f))
				{
					StyleTracker.localStyleTracker.Tumbleweed();
				}
			}
		}

		[HarmonyPatch(typeof(Bonkable), "OnCollisionEnter")]
		[HarmonyPrefix]
		public static void BonkableCollide(ref Bonkable __instance, Collision coll)
		{
			//IL_0014: 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)
			if (!Object.op_Implicit((Object)(object)StyleTracker.localStyleTracker) || (int)__instance.item.itemState != 0 || !Object.op_Implicit((Object)(object)__instance.item.rig))
			{
				return;
			}
			Vector3 relativeVelocity = coll.relativeVelocity;
			if (((Vector3)(ref relativeVelocity)).magnitude > __instance.minBonkVelocity)
			{
				Character componentInParent = coll.gameObject.GetComponentInParent<Character>();
				if (Object.op_Implicit((Object)(object)componentInParent) && Time.time > __instance.lastBonkedTime + __instance.bonkCooldown)
				{
					StyleTracker.localStyleTracker.Bonk(__instance.item, componentInParent);
				}
			}
		}

		[HarmonyPatch(typeof(Lava), "Heat")]
		[HarmonyPrefix]
		public static void LavaHeat(ref Lava __instance)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)StyleTracker.localStyleTracker))
			{
				return;
			}
			Character localCharacter = Character.localCharacter;
			if ((Object)(object)localCharacter == (Object)null)
			{
				return;
			}
			float num = __instance.counter + Time.deltaTime;
			if (!__instance.OutsideBounds(localCharacter.Center))
			{
				float num2 = localCharacter.Center.y - ((Component)__instance).transform.position.y;
				float num3 = 1f - Mathf.Clamp01(num2 / __instance.height);
				if (!(num3 < 0.25f) && !(num < __instance.heatRate))
				{
					StyleTracker.localStyleTracker.LavaHeat(num3 * 2f * __instance.heat * 1.5f);
				}
			}
		}
	}
}
namespace DevilMayClimb.Monobehavior
{
	public class FillBounce : MonoBehaviour
	{
		private AnimationCurve fillCurve;

		private float fillDuration = 0.5f;

		private Image image;

		private float goalFill;

		private float currentFill;

		private float fillStart;

		public void Start()
		{
			//IL_0033: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			image = ((Component)this).GetComponent<Image>();
			Keyframe[] array = (Keyframe[])(object)new Keyframe[3]
			{
				new Keyframe(0f, 0f, 0f, 1.25f, 0f, 0f),
				default(Keyframe),
				default(Keyframe)
			};
			((Keyframe)(ref array[0])).weightedMode = (WeightedMode)0;
			array[1] = new Keyframe(0.8f, 1f, -0.5780662f, -0.5780662f, 0.09657286f, 0f);
			((Keyframe)(ref array[1])).weightedMode = (WeightedMode)0;
			array[2] = new Keyframe(1f, 1f, 0f, 0f, 0f, 0f);
			((Keyframe)(ref array[2])).weightedMode = (WeightedMode)0;
			fillCurve = new AnimationCurve(array);
		}

		public void SetGoal(float newGoal)
		{
			goalFill = newGoal;
			fillStart = Time.time;
			currentFill = image.fillAmount;
		}

		public void Update()
		{
			if (Time.time - fillStart <= fillDuration)
			{
				image.fillAmount = currentFill + fillCurve.Evaluate((Time.time - fillStart) / fillDuration) * (goalFill - currentFill);
			}
		}
	}
	public class StyleTracker : MonoBehaviour
	{
		public static StyleTracker localStyleTracker;

		public static float RANK_POINTS = 100f * Config.rankMult.Value;

		public static float MAX_STYLE = RANK_POINTS * 7f;

		private const float SLOW_DECAY = 0.025f;

		private const float FAST_DECAY = 0.05f;

		private const float TRICK_GRACE = 5f;

		private const float INTERNAL_TRICK_COOLDOWN = 0.1f;

		private const float MIN_CLIMB = 4f;

		private const float LONG_CLIMB = 100f;

		private Character? localCharacter;

		private Dictionary<string, float> trickRecordDict;

		private float stylePoints;

		private int styleRank;

		private float lastTrickTime;

		private float lastUpsidedown;

		private int comboCounter = 1;

		private bool activeCombo;

		private Vector3 climbStartPos = Vector3.zero;

		private Vector3 climbLastPos = Vector3.zero;

		private Vector3 climbLastNormal = Vector3.zero;

		private bool canTransfer;

		private bool wallSliding;

		private float wallSlideStart;

		private bool ropeClimbing;

		private bool vineClimbing;

		private bool vineGrinding;

		private bool cannonLaunched;

		private float lastGrasp;

		private float lavaHeatCounter;

		private bool passedOut;

		private float passedOutTime;

		private float passedOutPoints;

		public void Awake()
		{
			trickRecordDict = new Dictionary<string, float>();
			localStyleTracker = this;
			localCharacter = ((Component)this).GetComponent<Character>();
			AttachEvents();
		}

		private void AttachEvents()
		{
			if (Object.op_Implicit((Object)(object)localCharacter))
			{
				Character? obj = localCharacter;
				obj.startClimbAction = (Action)Delegate.Combine(obj.startClimbAction, (Action)delegate
				{
					SetClimbStart();
				});
			}
		}

		private List<StyleMod> GetActiveModifiers()
		{
			List<StyleMod> list = new List<StyleMod>();
			if (!Object.op_Implicit((Object)(object)localCharacter))
			{
				return list;
			}
			if (localCharacter.GetMaxStamina() <= 0.1f)
			{
				list.Add(new StyleMod("Death's Door", 1f));
			}
			if (localCharacter.data.extraStamina >= 1f)
			{
				list.Add(new StyleMod("Happy", 0.25f));
			}
			Affliction val = default(Affliction);
			if (localCharacter.refs.afflictions.HasAfflictionType((AfflictionType)1, ref val))
			{
				list.Add(new StyleMod("Sugar Rush", 0.25f));
			}
			if (localCharacter.refs.afflictions.HasAfflictionType((AfflictionType)2, ref val))
			{
				list.Add(new StyleMod("Energized", 0.25f));
			}
			if (localCharacter.refs.balloons.currentBalloonCount > 0)
			{
				list.Add(new StyleMod("Air Head", -0.75f));
			}
			if (Object.op_Implicit((Object)(object)localCharacter.data.carriedPlayer))
			{
				list.Add(new StyleMod("Supportive", 1f));
			}
			if (Object.op_Implicit((Object)(object)localCharacter.data.currentItem))
			{
				if (((Object)localCharacter.data.currentItem).name.Contains("BingBong", StringComparison.CurrentCultureIgnoreCase))
				{
					list.Add(new StyleMod("Bing Bong", 0.5f));
				}
				if (((Object)localCharacter.data.currentItem).name.Contains("Bugle", StringComparison.CurrentCultureIgnoreCase))
				{
					list.Add(new StyleMod("Melodic", 0.5f));
				}
				if (((Object)localCharacter.data.currentItem).name.Contains("Parasol", StringComparison.CurrentCultureIgnoreCase))
				{
					list.Add(new StyleMod("Lightweight", -0.75f));
				}
			}
			if (localCharacter.refs.afflictions.GetCurrentStatus((STATUSTYPE)1) >= 0.3f)
			{
				list.Add(new StyleMod("Ravenous", 0.25f));
			}
			if (localCharacter.refs.afflictions.GetCurrentStatus((STATUSTYPE)7) >= 0.3f)
			{
				list.Add(new StyleMod("Loaded", 0.25f));
			}
			if (localCharacter.refs.afflictions.GetCurrentStatus((STATUSTYPE)8) >= 0.3f)
			{
				list.Add(new StyleMod("Blazing", 0.25f));
			}
			if (localCharacter.refs.afflictions.GetCurrentStatus((STATUSTYPE)2) >= 0.3f)
			{
				list.Add(new StyleMod("Chill", 0.25f));
			}
			if (localCharacter.refs.afflictions.GetCurrentStatus((STATUSTYPE)9) >= 0.3f)
			{
				list.Add(new StyleMod("Spiked", 0.25f));
			}
			if (localCharacter.refs.afflictions.GetCurrentStatus((STATUSTYPE)6) >= 0.3f)
			{
				list.Add(new StyleMod("Dreamy", 0.25f));
			}
			if (localCharacter.refs.afflictions.GetCurrentStatus((STATUSTYPE)3) >= 0.3f)
			{
				list.Add(new StyleMod("Toxic", 0.25f));
			}
			if (localCharacter.refs.afflictions.GetCurrentStatus((STATUSTYPE)0) >= 0.3f)
			{
				list.Add(new StyleMod("Busted", 0.25f));
			}
			if (localCharacter.refs.afflictions.GetCurrentStatus((STATUSTYPE)5) >= 0.3f)
			{
				list.Add(new StyleMod("Wicked", 0.5f));
			}
			if (localCharacter.data.slippy > 0f)
			{
				list.Add(new StyleMod("Slippery", 0.25f));
			}
			return list;
		}

		private void SendStyleAction(string action, int points)
		{
			if (localCharacter.data.passedOut || localCharacter.data.fullyPassedOut || localCharacter.data.dead || (trickRecordDict.TryGetValue(action, out var value) && Time.time - value < 0.1f))
			{
				return;
			}
			int num = points;
			float num2 = 1f;
			string text = action;
			foreach (StyleMod activeModifier in GetActiveModifiers())
			{
				num2 += activeModifier.Modifier;
				text = activeModifier.Descriptor + " " + text;
			}
			if (points > 0)
			{
				if (Time.time - lastTrickTime <= 5f)
				{
					if (Config.comboScaling.Value)
					{
						comboCounter++;
						num2 += 0.1f * (float)comboCounter;
					}
					else
					{
						num2 += 0.25f;
					}
					activeCombo = true;
				}
				else if (comboCounter != 1)
				{
					comboCounter = 1;
				}
				num = Mathf.RoundToInt((float)points * num2);
				lastTrickTime = Time.time;
			}
			else
			{
				DropCombo();
			}
			stylePoints += num;
			StyleManager.ApplyStyleAction(text, num, Time.time, comboCounter);
			trickRecordDict[action] = Time.time;
		}

		public void FixedUpdate()
		{
			if (Object.op_Implicit((Object)(object)localCharacter))
			{
				CheckCannon();
				CheckPassedOut();
				CheckClimbing();
				CheckForFlips();
				UpdateStyle();
			}
		}

		private void CheckCannon()
		{
			if (localCharacter.data.launchedByCannon && !cannonLaunched)
			{
				cannonLaunched = true;
				SendStyleAction("Cannonball", 70);
			}
			else if (!localCharacter.data.launchedByCannon && cannonLaunched)
			{
				cannonLaunched = false;
			}
		}

		private void CheckPassedOut()
		{
			if ((localCharacter.refs.afflictions.statusSum >= 1f || localCharacter.data.passedOut) && !passedOut)
			{
				passedOutTime = Time.time;
				StyleManager.ApplyWipeout(Mathf.RoundToInt(stylePoints));
				passedOutPoints = stylePoints;
				stylePoints = 0f;
				DropCombo();
				passedOut = true;
			}
			else if (localCharacter.refs.afflictions.statusSum < 1f && !localCharacter.data.passedOut && passedOut)
			{
				if (Time.time - passedOutTime < 5f)
				{
					stylePoints = passedOutPoints + 100f * Config.rankMult.Value;
					StyleManager.ApplyStyleAction("Close Call", Mathf.RoundToInt(passedOutPoints + 100f * Config.rankMult.Value), Time.time, 1);
				}
				passedOut = false;
			}
		}

		private void CheckClimbing()
		{
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			if (localCharacter.data.isGrounded && canTransfer)
			{
				canTransfer = false;
			}
			if (localCharacter.data.isClimbing && !localCharacter.IsSliding())
			{
				if (localCharacter.refs.climbing.playerSlide.y < 0f)
				{
					if (!wallSliding)
					{
						wallSliding = true;
						wallSlideStart = Time.time;
					}
				}
				else if (wallSliding)
				{
					wallSliding = false;
					if (Time.time - wallSlideStart >= 0.4f)
					{
						SendStyleAction("Slide", 40);
					}
					SetClimbStart();
				}
				else
				{
					EvalClimbDistance(1f);
				}
			}
			else if (wallSliding)
			{
				wallSliding = false;
			}
			if (localCharacter.data.isRopeClimbing)
			{
				if (!ropeClimbing)
				{
					ropeClimbing = true;
					SetClimbStart();
				}
				else
				{
					EvalClimbDistance(4f);
				}
			}
			else if (ropeClimbing)
			{
				ropeClimbing = false;
			}
			if (localCharacter.data.isVineClimbing)
			{
				if (!vineClimbing)
				{
					vineClimbing = true;
					SetClimbStart();
				}
				else if (localCharacter.refs.vineClimbing.Sliding())
				{
					if (!vineGrinding)
					{
						vineGrinding = true;
					}
					if (Vector3.SqrMagnitude(localCharacter.TorsoPos() - climbLastPos) >= 16f)
					{
						SendStyleAction("Grind", 40);
						climbLastPos = localCharacter.TorsoPos();
					}
				}
				else if (vineGrinding && !localCharacter.refs.vineClimbing.Sliding())
				{
					vineGrinding = false;
					SetClimbStart();
				}
				else
				{
					EvalClimbDistance(4f);
				}
			}
			else if (vineClimbing)
			{
				vineClimbing = false;
				if (vineGrinding)
				{
					vineGrinding = false;
				}
			}
		}

		private void CheckForFlips()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if (Vector3.Angle(((Component)localCharacter.GetBodypart((BodypartType)0)).transform.up, Vector3.down) < 20f)
			{
				lastUpsidedown = Time.time;
			}
			else if (Time.time - lastUpsidedown <= 5f && Vector3.Angle(((Component)localCharacter.GetBodypart((BodypartType)0)).transform.up, Vector3.up) < 20f)
			{
				SendStyleAction("Flip", 40);
				lastUpsidedown = 0f;
			}
		}

		public void ItemEaten(Item item)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)((Component)item).GetComponent<Action_RestoreHunger>()) || Object.op_Implicit((Object)(object)((Component)item).GetComponent<Action_GiveExtraStamina>()))
			{
				if (((Enum)item.itemTags).HasFlag((Enum)(object)(ItemTags)32) && item.GetData<IntItemData>((DataEntryKey)1).Value >= 1)
				{
					SendStyleAction("Gourmand", 15);
				}
				else if (item.GetData<IntItemData>((DataEntryKey)1).Value == 1)
				{
					SendStyleAction("Meal", 10);
				}
				else
				{
					SendStyleAction("Quaff", 5);
				}
			}
		}

		public void FedItem(Item item)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Invalid comparison between Unknown and I4
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)((Component)item).GetComponent<Action_RestoreHunger>()) || Object.op_Implicit((Object)(object)((Component)item).GetComponent<Action_GiveExtraStamina>()))
			{
				SendStyleAction("Waiter", 15);
			}
			else if (Object.op_Implicit((Object)(object)((Component)item).GetComponent<Action_ModifyStatus>()))
			{
				Action_ModifyStatus component = ((Component)item).GetComponent<Action_ModifyStatus>();
				if (component.changeAmount < 0f && ((int)component.statusType == 3 || (int)component.statusType == 0))
				{
					SendStyleAction("Medic", 25);
				}
			}
		}

		public void LuggageOpened(Luggage luggage)
		{
			if (!(luggage is RespawnChest))
			{
				if (luggage is LuggageCursed)
				{
					SendStyleAction("Risky Plunder", Mathf.RoundToInt(100f * Config.rankMult.Value));
				}
				else
				{
					SendStyleAction("Plunder", 10);
				}
			}
		}

		private void SetClimbStart()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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)
			climbStartPos = localCharacter.TorsoPos();
			climbLastPos = climbStartPos;
			if (localCharacter.data.isClimbing)
			{
				if (canTransfer && Vector3.Angle(localCharacter.data.climbNormal, climbLastNormal) >= 80f)
				{
					canTransfer = false;
					SendStyleAction("Wall Transfer", 25);
				}
				canTransfer = true;
				climbLastNormal = localCharacter.data.climbNormal;
			}
			else if (canTransfer)
			{
				canTransfer = false;
			}
		}

		private void EvalClimbDistance(float distMultSq)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: 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_002a: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (Vector3.SqrMagnitude(localCharacter.TorsoPos() - climbLastPos) >= 4f * distMultSq)
			{
				if (Vector3.SqrMagnitude(localCharacter.TorsoPos() - climbStartPos) < 100f * distMultSq)
				{
					SendStyleAction("Climb", 10);
				}
				else
				{
					SendStyleAction("Long Climb", 20);
				}
				climbLastPos = localCharacter.TorsoPos();
				if (localCharacter.data.isClimbing)
				{
					climbLastNormal = localCharacter.data.climbNormal;
				}
			}
		}

		public void Fail()
		{
			Affliction val = default(Affliction);
			if (!localCharacter.refs.afflictions.HasAfflictionType((AfflictionType)14, ref val))
			{
				stylePoints -= 100f * Config.rankMult.Value;
				StyleManager.ApplyFailure();
				DropCombo();
			}
		}

		public void CloseFall()
		{
			SendStyleAction("Risky Landing", 25);
		}

		public void Grasp()
		{
			if (Time.time - lastGrasp >= 2.5f)
			{
				SendStyleAction("Helping Hand", 20);
				lastGrasp = Time.time;
			}
		}

		public void Campfire()
		{
			SendStyleAction("Campfire", 50);
		}

		public void RemovedThorn()
		{
			SendStyleAction("Medic", 10);
		}

		public void Cooked(int timesCooked)
		{
			if (timesCooked == 1)
			{
				SendStyleAction("Chef", 10);
			}
			if (timesCooked == 2)
			{
				SendStyleAction("Overcooked", 5);
			}
			if (timesCooked >= 3)
			{
				SendStyleAction("Fire Hazard", -10);
			}
		}

		public void RespawnChestActivated()
		{
			if (Ascents.canReviveDead && Character.PlayerIsDeadOrDown())
			{
				SendStyleAction("Rule 0", 50);
			}
			else
			{
				SendStyleAction("Perfect Ascent", 70);
			}
		}

		public void EffigyActivated()
		{
			SendStyleAction("Rule 0", 50);
		}

		public void FriendBoosted()
		{
			SendStyleAction("Boost Jump", 40);
		}

		public void FriendBooster()
		{
			SendStyleAction("Friend Boost", 30);
		}

		public void ScorpionSting()
		{
			SendStyleAction("Stinger", -50);
		}

		public void JellyfishSlip()
		{
			SendStyleAction("Slip", -25);
		}

		public void Tumbleweed()
		{
			SendStyleAction("Tumbled", -25);
		}

		public void LavaHeat(float heatAmount)
		{
			lavaHeatCounter += heatAmount;
			if (lavaHeatCounter > 0.12f)
			{
				lavaHeatCounter = 0f;
				SendStyleAction("Hot Feet", 25);
			}
		}

		public void Bonk(Item item, Character character)
		{
			if (Object.op_Implicit((Object)(object)item.lastThrownCharacter) && (Object)(object)item.lastThrownCharacter == (Object)(object)localCharacter)
			{
				SendStyleAction("Bonk", 25);
			}
			if ((Object)(object)character == (Object)(object)localCharacter)
			{
				SendStyleAction("Bonked", -25);
			}
		}

		public void ItemCaught(Item item, Character character, Vector3 thrownPos)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (!(Time.time - item.lastThrownTime >= 0.5f) || !Object.op_Implicit((Object)(object)((Component)item).GetComponent<Rigidbody>()))
			{
				return;
			}
			Vector3 val = ((Component)item).GetComponent<Rigidbody>().linearVelocity;
			if (!(((Vector3)(ref val)).sqrMagnitude > 9f))
			{
				return;
			}
			val = ((Component)item).transform.position - thrownPos;
			float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
			float num = 100f;
			if ((Object)(object)character == (Object)(object)localCharacter)
			{
				if (sqrMagnitude >= num)
				{
					SendStyleAction("Long Catch", 40);
				}
				else
				{
					SendStyleAction("Catch", 25);
				}
			}
		}

		private void DropCombo()
		{
			if (activeCombo)
			{
				activeCombo = false;
				comboCounter = 1;
				lastTrickTime = 0f;
				StyleManager.DropCombo();
			}
		}

		private void UpdateStyle()
		{
			if (stylePoints > MAX_STYLE)
			{
				stylePoints = MAX_STYLE;
			}
			float num = Time.time - lastTrickTime;
			if (num > 5f)
			{
				float num2 = 0.05f;
				if (localCharacter.data.isSprinting || localCharacter.data.isJumping || !localCharacter.data.isGrounded)
				{
					num2 = 0.025f;
				}
				if (styleRank == 4)
				{
					num2 *= 2f;
				}
				if (styleRank == 5)
				{
					num2 *= 2.5f;
				}
				if (styleRank == 6)
				{
					num2 *= 3f;
				}
				num2 *= Config.decayMult.Value;
				stylePoints -= num2;
				DropCombo();
			}
			if (stylePoints < 0f)
			{
				stylePoints = 0f;
			}
			int num3 = Mathf.FloorToInt(stylePoints / (100f * Config.rankMult.Value));
			if (num3 < 0)
			{
				num3 = 0;
			}
			if (num3 > 6)
			{
				num3 = 6;
			}
			if (num3 != styleRank)
			{
				StyleManager.UpdateStyleRank(num3);
				styleRank = num3;
			}
			StyleManager.UpdateStyleFill(stylePoints / (100f * Config.rankMult.Value) - (float)styleRank);
		}
	}
	public class TrickFadout : MonoBehaviour
	{
		public float lifeTime = 5f;

		public float fadoutTime = 1f;

		public void Update()
		{
			lifeTime -= Time.deltaTime;
			if (lifeTime <= 0f)
			{
				if (lifeTime <= 0f - fadoutTime)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
				else
				{
					((Component)this).GetComponent<CanvasGroup>().alpha = Mathf.Lerp(1f, 0f, MathF.Abs(lifeTime) / fadoutTime);
				}
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}