Decompiled source of MoveStyler v1.0.1

CrewBoomAPI.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("CrewBoomAPI")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("API to interact with Crew Boom.")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+fe750cb15aafe2527fad60c5296f5be8aaf0403d")]
[assembly: AssemblyProduct("CrewBoomAPI")]
[assembly: AssemblyTitle("CrewBoomAPI")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CrewBoomAPI
{
	public class CharacterInfo
	{
		public readonly string Name;

		public readonly string GraffitiName;

		public CharacterInfo(string name, string graffitiName)
		{
			Name = name;
			GraffitiName = graffitiName;
		}
	}
	public static class CrewBoomAPIDatabase
	{
		private static Dictionary<int, Guid> _userCharacters;

		public static bool IsInitialized { get; private set; }

		public static CharacterInfo PlayerCharacterInfo { get; private set; }

		public static event Action OnInitialized;

		public static event Action<Guid> OnOverride;

		public static event Action<CharacterInfo> OnPlayerCharacterInfoChanged;

		public static void Initialize(Dictionary<int, Guid> userCharacters)
		{
			_userCharacters = userCharacters;
			CrewBoomAPIDatabase.OnInitialized?.Invoke();
			IsInitialized = true;
		}

		public static void UpdatePlayerCharacter(CharacterInfo characterInfo)
		{
			PlayerCharacterInfo = characterInfo;
			CrewBoomAPIDatabase.OnPlayerCharacterInfoChanged?.Invoke(characterInfo);
		}

		public static bool GetUserGuidForCharacter(int character, out Guid guid)
		{
			guid = Guid.Empty;
			if (_userCharacters.TryGetValue(character, out guid))
			{
				return true;
			}
			return false;
		}

		public static void OverrideNextCharacterLoadedWithGuid(Guid guid)
		{
			CrewBoomAPIDatabase.OnOverride?.Invoke(guid);
		}
	}
}

MoveStyler.dll

Decompiled 3 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CommonAPI;
using CommonAPI.Phone;
using CrewBoomAPI;
using HarmonyLib;
using MoveStyler.Data;
using MoveStyler.Properties;
using MoveStyler.UI;
using MoveStyler.Utility;
using MoveStylerApi;
using MoveStylerMono;
using Reptile;
using Reptile.Phone;
using TMPro;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("MoveStyler")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A plugin to load custom movestyles for Bomb Rush Cyberfunk.")]
[assembly: AssemblyFileVersion("4.0.0.0")]
[assembly: AssemblyInformationalVersion("4.0.0")]
[assembly: AssemblyProduct("MoveStyler")]
[assembly: AssemblyTitle("MoveStyler")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("4.0.0.0")]
[module: UnverifiableCode]
namespace MoveStyler
{
	public class CharacterSaveSlots
	{
		public const int SAVE_SLOT_COUNT = 4;

		public const string SLOT_FILE_EXTENSION = ".cbs";

		public const string SAVE_FILE_EXTENSION = ".cbc";

		public static readonly string SAVE_PATH = Path.Combine(Paths.ConfigPath, "MoveStyler", "saves");

		public static CharacterSaveSlot CurrentSaveSlot;

		private static Dictionary<Guid, CharacterProgress> _progressLookup = new Dictionary<Guid, CharacterProgress>();

		public static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler Saves");

		public static int CurrentSaveSlotId { get; private set; } = -1;


		public static void LoadSlot(int slot)
		{
			if (!Directory.Exists(SAVE_PATH))
			{
				Directory.CreateDirectory(SAVE_PATH);
				return;
			}
			string path = Path.Combine(SAVE_PATH, slot + ".cbs");
			if (File.Exists(path))
			{
				try
				{
					using FileStream input = File.OpenRead(path);
					using BinaryReader reader = new BinaryReader(input);
					CurrentSaveSlot.Read(reader);
				}
				catch (Exception)
				{
					DebugLog.LogWarning((object)$"Failed to read slot data for slot {slot}");
				}
			}
			CurrentSaveSlotId = slot;
		}

		public static void SaveSlot()
		{
			if (CurrentSaveSlotId == -1)
			{
				return;
			}
			if (!Directory.Exists(SAVE_PATH))
			{
				Directory.CreateDirectory(SAVE_PATH);
			}
			string path = Path.Combine(SAVE_PATH, CurrentSaveSlotId + ".cbs");
			try
			{
				using FileStream output = File.OpenWrite(path);
				using BinaryWriter writer = new BinaryWriter(output);
				CurrentSaveSlot.Write(writer);
			}
			catch (Exception)
			{
				DebugLog.LogError((object)$"Failed to write slot data for slot {CurrentSaveSlotId}");
			}
		}

		public static bool GetCharacterData(Guid guid, out CharacterProgress progress, Characters character = -1)
		{
			//IL_0048: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			if (_progressLookup.TryGetValue(guid, out progress))
			{
				return true;
			}
			progress = (CharacterProgress)(object)new CustomCharacterProgress();
			if (CurrentSaveSlotId == -1)
			{
				LogUninitialized();
				return false;
			}
			if (!EnsureSlotDirectory(out var slotPath))
			{
				return false;
			}
			string path = CharacterFilePath(slotPath, guid);
			if (!File.Exists(path))
			{
				progress = (CharacterProgress)(object)new CustomCharacterProgress
				{
					character = character,
					outfit = 0,
					moveStyle = (MoveStyle)0,
					moveStyleSkin = 0
				};
				_progressLookup.Add(guid, progress);
				return true;
			}
			try
			{
				using (FileStream input = File.OpenRead(path))
				{
					using BinaryReader binaryReader = new BinaryReader(input);
					progress.Read(binaryReader);
				}
				_progressLookup.Add(guid, progress);
				return true;
			}
			catch (Exception)
			{
				DebugLog.LogError((object)$"Could not load character save data for character with GUID \"{guid}\".");
			}
			return false;
		}

		public static void SaveCharacterData(Guid guid)
		{
			if (CurrentSaveSlotId == -1)
			{
				LogUninitialized();
				return;
			}
			EnsureSlotDirectory(out var slotPath);
			if (!_progressLookup.TryGetValue(guid, out var value))
			{
				DebugLog.LogError((object)$"No save data made for character with GUID \"{guid}\".");
				return;
			}
			string path = CharacterFilePath(slotPath, guid);
			try
			{
				using FileStream output = File.OpenWrite(path);
				using BinaryWriter binaryWriter = new BinaryWriter(output);
				value.Write(binaryWriter);
			}
			catch (Exception)
			{
				DebugLog.LogError((object)$"Could not write character save data for character with GUID \"{guid}\".");
			}
		}

		private static bool EnsureSlotDirectory(out string slotPath)
		{
			bool result = true;
			if (!Directory.Exists(SAVE_PATH))
			{
				Directory.CreateDirectory(SAVE_PATH);
				result = false;
			}
			slotPath = Path.Combine(SAVE_PATH, CurrentSaveSlotId.ToString());
			if (!Directory.Exists(slotPath))
			{
				Directory.CreateDirectory(slotPath);
				result = false;
			}
			return result;
		}

		private static string CharacterFilePath(string slotPath, Guid guid)
		{
			return Path.Combine(slotPath, guid.ToString() + ".cbc");
		}

		private static void LogUninitialized()
		{
			DebugLog.LogWarning((object)"Can't read or write character data before slot was initialized!");
		}
	}
	public struct CharacterSaveSlot
	{
		public Guid LastPlayedCharacter;

		public void Write(BinaryWriter writer)
		{
			writer.Write(LastPlayedCharacter.ToString());
		}

		public void Read(BinaryReader reader)
		{
			Guid.TryParse(reader.ReadString(), out LastPlayedCharacter);
		}
	}
	internal class CustomCharacterProgress : CharacterProgress
	{
		public CustomCharacterProgress()
		{
		}

		public CustomCharacterProgress(Characters setCharacter)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected I4, but got Unknown
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: 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_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			base.character = setCharacter;
			Characters character = base.character;
			switch ((int)character)
			{
			case 0:
				base.unlocked = true;
				base.moveStyle = (MoveStyle)2;
				break;
			case 1:
				base.moveStyle = (MoveStyle)1;
				break;
			case 2:
				base.moveStyle = (MoveStyle)1;
				break;
			case 3:
				base.unlocked = true;
				base.moveStyle = (MoveStyle)2;
				break;
			case 4:
				base.unlocked = true;
				base.moveStyle = (MoveStyle)1;
				break;
			case 5:
				base.unlocked = true;
				base.moveStyle = (MoveStyle)3;
				break;
			case 6:
				base.moveStyle = (MoveStyle)1;
				break;
			case 7:
				base.moveStyle = (MoveStyle)2;
				break;
			case 8:
				base.moveStyle = (MoveStyle)3;
				break;
			case 9:
				base.moveStyle = (MoveStyle)2;
				break;
			case 10:
				base.moveStyle = (MoveStyle)3;
				break;
			case 11:
				base.moveStyle = (MoveStyle)2;
				break;
			case 12:
				base.moveStyle = (MoveStyle)3;
				break;
			case 13:
				base.moveStyle = (MoveStyle)2;
				break;
			case 14:
				base.moveStyle = (MoveStyle)2;
				break;
			case 15:
				base.moveStyle = (MoveStyle)2;
				break;
			case 16:
				base.moveStyle = (MoveStyle)2;
				break;
			case 17:
				base.moveStyle = (MoveStyle)2;
				break;
			case 18:
				base.moveStyle = (MoveStyle)3;
				break;
			case 19:
				base.moveStyle = (MoveStyle)3;
				break;
			case 20:
				base.moveStyle = (MoveStyle)2;
				break;
			case 21:
				base.moveStyle = (MoveStyle)3;
				break;
			case 22:
				base.moveStyle = (MoveStyle)1;
				break;
			case 24:
				base.moveStyle = (MoveStyle)2;
				break;
			case 25:
				base.moveStyle = (MoveStyle)2;
				break;
			case 23:
				break;
			}
		}
	}
	public static class moveStyleDatabase
	{
		private static readonly string ASSET_PATH = Path.Combine(Paths.ConfigPath, "MoveStyler");

		private static Dictionary<Guid, string> _moveStyleBundlePaths;

		private static Dictionary<Guid, CustomMoveStyle> _customMoveStyle;

		private static Dictionary<MoveStyle, List<Guid>> _moveStyleIds;

		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler StyleDatabase");

		public static int NewMovestyleCount { get; private set; } = 0;


		public static bool HasMovestyleOverride { get; private set; }

		public static Guid MovestyleOverride { get; private set; }

		public static bool Initialize()
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Invalid comparison between Unknown and I4
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			if (!Directory.Exists(ASSET_PATH))
			{
				DebugLog.LogWarning((object)("Could not find movestyle bundle directory \"" + ASSET_PATH + "\".\nIt was created instead."));
				Directory.CreateDirectory(ASSET_PATH);
			}
			_moveStyleBundlePaths = new Dictionary<Guid, string>();
			_customMoveStyle = new Dictionary<Guid, CustomMoveStyle>();
			_moveStyleIds = new Dictionary<MoveStyle, List<Guid>>();
			foreach (MoveStyle value in Enum.GetValues(typeof(MoveStyle)))
			{
				if ((int)value == 0 || (int)value == 5)
				{
					_moveStyleIds.Add(value, null);
				}
				else
				{
					_moveStyleIds.Add(value, new List<Guid>());
				}
			}
			if (!LoadAllMoveStyleData())
			{
				DebugLog.LogWarning((object)("There were no valid movestyles found in " + ASSET_PATH + ".\nMake sure your movestyle bundles (.msb or .cbb) are in the CONFIG folder, NOT the PLUGIN folder."));
			}
			InitializeAPI();
			return true;
		}

		private static bool LoadAllMoveStyleData()
		{
			bool result = false;
			string[] files = Directory.GetFiles(ASSET_PATH, "*.msb");
			for (int i = 0; i < files.Length; i++)
			{
				if (LoadMoveStyleBundle(files[i], enableCypher: true))
				{
					result = true;
				}
			}
			return result;
		}

		private static bool LoadMoveStyleBundle(string filePath, bool enableCypher)
		{
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Expected I4, but got Unknown
			bool result = false;
			DebugLog.LogMessage((object)"Start Loading MoveStyler Bundles");
			if (File.Exists(filePath) && Path.GetExtension(filePath) == ".msb")
			{
				AssetBundle val = null;
				try
				{
					val = AssetBundle.LoadFromFile(filePath);
				}
				catch (Exception)
				{
					DebugLog.LogWarning((object)("File at " + filePath + " is not a MoveStyler movestyle bundle, it will not be loaded"));
				}
				if ((Object)(object)val != (Object)null)
				{
					GameObject[] array = val.LoadAllAssets<GameObject>();
					MoveStyleDefinition val2 = null;
					GameObject[] array2 = array;
					for (int i = 0; i < array2.Length; i++)
					{
						val2 = array2[i].GetComponent<MoveStyleDefinition>();
						if ((Object)(object)val2 != (Object)null)
						{
							break;
						}
					}
					if ((Object)(object)val2 != (Object)null)
					{
						DebugLog.LogMessage((object)"Found MovestyleDefinition");
						string fileName = Path.GetFileName(filePath);
						string text = Path.Combine(Path.GetDirectoryName(filePath), Path.GetFileNameWithoutExtension(filePath) + ".json");
						if (File.Exists(text))
						{
							DebugLog.LogMessage((object)text);
							string text2 = File.ReadAllText(text);
							try
							{
								AnimConfig animConfig = JsonUtility.FromJson<AnimConfig>(text2);
								DebugLog.LogMessage((object)"Created Anim Config");
								Array.Resize(ref val2.AnimationInfoOverrides, animConfig.stringArray.Count());
								for (int j = 0; j < animConfig.stringArray.Count(); j++)
								{
									string text3 = animConfig.stringArray[j];
									CustomAnimInfo val3 = JsonUtility.FromJson<CustomAnimInfo>(text3);
									getConfigFadeInfo(val3, text3);
									val2.AnimationInfoOverrides[j] = val3;
								}
								DebugLog.LogMessage((object)"Added Anim Info Definitions");
							}
							catch (Exception)
							{
								DebugLog.LogError((object)("Failed to read JSON config for \"" + fileName + "\""));
							}
						}
						StringBuilder stringBuilder = new StringBuilder();
						stringBuilder.Append("Loading \"" + val2.Movestylename + "\"");
						stringBuilder.Append("...");
						DebugLog.LogMessage((object)stringBuilder.ToString());
						if (Guid.TryParse(val2.Id, out var result2))
						{
							DebugLog.LogInfo((object)$"GUID: {result2}");
							if (_moveStyleBundlePaths.ContainsKey(result2))
							{
								DebugLog.LogWarning((object)"Movestyle GUID already exists. Make sure to not have duplicate movestyle bundles.");
								return false;
							}
							result = true;
							_moveStyleBundlePaths.Add(result2, filePath);
							SfxCollectionID val4 = (SfxCollectionID)(-1);
							NewMovestyleCount++;
							MoveStyle val5 = (MoveStyle)(5 + NewMovestyleCount);
							val4 = VoiceUtility.GetMovestyleSFXCollectionID(val5);
							if (_moveStyleIds.ContainsKey(val5))
							{
								_moveStyleIds[val5].Add(result2);
							}
							else
							{
								_moveStyleIds.Add(val5, new List<Guid> { result2 });
							}
							DebugLog.LogMessage((object)"Create CustomMoveStyle");
							CustomMoveStyle value = new CustomMoveStyle(val2, val4, (int)val5);
							_customMoveStyle.Add(result2, value);
						}
						else
						{
							DebugLog.LogError((object)("This character's GUID (\"" + val2.Id + "\") is invalid! Make sure their bundle was built correctly."));
						}
					}
					else
					{
						DebugLog.LogWarning((object)("The asset bundle at \"" + filePath + "\" does not have a MovestyleDefinition. You may be trying to load a movestyle that was made with a different version of this plugin."));
					}
				}
			}
			return result;
		}

		public static void SetOutfitShader(Shader shader)
		{
			if ((Object)(object)shader == (Object)null)
			{
				return;
			}
			foreach (CustomMoveStyle value in _customMoveStyle.Values)
			{
				_ = value;
			}
		}

		private static void InitializeAPI()
		{
			DebugLog.LogMessage((object)"Movestyle API");
			Dictionary<int, Guid> dictionary = new Dictionary<int, Guid>();
			Dictionary<Guid, int> dictionary2 = new Dictionary<Guid, int>();
			Dictionary<int, string> dictionary3 = new Dictionary<int, string>();
			Dictionary<string, int> dictionary4 = new Dictionary<string, int>();
			int num = 5;
			for (int i = num + 1; i <= num + NewMovestyleCount; i++)
			{
				if (GetFirstOrConfigMoveStyleId((MoveStyle)i, out var guid))
				{
					dictionary.Add(i, guid);
					dictionary2.Add(guid, i);
					if (GetCharacter(guid, out var characterObject))
					{
						DebugLog.LogMessage((object)$"Add : {characterObject.Definition.Movestylename} | {i}");
						dictionary3.Add(i, characterObject.Definition.Movestylename);
						dictionary4.Add(characterObject.Definition.Movestylename, i);
					}
					else
					{
						DebugLog.LogError((object)$"Failed to add Movestyle ({i}) to API Database, Things may not work as expected");
					}
				}
			}
			MoveStyleAPIDatabase.Initialize(dictionary, dictionary2, dictionary3, dictionary4);
		}

		public static void InitializeMissingSfxCollections(MoveStyle character, SfxCollection collection)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			if (!_moveStyleIds.TryGetValue(character, out var value) || value == null || value.Count <= 0)
			{
				return;
			}
			foreach (Guid item in value)
			{
				GetCharacter(item, out var _);
			}
		}

		public static bool GetCharacterNameWithId(int localizationId, out string name)
		{
			name = string.Empty;
			return false;
		}

		public static bool GetCharacterName(MoveStyle character, out string name)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			name = string.Empty;
			if (GetCharacter(character, out var characterObject))
			{
				name = characterObject.Definition.Movestylename;
				return true;
			}
			return false;
		}

		public static bool GetFirstOrConfigMoveStyleId(MoveStyle character, out Guid guid)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			guid = Guid.Empty;
			if (!_moveStyleIds.TryGetValue(character, out var value) || value == null || value.Count == 0)
			{
				return false;
			}
			guid = value[0];
			return true;
		}

		public static SfxCollectionID GetCustomMovestyleSFXID(MoveStyle moveStyle)
		{
			//IL_0002: 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)
			CustomMoveStyle characterObject = null;
			if (GetFirstOrConfigMoveStyleId(moveStyle, out var guid))
			{
				GetCharacter(guid, out characterObject);
				return characterObject.SfxID;
			}
			return (SfxCollectionID)0;
		}

		public static bool GetCharacter(Guid id, out CustomMoveStyle characterObject)
		{
			if (!_customMoveStyle.TryGetValue(id, out characterObject))
			{
				return false;
			}
			return true;
		}

		public static bool GetCharacter(MoveStyle character, out CustomMoveStyle characterObject)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			characterObject = null;
			if (GetFirstOrConfigMoveStyleId(character, out var guid))
			{
				GetCharacter(guid, out characterObject);
			}
			return characterObject != null;
		}

		public static bool HasMovestyle(MoveStyle character)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			if (!_moveStyleIds.TryGetValue(character, out var value))
			{
				return false;
			}
			if (value != null)
			{
				return value.Count > 0;
			}
			return false;
		}

		public static bool GetMovestyleValueFromGuid(Guid guid, out MoveStyle character)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected I4, but got Unknown
			character = (MoveStyle)0;
			foreach (KeyValuePair<MoveStyle, List<Guid>> moveStyleId in _moveStyleIds)
			{
				if (moveStyleId.Value != null && moveStyleId.Value.Contains(guid))
				{
					character = (MoveStyle)(int)moveStyleId.Key;
					return true;
				}
			}
			return false;
		}

		public static void advancePlayerMovementStyle(Player player, bool reverse = false)
		{
			//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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Invalid comparison between Unknown and I4
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Invalid comparison between Unknown and I4
			//IL_002c: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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_0047: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Invalid comparison between Unknown and I4
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Invalid comparison between Unknown and I4
			//IL_005e: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected I4, but got Unknown
			//IL_0083: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			MoveStyle val = (MoveStyle)player.GetField("moveStyleEquipped").GetValue(player);
			int num = 5 + NewMovestyleCount;
			MoveStyle val2 = val;
			val2 = (MoveStyle)(((int)val >= num) ? (reverse ? (val2 - 1) : ((MoveStyle)1)) : (((int)val <= 1) ? (reverse ? ((MoveStyle)num) : ((MoveStyle)2)) : (reverse ? (val2 - 1) : (val2 + 1))));
			if ((int)val2 == 5 || (int)val2 == 4)
			{
				val2 = (reverse ? ((MoveStyle)3) : ((MoveStyle)6));
			}
			DebugLog.LogMessage((object)$"New Movestyle index: {(int)val2}");
			player.SetCurrentMoveStyleEquipped((MoveStyle)0, true, true);
			player.SetCurrentMoveStyleEquipped(val2, true, true);
			Core instance = Core.Instance;
			Characters val3 = (Characters)player.GetField("character").GetValue(player);
			instance.SaveManager.CurrentSaveSlot.GetCharacterProgress(val3).moveStyle = val2;
		}

		public static void setPlayerMovementStyle(Player player, MoveStyle moveStyle)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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)
			player.SetCurrentMoveStyleEquipped(moveStyle, true, true);
			_ = Core.Instance;
			Characters val = (Characters)player.GetField("character").GetValue(player);
			if (CharUtil.GetGuidForCharacters(val, out var guid))
			{
				DebugLog.LogMessage((object)$"Save {val}");
				if (CharacterSaveSlots.GetCharacterData(guid, out var progress, val))
				{
					progress.moveStyle = moveStyle;
				}
				CharacterSaveSlots.SaveCharacterData(guid);
			}
		}

		private static void getConfigFadeInfo(CustomAnimInfo Info, string Json)
		{
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			int num = Json.IndexOf("_fadeFrom", 0);
			if (num == -1)
			{
				DebugLog.LogMessage((object)"failed to find _fadeFrom in Json");
				return;
			}
			string text = Json.Substring(num + 12);
			int startIndex = text.IndexOf("]", 0);
			text = text.Remove(startIndex);
			List<animFade> list = new List<animFade>();
			if (text.Length > 2)
			{
				string[] separator = new string[1] { "},{" };
				string[] array = text.Split(separator, StringSplitOptions.None);
				for (int i = 0; i < array.Length; i++)
				{
					string text2 = array[i];
					if (i == 0 && array.Length > 1)
					{
						text2 += "}";
					}
					else if (array.Length != 1)
					{
						text2 = ((i != array.Length - 1 || array.Length <= 1) ? ("{" + text2 + "}") : ("{" + text2));
					}
					animFade item = JsonUtility.FromJson<animFade>(text2);
					list.Add(item);
				}
			}
			Info._fadeFrom = list.ToArray();
			num = Json.IndexOf("_fadeTo", 0);
			if (num == -1)
			{
				DebugLog.LogMessage((object)"failed to find _fadeTo in Json");
				return;
			}
			text = Json.Substring(num + 10);
			startIndex = text.IndexOf("]", 0);
			text = text.Remove(startIndex);
			List<animFade> list2 = new List<animFade>();
			if (text.Length > 2)
			{
				string[] separator2 = new string[1] { "},{" };
				string[] array2 = text.Split(separator2, StringSplitOptions.None);
				for (int j = 0; j < array2.Length; j++)
				{
					string text3 = array2[j];
					if (j == 0 && array2.Length > 1)
					{
						text3 += "}";
					}
					else if (array2.Length != 1)
					{
						text3 = ((j != array2.Length - 1 || array2.Length <= 1) ? ("{" + text3 + "}") : ("{" + text3));
					}
					animFade item2 = JsonUtility.FromJson<animFade>(text3);
					list2.Add(item2);
				}
			}
			Info._fadeTo = list2.ToArray();
		}
	}
	[Serializable]
	public class AnimConfig
	{
		public List<string> stringArray;
	}
	public static class MoveStyleDatabaseConfig
	{
		private const string CONFIG_DESCRIPTION = "Enter a GUID of a character bundle to always load for {0} (Blank = Auto-detect, \"OFF\" = Default character for you)";

		private static ConfigEntry<string>[] _moveStyleIdOverrides;

		public static void Initialize(ConfigFile config)
		{
			//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_0035: 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_003a: Invalid comparison between Unknown and I4
			//IL_003c: 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_0043: 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)
			Array values = Enum.GetValues(typeof(MoveStyle));
			_moveStyleIdOverrides = new ConfigEntry<string>[values.Length - 1];
			foreach (MoveStyle item in values)
			{
				if ((int)item != 0 && (int)item != 5)
				{
					BrcMovestyle val2 = (BrcMovestyle)item;
					_moveStyleIdOverrides[item] = config.Bind<string>("Replacement IDs", ((object)(BrcMovestyle)(ref val2)).ToString(), (string)null, $"Enter a GUID of a character bundle to always load for {val2} (Blank = Auto-detect, \"OFF\" = Default character for you)");
				}
			}
		}

		public static bool GetMovestyleOverride(MoveStyle character, out Guid id, out bool isDisabled)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			id = Guid.Empty;
			isDisabled = false;
			if ((int)character > 5)
			{
				return false;
			}
			string value = _moveStyleIdOverrides[character].Value;
			if (value == string.Empty)
			{
				return false;
			}
			if (value == "OFF")
			{
				isDisabled = true;
				return false;
			}
			if (Guid.TryParse(value, out id))
			{
				return true;
			}
			return false;
		}
	}
	[BepInPlugin("Ariki.MoveStylers", "MoveStylers", "4.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string CharacterAPIGuid = "com.Viliger.CharacterAPI";

		private const string CommonAPIGUID = "CommonAPI";

		private void Awake()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			((BaseUnityPlugin)this).Logger.LogMessage((object)"MoveStyler v4.0.0 starting...");
			MoveStyleDatabaseConfig.Initialize(((BaseUnityPlugin)this).Config);
			if (moveStyleDatabase.Initialize())
			{
				new Harmony("Ariki.moveStyler").PatchAll();
				((BaseUnityPlugin)this).Logger.LogMessage((object)"Loaded all available movestyles!");
			}
			((BaseUnityPlugin)this).Logger.LogMessage((object)"Init Phone App");
			MoveStylerApp.Initialize();
			MoveStylerEmailManager.Initialize();
		}

		private void Update()
		{
		}
	}
	public static class CharUtil
	{
		public const string CHARACTER_BUNDLE = "characters";

		public const string ADD_CHARACTER_METHOD = "AddCharacterFBX";

		public const string ADD_MATERIAL_METHOD = "AddCharacterMaterial";

		public const string MATERIAL_FORMAT = "{0}Mat{1}";

		public const string SKATE_OFFSET_L = "skateOffsetL";

		public const string SKATE_OFFSET_R = "skateOffsetR";

		public const string GRAFFITI_ASSET = "charGraffiti";

		private static readonly string[] PropBones = new string[7] { "propl", "propr", "footl", "footr", "handl", "handr", "jetpackPos" };

		public static string GetOutfitMaterialName(Characters character, int outfitIndex)
		{
			return $"{((object)(Characters)(ref character)).ToString()}Mat{outfitIndex.ToString()}";
		}

		public static void ReparentAllProps(Transform originalRoot, Transform targetRoot)
		{
			string[] propBones = PropBones;
			foreach (string text in propBones)
			{
				Transform val = TransformExtentions.FindRecursive(originalRoot, text);
				Transform val2 = TransformExtentions.FindRecursive(targetRoot, text);
				if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2))
				{
					ReparentChildren(val, val2);
				}
			}
		}

		private static void ReparentChildren(Transform source, Transform target)
		{
			//IL_0023: 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)
			Transform[] componentsInChildren = ((Component)source).GetComponentsInChildren<Transform>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				if (!((Object)(object)componentsInChildren[i] == (Object)null))
				{
					componentsInChildren[i].SetParent(target, false);
					componentsInChildren[i].SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
				}
			}
		}

		public static bool TrySetCustomOutfit(Component source, int outfit, out SkinnedMeshRenderer firstActiveRenderer)
		{
			firstActiveRenderer = null;
			return false;
		}

		public static int GetSavedCharacterOutfit(Characters character)
		{
			return 0;
		}

		public static bool GetGuidForDefaultCharacters(Characters character, out Guid guid)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			guid = default(Guid);
			if ((int)character > 26)
			{
				return false;
			}
			string text = ((Enum)character).ToString("X");
			if (text.Length > 8)
			{
				text = text.Remove(8);
			}
			text = text.PadRight(8, '0');
			text += "-0000-0000-0000-000000000000";
			if (Guid.TryParse(text, out guid))
			{
				return true;
			}
			return false;
		}

		public static bool GetGuidForCharacters(Characters character, out Guid guid)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Invalid comparison between Unknown and I4
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected I4, but got Unknown
			guid = Guid.Empty;
			if ((int)character < 26)
			{
				GetGuidForDefaultCharacters(character, out guid);
			}
			else if (CrewBoomAPIDatabase.IsInitialized)
			{
				CrewBoomAPIDatabase.GetUserGuidForCharacter((int)character, ref guid);
			}
			return guid != Guid.Empty;
		}
	}
	public static class LoadUtil
	{
		public static readonly BindingFlags BindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;

		public static Assets GetAssets(CharacterLoader instance)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			return (Assets)(((object)instance).GetType().GetField("assets", BindingFlags)?.GetValue(instance));
		}

		public static MethodInfo GetMethod(this object instance, string name)
		{
			return instance.GetType().GetMethod(name, BindingFlags);
		}

		public static void InvokeMethod(this object instance, string name, params object[] parameters)
		{
			Traverse.Create(instance).Method(name, parameters).GetValue(parameters);
		}

		public static void InvokeMethod(this object instance, string name, Type[] types, params object[] parameters)
		{
			Traverse.Create(instance).Method(name, types, (object[])null).GetValue(parameters);
		}

		public static FieldInfo GetField(this object instance, string name)
		{
			return instance.GetType().GetField(name, BindingFlags);
		}

		public static T GetComponentValue<T>(this object instance, string name) where T : Component
		{
			object? value = instance.GetField(name).GetValue(instance);
			return (T)((value is T) ? value : null);
		}

		public static T GetFieldValue<T>(this object instance, string name) where T : class
		{
			return instance.GetField(name).GetValue(instance) as T;
		}

		public static void SetField(this object instance, string name, object value)
		{
			instance.GetField(name).SetValue(instance, value);
		}
	}
	public static class moveStyleUtil
	{
		public const string style_BUNDLE = "movestyles";

		public const string ADD_CHARACTER_METHOD = "AddCharacterFBX";

		public const string ADD_MATERIAL_METHOD = "AddCharacterMaterial";

		public const string MATERIAL_FORMAT = "{0}Mat{1}";

		public static int GetSavedCharacterOutfit(MoveStyle moveStyle)
		{
			return 0;
		}
	}
	public static class VoiceUtility
	{
		public enum CustomMovestyleSFXID
		{
			GrindTrick1 = 7800,
			GrindTrick2,
			GrindTrick3,
			GroundTrick1,
			GroundTrick2,
			GroundTrick3,
			AirTrick1,
			AirTrick2,
			AirTrick3
		}

		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler AudioPatch");

		public static AudioClip GetRandomClipFromIdCustomSFX(AudioClipID audioClipID, SfxCollection SFX)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (SFX.audioClipContainers.Length == 0)
			{
				return null;
			}
			RandomAudioClipContainer audioClipContainerFromIDCustom = GetAudioClipContainerFromIDCustom(ref SFX.audioClipContainers, audioClipID);
			AudioClip result = null;
			if (audioClipContainerFromIDCustom != null && audioClipContainerFromIDCustom.clipID == audioClipID && audioClipContainerFromIDCustom.clips != null)
			{
				int num = audioClipContainerFromIDCustom.clips.Length;
				int num2 = Random.Range(0, num);
				if (num2 == audioClipContainerFromIDCustom.lastRandomClip)
				{
					num2 = (num2 + 1) % num;
				}
				audioClipContainerFromIDCustom.lastRandomClip = num2;
				result = audioClipContainerFromIDCustom.clips[num2];
			}
			return result;
		}

		public static RandomAudioClipContainer GetAudioClipContainerFromIDCustom(ref RandomAudioClipContainer[] audioClipContainers, AudioClipID clipID)
		{
			//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)
			_ = audioClipContainers.Length;
			RandomAudioClipContainer[] array = audioClipContainers;
			foreach (RandomAudioClipContainer val in array)
			{
				if (val.clipID == clipID)
				{
					return val;
				}
			}
			return null;
		}

		public static void AddNewMovestyleSFXCollection(SfxLibrary sfxLibrary, SfxCollection collection, SfxCollectionID sfxCollectionID, string name)
		{
			//IL_0006: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected I4, but got Unknown
			if (sfxLibrary.sfxCollectionIDDictionary.ContainsKey(sfxCollectionID))
			{
				DebugLog.LogWarning((object)$"A SFX Collection of ID {(int)sfxCollectionID} already exists");
				return;
			}
			sfxLibrary.sfxCollectionIDDictionary.Add(sfxCollectionID, collection);
			((Dictionary<string, SfxCollection>)(object)sfxLibrary.sfxCollectionDictionary).Add(GetMovestyleSFXCollectionNameFromStyleName(name), collection);
		}

		public static SfxCollectionID GetMovestyleSFXCollectionID(MoveStyle moveStyle)
		{
			//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)
			return (SfxCollectionID)(567 + moveStyle);
		}

		public static string GetMovestyleSFXCollectionNameFromStyleName(string name)
		{
			return "customMovestyle." + name;
		}

		public static void PlayLoopingSFX(AudioMixerGroup audioMixerGroup, AudioClip audioClip, AudioSource audioSource, float randomPitchVariance, float delayedSeconds)
		{
			if ((Object)(object)audioClip == (Object)null)
			{
				DebugLog.LogWarning((object)$"clip {audioClip} was null");
				return;
			}
			if (randomPitchVariance > 0f)
			{
				randomPitchVariance = Random.Range(0f - randomPitchVariance, randomPitchVariance);
			}
			audioSource.clip = audioClip;
			audioSource.loop = true;
			audioSource.outputAudioMixerGroup = audioMixerGroup;
			audioSource.pitch = 1f - randomPitchVariance;
			if (delayedSeconds != 0f)
			{
				audioSource.PlayDelayed(delayedSeconds);
			}
			else
			{
				audioSource.Play();
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "MoveStyler";

		public const string PLUGIN_NAME = "MoveStyler";

		public const string PLUGIN_VERSION = "4.0.0";
	}
}
namespace MoveStyler.Utility
{
	public static class moveStyleDefinitionExtensions
	{
	}
	public class TextureUtil
	{
		public static Texture2D GetTextureFromBitmap(Bitmap bitmap, FilterMode filterMode = 1)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//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_0033: Expected O, but got Unknown
			//IL_0034: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			byte[] array = (byte[])((TypeConverter)new ImageConverter()).ConvertTo((object?)bitmap, typeof(byte[]));
			Texture2D val = new Texture2D(((Image)bitmap).Width, ((Image)bitmap).Height);
			ImageConversion.LoadImage(val, array);
			((Texture)val).filterMode = filterMode;
			val.Apply();
			return val;
		}
	}
}
namespace MoveStyler.UI
{
	public class MoveStylerApp : CustomApp
	{
		private static List<KeyValuePair<SimplePhoneButton, MoveStyle>> styleButtons;

		private static Color defaultSelectedColor;

		private static Color defaultUnSelectedColor;

		private static Color equiptSelectedColor;

		private static Color equiptUnSelectedColor;

		private static Sprite Icon;

		public static void Initialize()
		{
			//IL_0038: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			Icon = TextureUtility.CreateSpriteFromTexture(TextureUtil.GetTextureFromBitmap(Resources.phoneAppIcon, (FilterMode)1));
			PhoneAPI.RegisterApp<MoveStylerApp>("MoveStyles", Icon);
			equiptSelectedColor = new Color(1f, 0.7f, 0f, 1f);
			equiptUnSelectedColor = new Color(1f, 0.75f, 0.25f, 1f);
			defaultSelectedColor = Color32.op_Implicit(new Color32((byte)49, (byte)90, (byte)165, byte.MaxValue));
			defaultUnSelectedColor = Color.white;
			styleButtons = new List<KeyValuePair<SimplePhoneButton, MoveStyle>>();
		}

		public override void OnAppInit()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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_012e: Unknown result type (might be due to invalid IL or missing references)
			((CustomApp)this).OnAppInit();
			((CustomApp)this).CreateTitleBar("MoveStylz", Icon, 80f);
			base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f);
			int newMovestyleCount = moveStyleDatabase.NewMovestyleCount;
			for (int i = 1; i < 4; i++)
			{
				MoveStyle style2 = (MoveStyle)i;
				SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton(i switch
				{
					2 => "Skateboard", 
					3 => "Inline", 
					_ => "BMX", 
				});
				((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
				{
					//IL_000b: Unknown result type (might be due to invalid IL or missing references)
					moveStyleDatabase.setPlayerMovementStyle(WorldHandler.instance.GetCurrentPlayer(), style2);
				});
				base.ScrollView.AddButton((PhoneButton)(object)val);
				styleButtons.Add(new KeyValuePair<SimplePhoneButton, MoveStyle>(val, style2));
			}
			for (int j = 1; j <= newMovestyleCount; j++)
			{
				MoveStyle style = (MoveStyle)(5 + j);
				moveStyleDatabase.GetCharacterName(style, out var name);
				SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton(name);
				((PhoneButton)val2).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val2).OnConfirm, (Action)delegate
				{
					//IL_000b: Unknown result type (might be due to invalid IL or missing references)
					moveStyleDatabase.setPlayerMovementStyle(WorldHandler.instance.GetCurrentPlayer(), style);
				});
				base.ScrollView.AddButton((PhoneButton)(object)val2);
				styleButtons.Add(new KeyValuePair<SimplePhoneButton, MoveStyle>(val2, style));
			}
		}

		public void setButtonState()
		{
			//IL_0031: 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_007b: 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_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)
			//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)
			Player currentPlayer = WorldHandler.instance.GetCurrentPlayer();
			foreach (KeyValuePair<SimplePhoneButton, MoveStyle> styleButton in styleButtons)
			{
				if ((MoveStyle)currentPlayer.GetField("moveStyleEquipped").GetValue(currentPlayer) == styleButton.Value)
				{
					styleButton.Key.LabelSelectedColor = equiptSelectedColor;
					styleButton.Key.LabelUnselectedColor = equiptUnSelectedColor;
				}
				else
				{
					styleButton.Key.LabelSelectedColor = defaultSelectedColor;
					styleButton.Key.LabelUnselectedColor = defaultUnSelectedColor;
				}
			}
		}
	}
	internal class CustomMoveStyleUIManager
	{
	}
	[HarmonyPatch(typeof(AppEmail))]
	public class PhoneAppEmailPatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler AppEmail");

		[HarmonyPostfix]
		[HarmonyPatch("RefreshList")]
		public static void RefreshListpatch(AppEmail __instance, ref List<EmailMessage> ___m_Emails, ref EmailScrollView ___m_CardsScroll)
		{
			___m_Emails.Reverse();
			foreach (KeyValuePair<EmailMessage, bool> item in MoveStylerEmailManager._messagesDatabase)
			{
				if (MovestylerEmailSave.Instance.getMessageState(((Object)item.Key).name) && !___m_Emails.Contains(item.Key))
				{
					___m_Emails.Add(item.Key);
				}
			}
			___m_Emails.Reverse();
			((PhoneScroll)___m_CardsScroll).UpdateListContent(___m_Emails.Count);
		}

		[HarmonyPrefix]
		[HarmonyPatch("PushNotification")]
		public static bool PushNotificationPatch(AppEmail __instance, EmailMessage email)
		{
			if (email.characterNameIDOfSender > 9000)
			{
				if (MoveStylerEmailManager._MSContacts.TryGetValue(email.characterNameIDOfSender, out var value))
				{
					MoveStylerEmailManager.phone.PushNotification((App)(object)__instance, value.characterName, (AUnlockable)(object)email);
				}
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(EmailCard))]
	public class EmailCardPatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler EmailCard");

		[HarmonyPrefix]
		[HarmonyPatch("SetContent")]
		public static bool SetContentpatch(EmailCard __instance, AUnlockable content, ref Image ___m_ProfilePicture, ref Image ___m_BackgroundImage)
		{
			//IL_0065: 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)
			//IL_0081: Expected O, but got Unknown
			EmailMessage val = (EmailMessage)(object)((content is EmailMessage) ? content : null);
			if ((Object)(object)val != (Object)null && val.characterNameIDOfSender > 9000)
			{
				PropertyInfo property = typeof(EmailCard).GetProperty("AssignedContent", BindingFlags.Instance | BindingFlags.Public);
				property = property.DeclaringType.GetProperty(property.Name);
				property.SetValue(__instance, content);
				TextMeshProUGUI val2 = (TextMeshProUGUI)__instance.GetField("m_SubjectLabel").GetValue(__instance);
				TextMeshProUGUI val3 = (TextMeshProUGUI)__instance.GetField("m_SenderLabel").GetValue(__instance);
				((TMP_Text)val2).text = val.subject;
				string text = val.characterNameIDOfSender.ToString();
				if (MoveStylerEmailManager._MSContacts.TryGetValue(val.characterNameIDOfSender, out var value))
				{
					text = value.characterName;
					___m_ProfilePicture.sprite = value.avatar;
				}
				((TMP_Text)val3).text = text;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(EmailMessagePanel))]
	internal class EmailMessagePanelPatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler EmailCard");

		[HarmonyPrefix]
		[HarmonyPatch("SetContent")]
		public static bool SetContentpatch(EmailMessagePanel __instance, EmailMessage email, ref int ___messageCurrentPage, ref int ___messagePageCount, ref EmailMessage ___currentEmail, ref TextMeshProUGUI ___senderText, ref TextMeshProUGUI ___subjectText, ref TextMeshProUGUI ___messageArea, ref Image ___senderAvatar)
		{
			if (email.characterNameIDOfSender > 9000)
			{
				___messageCurrentPage = 0;
				___messagePageCount = email.message.Length;
				___currentEmail = email;
				((TMP_Text)___senderText).text = email.characterNameIDOfSender.ToString();
				((TMP_Text)___subjectText).text = email.subject;
				if (MoveStylerEmailManager._MSContacts.TryGetValue(email.characterNameIDOfSender, out var value))
				{
					((TMP_Text)___senderText).text = value.characterName;
					___senderAvatar.sprite = value.avatar;
				}
				((Component)___messageArea).gameObject.SetActive(false);
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Player))]
	internal class PlayerEmailPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Init")]
		public static void InitPatch()
		{
			if (!MovestylerEmailSave.Instance.getMessageState("msg1"))
			{
				MoveStylerEmailManager.EmailNotification("msg1");
			}
		}
	}
	public static class MoveStylerEmailManager
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler MoveStylerEmailManager");

		private static int msgSenderID = 9001;

		private static Color msgSenderColor = new Color(1f, 0.9f, 0.9f);

		public static Player player;

		public static Phone phone;

		public static AppEmail emailApp;

		public static EmailMessage msg_tutorial;

		public static List<KeyValuePair<EmailMessage, bool>> _messagesDatabase;

		public static Dictionary<string, EmailMessage> _messagesIDDatabase;

		private static MovestylerEmailSave SaveState;

		public static Dictionary<int, CustomContact> _MSContacts { get; private set; }

		public static void Initialize()
		{
			DebugLog.LogMessage((object)"Init Email Manager");
			_messagesDatabase = new List<KeyValuePair<EmailMessage, bool>>();
			_messagesIDDatabase = new Dictionary<string, EmailMessage>();
			InitLoadEmailSave();
			InitCustomContacts();
			InitEmailMessages();
		}

		private static void InitLoadEmailSave()
		{
			new MovestylerEmailSave();
			_ = MovestylerEmailSave.Instance.hasReadData;
		}

		private static void InitCustomContacts()
		{
			_MSContacts = new Dictionary<int, CustomContact>();
			CustomContact value = new CustomContact(msgSenderID, "Movestyler");
			Texture2D textureFromBitmap = TextureUtil.GetTextureFromBitmap(Resources.MS_Email_Icon, (FilterMode)1);
			value.avatar = TextureUtility.CreateSpriteFromTexture(textureFromBitmap);
			_MSContacts.Add(value.characterID, value);
		}

		private static void InitEmailMessages()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			msg_tutorial = ScriptableObject.CreateInstance<EmailMessage>();
			((Object)msg_tutorial).name = "msg1";
			msg_tutorial.characterNameIDOfSender = msgSenderID;
			msg_tutorial.subject = "Intro";
			msg_tutorial.profileBackground = msgSenderColor;
			List<string> list = new List<string>();
			list.Add("You can access new movestyles through the new movestyler app on your phone");
			list.Add("New movestyles can be copied into the movestyler config folder");
			msg_tutorial.message = list.ToArray();
			_messagesDatabase.Add(new KeyValuePair<EmailMessage, bool>(msg_tutorial, value: true));
			_messagesIDDatabase.Add(((Object)msg_tutorial).name, msg_tutorial);
		}

		public static void EmailNotification(string MessageID, bool setSave = true)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			player = WorldHandler.instance.GetCurrentPlayer();
			phone = (Phone)player.GetField("phone").GetValue(player);
			emailApp = phone.GetAppInstance<AppEmail>();
			if ((Object)(object)emailApp != (Object)null && _messagesIDDatabase.TryGetValue(MessageID, out var value))
			{
				if (setSave)
				{
					MovestylerEmailSave.Instance.setMessageState(MessageID, setSave);
				}
				emailApp.PushNotification(value);
			}
		}
	}
	public struct CustomContact
	{
		public int characterID;

		public string characterName;

		public Sprite avatar;

		public Guid associatedCharacterGuid;

		public int CompareTo(Contact other)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return characterID.CompareTo(other.characterID);
		}

		public CustomContact(int characterID, string characterName)
		{
			this.characterID = characterID;
			this.characterName = characterName;
			avatar = null;
			associatedCharacterGuid = Guid.Empty;
		}
	}
	public class MovestylerEmailSave : CustomSaveData
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler MoveStylerEmailManager");

		private readonly Dictionary<string, bool> messageStates;

		public bool hasReadData;

		public static MovestylerEmailSave Instance { get; private set; }

		public MovestylerEmailSave()
			: base("MoveStyler", "{0}_msg.data")
		{
			Instance = this;
			messageStates = new Dictionary<string, bool>();
		}

		public void setMessageState(string messageName, bool state)
		{
			if (messageStates.ContainsKey(messageName))
			{
				messageStates[messageName] = state;
			}
			else
			{
				messageStates.Add(messageName, state);
			}
		}

		public bool getMessageState(string messageName)
		{
			if (messageStates.ContainsKey(messageName))
			{
				return messageStates[messageName];
			}
			return false;
		}

		public override void Initialize()
		{
			messageStates.Clear();
		}

		public override void Read(BinaryReader reader)
		{
			reader.ReadByte();
			int num = reader.ReadInt32();
			for (int i = 0; i < num; i++)
			{
				string key = reader.ReadString();
				bool value = reader.ReadBoolean();
				if (!messageStates.ContainsKey(key))
				{
					messageStates.Add(key, value);
				}
			}
			hasReadData = true;
		}

		public override void Write(BinaryWriter writer)
		{
			writer.Write((byte)0);
			writer.Write(messageStates.Count);
			foreach (KeyValuePair<string, bool> messageState in messageStates)
			{
				writer.Write(messageState.Key);
				writer.Write(messageState.Value);
			}
		}
	}
}
namespace MoveStyler.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	public class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		public static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					resourceMan = new ResourceManager("MoveStyler.Properties.Resources", typeof(Resources).Assembly);
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		public static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		public static Bitmap logo_background => (Bitmap)ResourceManager.GetObject("logo_background", resourceCulture);

		public static Bitmap MS_Email_Icon => (Bitmap)ResourceManager.GetObject("MS_Email_Icon", resourceCulture);

		public static Bitmap phoneAppIcon => (Bitmap)ResourceManager.GetObject("phoneAppIcon", resourceCulture);

		internal Resources()
		{
		}
	}
}
namespace MoveStyler.Patches
{
	[HarmonyPatch(typeof(SlideAbility))]
	internal class SlideAbilityPatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler AnimationEventRelayPatch");

		[HarmonyPrefix]
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private static void IsPerformingManualGetPatch(SlideAbility __instance, ref bool __result)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Invalid comparison between Unknown and I4
			MoveStyle val = (MoveStyle)((Ability)__instance).p.GetField("moveStyle").GetValue(((Ability)__instance).p);
			__result = __result || (int)val > 5;
		}
	}
	[HarmonyPatch(typeof(CharacterSelect))]
	public class CharacterSelectSetPlayerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("SetPlayerToCharacter")]
		public static void SetPlayerToCharacterPostfix(Player ___player, Characters __state)
		{
			//IL_0000: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (CharUtil.GetGuidForCharacters(__state, out var guid) && CharacterSaveSlots.GetCharacterData(guid, out var progress, __state) && moveStyleDatabase.HasMovestyle(progress.moveStyle))
			{
				___player.SetCurrentMoveStyleEquipped(progress.moveStyle, true, true);
			}
		}
	}
	[HarmonyPatch(typeof(CharacterVisual), "InitMoveStyleProps")]
	public class CharacterVisualInitMoveStylePropsPatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler Char Visual");

		public static void Postfix(ref CharacterVisual __instance)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			CustomMoveStyleVisualParent customMoveStyleVisualParent = ((Component)__instance.anim).gameObject.AddComponent<CustomMoveStyleVisualParent>();
			if ((Object)(object)customMoveStyleVisualParent == (Object)null)
			{
				DebugLog.LogMessage((object)"CustomMoveSyleVisuals is null ");
				return;
			}
			for (int i = 1; i <= moveStyleDatabase.NewMovestyleCount; i++)
			{
				MoveStyle val = (MoveStyle)(i + 5);
				moveStyleDatabase.GetCharacter(val, out var characterObject);
				_ = characterObject.Visual;
				CustomMoveStyleVisual customMoveStyleVisual = new CustomMoveStyleVisual();
				if (customMoveStyleVisual == null)
				{
					DebugLog.LogMessage((object)"moveStyleVisual == null");
				}
				foreach (KeyValuePair<GameObject, string> prop in characterObject.Props)
				{
					GameObject val2 = Object.Instantiate<GameObject>(prop.Key);
					if ((Object)(object)val2 == (Object)null)
					{
						DebugLog.LogMessage((object)"newObj == null");
					}
					customMoveStyleVisual.AddPropObject(val2, prop.Value);
				}
				customMoveStyleVisualParent.CustomMoveStylesList.Add(new KeyValuePair<MoveStyle, CustomMoveStyleVisual>(val, customMoveStyleVisual));
			}
			customMoveStyleVisualParent.SetupPropVisuals(__instance);
		}
	}
	[HarmonyPatch(typeof(CharacterVisual), "SetMoveStyleVisualProps")]
	public class CharacterSetMoveStyleVisualPropsPatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler Char Visual");

		public static void Postfix(ref CharacterVisual __instance, Player player, MoveStyle setMoveStyle, bool forceOff = false)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player != (Object)null)
			{
				_ = (MoveStyle)player.GetField("moveStyleEquipped").GetValue(player);
				CustomMoveStyleVisualParent customMoveStyleVisualParent = CustomMoveStyleVisualParent.GetCustomMoveStyleVisualParent(__instance);
				if ((Object)(object)customMoveStyleVisualParent == (Object)null)
				{
					DebugLog.LogMessage((object)"PropList is Null");
				}
				else
				{
					customMoveStyleVisualParent.SetCustomMoveStyleVisualsPropMode(player, setMoveStyle, forceOff);
				}
			}
		}
	}
	[HarmonyPatch(typeof(CharacterVisual), "SetMoveStyleVisualAnim")]
	public class CharacterVisualSetMoveStyleVisualAnimPatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler Char Visual");

		public static void Postfix(ref CharacterVisual __instance, Player player, MoveStyle setMoveStyle, GameObject specialSkateboard = null)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			if ((int)setMoveStyle > 5)
			{
				moveStyleDatabase.GetCharacter(setMoveStyle, out var characterObject);
				if (characterObject != null)
				{
					__instance.anim.runtimeAnimatorController = characterObject.AnimController;
					__instance.GetField("handIKActiveR").SetValue(__instance, characterObject.Definition.UseHandRIK);
					__instance.GetField("handIKActiveL").SetValue(__instance, characterObject.Definition.UseHandLIK);
					CustomMoveStyleVisualParent customMoveStyleVisualParent = CustomMoveStyleVisualParent.GetCustomMoveStyleVisualParent(__instance);
					customMoveStyleVisualParent.LHandIKCurrent = characterObject.Definition.UseHandLIK;
					customMoveStyleVisualParent.RHandIKCurrent = characterObject.Definition.UseHandRIK;
				}
			}
		}
	}
	[HarmonyPatch(typeof(CharacterVisual), "SetSpraycan")]
	public class CharacterVisualSetSpraycanPatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler Set Spraycan");

		public static void Postfix(ref CharacterVisual __instance, bool set, Characters c = -1)
		{
			//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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			MoveStyle val = (MoveStyle)__instance.GetField("moveStyle").GetValue(__instance);
			if ((int)val > 5)
			{
				moveStyleDatabase.GetCharacter(val, out var characterObject);
				if (characterObject != null)
				{
					CustomMoveStyleVisualParent customMoveStyleVisualParent = CustomMoveStyleVisualParent.GetCustomMoveStyleVisualParent(__instance);
					bool flag = false;
					flag = !set && customMoveStyleVisualParent.RHandIKCurrent;
					__instance.GetField("handIKActiveR").SetValue(__instance, flag);
				}
			}
		}
	}
	[HarmonyPatch(typeof(CharacterVisual), "SetPhone")]
	public class CharacterVisualSetPhonePatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler Set Phone");

		public static void Postfix(ref CharacterVisual __instance, bool set)
		{
			//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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			MoveStyle val = (MoveStyle)__instance.GetField("moveStyle").GetValue(__instance);
			if ((int)val > 5)
			{
				moveStyleDatabase.GetCharacter(val, out var characterObject);
				if (characterObject != null)
				{
					CustomMoveStyleVisualParent customMoveStyleVisualParent = CustomMoveStyleVisualParent.GetCustomMoveStyleVisualParent(__instance);
					bool flag = false;
					flag = !set && customMoveStyleVisualParent.LHandIKCurrent;
					__instance.GetField("handIKActiveL").SetValue(__instance, flag);
				}
			}
		}
	}
	[HarmonyPatch(typeof(MainMenuManager), "Init")]
	public class MainMenuPatch
	{
		public static void Postfix(MainMenuManager __instance)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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)
			//IL_0094: Expected O, but got Unknown
			//IL_00a3: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: 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_0124: Unknown result type (might be due to invalid IL or missing references)
			Texture2D textureFromBitmap = TextureUtil.GetTextureFromBitmap(Resources.logo_background, (FilterMode)1);
			int num = 15;
			int num2 = (int)((float)Screen.width * 0.5f - (float)num);
			int num3 = (int)((float)Screen.height * 0.35f - (float)num);
			GameObject val = new GameObject("MoveStyler Logo");
			val.transform.SetParent(((Component)__instance).transform, false);
			val.AddComponent<Image>().sprite = Sprite.Create(textureFromBitmap, new Rect(0f, 0f, (float)((Texture)textureFromBitmap).width, (float)((Texture)textureFromBitmap).height), new Vector2(0.5f, 0.5f), 100f);
			RectTransform obj = GameObjectExtensions.RectTransform(val);
			obj.sizeDelta = new Vector2((float)((Texture)textureFromBitmap).width, (float)((Texture)textureFromBitmap).height);
			obj.anchorMin = new Vector2(0f, 0.85f);
			obj.anchorMax = obj.anchorMin;
			obj.pivot = obj.anchorMin;
			obj.anchoredPosition = new Vector2((float)Random.Range(num, num2), (float)Random.Range(num, -num3));
			((Transform)obj).rotation = Quaternion.Euler(0f, 0f, (float)Random.Range(-35, 35));
			new Vector2((float)Random.Range(0, num2), (float)Random.Range(0, num3));
		}
	}
	[HarmonyPatch(typeof(Player), "SetCurrentMoveStyleEquipped")]
	[HarmonyBefore(new string[] { "sgiygas.crewBoom" })]
	public class PlayerSetCurrentMoveStyleEquippedPatch
	{
		public static void Postfix(ref MoveStyle setMoveStyleEquipped)
		{
			if ((int)setMoveStyleEquipped > 5)
			{
				setMoveStyleEquipped = (MoveStyle)0;
			}
		}
	}
	[HarmonyPatch(typeof(Player), "SetMoveStyle")]
	public class PlayerSetMoveStylePatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler Player Patches");

		public static bool Prefix(ref Player __instance, MoveStyle setMoveStyle, bool changeProp, bool changeAnim, GameObject specialSkateboard = null)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0082: 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_009a: 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)
			if ((int)setMoveStyle > 5)
			{
				CharacterVisual val = (CharacterVisual)__instance.GetField("characterVisual").GetValue(__instance);
				if (changeAnim)
				{
					int num = (int)__instance.GetField("curAnim").GetValue(__instance);
					val.SetMoveStyleVisualAnim(__instance, setMoveStyle, specialSkateboard);
					if (num != 0)
					{
						int num2 = num;
						__instance.GetField("curAnim").SetValue(__instance, 0);
						__instance.PlayAnim(num2, false, false, -1f);
					}
				}
				__instance.GetField("moveStyle").SetValue(__instance, setMoveStyle);
				if (changeProp)
				{
					val.SetMoveStyleVisualProps(__instance, setMoveStyle, false);
				}
				moveStyleDatabase.GetCharacter(setMoveStyle, out var characterObject);
				characterObject.setCustomMovementStats(__instance);
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Player), "InitAnimation")]
	public class PlayerInitAnimationPatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler Player Patches");

		public static void Postfix(ref Player __instance)
		{
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_006c: Invalid comparison between I4 and Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			MoveStyle val = (MoveStyle)__instance.GetField("moveStyle").GetValue(__instance);
			Dictionary<int, AnimInfo>[] array = (Dictionary<int, AnimInfo>[])__instance.GetField("animInfosSets").GetValue(__instance);
			Array.Resize(ref array, array.Length + moveStyleDatabase.NewMovestyleCount + 1);
			__instance.GetField("animInfosSets").SetValue(__instance, array);
			for (int i = 1; i <= moveStyleDatabase.NewMovestyleCount; i++)
			{
				MoveStyle val2 = (MoveStyle)(i + 5);
				array[val2] = new Dictionary<int, AnimInfo>();
				if (array.Length < (int)val2)
				{
					DebugLog.LogWarning((object)"Anim Info2 Array Length is not long enough");
					return;
				}
				moveStyleDatabase.GetCharacter(val2, out var characterObject);
				characterObject.InitCustomAnimInfo(__instance, val2);
			}
			__instance.GetField("moveStyle").SetValue(__instance, val);
		}
	}
	[HarmonyPatch(typeof(Player), "UpdateAnim")]
	public class PlayerUpdateAnimPatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler Player Patches");

		public static void Postfix(ref Player __instance)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			float forwardSpeed = __instance.GetForwardSpeed();
			CharacterVisual val = (CharacterVisual)__instance.GetField("characterVisual").GetValue(__instance);
			_ = val.anim;
			val.anim.SetFloat("forwardSpeed", forwardSpeed);
		}
	}
	[HarmonyPatch(typeof(Player), "PlayAnim")]
	public class PlayerPlayAnimPatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler Player Patches");

		public static void Postfix(ref Player __instance, int newAnim, Dictionary<int, AnimInfo>[] ___animInfosSets, ref CharacterVisual ___characterVisual, bool forceOverwrite = false, bool instant = false, float atTime = -1f)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Invalid comparison between Unknown and I4
			//IL_003a: 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_005c: Expected O, but got Unknown
			if ((Object)(object)__instance == (Object)null)
			{
				DebugLog.LogMessage((object)"player instance is null");
				return;
			}
			MoveStyle val = (MoveStyle)__instance.GetField("moveStyle").GetValue(__instance);
			if ((int)val <= 5)
			{
				return;
			}
			moveStyleDatabase.GetCharacter(val, out var characterObject);
			CharacterVisual val2 = (CharacterVisual)__instance.GetField("characterVisual").GetValue(__instance);
			if ((Object)(object)val2 == (Object)null || characterObject == null)
			{
				DebugLog.LogMessage((object)"character visual or customMovestyle is null");
				return;
			}
			bool lHandIKCurrent = characterObject.Definition.UseHandLIK;
			bool rHandIKCurrent = characterObject.Definition.UseHandRIK;
			if (characterObject.customAnimInfoDict.ContainsKey(newAnim))
			{
				lHandIKCurrent = characterObject.customAnimInfoDict[newAnim].lHandIKOverride ^ characterObject.Definition.UseHandLIK;
				rHandIKCurrent = characterObject.customAnimInfoDict[newAnim].rHandIKOverride ^ characterObject.Definition.UseHandRIK;
			}
			CustomMoveStyleVisualParent customMoveStyleVisualParent = CustomMoveStyleVisualParent.GetCustomMoveStyleVisualParent(val2);
			if ((Object)(object)customMoveStyleVisualParent == (Object)null)
			{
				DebugLog.LogMessage((object)"CustomMoveStyleVisualParent is null");
				return;
			}
			customMoveStyleVisualParent.LHandIKCurrent = lHandIKCurrent;
			customMoveStyleVisualParent.RHandIKCurrent = rHandIKCurrent;
		}
	}
	[HarmonyPatch(typeof(Player), "DoTrick")]
	public class PlayerDoTrick
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler Player Patches");

		[HarmonyPriority(701)]
		public static void Prefix(Player __instance, ref string trickName, int trickNum = 0, TrickType type = 0)
		{
			if (trickName == null)
			{
				trickName = "";
			}
		}
	}
	[HarmonyPatch(typeof(Player), "FixedUpdateAbilities")]
	public class PlayerFixedUpdateAbilitiesPatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler PlayerSaveCharacterPatch");

		public static void Prefix(Player __instance, ref bool ___inWalkZone, ref MoveStyle ___moveStyleEquipped, out bool __state)
		{
			__state = ___inWalkZone;
			if ((int)___moveStyleEquipped > 5 && moveStyleDatabase.GetCharacter(___moveStyleEquipped, out var characterObject) && characterObject.Definition.StopSwitchToOnFoot)
			{
				___inWalkZone = false;
			}
		}

		public static void Postfix(Player __instance, ref bool ___inWalkZone, ref MoveStyle ___moveStyleEquipped, bool __state)
		{
			___inWalkZone = __state;
		}
	}
	[HarmonyPatch(typeof(SaveSlotData), "GetCharacterProgress")]
	public class SaveSlotGetProgressPatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler SaveSlotGetProgressPatch");

		[HarmonyPriority(399)]
		public static void Postfix(Characters character, ref CharacterProgress __result)
		{
			//IL_0000: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Invalid comparison between Unknown and I4
			//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)
			if (CharUtil.GetGuidForCharacters(character, out var guid) && CharacterSaveSlots.GetCharacterData(guid, out var progress, character))
			{
				if (progress == null)
				{
					DebugLog.LogMessage((object)"data was null");
				}
				else if ((moveStyleDatabase.HasMovestyle(progress.moveStyle) || (int)progress.moveStyle < 5) && __result != null)
				{
					__result.moveStyle = progress.moveStyle;
					__result.moveStyleSkin = progress.moveStyleSkin;
					progress.unlocked = __result.unlocked;
					progress.version = __result.version;
				}
			}
		}
	}
	[HarmonyPatch(typeof(CharacterProgress), "Write")]
	public class CharacterProgressPatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler SaveSlotWritePatch");

		[HarmonyPriority(399)]
		public static void Prefix(ref CharacterProgress __instance, BinaryWriter writer, out MoveStyle __state)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected I4, but got Unknown
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			__state = (MoveStyle)(int)__instance.moveStyle;
			if (!(__instance is CustomCharacterProgress) && (int)__instance.moveStyle > 5)
			{
				__instance.moveStyle = new CharacterProgress(__instance.character).moveStyle;
			}
		}

		[HarmonyPriority(399)]
		public static void Postfix(ref CharacterProgress __instance, BinaryWriter writer, MoveStyle __state)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			__instance.moveStyle = __state;
		}
	}
	[HarmonyPatch(typeof(SaveSlotHandler), "SetCurrentSaveSlotDataBySlotId")]
	public class SaveSlotHandlerLoadPatch
	{
		[HarmonyPriority(100)]
		public static void Postfix(int saveSlotId)
		{
			CharacterSaveSlots.LoadSlot(saveSlotId);
		}
	}
	[HarmonyPatch(typeof(SwitchMoveStyleAbility), "OnStartAbility")]
	public class MoveSwitchOnStartAbility
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler Ability SwitchStyle");

		public static bool Prefix(ref SwitchMoveStyleAbility __instance)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			_ = (MoveStyle)((Ability)__instance).p.GetField("moveStyle").GetValue(((Ability)__instance).p);
			_ = 5;
			return true;
		}
	}
	[HarmonyPatch(typeof(AudioManager))]
	public class AudioManagerPatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler AudioPatch");

		[HarmonyPostfix]
		[HarmonyPatch("InitializeSfxLibrary")]
		public static void InitializeSfxLibraryPatch(AudioManager __instance)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < moveStyleDatabase.NewMovestyleCount; i++)
			{
				moveStyleDatabase.GetCharacter((MoveStyle)(5 + i + 1), out var characterObject);
				if (characterObject == null)
				{
					DebugLog.LogError((object)"Failed to get Custom MoveStyle");
					break;
				}
				SfxLibrary val = (SfxLibrary)__instance.GetField("sfxLibrary").GetValue(__instance);
				if ((Object)(object)val == (Object)null)
				{
					DebugLog.LogError((object)"Failed to get SFXLibrary");
					break;
				}
				VoiceUtility.AddNewMovestyleSFXCollection(val, characterObject.Sfx, characterObject.SfxID, characterObject.name);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("PlaySfxGameplayLooping", new Type[]
		{
			typeof(MoveStyle),
			typeof(AudioClipID),
			typeof(AudioSource),
			typeof(float),
			typeof(float)
		})]
		public static bool PlaySfxGameplayLoopingPatched(AudioManager __instance, ref List<AudioSource> ___activeGameplayLoopingAudioSources, AudioMixerGroup[] ___mixerGroups, ref MoveStyle moveStyle, AudioClipID audioClipId, AudioSource audioSource, float randomPitchVariance = 0f, float delayedSeconds = 0f)
		{
			//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_0019: Expected I4, but got Unknown
			if ((int)moveStyle > 5)
			{
				moveStyleDatabase.GetCharacter(moveStyle, out var characterObject);
				moveStyle = (MoveStyle)(characterObject.SfxID - 8);
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch("PlaySfxGameplay", new Type[]
		{
			typeof(MoveStyle),
			typeof(AudioClipID),
			typeof(AudioSource),
			typeof(float)
		})]
		public static bool PlaySfxGameplayPatch(AudioManager __instance, AudioMixerGroup[] ___mixerGroups, MoveStyle moveStyle, AudioClipID audioClipId, AudioSource audioSource, float randomPitchVariance = 0f)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//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_0053: 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 ((int)moveStyle > 5)
			{
				SfxCollectionID movestyleSFXCollectionID = VoiceUtility.GetMovestyleSFXCollectionID(moveStyle);
				__instance.InvokeMethod("PlaySfxGameplay", new Type[4]
				{
					typeof(SfxCollectionID),
					typeof(AudioClipID),
					typeof(AudioSource),
					typeof(float)
				}, movestyleSFXCollectionID, audioClipId, audioSource, randomPitchVariance);
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(AnimationEventRelay))]
	public class AnimationEventRelayPatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler AnimationEventRelayPatch");

		[HarmonyPrefix]
		[HarmonyPatch("PlayRandomSoundMoveStyle")]
		private static bool PlayRandomSoundMoveStylePatch(ref AnimationEventRelay __instance, string soundName)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Invalid comparison between Unknown and I4
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			Player val = (Player)__instance.GetField("player").GetValue(__instance);
			if ((Object)(object)val == (Object)null)
			{
				return true;
			}
			MoveStyle val2 = (MoveStyle)val.GetField("moveStyle").GetValue(val);
			AudioSource val3 = (AudioSource)val.GetField("playerOneShotAudioSource").GetValue(val);
			if ((int)val2 > 5)
			{
				int result = -1;
				if (!int.TryParse(soundName, out result))
				{
					return true;
				}
				AudioClipID val4 = (AudioClipID)result;
				val.AudioManager.InvokeMethod("PlaySfxGameplay", new Type[4]
				{
					typeof(MoveStyle),
					typeof(AudioClipID),
					typeof(AudioSource),
					typeof(float)
				}, val2, val4, val3, 0f);
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Player))]
	public class PlayerSFXPatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler AnimationEventRelayPatch");

		[HarmonyPrefix]
		[HarmonyPatch("UpdateMoveStyleMovementAudio")]
		private static bool UpdateMoveStyleMovementAudio(ref Player __instance, MoveStyle ___moveStyle, Ability ___ability, MovementType ___targetMovement, ref MoveStyle ___movestyleAudioCurrent, ref AudioClip ___movestyleAudioTargetClip, AudioSource ___playerMovementLoopAudioSource)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0006: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Invalid comparison between Unknown and I4
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Invalid comparison between Unknown and I4
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected I4, but got Unknown
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			if ((int)___moveStyle <= 5)
			{
				return true;
			}
			moveStyleDatabase.GetCharacter(___moveStyle, out var characterObject);
			if (___ability == null && ((int)___targetMovement == 0 || (int)___targetMovement == 1) && __instance.IsGrounded())
			{
				SfxCollectionID sfxID = characterObject.SfxID;
				if ((int)___moveStyle != (int)___movestyleAudioCurrent)
				{
					___movestyleAudioTargetClip = VoiceUtility.GetRandomClipFromIdCustomSFX((AudioClipID)329, characterObject.Sfx);
					___movestyleAudioCurrent = (MoveStyle)(int)___moveStyle;
				}
				if ((Object)(object)___playerMovementLoopAudioSource.clip != (Object)(object)___movestyleAudioTargetClip)
				{
					__instance.AudioManager.InvokeMethod("PlaySfxGameplayLooping", new Type[5]
					{
						typeof(SfxCollectionID),
						typeof(AudioClipID),
						typeof(AudioSource),
						typeof(float),
						typeof(float)
					}, sfxID, (object)(AudioClipID)329, ___playerMovementLoopAudioSource, 0f, 0f);
					return false;
				}
			}
			else if ((!___playerMovementLoopAudioSource.isPlaying || ___playerMovementLoopAudioSource.time != 0f) && (Object)(object)VoiceUtility.GetRandomClipFromIdCustomSFX((AudioClipID)329, characterObject.Sfx) == (Object)(object)___playerMovementLoopAudioSource.clip)
			{
				__instance.AudioManager.InvokeMethod("StopLoopingSfx", new Type[1] { typeof(AudioSource) }, ___playerMovementLoopAudioSource);
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(SfxCollection))]
	public class SfxCollectionPatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler SfxCollectionPatch");

		[HarmonyPrefix]
		[HarmonyPatch("GetAudioClipContainerFromID")]
		public static bool GetAudioClipContainerFromIDPatch(ref RandomAudioClipContainer[] audioClipContainers, AudioClipID clipID, ref string ___collectionName, ref RandomAudioClipContainer __result)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if ((int)audioClipContainers[audioClipContainers.Length - 1].clipID == 9999)
			{
				__result = VoiceUtility.GetAudioClipContainerFromIDCustom(ref audioClipContainers, clipID);
				return false;
			}
			return true;
		}
	}
}
namespace MoveStyler.Data
{
	public class CustomMoveStyle
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("MoveStyler CustomMoveStyle");

		public string name;

		public int Index;

		public RuntimeAnimatorController AnimController;

		public Animator Anim;

		public List<CustomAnimInfo> _customAnimInfo;

		public Dictionary<int, CustomAnimInfo> customAnimInfoDict;

		public MovementStats movementStats;

		private GameObject _visual;

		public List<KeyValuePair<GameObject, string>> Props;

		private int canSprayHash;

		private int canShakeHash;

		private int canStartShakeHash;

		private int landRunHash;

		private int startRunHash;

		private int stopRunHash;

		private int walkHash;

		private int runHash;

		private int fallHash;

		private int idleHash;

		private int idleFidget1Hash;

		private int phoneDirectionXHash;

		private int phoneDirectionYHash;

		private int turnDirectionXHash;

		private int turnDirectionX2Hash;

		private int turnDirectionX3Hash;

		private int turnDirectionSkateboardHash;

		public MoveStyleDefinition Definition { get; private set; }

		public SfxCollection Sfx { get; private set; }

		public SfxCollectionID SfxID { get; private set; }

		public GameObject Visual
		{
			get
			{
				if ((Object)(object)_visual == (Object)null)
				{
					CreateVisual();
				}
				return _visual;
			}
		}

		public CustomMoveStyle(MoveStyleDefinition definition, SfxCollectionID sfxID, int index)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			Definition = definition;
			Index = index;
			SfxID = sfxID;
			name = ((Object)definition).name;
			createAnimInfo();
			Anim = Definition.StyleAnimator;
			AnimController = Anim.runtimeAnimatorController;
			initCustomMovementStats();
			initCustomSFX();
			Props = new List<KeyValuePair<GameObject, string>>();
		}

		private void CreateVisual()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			GameObject val = new GameObject(Definition.Movestylename + " Visuals");
			MoveStyleDefinition val2 = Object.Instantiate<MoveStyleDefinition>(Definition);
			Props.Clear();
			((Component)val2).transform.SetParent(val.transform, false);
			for (int i = 0; i < val2.PropObjects.Length; i++)
			{
				GameObject val3 = val2.PropObjects[i];
				string value = val2.PropAttachmentBones[i];
				val3.gameObject.layer = 15;
				val3.gameObject.SetActive(true);
				val3.gameObject.transform.SetParent(val.transform);
				Props.Add(new KeyValuePair<GameObject, string>(val3, value));
			}
			val.SetActive(false);
			_visual = val;
		}

		private void createAnimInfo()
		{
			canSprayHash = Animator.StringToHash("canSpray");
			canShakeHash = Animator.StringToHash("canShake");
			canStartShakeHash = Animator.StringToHash("canStartShake");
			landRunHash = Animator.StringToHash("landRun");
			startRunHash = Animator.StringToHash("startRun");
			stopRunHash = Animator.StringToHash("stopRun");
			walkHash = Animator.StringToHash("walk");
			runHash = Animator.StringToHash("run");
			fallHash = Animator.StringToHash("fall");
			idleHash = Animator.StringToHash("idle");
			idleFidget1Hash = Animator.StringToHash("idleFidget1");
			phoneDirectionXHash = Animator.StringToHash("phoneDirectionX");
			phoneDirectionYHash = Animator.StringToHash("phoneDirectionY");
			turnDirectionXHash = Animator.StringToHash("turnDirectionX");
			turnDirectionX2Hash = Animator.StringToHash("turnDirectionX2");
			turnDirectionX3Hash = Animator.StringToHash("turnDirectionX3");
			turnDirectionSkateboardHash = Animator.StringToHash("turnDirectionSkateboard");
			_customAnimInfo = new List<CustomAnimInfo>();
			customAnimInfoDict = new Dictionary<int, CustomAnimInfo>();
			CustomAnimInfo[] animationInfoOverrides = Definition.AnimationInfoOverrides;
			foreach (CustomAnimInfo val in animationInfoOverrides)
			{
				_customAnimInfo.Add(val);
				customAnimInfoDict.Add(Animator.StringToHash(val.animName), val);
			}
		}

		public void InitCustomAnimInfo(Player _player, MoveStyle ParentMovestyle)
		{
			//IL_001b: 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_003c: Expected I4, but got Unknown
			//IL_005e: 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_0054: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			DebugLog.LogMessage((object)"InitCustomAnimInfo");
			_player.GetField("moveStyle").SetValue(_player, ParentMovestyle);
			switch ((int)ParentMovestyle)
			{
			case 1:
				setAnimInfoBMX(_player, ParentMovestyle);
				break;
			case 3:
				setAnimInfoSKATES(_player, ParentMovestyle);
				break;
			case 2:
				setAnimInfoSKATEBOARD(_player, ParentMovestyle);
				break;
			case 0:
				setAnimInfoONFOOT(_player, ParentMovestyle);
				break;
			default:
				setAnimInfoONFOOT(_player, ParentMovestyle);
				break;
			}
			setCustomAnimInfoOverrides(_player, ParentMovestyle);
		}

		public void setAnimInfoBMX(Player _player, MoveStyle ParentMovestyle)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: 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_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_039c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_0456: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0715: Unknown result type (might be due to invalid IL or missing references)
			//IL_072b: Unknown result type (might be due to invalid IL or missing references)
			//IL_073d: Unknown result type (might be due to invalid IL or missing references)
			//IL_074f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0761: Unknown result type (might be due to invalid IL or missing references)
			//IL_0773: Unknown result type (might be due to invalid IL or missing references)
			//IL_0785: Unknown result type (might be due to invalid IL or missing references)
			//IL_0797: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_07cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_07df: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0803: Unknown result type (might be due to invalid IL or missing references)
			//IL_0815: Unknown result type (might be due to invalid IL or missing references)
			//IL_0827: Unknown result type (might be due to invalid IL or missing references)
			//IL_0839: Unknown result type (might be due to invalid IL or missing references)
			//IL_084b: 

MoveStylerApi.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("MoveStylerApi")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("MoveStylerApi")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("MoveStylerApi")]
[assembly: AssemblyTitle("MoveStylerApi")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
namespace MoveStylerApi;

public static class MoveStyleAPIDatabase
{
	private static Dictionary<int, Guid> _moveStyleDatabase;

	private static Dictionary<Guid, int> _moveStyleGuidDatabase;

	private static Dictionary<int, string> _moveStyleIntNameDatabase;

	private static Dictionary<string, int> _moveStyleNameIntDatabase;

	public static bool IsInitialized { get; private set; }

	public static void Initialize(Dictionary<int, Guid> moveStyleDatabase, Dictionary<Guid, int> moveStyleGuidDatabase, Dictionary<int, string> moveStyleIntStringDatabase, Dictionary<string, int> moveStyleStringIntDatabase)
	{
		_moveStyleDatabase = moveStyleDatabase;
		_moveStyleGuidDatabase = moveStyleGuidDatabase;
		_moveStyleIntNameDatabase = moveStyleIntStringDatabase;
		_moveStyleNameIntDatabase = moveStyleStringIntDatabase;
		IsInitialized = true;
	}

	public static int GetMovestyleFromGuid(Guid guid)
	{
		_moveStyleGuidDatabase.TryGetValue(guid, out var value);
		return value;
	}

	public static Guid GetMovestyleGuid(int moveStyleint)
	{
		Guid value = Guid.Empty;
		_moveStyleDatabase.TryGetValue(moveStyleint, out value);
		return value;
	}

	public static int GetMovestyleFromName(string name)
	{
		if (_moveStyleNameIntDatabase.TryGetValue(name, out var value))
		{
			if (value < 5)
			{
				return -1;
			}
			return value;
		}
		return -1;
	}

	public static string GetMovestyleName(int moveStyleint)
	{
		_moveStyleIntNameDatabase.TryGetValue(moveStyleint, out var value);
		return value;
	}
}
[BepInPlugin("MoveStylerApi", "MoveStylerApi", "1.0.1")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MoveStylerApi is loaded!");
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "MoveStylerApi";

	public const string PLUGIN_NAME = "MoveStylerApi";

	public const string PLUGIN_VERSION = "1.0.1";
}

MoveStylerMono.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("MoveStylerMono")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Library to supply monobehaviours for MoveStyler objects.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MoveStylerMono")]
[assembly: AssemblyTitle("MoveStylerMono")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace MoveStylerMono;

public enum BrcCharacter
{
	None = -1,
	Vinyl,
	Frank,
	Coil,
	Red,
	Tryce,
	Bel,
	Rave,
	DotExeMember,
	Solace,
	DjCyber,
	EclipseMember,
	DevilTheoryMember,
	FauxWithBoostPack,
	FleshPrince,
	Irene,
	Felix,
	OldHeadMember,
	Base,
	Jet,
	Mesh,
	FuturismMember,
	Rise,
	Shine,
	FauxWithoutBoostPack,
	DotExeBoss,
	FelixWithCyberHead
}
public enum BrcMovestyle
{
	ON_FOOT,
	Bmx,
	Skateboard,
	Skates,
	Special
}
public class CharacterOutfit : MonoBehaviour
{
	public string Name;

	public bool[] EnabledRenderers;

	public CharacterOutfitRenderer[] MaterialContainers;
}
public class CharacterOutfitRenderer : MonoBehaviour
{
	public Material[] Materials;

	public bool[] UseShaderForMaterial;
}
public class CustomMovementStats : MonoBehaviour
{
	public float runSpeed = 6.5f;

	public float walkSpeed = 1.8f;

	public float groundAcc = 16.5f;

	public float groundDecc = 24.9f;

	public float airAcc = 9.95f;

	public float airDecc = 2f;

	public float rotSpeedAtMaxSpeed = 8f;

	public float rotSpeedAtStill = 40f;

	public float rotSpeedInAir = 1.45f;

	public float grindSpeed = 11.5f;

	public float slideDeccHighSpeed = 2.5f;

	public float slideDeccLowSpeed = 3.8f;
}
[AddComponentMenu("MoveStyler/Movestyle Definition")]
public class MoveStyleDefinition : MonoBehaviour
{
	public string Movestylename = "New Custom Movestyle";

	public BrcMovestyle ParentMovestyle = BrcMovestyle.Skateboard;

	public bool UseHandRIK;

	public bool UseHandLIK;

	public bool StopSwitchToOnFoot;

	public GameObject[] PropObjects;

	public string[] PropAttachmentBones;

	public Animator StyleAnimator;

	public float runSpeed = 6.5f;

	public float walkSpeed = 1.8f;

	public float groundAcc = 16.5f;

	public float groundDecc = 24.9f;

	public float airAcc = 9.95f;

	public float airDecc = 2f;

	public float rotSpeedAtMaxSpeed = 8f;

	public float rotSpeedAtStill = 40f;

	public float rotSpeedInAir = 1.45f;

	public float grindSpeed = 11.5f;

	public float slideDeccHighSpeed = 2.5f;

	public float slideDeccLowSpeed = 3.8f;

	public CustomAnimInfo[] AnimationInfoOverrides;

	public CustomSFXCollection SFXCollection;

	public AudioClip[] Jump;

	public AudioClip[] Land;

	public AudioClip[] Run;

	public AudioClip[] Wallrun;

	public AudioClip[] Slide;

	public AudioClip[] Grind;

	public AudioClip[] GroundTrick1;

	public AudioClip[] GroundTrick2;

	public AudioClip[] GroundTrick3;

	public AudioClip[] AirTrick1;

	public AudioClip[] AirTrick2;

	public AudioClip[] AirTrick3;

	public AudioClip[] GrindTrick1;

	public AudioClip[] GrindTrick2;

	public AudioClip[] GrindTrick3;

	public AudioClip[] HandPlant;

	public AudioClip[] CustomAudioClips;

	public int[] AudioClipID;

	public string Id;

	public int Index;
}
[Serializable]
public class MovestyleConfig
{
	public List<CustomAnimInfo> CustomAnimationInfo;
}
[Serializable]
public class CustomAnimInfo
{
	public string animName;

	public animFade[] _fadeFrom;

	public animFade[] _fadeTo;

	public string nextAnim;

	public float nextAnimAtTime;

	public float duration = 1f;

	public bool lHandIKOverride;

	public bool rHandIKOverride;

	public bool feetIK;

	public _AnimType animType;

	public bool skipStartrun;

	public float interruptIntoFallFrom;
}
public enum _AnimType
{
	NORMAL,
	IDLE,
	RUN,
	STOPRUN,
	LAND,
	OVERRULE_IDLE,
	AIRTRICK,
	GROUNDTRICK
}
[Serializable]
public struct animFade
{
	public string animName;

	public float fadeDuration;

	public animFade(string _animName, float _fadeDuration)
	{
		animName = _animName;
		fadeDuration = _fadeDuration;
	}
}
[Serializable]
public class CustomSFXCollection
{
	public AudioClip[] Jump;

	public AudioClip[] Land;

	public AudioClip[] Run;

	public AudioClip[] Wallrun;

	public AudioClip[] Slide;

	public AudioClip[] Grind;

	public AudioClip[] GroundTrick1;

	public AudioClip[] GroundTrick2;

	public AudioClip[] GroundTrick3;

	public AudioClip[] AirTrick1;

	public AudioClip[] AirTrick2;

	public AudioClip[] AirTrick3;

	public AudioClip[] GrindTrick1;

	public AudioClip[] GrindTrick2;

	public AudioClip[] GrindTrick3;

	public AudioClip[] HandPlant;

	public AudioClip[] CustomSFX;

	public int[] CustomSFXID;

	public CustomClipDefinition[] CustomClips;
}
[Serializable]
public struct CustomClipDefinition
{
	public int ID;

	public AudioClip[] audioClips;

	public CustomClipDefinition(int _ID, AudioClip[] _audioClips)
	{
		ID = _ID;
		audioClips = _audioClips;
	}
}