using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Threading; using B83.Image; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DDSLoader; using GameplayEntities; using HarmonyLib; using LLBML.GameEvents; using LLBML.Math; using LLBML.Messages; using LLBML.Networking; using LLBML.Players; using LLBML.States; using LLBML.UI; using LLBML.Utils; using LLGUI; using LLHandlers; using LLScreen; using Multiplayer; using Steamworks; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyTitle("LLBModdingLib (fr.glomzubuk.plugins.llb.llbml)")] [assembly: AssemblyProduct("LLBModdingLib")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.10.6.0")] [module: UnverifiableCode] namespace DDSLoader { public static class DDSUnityExtensions { public static TextureFormat GetTextureFormat(this DDSImage image) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (image.HasFourCC) { FourCC pixelFormatFourCC = image.GetPixelFormatFourCC(); if (pixelFormatFourCC == "DXT1") { return (TextureFormat)10; } if (pixelFormatFourCC == "DXT5") { return (TextureFormat)12; } throw new UnityException("Unsupported PixelFormat! " + pixelFormatFourCC.ToString()); } throw new UnityException("Unsupported Format!"); } } public class DDSImage { public struct DDSHeader { public uint magicWord; public uint size; public HeaderFlags Flags; public uint Height; public uint Width; public uint PitchOrLinearSize; public uint Depth; public uint MipMapCount; public uint Reserved1; public uint Reserved2; public uint Reserved3; public uint Reserved4; public uint Reserved5; public uint Reserved6; public uint Reserved7; public uint Reserved8; public uint Reserved9; public uint Reserved10; public uint Reserved11; public DDSPixelFormat PixelFormat; public uint dwCaps; public uint dwCaps2; public uint dwCaps3; public uint dwCaps4; public uint dwReserved2; public bool IsValid => magicWord == 542327876; public bool SizeCheck() { return size == 124; } } public struct DDSPixelFormat { public uint size; public PixelFormatFlags dwFlags; public uint FourCC; public uint dwRGBBitCount; public uint dwRBitMask; public uint dwGBitMask; public uint dwBBitMask; public uint dwABitMask; public bool SizeCheck() { return size == 32; } } [Flags] public enum HeaderFlags { CAPS = 1, HEIGHT = 2, WIDTH = 4, PITCH = 8, PIXELFORMAT = 0x1000, MIPMAPCOUNT = 0x20000, LINEARSIZE = 0x80000, DEPTH = 0x800000, TEXTURE = 0x1007 } [Flags] public enum PixelFormatFlags { ALPHAPIXELS = 1, ALPHA = 2, FOURCC = 4, RGB = 0x40, YUV = 0x200, LUMINANCE = 0x20000 } private static readonly int HeaderSize = 128; private DDSHeader _header; private byte[] rawData; public DDSHeader Header => _header; public HeaderFlags headerFlags => Header.Flags; public bool IsValid { get { if (Header.IsValid) { return Header.SizeCheck(); } return false; } } public bool HasHeight => CheckFlag(HeaderFlags.HEIGHT); public int Height => (int)Header.Height; public bool HasWidth => CheckFlag(HeaderFlags.WIDTH); public int Width => (int)Header.Width; public bool HasDepth => CheckFlag(HeaderFlags.DEPTH); public int Depth => (int)Header.Depth; public int MipMapCount => (int)Header.MipMapCount; public bool HasFourCC => Header.PixelFormat.dwFlags == PixelFormatFlags.FOURCC; public bool IsUncompressedRGB => Header.PixelFormat.dwFlags == PixelFormatFlags.RGB; private bool CheckFlag(HeaderFlags flag) { return (Header.Flags & flag) == flag; } public DDSImage(byte[] rawData) { this.rawData = rawData; _header = ByteArrayToStructure(rawData); } public FourCC GetPixelFormatFourCC() { return new FourCC(Header.PixelFormat.FourCC); } public byte[] GetTextureData() { byte[] array = new byte[rawData.Length - HeaderSize]; GetRGBData(array); return array; } public void GetRGBData(byte[] rgbData) { Buffer.BlockCopy(rawData, HeaderSize, rgbData, 0, rgbData.Length); } private static T ByteArrayToStructure(byte[] bytes) where T : struct { GCHandle gCHandle = GCHandle.Alloc(bytes, GCHandleType.Pinned); try { return (T)Marshal.PtrToStructure(gCHandle.AddrOfPinnedObject(), typeof(T)); } finally { gCHandle.Free(); } } } public struct FourCC { private readonly uint valueDWord; private readonly string valueString; public FourCC(uint value) { valueDWord = value; valueString = new string(new char[4] { (char)(value & 0xFFu), (char)((value & 0xFF00) >> 8), (char)((value & 0xFF0000) >> 16), (char)((value & 0xFF000000u) >> 24) }); } public FourCC(string value) { if (value == null) { throw new Exception(); } if (value.Length > 4) { throw new Exception(); } if (value.Any((char c) => ' ' > c || c > '~')) { throw new Exception(); } valueString = value.PadRight(4); valueDWord = valueString[0] + ((uint)valueString[1] << 8) + ((uint)valueString[2] << 16) + ((uint)valueString[3] << 24); } public override string ToString() { if (!valueString.All((char c) => ' ' <= c && c <= '~')) { uint num = valueDWord; return num.ToString("X8"); } return valueString; } public override int GetHashCode() { uint num = valueDWord; return num.GetHashCode(); } public override bool Equals(object obj) { if (obj is FourCC) { return (FourCC)obj == this; } return base.Equals(obj); } public static implicit operator FourCC(uint value) { return new FourCC(value); } public static implicit operator FourCC(string value) { return new FourCC(value); } public static explicit operator uint(FourCC value) { return value.valueDWord; } public static explicit operator string(FourCC value) { return value.valueString; } public static bool operator ==(FourCC value1, FourCC value2) { return value1.valueDWord == value2.valueDWord; } public static bool operator !=(FourCC value1, FourCC value2) { return !(value1 == value2); } } } namespace B83.Image { public enum EPNGChunkType : uint { IHDR = 1229472850u, sRBG = 1934772034u, gAMA = 1732332865u, cHRM = 1665684045u, pHYs = 1883789683u, IDAT = 1229209940u, IEND = 1229278788u } public class PNGFile { public static ulong m_Signature = 9894494448401390090uL; public ulong Signature; public List chunks; public int FindChunk(EPNGChunkType aType, int aStartIndex = 0) { if (chunks == null) { return -1; } for (int i = aStartIndex; i < chunks.Count; i++) { if (chunks[i].type == aType) { return i; } } return -1; } } public class PNGChunk { public uint length; public EPNGChunkType type; public byte[] data; public uint crc; public uint CalcCRC() { return PNGTools.UpdateCRC(PNGTools.UpdateCRC(uint.MaxValue, (uint)type), data) ^ 0xFFFFFFFFu; } } public class PNGTools { private static uint[] crc_table; static PNGTools() { crc_table = new uint[256]; for (int i = 0; i < 256; i++) { uint num = (uint)i; for (int j = 0; j < 8; j++) { num = (((num & 1) == 0) ? (num >> 1) : (0xEDB88320u ^ (num >> 1))); } crc_table[i] = num; } } public static uint UpdateCRC(uint crc, byte aData) { return crc_table[(crc ^ aData) & 0xFF] ^ (crc >> 8); } public static uint UpdateCRC(uint crc, uint aData) { crc = crc_table[(crc ^ ((aData >> 24) & 0xFF)) & 0xFF] ^ (crc >> 8); crc = crc_table[(crc ^ ((aData >> 16) & 0xFF)) & 0xFF] ^ (crc >> 8); crc = crc_table[(crc ^ ((aData >> 8) & 0xFF)) & 0xFF] ^ (crc >> 8); crc = crc_table[(crc ^ (aData & 0xFF)) & 0xFF] ^ (crc >> 8); return crc; } public static uint UpdateCRC(uint crc, byte[] buf) { for (int i = 0; i < buf.Length; i++) { crc = crc_table[(crc ^ buf[i]) & 0xFF] ^ (crc >> 8); } return crc; } public static uint CalculateCRC(byte[] aBuf) { return UpdateCRC(uint.MaxValue, aBuf) ^ 0xFFFFFFFFu; } public static List ReadChunks(BinaryReader aReader) { List list = new List(); while (aReader.BaseStream.Position < aReader.BaseStream.Length - 4) { PNGChunk pNGChunk = new PNGChunk(); pNGChunk.length = aReader.ReadUInt32BE(); if (aReader.BaseStream.Position >= aReader.BaseStream.Length - 4 - pNGChunk.length) { break; } list.Add(pNGChunk); pNGChunk.type = (EPNGChunkType)aReader.ReadUInt32BE(); pNGChunk.data = aReader.ReadBytes((int)pNGChunk.length); pNGChunk.crc = aReader.ReadUInt32BE(); uint num = pNGChunk.CalcCRC(); if ((pNGChunk.crc ^ num) != 0) { Debug.Log((object)("Chunk CRC wrong. Got 0x" + pNGChunk.crc.ToString("X8") + " expected 0x" + num.ToString("X8"))); } if (pNGChunk.type == EPNGChunkType.IEND) { break; } } return list; } public static PNGFile ReadPNGFile(BinaryReader aReader) { if (aReader == null || aReader.BaseStream.Position >= aReader.BaseStream.Length - 8) { return null; } return new PNGFile { Signature = aReader.ReadUInt64BE(), chunks = ReadChunks(aReader) }; } public static void WritePNGFile(PNGFile aFile, BinaryWriter aWriter) { aWriter.WriteUInt64BE(PNGFile.m_Signature); foreach (PNGChunk chunk in aFile.chunks) { aWriter.WriteUInt32BE((uint)chunk.data.Length); aWriter.WriteUInt32BE((uint)chunk.type); aWriter.Write(chunk.data); aWriter.WriteUInt32BE(chunk.crc); } } public static void SetPPM(PNGFile aFile, uint aXPPM, uint aYPPM) { int num = aFile.FindChunk(EPNGChunkType.pHYs); PNGChunk pNGChunk; if (num > 0) { pNGChunk = aFile.chunks[num]; if (pNGChunk.data == null || pNGChunk.data.Length < 9) { throw new Exception("PNG: pHYs chunk data size is too small. It should be at least 9 bytes"); } } else { pNGChunk = new PNGChunk(); pNGChunk.type = EPNGChunkType.pHYs; pNGChunk.length = 9u; pNGChunk.data = new byte[9]; aFile.chunks.Insert(1, pNGChunk); } byte[] data = pNGChunk.data; data[0] = (byte)((aXPPM >> 24) & 0xFFu); data[1] = (byte)((aXPPM >> 16) & 0xFFu); data[2] = (byte)((aXPPM >> 8) & 0xFFu); data[3] = (byte)(aXPPM & 0xFFu); data[4] = (byte)((aYPPM >> 24) & 0xFFu); data[5] = (byte)((aYPPM >> 16) & 0xFFu); data[6] = (byte)((aYPPM >> 8) & 0xFFu); data[7] = (byte)(aYPPM & 0xFFu); data[8] = 1; pNGChunk.crc = pNGChunk.CalcCRC(); } public static byte[] ChangePPM(byte[] aPNGData, uint aXPPM, uint aYPPM) { PNGFile aFile; using (MemoryStream input = new MemoryStream(aPNGData)) { using BinaryReader aReader = new BinaryReader(input); aFile = ReadPNGFile(aReader); } SetPPM(aFile, aXPPM, aYPPM); using MemoryStream memoryStream = new MemoryStream(); using BinaryWriter aWriter = new BinaryWriter(memoryStream); WritePNGFile(aFile, aWriter); return memoryStream.ToArray(); } public static byte[] ChangePPI(byte[] aPNGData, float aXPPI, float aYPPI) { return ChangePPM(aPNGData, (uint)(aXPPI * 39.3701f), (uint)(aYPPI * 39.3701f)); } } public static class BinaryReaderWriterExt { public static uint ReadUInt32BE(this BinaryReader aReader) { return (uint)((aReader.ReadByte() << 24) | (aReader.ReadByte() << 16) | (aReader.ReadByte() << 8) | aReader.ReadByte()); } public static ulong ReadUInt64BE(this BinaryReader aReader) { return ((ulong)aReader.ReadUInt32BE() << 32) | aReader.ReadUInt32BE(); } public static void WriteUInt32BE(this BinaryWriter aWriter, uint aValue) { aWriter.Write((byte)((aValue >> 24) & 0xFFu)); aWriter.Write((byte)((aValue >> 16) & 0xFFu)); aWriter.Write((byte)((aValue >> 8) & 0xFFu)); aWriter.Write((byte)(aValue & 0xFFu)); } public static void WriteUInt64BE(this BinaryWriter aWriter, ulong aValue) { aWriter.WriteUInt32BE((uint)(aValue >> 32)); aWriter.WriteUInt32BE((uint)aValue); } } } namespace TarUtils { public class TarUtils { public static void ExtractTarGz(string filename, string outputDir) { using FileStream stream = File.OpenRead(filename); ExtractTarGz(stream, outputDir); } public static void ExtractTarGz(Stream stream, string outputDir) { using GZipStream gZipStream = new GZipStream(stream, CompressionMode.Decompress); using MemoryStream memoryStream = new MemoryStream(); byte[] buffer = new byte[4096]; int num; do { num = gZipStream.Read(buffer, 0, 4096); memoryStream.Write(buffer, 0, num); } while (num == 4096); memoryStream.Seek(0L, SeekOrigin.Begin); ExtractTar(memoryStream, outputDir); } public static void ExtractTar(string filename, string outputDir) { using FileStream stream = File.OpenRead(filename); ExtractTar(stream, outputDir); } public static void ExtractTar(Stream stream, string outputDir) { byte[] array = new byte[100]; while (true) { stream.Read(array, 0, 100); string text = Encoding.ASCII.GetString(array).Trim(new char[1]); if (string.IsNullOrEmpty(text)) { break; } stream.Seek(24L, SeekOrigin.Current); stream.Read(array, 0, 12); long num = Convert.ToInt64(Encoding.UTF8.GetString(array, 0, 12).Trim(new char[1]).Trim(), 8); stream.Seek(376L, SeekOrigin.Current); string path = Path.Combine(outputDir, text); if (!Directory.Exists(Path.GetDirectoryName(path))) { Directory.CreateDirectory(Path.GetDirectoryName(path)); } if (!text.EndsWith("/")) { using FileStream fileStream = File.Open(path, FileMode.OpenOrCreate, FileAccess.Write); byte[] array2 = new byte[num]; stream.Read(array2, 0, array2.Length); fileStream.Write(array2, 0, array2.Length); } long position = stream.Position; long num2 = 512 - position % 512; if (num2 == 512) { num2 = 0L; } stream.Seek(num2, SeekOrigin.Current); } } } } namespace TinyJson { public static class JSONParser { [ThreadStatic] private static Stack> splitArrayPool; [ThreadStatic] private static StringBuilder stringBuilder; [ThreadStatic] private static Dictionary> fieldInfoCache; [ThreadStatic] private static Dictionary> propertyInfoCache; public static T FromJson(this string json) { if (propertyInfoCache == null) { propertyInfoCache = new Dictionary>(); } if (fieldInfoCache == null) { fieldInfoCache = new Dictionary>(); } if (stringBuilder == null) { stringBuilder = new StringBuilder(); } if (splitArrayPool == null) { splitArrayPool = new Stack>(); } stringBuilder.Length = 0; for (int i = 0; i < json.Length; i++) { char c = json[i]; if (c == '"') { i = AppendUntilStringEnd(appendEscapeCharacter: true, i, json); } else if (!char.IsWhiteSpace(c)) { stringBuilder.Append(c); } } return (T)ParseValue(typeof(T), stringBuilder.ToString()); } private static int AppendUntilStringEnd(bool appendEscapeCharacter, int startIdx, string json) { stringBuilder.Append(json[startIdx]); for (int i = startIdx + 1; i < json.Length; i++) { if (json[i] == '\\') { if (appendEscapeCharacter) { stringBuilder.Append(json[i]); } stringBuilder.Append(json[i + 1]); i++; } else { if (json[i] == '"') { stringBuilder.Append(json[i]); return i; } stringBuilder.Append(json[i]); } } return json.Length - 1; } private static List Split(string json) { List list = ((splitArrayPool.Count > 0) ? splitArrayPool.Pop() : new List()); list.Clear(); if (json.Length == 2) { return list; } int num = 0; stringBuilder.Length = 0; for (int i = 1; i < json.Length - 1; i++) { switch (json[i]) { case '[': case '{': num++; break; case ']': case '}': num--; break; case '"': i = AppendUntilStringEnd(appendEscapeCharacter: true, i, json); continue; case ',': case ':': if (num == 0) { list.Add(stringBuilder.ToString()); stringBuilder.Length = 0; continue; } break; } stringBuilder.Append(json[i]); } list.Add(stringBuilder.ToString()); return list; } internal static object ParseValue(Type type, string json) { if ((object)type == typeof(string)) { if (json.Length <= 2) { return string.Empty; } StringBuilder stringBuilder = new StringBuilder(json.Length); for (int i = 1; i < json.Length - 1; i++) { if (json[i] == '\\' && i + 1 < json.Length - 1) { int num = "\"\\nrtbf/".IndexOf(json[i + 1]); if (num >= 0) { stringBuilder.Append("\"\\\n\r\t\b\f/"[num]); i++; continue; } if (json[i + 1] == 'u' && i + 5 < json.Length - 1) { uint result = 0u; if (uint.TryParse(json.Substring(i + 2, 4), NumberStyles.AllowHexSpecifier, null, out result)) { stringBuilder.Append((char)result); i += 5; continue; } } } stringBuilder.Append(json[i]); } return stringBuilder.ToString(); } if (type.IsPrimitive) { return Convert.ChangeType(json, type, CultureInfo.InvariantCulture); } if ((object)type == typeof(decimal)) { decimal.TryParse(json, NumberStyles.Float, CultureInfo.InvariantCulture, out var result2); return result2; } if ((object)type == typeof(DateTime)) { DateTime.TryParse(json.Replace("\"", ""), CultureInfo.InvariantCulture, DateTimeStyles.None, out var result3); return result3; } if (json == "null") { return null; } if (type.IsEnum) { if (json[0] == '"') { json = json.Substring(1, json.Length - 2); } try { return Enum.Parse(type, json, ignoreCase: false); } catch { return 0; } } if (type.IsArray) { Type elementType = type.GetElementType(); if (json[0] != '[' || json[json.Length - 1] != ']') { return null; } List list = Split(json); Array array = Array.CreateInstance(elementType, list.Count); for (int j = 0; j < list.Count; j++) { array.SetValue(ParseValue(elementType, list[j]), j); } splitArrayPool.Push(list); return array; } if (type.IsGenericType && (object)type.GetGenericTypeDefinition() == typeof(List<>)) { Type type2 = type.GetGenericArguments()[0]; if (json[0] != '[' || json[json.Length - 1] != ']') { return null; } List list2 = Split(json); IList list3 = (IList)type.GetConstructor(new Type[1] { typeof(int) }).Invoke(new object[1] { list2.Count }); for (int k = 0; k < list2.Count; k++) { list3.Add(ParseValue(type2, list2[k])); } splitArrayPool.Push(list2); return list3; } if (TomlTypeConverter.CanConvert(type)) { if (json.Length <= 2) { return null; } return TomlTypeConverter.ConvertToValue(json.Substring(1, json.Length - 2), type); } if (type.IsGenericType && (object)type.GetGenericTypeDefinition() == typeof(Dictionary<, >)) { Type[] genericArguments = type.GetGenericArguments(); Type type3 = genericArguments[0]; Type type4 = genericArguments[1]; if ((object)type3 != typeof(string)) { return null; } if (json[0] != '{' || json[json.Length - 1] != '}') { return null; } List list4 = Split(json); if (list4.Count % 2 != 0) { return null; } IDictionary dictionary = (IDictionary)type.GetConstructor(new Type[1] { typeof(int) }).Invoke(new object[1] { list4.Count / 2 }); for (int l = 0; l < list4.Count; l += 2) { if (list4[l].Length > 2) { string key = list4[l].Substring(1, list4[l].Length - 2); object value = ParseValue(type4, list4[l + 1]); dictionary[key] = value; } } return dictionary; } if ((object)type == typeof(object)) { return ParseAnonymousValue(json); } if (json[0] == '{' && json[json.Length - 1] == '}') { return ParseObject(type, json); } return null; } private static object ParseAnonymousValue(string json) { if (json.Length == 0) { return null; } if (json[0] == '{' && json[json.Length - 1] == '}') { List list = Split(json); if (list.Count % 2 != 0) { return null; } Dictionary dictionary = new Dictionary(list.Count / 2); for (int i = 0; i < list.Count; i += 2) { dictionary[list[i].Substring(1, list[i].Length - 2)] = ParseAnonymousValue(list[i + 1]); } return dictionary; } if (json[0] == '[' && json[json.Length - 1] == ']') { List list2 = Split(json); List list3 = new List(list2.Count); for (int j = 0; j < list2.Count; j++) { list3.Add(ParseAnonymousValue(list2[j])); } return list3; } if (json[0] == '"' && json[json.Length - 1] == '"') { return json.Substring(1, json.Length - 2).Replace("\\", string.Empty); } if (char.IsDigit(json[0]) || json[0] == '-') { if (json.Contains(".")) { double.TryParse(json, NumberStyles.Float, CultureInfo.InvariantCulture, out var result); return result; } int.TryParse(json, out var result2); return result2; } if (json == "true") { return true; } if (json == "false") { return false; } return null; } private static Dictionary CreateMemberNameDictionary(T[] members) where T : MemberInfo { Dictionary dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase); foreach (T val in members) { if (val.IsDefined(typeof(IgnoreDataMemberAttribute), inherit: true)) { continue; } string name = val.Name; if (val.IsDefined(typeof(DataMemberAttribute), inherit: true)) { DataMemberAttribute dataMemberAttribute = (DataMemberAttribute)Attribute.GetCustomAttribute(val, typeof(DataMemberAttribute), inherit: true); if (!string.IsNullOrEmpty(dataMemberAttribute.Name)) { name = dataMemberAttribute.Name; } } dictionary.Add(name, val); } return dictionary; } private static object ParseObject(Type type, string json) { object uninitializedObject = FormatterServices.GetUninitializedObject(type); List list = Split(json); if (list.Count % 2 != 0) { return uninitializedObject; } if (!fieldInfoCache.TryGetValue(type, out var value)) { value = CreateMemberNameDictionary(type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy)); fieldInfoCache.Add(type, value); } if (!propertyInfoCache.TryGetValue(type, out var value2)) { value2 = CreateMemberNameDictionary(type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy)); propertyInfoCache.Add(type, value2); } for (int i = 0; i < list.Count; i += 2) { if (list[i].Length > 2) { string key = list[i].Substring(1, list[i].Length - 2); string json2 = list[i + 1]; PropertyInfo value4; if (value.TryGetValue(key, out var value3)) { value3.SetValue(uninitializedObject, ParseValue(value3.FieldType, json2)); } else if (value2.TryGetValue(key, out value4)) { value4.SetValue(uninitializedObject, ParseValue(value4.PropertyType, json2), null); } } } return uninitializedObject; } } public static class JSONWriter { public static string ToJson(this object item) { StringBuilder stringBuilder = new StringBuilder(); AppendValue(stringBuilder, item); return stringBuilder.ToString(); } private static void AppendValue(StringBuilder stringBuilder, object item) { if (item == null) { stringBuilder.Append("null"); return; } Type type = item.GetType(); if ((object)type == typeof(string) || (object)type == typeof(char)) { stringBuilder.Append('"'); string text = item.ToString(); for (int i = 0; i < text.Length; i++) { if (text[i] < ' ' || text[i] == '"' || text[i] == '\\') { stringBuilder.Append('\\'); int num = "\"\\\n\r\t\b\f".IndexOf(text[i]); if (num >= 0) { stringBuilder.Append("\"\\nrtbf"[num]); } else { stringBuilder.AppendFormat("u{0:X4}", (uint)text[i]); } } else { stringBuilder.Append(text[i]); } } stringBuilder.Append('"'); return; } if ((object)type == typeof(byte) || (object)type == typeof(sbyte)) { stringBuilder.Append(item.ToString()); return; } if ((object)type == typeof(short) || (object)type == typeof(ushort)) { stringBuilder.Append(item.ToString()); return; } if ((object)type == typeof(int) || (object)type == typeof(uint)) { stringBuilder.Append(item.ToString()); return; } if ((object)type == typeof(long) || (object)type == typeof(ulong)) { stringBuilder.Append(item.ToString()); return; } if ((object)type == typeof(float)) { stringBuilder.Append(((float)item).ToString(CultureInfo.InvariantCulture)); return; } if ((object)type == typeof(double)) { stringBuilder.Append(((double)item).ToString(CultureInfo.InvariantCulture)); return; } if ((object)type == typeof(decimal)) { stringBuilder.Append(((decimal)item).ToString(CultureInfo.InvariantCulture)); return; } if ((object)type == typeof(bool)) { stringBuilder.Append(((bool)item) ? "true" : "false"); return; } if ((object)type == typeof(DateTime)) { stringBuilder.Append('"'); stringBuilder.Append(((DateTime)item).ToString(CultureInfo.InvariantCulture)); stringBuilder.Append('"'); return; } if (type.IsEnum) { stringBuilder.Append('"'); stringBuilder.Append(item.ToString()); stringBuilder.Append('"'); return; } if (item is IList) { stringBuilder.Append('['); bool flag = true; IList list = item as IList; for (int j = 0; j < list.Count; j++) { if (flag) { flag = false; } else { stringBuilder.Append(','); } AppendValue(stringBuilder, list[j]); } stringBuilder.Append(']'); return; } if (type.IsGenericType && (object)type.GetGenericTypeDefinition() == typeof(Dictionary<, >)) { if ((object)type.GetGenericArguments()[0] != typeof(string)) { stringBuilder.Append("{}"); return; } stringBuilder.Append('{'); IDictionary dictionary = item as IDictionary; bool flag2 = true; foreach (object key in dictionary.Keys) { if (flag2) { flag2 = false; } else { stringBuilder.Append(','); } stringBuilder.Append('"'); stringBuilder.Append((string)key); stringBuilder.Append("\":"); AppendValue(stringBuilder, dictionary[key]); } stringBuilder.Append('}'); return; } if (TomlTypeConverter.CanConvert(type)) { stringBuilder.Append('"'); stringBuilder.Append(TomlTypeConverter.ConvertToString(item, type)); stringBuilder.Append('"'); return; } stringBuilder.Append('{'); bool flag3 = true; FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy); for (int k = 0; k < fields.Length; k++) { if (fields[k].IsDefined(typeof(IgnoreDataMemberAttribute), inherit: true)) { continue; } object value = fields[k].GetValue(item); if (value != null) { if (flag3) { flag3 = false; } else { stringBuilder.Append(','); } stringBuilder.Append('"'); stringBuilder.Append(GetMemberName(fields[k])); stringBuilder.Append("\":"); AppendValue(stringBuilder, value); } } PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy); for (int l = 0; l < properties.Length; l++) { if (!properties[l].CanRead || properties[l].IsDefined(typeof(IgnoreDataMemberAttribute), inherit: true)) { continue; } object value2 = properties[l].GetValue(item, null); if (value2 != null) { if (flag3) { flag3 = false; } else { stringBuilder.Append(','); } stringBuilder.Append('"'); stringBuilder.Append(GetMemberName(properties[l])); stringBuilder.Append("\":"); AppendValue(stringBuilder, value2); } } stringBuilder.Append('}'); } private static string GetMemberName(MemberInfo member) { if (member.IsDefined(typeof(DataMemberAttribute), inherit: true)) { DataMemberAttribute dataMemberAttribute = (DataMemberAttribute)Attribute.GetCustomAttribute(member, typeof(DataMemberAttribute), inherit: true); if (!string.IsNullOrEmpty(dataMemberAttribute.Name)) { return dataMemberAttribute.Name; } } return member.Name; } } } namespace LLBML { public static class StateApi { public static GameMode CurrentGameMode => JOMBNFKIHIC.GIGAKBJGFDI.PNJOKAICMNN; } [BepInPlugin("fr.glomzubuk.plugins.llb.llbml", "LLBModdingLib", "0.10.6")] [BepInProcess("LLBlaze.exe")] public class LLBMLPlugin : BaseUnityPlugin { internal static LLBMLPlugin Instance { get; private set; } internal static ManualLogSource Log { get; private set; } internal static ConfigFile Conf { get; private set; } internal static bool StartReached { get; private set; } private void Awake() { //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_0041: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0052: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Hello, world!"); ConfigTypeConverters.AddConfigConverters(); ModdingFolder.InitConfig(((BaseUnityPlugin)this).Config); Harmony val = new Harmony("fr.glomzubuk.plugins.llb.llbml"); MessageApi.Patch(val); NetworkApi.Patch(val); LLBML.GameEvents.GameEvents.PatchAll(val); PlayerLobbyState.Patch(val); } private void Start() { ModDependenciesUtils.RegisterToModMenu(((BaseUnityPlugin)this).Info, new List { "The modding folder is the place where mods that use it will store user information.Things like sounds, skins or special configuration should get gathered there.", "For it to be applied properly, you should restart your game after changing it." }); StartReached = true; BepInRef.RefCheck(); } private void OnGUI() { LoadingScreen.OnGUI(); } } public static class PluginInfos { public const string PLUGIN_NAME = "LLBModdingLib"; public const string PLUGIN_ID = "fr.glomzubuk.plugins.llb.llbml"; public const string PLUGIN_VERSION = "0.10.6"; } public static class BallApi { public static bool NoBallsActivelyInMatch() { if ((Object)(object)BallHandler.instance == (Object)null) { return true; } return BallHandler.instance.NoBallsActivelyInMatch(); } public static bool BallsActivelyInMatch() { if ((Object)(object)BallHandler.instance == (Object)null) { return false; } BallEntity[] balls = BallHandler.instance.balls; for (int i = 0; i < balls.Length; i++) { if (((Entity)balls[i]).IsActivelyInMatch()) { return true; } } return false; } public static BallEntity GetBall(int ballIndex = 0) { if ((Object)(object)BallHandler.instance == (Object)null) { return null; } return BallHandler.instance.GetBall(0); } } public static class LoadingScreen { private static Dictionary loadingInfos = new Dictionary(); public static bool AnyModLoading => loadingInfos.Count > 0; public static void SetLoading(PluginInfo plugin, bool loading, string message = null, bool showScreen = true) { if (loading) { if (!loadingInfos.ContainsKey(plugin.Metadata.GUID)) { string message2 = ((message == null) ? (plugin.Metadata.Name + " is loading external resources") : message); loadingInfos.Add(plugin.Metadata.GUID, new LoadingInfo(message2, showScreen)); } } else if (loadingInfos.ContainsKey(plugin.Metadata.GUID)) { loadingInfos.Remove(plugin.Metadata.GUID); } UpdateState(); } public static void UpdateState() { if (AnyModLoading) { if (!UIScreen.loadingScreenActive) { UIScreen.SetLoadingScreen(true, false, false, (Stage)0); } } else if (UIScreen.loadingScreenActive && GameStates.GetCurrent() != GameState.NONE) { UIScreen.SetLoadingScreen(false, false, false, (Stage)0); } } internal static void OnGUI() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) if (!UIScreen.loadingScreenActive || !AnyModLoading) { return; } Color contentColor = GUI.contentColor; int fontSize = GUI.skin.label.fontSize; TextAnchor alignment = GUI.skin.label.alignment; GUI.contentColor = Color.white; GUI.skin.label.fontSize = 50; new GUIStyle(GUI.skin.label); GUI.skin.label.alignment = (TextAnchor)4; Resolution resolutionFromConfig = UIScreen.GetResolutionFromConfig(); float num = ((Resolution)(ref resolutionFromConfig)).height / loadingInfos.Count; foreach (LoadingInfo value in loadingInfos.Values) { GUI.Label(new Rect(0f, num - 25f, (float)Screen.width, 50f), value.message); num -= 50f; } GUI.skin.label.alignment = (TextAnchor)3; GUI.contentColor = contentColor; GUI.skin.label.fontSize = fontSize; GUI.skin.label.alignment = alignment; } } public struct LoadingInfo { public string message; public bool showScreen; public LoadingInfo(string _message, bool _showScreen) { message = _message; showScreen = _showScreen; } } public static class ScreenApi { public static ScreenBase[] CurrentScreens => UIScreen.currentScreens; public static bool IsGameResult() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 ScreenBase obj = CurrentScreens[0]; if (obj == null) { return false; } return (int)obj.screenType == 21; } public static PostScreen GetPostScreen() { if (IsGameResult()) { ScreenBase obj = CurrentScreens[0]; return (PostScreen)(object)((obj is PostScreen) ? obj : null); } return null; } } public class CharacterApi { public static Character[] invalidCharacters = (Character[])(object)new Character[3] { (Character)12, (Character)100, (Character)101 }; public static Character[] unplayableCharacters = (Character[])(object)new Character[1] { (Character)102 }; public static IEnumerable GetAllCharacters() { return GenericUtils.GetEnumValues(); } public static IEnumerable GetValidCharacters() { return GetAllCharacters().Except(invalidCharacters); } public static IEnumerable GetPlayableCharacters() { return GetValidCharacters().Except(unplayableCharacters); } public static Character GetCharacterByName(string characterName) { //IL_0005: 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) for (int i = 0; i < 12; i++) { Character result = (Character)i; if (((object)(Character)(ref result)).ToString() == characterName.ToUpper()) { return result; } } return (Character)101; } public static Character TheWitcherGetCharacterByName(string characterName) { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) foreach (Character enumValue in GenericUtils.GetEnumValues()) { Character current = enumValue; if (((object)(Character)(ref current)).ToString() == characterName) { return current; } } return (Character)101; } } public static class ProgressApi { public static int GetCurrency() { return BDCINPKBMBL.currency; } public static int GetXp() { return BDCINPKBMBL.xp; } public static bool DidCharacterCompleteArcade(Character pChar) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return EPCDKLCABNC.HGHKKPCAKOM(pChar); } public static bool DidAllCharactersCompleteArcade() { return EPCDKLCABNC.JIAKEINJLMN(); } public static void CharacterCompleteArcadeSet(Character pChar) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) EPCDKLCABNC.NHANFBFHNDJ(pChar); } public static bool IsAvaliableForUnlocking(AudioTrack track) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return EPCDKLCABNC.ENLLEDKHNAH(track); } public static bool IsAvaliableForUnlocking(Character pChar, CharacterVariant pCharVar) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) return EPCDKLCABNC.ENLLEDKHNAH(pChar, pCharVar); } public static bool AllOutfitsAboveModelAlt2AreUnlocked(Character pChar) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return EPCDKLCABNC.NHMBIMHGDNH(pChar); } public static bool IsUnlocked(AudioTrack track) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return EPCDKLCABNC.KFFJOEAJLEH(track); } public static bool IsUnlocked(Character pChar, CharacterVariant pCharVar, int peerPlayerNr = -1) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) return EPCDKLCABNC.KFFJOEAJLEH(pChar, pCharVar, peerPlayerNr); } public static bool IsUnlocked(Character pChar, int peerPlayerNr = -1) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return EPCDKLCABNC.KFFJOEAJLEH(pChar, peerPlayerNr); } public static bool IsUnlocked(GameMode pGameMode) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return EPCDKLCABNC.KFFJOEAJLEH(pGameMode); } public static bool IsUnlocked(Stage pStage) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return EPCDKLCABNC.KFFJOEAJLEH(pStage); } public static bool IsUnlocked(UnlockableMode pMode) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return EPCDKLCABNC.KFFJOEAJLEH(pMode); } public static bool IsDefaultUnlocked(Character pChar) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 if (pChar - 6 <= 2 || (int)pChar == 10) { return false; } return true; } public static bool IsDefaultUnlocked(Stage pStage) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected I4, but got Unknown switch (pStage - 3) { case 0: case 1: case 3: case 5: case 8: case 9: return true; default: return false; } } public static string GetSkinName(Character character, CharacterVariant characterVariant) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected I4, but got Unknown return EPCDKLCABNC.CPNGJKMEOOM(character, (int)characterVariant); } public static string GetStageName(Stage stage) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return EPCDKLCABNC.IHODJKJJMLE(stage); } } public static class InputApi { } public static class GraphicUtils { private static readonly Texture2D backgroundTexture = Texture2D.whiteTexture; private static readonly GUIStyle textureStyle = new GUIStyle { normal = new GUIStyleState { background = backgroundTexture } }; public static void DrawRect(Rect position, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) DrawRectWithContent(position, color, null); } public static void DrawRectWithContent(Rect position, Color color, GUIContent content) { //IL_0000: 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_000b: Unknown result type (might be due to invalid IL or missing references) Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = color; GUI.Box(position, content ?? GUIContent.none, textureStyle); GUI.backgroundColor = backgroundColor; } } public static class Tuple { public static Tuple Create(T1 item1, T2 item2) { return new Tuple(item1, item2); } } [DebuggerDisplay("Item1={Item1};Item2={Item2}")] public class Tuple : IFormattable { private static readonly IEqualityComparer Item1Comparer = EqualityComparer.Default; private static readonly IEqualityComparer Item2Comparer = EqualityComparer.Default; public T1 Item1 { get; private set; } public T2 Item2 { get; private set; } public Tuple(T1 item1, T2 item2) { Item1 = item1; Item2 = item2; } public override int GetHashCode() { int num = 0; if (Item1 != null) { num = Item1Comparer.GetHashCode(Item1); } if (Item2 != null) { num = (num << 3) ^ Item2Comparer.GetHashCode(Item2); } return num; } public override bool Equals(object obj) { if (!(obj is Tuple tuple)) { return false; } if (Item1Comparer.Equals(Item1, tuple.Item1)) { return Item2Comparer.Equals(Item2, tuple.Item2); } return false; } public override string ToString() { return ToString(null, CultureInfo.CurrentCulture); } public string ToString(string format, IFormatProvider formatProvider) { return string.Format(formatProvider, format ?? "{0},{1}", new object[2] { Item1, Item2 }); } } internal static class ConfigTypeConverters { public static void AddConfigConverters() { AddColorConverters(); AddVectorConverters(); AddLLBMathConverters(); } [MethodImpl(MethodImplOptions.NoInlining)] private static void AddColorConverters() { //IL_0000: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown TypeConverter val = new TypeConverter { ConvertToString = (object obj, Type type) => ColorUtility.ToHtmlStringRGBA((Color)obj), ConvertToObject = delegate(string str, Type type) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) Color val2 = default(Color); if (!ColorUtility.TryParseHtmlString("#" + str.Trim('#', ' '), ref val2)) { throw new FormatException("Invalid color string, expected hex #RRGGBBAA"); } return val2; } }; TomlTypeConverter.AddConverter(typeof(Color), val); } [MethodImpl(MethodImplOptions.NoInlining)] private static void AddVectorConverters() { //IL_0000: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown TypeConverter val = new TypeConverter { ConvertToString = (object obj, Type type) => JsonUtility.ToJson(obj), ConvertToObject = (string str, Type type) => JsonUtility.FromJson(str, type) }; TomlTypeConverter.AddConverter(typeof(Vector2), val); TomlTypeConverter.AddConverter(typeof(Vector3), val); TomlTypeConverter.AddConverter(typeof(Vector4), val); TomlTypeConverter.AddConverter(typeof(Quaternion), val); } [MethodImpl(MethodImplOptions.NoInlining)] private static void AddLLBMathConverters() { //IL_0000: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown TypeConverter val = new TypeConverter { ConvertToString = (object obj, Type type) => ((Floatf)obj).ToMachineString(), ConvertToObject = (string str, Type type) => Floatf.FromMachineString(str) }; TypeConverter val2 = new TypeConverter { ConvertToString = (object obj, Type type) => ((Vector2f)obj).ToMachineString(), ConvertToObject = (string str, Type type) => Vector2f.FromMachineString(str) }; TypeConverter val3 = new TypeConverter { ConvertToString = (object obj, Type type) => JsonUtility.ToJson((object)(Vector2)(Vector2i)obj), ConvertToObject = (string str, Type type) => (Vector2i)JsonUtility.FromJson(str) }; TomlTypeConverter.AddConverter(typeof(Floatf), val); TomlTypeConverter.AddConverter(typeof(Vector2f), val2); TomlTypeConverter.AddConverter(typeof(Vector2i), val3); } } } namespace LLBML.External { public class Murmur3 { public static ulong READ_SIZE = 16uL; private static ulong C1 = 9782798678568883157uL; private static ulong C2 = 5545529020109919103uL; private ulong length; private uint seed; private ulong h1; private ulong h2; public byte[] Hash { get { h1 ^= length; h2 ^= length; h1 += h2; h2 += h1; h1 = MixFinal(h1); h2 = MixFinal(h2); h1 += h2; h2 += h1; byte[] array = new byte[READ_SIZE]; Array.Copy(BitConverter.GetBytes(h1), 0, array, 0, 8); Array.Copy(BitConverter.GetBytes(h2), 0, array, 8, 8); return array; } } private void MixBody(ulong k1, ulong k2) { h1 ^= MixKey1(k1); h1 = h1.RotateLeft(27); h1 += h2; h1 = h1 * 5 + 1390208809; h2 ^= MixKey2(k2); h2 = h2.RotateLeft(31); h2 += h1; h2 = h2 * 5 + 944331445; } private static ulong MixKey1(ulong k1) { k1 *= C1; k1 = k1.RotateLeft(31); k1 *= C2; return k1; } private static ulong MixKey2(ulong k2) { k2 *= C2; k2 = k2.RotateLeft(33); k2 *= C1; return k2; } private static ulong MixFinal(ulong k) { k ^= k >> 33; k *= 18397679294719823053uL; k ^= k >> 33; k *= 14181476777654086739uL; k ^= k >> 33; return k; } public byte[] ComputeHash(byte[] bb) { ProcessBytes(bb); return Hash; } private void ProcessBytes(byte[] bb) { h1 = seed; length = 0uL; int num = 0; ulong num2 = (ulong)bb.Length; while (num2 >= READ_SIZE) { ulong uInt = bb.GetUInt64(num); num += 8; ulong uInt2 = bb.GetUInt64(num); num += 8; length += READ_SIZE; num2 -= READ_SIZE; MixBody(uInt, uInt2); } if (num2 != 0) { ProcessBytesRemaining(bb, num2, num); } } private void ProcessBytesRemaining(byte[] bb, ulong remaining, int pos) { ulong num = 0uL; ulong num2 = 0uL; length += remaining; ulong num3 = remaining - 1; if (num3 <= 14) { switch (num3) { case 14uL: num2 ^= (ulong)bb[pos + 14] << 48; goto case 13uL; case 13uL: num2 ^= (ulong)bb[pos + 13] << 40; goto case 12uL; case 12uL: num2 ^= (ulong)bb[pos + 12] << 32; goto case 11uL; case 11uL: num2 ^= (ulong)bb[pos + 11] << 24; goto case 10uL; case 10uL: num2 ^= (ulong)bb[pos + 10] << 16; goto case 9uL; case 9uL: num2 ^= (ulong)bb[pos + 9] << 8; goto case 8uL; case 8uL: num2 ^= bb[pos + 8]; goto case 7uL; case 7uL: num ^= bb.GetUInt64(pos); goto IL_0128; case 6uL: num ^= (ulong)bb[pos + 6] << 48; goto case 5uL; case 5uL: num ^= (ulong)bb[pos + 5] << 40; goto case 4uL; case 4uL: num ^= (ulong)bb[pos + 4] << 32; goto case 3uL; case 3uL: num ^= (ulong)bb[pos + 3] << 24; goto case 2uL; case 2uL: num ^= (ulong)bb[pos + 2] << 16; goto case 1uL; case 1uL: num ^= (ulong)bb[pos + 1] << 8; goto case 0uL; case 0uL: { num ^= bb[pos]; goto IL_0128; } IL_0128: h1 ^= MixKey1(num); h2 ^= MixKey2(num2); return; } } throw new Exception("Something went wrong with remaining bytes calculation."); } } public static class IntHelpers { public static ulong RotateLeft(this ulong original, int bits) { return (original << bits) | (original >> 64 - bits); } public static ulong RotateRight(this ulong original, int bits) { return (original >> bits) | (original << 64 - bits); } public unsafe static ulong GetUInt64(this byte[] bb, int pos) { fixed (byte* ptr = &bb[pos]) { return *(ulong*)ptr; } } } } namespace LLBML.Graphic { public static class Draw { public enum Alignment : byte { INSIDE, OUTSIDE } private static Material _lineMaterial; private static Material lineMaterial { get { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if ((Object)(object)_lineMaterial == (Object)null) { _lineMaterial = new Material(Shader.Find("Hidden/Internal-Colored")); ((Object)_lineMaterial).hideFlags = (HideFlags)61; _lineMaterial.SetInt("_SrcBlend", 5); _lineMaterial.SetInt("_DstBlend", 0); _lineMaterial.SetInt("_Cull", 0); _lineMaterial.SetInt("_ZWrite", 0); _lineMaterial.SetInt("_ZTest", 8); } return _lineMaterial; } } public static void Cube(Vector2f center, Vector2f size, Color color, float thicc = 4f, Alignment align = Alignment.INSIDE) { //IL_0025: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: 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_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0218: 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_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0289: 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_0295: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: 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_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: 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_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) lineMaterial.SetPass(0); thicc *= 0.01f; Camera gameplayCam = GameCamera.gameplayCam; GL.PushMatrix(); GL.Begin(7); GL.Color(color); GL.LoadProjectionMatrix(gameplayCam.projectionMatrix); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor((float)(center.x - size.x * HHBCPNCDNDH.GMEDDLALMGA), (float)(center.y - size.y * HHBCPNCDNDH.GMEDDLALMGA)); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor((float)(center.x - size.x * HHBCPNCDNDH.GMEDDLALMGA), (float)(center.y + size.y * HHBCPNCDNDH.GMEDDLALMGA)); Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor((float)(center.x + size.x * HHBCPNCDNDH.GMEDDLALMGA), (float)(center.y + size.y * HHBCPNCDNDH.GMEDDLALMGA)); Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor((float)(center.x + size.x * HHBCPNCDNDH.GMEDDLALMGA), (float)(center.y - size.y * HHBCPNCDNDH.GMEDDLALMGA)); Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor(thicc, 0f, 0f); Vector3 val6 = default(Vector3); ((Vector3)(ref val6))..ctor(0f, thicc * (float)(int)align, 0f); Vector3 val7 = default(Vector3); ((Vector3)(ref val7))..ctor(thicc, thicc, 0f); Vector3 val8 = default(Vector3); ((Vector3)(ref val8))..ctor(thicc, 0f - thicc, 0f); GL.Vertex(val - val6); GL.Vertex(val2 + val6); if (align == Alignment.INSIDE) { GL.Vertex(val2 + val5); GL.Vertex(val + val5); } else { GL.Vertex(val2 - val8); GL.Vertex(val - val7); } GL.Vertex(val2); GL.Vertex(val3); if (align == Alignment.INSIDE) { GL.Vertex3(val3.x, val3.y - thicc, val3.z); GL.Vertex3(val2.x, val2.y - thicc, val2.z); } else { GL.Vertex3(val3.x, val3.y + thicc, val3.z); GL.Vertex3(val2.x, val2.y + thicc, val2.z); } GL.Vertex(val3 + val6); GL.Vertex(val4 - val6); if (align == Alignment.INSIDE) { GL.Vertex(val4 - val5); GL.Vertex(val3 - val5); } else { GL.Vertex(val4 + val8); GL.Vertex(val3 + val7); } GL.Vertex(val4); GL.Vertex(val); if (align == Alignment.INSIDE) { GL.Vertex3(val.x, val.y + thicc, val.z); GL.Vertex3(val4.x, val4.y + thicc, val4.z); } else { GL.Vertex3(val.x, val.y - thicc, val.z); GL.Vertex3(val4.x, val4.y - thicc, val4.z); } GL.End(); GL.PopMatrix(); } public static void Polygon(Vector2f center, Floatf radius, Color color, int vertexNumber = 360, bool hollow = false, float thicness = 4f) { //IL_0062: 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) lineMaterial.SetPass(0); thicness *= 0.01f; Camera gameplayCam = GameCamera.gameplayCam; float num = ((radius - thicness <= 0f) ? 0f : ((float)radius - thicness)); GL.PushMatrix(); if (hollow) { GL.Begin(4); } else { GL.Begin(7); } GL.Color(color); GL.LoadProjectionMatrix(gameplayCam.projectionMatrix); float num2 = (float)System.Math.PI * 2f / (float)vertexNumber; for (float num3 = 0f; num3 <= (float)vertexNumber; num3 += 1f) { float num4 = num2 * num3 - (float)System.Math.PI / 2f + num2 / 2f; float num5 = num2 * (num3 + 1f) - (float)System.Math.PI / 2f + num2 / 2f; if (hollow) { GL.Vertex3((float)center.x, (float)center.y, 0f); GL.Vertex3((float)(center.x + Mathf.Cos(num4) * radius), (float)(center.y + Mathf.Sin(num4) * radius), 0f); GL.Vertex3((float)(center.x + Mathf.Cos(num5) * radius), (float)(center.y + Mathf.Sin(num5) * radius), 0f); } else { GL.Vertex3((float)(center.x + Mathf.Cos(num4) * radius), (float)(center.y + Mathf.Sin(num4) * radius), 0f); GL.Vertex3((float)(center.x + Mathf.Cos(num5) * radius), (float)(center.y + Mathf.Sin(num5) * radius), 0f); GL.Vertex3((float)(center.x + Mathf.Cos(num5) * num), (float)(center.y + Mathf.Sin(num5) * num), 0f); GL.Vertex3((float)(center.x + Mathf.Cos(num4) * num), (float)(center.y + Mathf.Sin(num4) * num), 0f); } } GL.End(); GL.PopMatrix(); } } } namespace LLBML.Texture { public static class TextureUtils { private static ManualLogSource Logger = LLBMLPlugin.Log; public static Texture2D LoadPNG(FileInfo file) { if (!file.Exists) { Logger.LogWarning((object)("LoadPNG: Could not find " + file.FullName)); return null; } byte[] array; using (FileStream input = file.OpenRead()) { using BinaryReader aReader = new BinaryReader(input); PNGFile pNGFile = PNGTools.ReadPNGFile(aReader); for (int num = pNGFile.chunks.Count - 1; num >= 0; num--) { PNGChunk pNGChunk = pNGFile.chunks[num]; if (pNGChunk.type == EPNGChunkType.gAMA || pNGChunk.type == EPNGChunkType.pHYs || pNGChunk.type == EPNGChunkType.sRBG) { pNGFile.chunks.RemoveAt(num); } } using MemoryStream memoryStream = new MemoryStream(); PNGTools.WritePNGFile(pNGFile, new BinaryWriter(memoryStream)); array = memoryStream.ToArray(); } string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file.FullName); Texture2D obj = DefaultTexture(512, 512, (TextureFormat)4); ((Object)obj).name = fileNameWithoutExtension; ImageConversion.LoadImage(obj, array); return obj; } public static Texture2D LoadPNG(string filePath) { return LoadPNG(new FileInfo(filePath)); } public static Texture2D LoadDDS(FileInfo file) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) DDSImage dDSImage = new DDSImage(File.ReadAllBytes(file.FullName)); Texture2D obj = DefaultTexture(dDSImage.Width, dDSImage.Height, dDSImage.GetTextureFormat()); obj.LoadRawTextureData(dDSImage.GetTextureData()); obj.Apply(); return obj; } public static Texture2D LoadDDS(string filePath) { return LoadDDS(new FileInfo(filePath)); } public static Texture2D LoadTexture(FileInfo file) { string text = file.Extension.ToLower(); if (!(text == ".png")) { if (text == ".dds") { return LoadDDS(file); } throw new NotSupportedException("Unkown file extension: " + file.Extension); } return LoadPNG(file); } public static Texture2D LoadTexture(string filePath) { return LoadTexture(new FileInfo(filePath)); } public static Texture2D DefaultTexture(int width = 512, int height = 512, TextureFormat format = 4) { //IL_0002: 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_0011: 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_0025: Expected O, but got Unknown return new Texture2D(width, height, format, true, false) { filterMode = (FilterMode)2, anisoLevel = 9, mipMapBias = -0.5f }; } } } namespace LLBML.UI { public class Dialogs { private static ScreenBase screenDialog; private static void CloseDialog() { UIScreen.Close(screenDialog, (ScreenTransition)0); screenDialog = null; } private static bool IsDialogOpen() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 if ((Object)(object)screenDialog != (Object)null) { return true; } ScreenBase[] currentScreens = ScreenApi.CurrentScreens; foreach (ScreenBase val in currentScreens) { if ((Object)(object)val != (Object)null && ((int)val.screenType == 26 || (int)val.screenType == 28 || (int)val.screenType == 27)) { return true; } } return false; } public static void OpenDialog(string title, string message, string buttonText = null, Action onClickButton = null) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown if (IsDialogOpen()) { LLBMLPlugin.Log.LogWarning((object)("Tried to open a dialog while one was already opened. Title:" + title)); return; } screenDialog = UIScreen.Open((ScreenType)26, 2); ScreenBase obj = screenDialog; ScreenDialog val = (ScreenDialog)(object)((obj is ScreenDialog) ? obj : null); val.SetText(title, message, -1, false); if (buttonText != null) { val.ShowButton(buttonText); } else { val.AutoClose(10f); } ((LLClickable)val.btOk).onClick = (ControlDelegate)delegate { if (onClickButton != null) { onClickButton(); } CloseDialog(); }; } public static void OpenConfirmationDialog(string title, string text, Action onClickOK = null, Action onClickCancel = null) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown if (IsDialogOpen()) { LLBMLPlugin.Log.LogWarning((object)("Tried to open a dialog while one was already opened. Title:" + title)); return; } screenDialog = UIScreen.Open((ScreenType)27, 2, (ScreenTransition)0, true); ScreenBase obj = screenDialog; ScreenBase obj2 = ((obj is ScreenDialogConfirmation) ? obj : null); ((ScreenDialogConfirmation)obj2).SetText(title, text, -1); ((LLClickable)((ScreenDialogConfirmation)obj2).btOk).onClick = (ControlDelegate)delegate { if (onClickOK != null) { onClickOK(); } CloseDialog(); }; ((LLClickable)((ScreenDialogConfirmation)obj2).btCancel).onClick = (ControlDelegate)delegate { if (onClickCancel != null) { onClickCancel(); } CloseDialog(); }; } } } namespace LLBML.States { public class GameStates { private readonly DNPFJHMAIBP _gameStates; public static GameStates Instance => DNPFJHMAIBP.AKGAOAEJ; public static List Messages => DNPFJHMAIBP.IGEBDAFJIDI; public GameStates(DNPFJHMAIBP gs) { _gameStates = gs; } public override bool Equals(object obj) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if (obj is DNPFJHMAIBP || obj is GameStates) { return object.Equals((object?)(DNPFJHMAIBP)obj, (DNPFJHMAIBP)this); } return false; } public override int GetHashCode() { return ((object)_gameStates).GetHashCode(); } public override string ToString() { return ((object)_gameStates).ToString(); } public static implicit operator DNPFJHMAIBP(GameStates gs) { return gs._gameStates; } public static implicit operator GameStates(DNPFJHMAIBP gs) { return new GameStates(gs); } public static GameState GetCurrent() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return DNPFJHMAIBP.HHMOGKIMBNM(); } public static void DirectProcess(Message message) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) DNPFJHMAIBP.OLGPEGGAIIB(message); } public static void DirectProcess(Msg msg, int playerNr, int index) { //IL_0000: 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) DirectProcess(new Message(msg, playerNr, index, (object)null, -1)); } public static void ClearMessages() { DNPFJHMAIBP.CJLNFAABMGM(); } public static bool ShouldIgnoreInputs() { return DNPFJHMAIBP.CNEEALIJJFE(); } public static bool IsInIntro() { return DNPFJHMAIBP.DEDHLLMANNE(); } public static bool IsSwitching() { return DNPFJHMAIBP.KHJPIEHGCHK(); } public static bool IsMenuState(GameState s, bool alsoOptions = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return DNPFJHMAIBP.LJCBCBAKKDF((JOFJHDJHJGI)s, alsoOptions); } public static void Send(Message message) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) DNPFJHMAIBP.GKBNNFEAJGO(message); } public static void Send(Msg msgType, int playerNr, int index) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) DNPFJHMAIBP.GKBNNFEAJGO(msgType, playerNr, index); } public static void SendAfter(float delay, Message message) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) DNPFJHMAIBP.EPPPGGPNAPK(delay, message); } public static void Set(GameState newState, bool noLink = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) DNPFJHMAIBP.HOGJDNCMNFP((JOFJHDJHJGI)newState, noLink); } public static void UpdateToConfigAll() { DNPFJHMAIBP.CHILDIDHNBH(); } public static FHPLAFJAAIP GetCurrentGameStateObject() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) return DNPFJHMAIBP.AKGAOAEJ.EAPCPAJPEMA((JOFJHDJHJGI)GetCurrent()); } public static bool IsInLobby() { if (!IsInLocalLobby() && !IsInOnlineLobby()) { return IsInSingleLobby(); } return true; } public static bool IsInLocalLobby() { return GetCurrent() == GameState.LOBBY_LOCAL; } public static bool IsInOnlineLobby() { return GetCurrent() == GameState.LOBBY_ONLINE; } public static bool IsInSingleLobby() { GameState current = GetCurrent(); if (!(current == GameState.LOBBY_TRAINING) && !(current == GameState.LOBBY_STORY) && !(current == GameState.LOBBY_TUTORIAL)) { return current == GameState.LOBBY_CHALLENGE; } return true; } public static bool IsInGame() { GameState current = GetCurrent(); if (!(current == GameState.GAME)) { return current == GameState.GAME_PAUSE; } return true; } public static bool IsInMatch() { GetCurrent(); if ((Object)(object)World.instance != (Object)null && !UIScreen.loadingScreenActive) { return IsInGame(); } return false; } } public static class GameStatesLobbyUtils { private static ManualLogSource Logger = LLBMLPlugin.Log; public static HPNLMFHPHFD GetLobby() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown if (!GameStates.IsInLobby()) { throw new InvalidOperationException(ErrorMessage("GameStatesLobby", GameStates.GetCurrent().ToString())); } return (HPNLMFHPHFD)GameStates.GetCurrentGameStateObject(); } public static void UpdatePlayer(HPNLMFHPHFD gs_lobby, Player player, bool play_selection_anim = false) { gs_lobby.BDMIDGAHNLA((ALDOKEMAOMB)player, play_selection_anim); } public static void UpdatePlayer(Player player, bool play_selection_anim = false) { UpdatePlayer(GetLobby(), player, play_selection_anim); } public static HDLIJDBFGKN GetOnlineLobby() { if (!GameStates.IsInOnlineLobby()) { throw new InvalidOperationException(ErrorMessage("GameStatesLobbyOnline", GameStates.GetCurrent().ToString())); } return HDLIJDBFGKN.instance; } public static void MakeSureReadyIs(HDLIJDBFGKN gs_lobbyOnline, bool ready, bool resetTimer = false) { gs_lobbyOnline.IKPDLPDNHIJ(ready, resetTimer); } public static void MakeSureReadyIs(bool ready, bool resetTimer = false) { MakeSureReadyIs(GetOnlineLobby(), ready, resetTimer); } public static void SendPlayerState(HDLIJDBFGKN gs_lobbyOnline, Player player) { gs_lobbyOnline.OFGNNIBJOLH((ALDOKEMAOMB)player); } public static void SendPlayerState(Player player) { SendPlayerState(GetOnlineLobby(), player); } public static void RefreshPlayerState(Player player) { Logger.LogInfo((object)("Refreshing player " + player.nr)); if (GameStates.IsInLobby()) { UpdatePlayer(player); } else { Logger.LogWarning((object)("Tried to refresh state while not in a lobby.\n Current GameState: " + GameStates.GetCurrent()?.ToString() + " . Stacktrace: \n" + new StackTrace())); } } public static void RefreshLocalPlayerState() { RefreshPlayerState(Player.GetLocalPlayer()); } public static bool GetAutoreadyStatus() { if (GameStates.IsInLobby() && GameStates.IsInOnlineLobby()) { return GetOnlineLobby().BOEPIJPONCK; } return false; } public static IJDANPONMLL GetLocalLobby() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown if (!GameStates.IsInLocalLobby()) { throw new InvalidOperationException(ErrorMessage("GameStatesLobbyLocal", GameStates.GetCurrent().ToString())); } return (IJDANPONMLL)GameStates.GetCurrentGameStateObject(); } public static HFAEJNGHDDM GetSingleLobby() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown if (!GameStates.IsInSingleLobby()) { throw new InvalidOperationException(ErrorMessage("GameStatesLobbySingle", GameStates.GetCurrent().ToString())); } return (HFAEJNGHDDM)GameStates.GetCurrentGameStateObject(); } private static string ErrorMessage(string obName, string state) { return "Tried to fetch " + obName + " object while not in the right state. Current state: " + state; } } public class GameState : EnumWrapper { public enum Enum { NONE, INTRO, MENU, QUIT, LOBBY_LOCAL, LOBBY_ONLINE, LOBBY_CHALLENGE, CHALLENGE_LADDER, CHALLENGE_LOST, STORY_GRID, STORY_COMIC, LOBBY_TRAINING, LOBBY_TUTORIAL, CREDITS, OPTIONS_GAME, OPTIONS_INPUT, OPTIONS_AUDIO, OPTIONS_VIDEO, GAME_INTRO, GAME, GAME_PAUSE, GAME_RESULT, UNLOCKS, LOBBY_STORY, UNKNOWN1, UNKNOWN2 } public enum Enum_Mapping { NONE, INTRO, MENU, QUIT, LOBBY_LOCAL, LOBBY_ONLINE, LOBBY_CHALLENGE, CHALLENGE_LADDER, CHALLENGE_LOST, STORY_GRID, STORY_COMIC, LOBBY_TRAINING, LOBBY_TUTORIAL, CREDITS, OPTIONS_GAME, OPTIONS_INPUT, OPTIONS_AUDIO, OPTIONS_VIDEO, GAME_INTRO, GAME, GAME_PAUSE, GAME_RESULT, UNLOCKS, LOBBY_STORY, UNKNOWN1, UNKNOWN2 } public static readonly GameState NONE = Enum.NONE; public static readonly GameState INTRO = Enum.INTRO; public static readonly GameState MENU = Enum.MENU; public static readonly GameState QUIT = Enum.QUIT; public static readonly GameState LOBBY_LOCAL = Enum.LOBBY_LOCAL; public static readonly GameState LOBBY_ONLINE = Enum.LOBBY_ONLINE; public static readonly GameState LOBBY_CHALLENGE = Enum.LOBBY_CHALLENGE; public static readonly GameState CHALLENGE_LADDER = Enum.CHALLENGE_LADDER; public static readonly GameState CHALLENGE_LOST = Enum.CHALLENGE_LOST; public static readonly GameState STORY_GRID = Enum.STORY_GRID; public static readonly GameState STORY_COMIC = Enum.STORY_COMIC; public static readonly GameState LOBBY_TRAINING = Enum.LOBBY_TRAINING; public static readonly GameState LOBBY_TUTORIAL = Enum.LOBBY_TUTORIAL; public static readonly GameState CREDITS = Enum.CREDITS; public static readonly GameState OPTIONS_GAME = Enum.OPTIONS_GAME; public static readonly GameState OPTIONS_INPUT = Enum.OPTIONS_INPUT; public static readonly GameState OPTIONS_AUDIO = Enum.OPTIONS_AUDIO; public static readonly GameState OPTIONS_VIDEO = Enum.OPTIONS_VIDEO; public static readonly GameState GAME_INTRO = Enum.GAME_INTRO; public static readonly GameState GAME = Enum.GAME; public static readonly GameState GAME_PAUSE = Enum.GAME_PAUSE; public static readonly GameState GAME_RESULT = Enum.GAME_RESULT; public static readonly GameState UNLOCKS = Enum.UNLOCKS; public static readonly GameState LOBBY_STORY = Enum.LOBBY_STORY; public static readonly GameState UNKNOWN1 = Enum.UNKNOWN1; public static readonly GameState UNKNOWN2 = Enum.UNKNOWN2; private GameState(int id) : base(id) { } private GameState(JOFJHDJHJGI gameState) : base((int)gameState) { }//IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected I4, but got Unknown public override string ToString() { return ((Enum)id).ToString(); } public static implicit operator JOFJHDJHJGI(GameState ew) { return (JOFJHDJHJGI)ew.id; } public static implicit operator GameState(JOFJHDJHJGI val) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return new GameState(val); } public static implicit operator GameState(int id) { return new GameState(id); } public static implicit operator GameState(Enum val) { return new GameState((int)val); } public static implicit operator Enum(GameState ew) { return (Enum)ew.id; } } public class PlayerLobbyState { internal struct PLSCustomPayload { public string name; public byte[] netID; public Func onSendPayload; public Action onReceivePayload; public PLSCustomPayload(byte[] netID, Func onSendPayload, Action onReceivePayload) { name = null; this.netID = netID; this.onSendPayload = onSendPayload; this.onReceivePayload = onReceivePayload; } public PLSCustomPayload(PluginInfo pi, Func onSendPayload, Action onReceivePayload) { name = pi.Metadata.Name; netID = NetworkApi.GetNetworkIdentifier(pi.Metadata.GUID); this.onSendPayload = onSendPayload; this.onReceivePayload = onReceivePayload; } } private readonly JMLEHJLKPAC _pls; internal static readonly byte[] nullNetID = new byte[4]; internal static readonly DateTime payloadLengthSwitchDate = new DateTime(2025, 6, 1, 8, 0, 0, DateTimeKind.Utc); internal static Dictionary customPayloads = new Dictionary(); public int playerNr { get { return _pls.BKEOPDPFFPM; } set { _pls.BKEOPDPFFPM = value; } } public Character character { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _pls.LALEEFJMMLH; } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) _pls.LALEEFJMMLH = value; } } public CharacterVariant variant { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _pls.AIINAIDBHJI; } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) _pls.AIINAIDBHJI = value; } } public Team team { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _pls.HEOKEMBMDIJ; } set { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) _pls.HEOKEMBMDIJ = value; } } public bool selected { get { return _pls.CHNGAKOIJFE; } set { _pls.CHNGAKOIJFE = value; } } public bool ready { get { return _pls.GFCMODHPPCN; } set { _pls.GFCMODHPPCN = value; } } public bool spectator { get { return _pls.HOKENEBPEGH; } set { _pls.HOKENEBPEGH = value; } } public PlayerLobbyState() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown _pls = new JMLEHJLKPAC(); } public PlayerLobbyState(JMLEHJLKPAC pls) { _pls = pls; } public PlayerLobbyState(Player player) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown _pls = new JMLEHJLKPAC((ALDOKEMAOMB)player); } public override bool Equals(object obj) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if (obj is JMLEHJLKPAC || obj is PlayerLobbyState) { return object.Equals((object?)(JMLEHJLKPAC)obj, (JMLEHJLKPAC)this); } return false; } public override int GetHashCode() { return ((object)_pls).GetHashCode(); } public override string ToString() { return ((object)_pls).ToString(); } public static implicit operator JMLEHJLKPAC(PlayerLobbyState pls) { return pls._pls; } public static implicit operator PlayerLobbyState(JMLEHJLKPAC pls) { return new PlayerLobbyState(pls); } public void CopyTo(Player p) { _pls.LMIPEFAPKOJ((ALDOKEMAOMB)p); } public void WriteBytes(BinaryWriter writer) { _pls.JFFMEHKLMNG(writer); } public static PlayerLobbyState ReadBytes(BinaryReader reader) { return JMLEHJLKPAC.JFNLMPNOEMA(reader); } internal static void Patch(Harmony harmonyInstance) { harmonyInstance.PatchAll(typeof(PlayerLobbyState_Patches)); } public static void RegisterPayload(PluginInfo info, Func onSendPayload, Action onReceivePayload) { string key = StringUtils.PrettyPrintBytes(NetworkApi.GetNetworkIdentifier(info.Metadata.GUID)); if (customPayloads.ContainsKey(key)) { LLBMLPlugin.Log.LogWarning((object)(info.Metadata.Name + " has already registered a payload.")); } else { customPayloads.Add(key, new PLSCustomPayload(info, onSendPayload, onReceivePayload)); } } public static void UnregisterPayload(PluginInfo info) { string key = StringUtils.PrettyPrintBytes(NetworkApi.GetNetworkIdentifier(info.Metadata.GUID)); if (customPayloads.ContainsKey(key)) { customPayloads.Remove(key); return; } LLBMLPlugin.Log.LogWarning((object)(info.Metadata.Name + " doesn't have a registered payload.")); DebugUtils.PrintStacktrace(); } } public static class PlayerLobbyState_Patches { [HarmonyPatch(typeof(JMLEHJLKPAC), "JFFMEHKLMNG")] [HarmonyPrefix] public static bool WriteBytes_Prefix(BinaryWriter __0, JMLEHJLKPAC __instance) { //IL_0025: 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) if (PlayerLobbyState.customPayloads.Count <= 0) { return true; } PlayerLobbyState playerLobbyState = __instance; __0.Write((byte)playerLobbyState.playerNr); __0.Write((byte)playerLobbyState.character); __0.Write((byte)playerLobbyState.variant); __0.Write((byte)(int)playerLobbyState.team); __0.Write((byte)(playerLobbyState.selected ? 1u : 0u)); __0.Write((byte)(playerLobbyState.ready ? 1u : 0u)); __0.Write((byte)(playerLobbyState.spectator ? 1u : 0u)); foreach (KeyValuePair customPayload in PlayerLobbyState.customPayloads) { byte[] array = null; try { LLBMLPlugin.Log.LogDebug((object)("Getting PLS payload for: " + customPayload.Value.name)); array = customPayload.Value.onSendPayload(playerLobbyState); } catch (Exception ex) { LLBMLPlugin.Log.LogError((object)((customPayload.Value.name ?? customPayload.Value.netID.ToString()) + " returned error during PlayerLobbyState packing: " + ex)); } if (array == null || array.Length == 0) { continue; } if (DateTime.UtcNow < PlayerLobbyState.payloadLengthSwitchDate) { if (array.Length > 255) { LLBMLPlugin.Log.LogError((object)$"Payload size for {customPayload.Value.name} is too big. {array.Length} bytes received for a maximum of {byte.MaxValue}."); ManualLogSource log = LLBMLPlugin.Log; DateTime payloadLengthSwitchDate = PlayerLobbyState.payloadLengthSwitchDate; log.LogInfo((object)$"This behaviour will change after {payloadLengthSwitchDate.ToLocalTime()}, and will be extended to {ushort.MaxValue}."); continue; } } else if (array.Length > 65535) { LLBMLPlugin.Log.LogError((object)$"Payload size for {customPayload.Value.name} is too big. {array.Length} bytes received for a maximum of {ushort.MaxValue}."); continue; } LLBMLPlugin.Log.LogDebug((object)$"Sending {array.Length} bytes payload for: {customPayload.Value.name}"); __0.Write(customPayload.Value.netID); if (DateTime.UtcNow < PlayerLobbyState.payloadLengthSwitchDate) { __0.Write((byte)array.Length); } else { __0.Write((ushort)array.Length); } __0.Write(array); } __0.Write(PlayerLobbyState.nullNetID); return false; } [HarmonyPatch(typeof(JMLEHJLKPAC), "JFNLMPNOEMA")] [HarmonyPrefix] public static bool ReadBytes_Prefix(ref JMLEHJLKPAC __result, BinaryReader __0) { if (PlayerLobbyState.customPayloads.Count <= 0) { return true; } __result = new PlayerLobbyState { playerNr = __0.ReadByte(), character = (Character)__0.ReadByte(), variant = (CharacterVariant)__0.ReadByte(), team = __0.ReadByte(), selected = (__0.ReadByte() != 0), ready = (__0.ReadByte() != 0), spectator = (__0.ReadByte() != 0) }; while (__0.BaseStream.Position < __0.BaseStream.Length) { LLBMLPlugin.Log.LogDebug((object)$"Current Stream position: {__0.BaseStream.Position}/{__0.BaseStream.Length}"); byte[] array = __0.ReadBytes(4); if (array.Aggregate(0, (int acc, byte val) => acc + val) == 0) { break; } int num = ((DateTime.UtcNow < PlayerLobbyState.payloadLengthSwitchDate) ? __0.ReadByte() : __0.ReadUInt16()); LLBMLPlugin.Log.LogDebug((object)$"Received {num} bytes payload for: {StringUtils.PrettyPrintBytes(array)}"); byte[] arg = __0.ReadBytes(num); string key = StringUtils.PrettyPrintBytes(array); if (PlayerLobbyState.customPayloads.ContainsKey(key)) { PlayerLobbyState.PLSCustomPayload pLSCustomPayload = PlayerLobbyState.customPayloads[key]; LLBMLPlugin.Log.LogDebug((object)("Which is " + pLSCustomPayload.name + ".")); try { pLSCustomPayload.onReceivePayload(__result, arg); } catch (Exception ex) { LLBMLPlugin.Log.LogError((object)((pLSCustomPayload.name ?? pLSCustomPayload.netID.ToString()) + " returned error during PlayerLobbyState unpacking: " + ex)); } } else { LLBMLPlugin.Log.LogWarning((object)$"Unknown PluginID: Couldn't find a plugin with \"{StringUtils.PrettyPrintBytes(array)}\" as netID. It had {num} bytes of data."); } } return false; } } public static class GameStatesGameUtils { private static ManualLogSource Logger = LLBMLPlugin.Log; public static int currentFrame => OGONAGCFDPK.JGKJICLOPFJ(); } } namespace LLBML.Messages { public class CustomMessage { public readonly PluginInfo pluginInfo; public readonly int messageCode; public readonly string messageName; public readonly MessageActions messageActions; public CustomMessage(PluginInfo pluginInfo, int messageCode, string messageName, Action onReceiveCode) { this.pluginInfo = pluginInfo; this.messageCode = messageCode; messageActions = new MessageActions(onReceiveCode); } public CustomMessage(PluginInfo pluginInfo, int messageCode, string messageName, MessageActions messageActions) { this.pluginInfo = pluginInfo; this.messageCode = messageCode; this.messageActions = messageActions; } } public class MessageActions { public readonly Action onReceiveCode; public readonly Action customWriter; public readonly Action customReader; public MessageActions(Action onReceiveCode, Action customWriter = null, Action customReader = null) { this.onReceiveCode = onReceiveCode; this.customWriter = customWriter; this.customReader = customReader; } } public static class MessageApi { public delegate void OnReceiveMessageHandler(object sender, Message e); private static ManualLogSource Logger = LLBMLPlugin.Log; internal static List vanillaMessageCodes; internal static List internalMessageCodes; internal static Dictionary> vanillaSubscriptions = new Dictionary>(); internal static Dictionary customMessages = new Dictionary(); internal static void Patch(Harmony harmonyPatcher) { vanillaMessageCodes = GenericUtils.GetEnumValues().Cast().ToList(); internalMessageCodes = GenericUtils.GetEnumValues().Cast().ToList(); } public static CustomMessage RegisterCustomMessage(PluginInfo pluginInfo, ushort messageCode, string messageName, Action onReceiveMessageCallback) { return RegisterCustomMessage(pluginInfo, messageCode, messageName, new MessageActions(onReceiveMessageCallback)); } public static CustomMessage RegisterCustomMessage(PluginInfo pluginInfo, ushort messageCode, string messageName, MessageActions messageActions) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (messageCode <= 255) { ManualLogSource logger = Logger; Msg val = (Msg)messageCode; logger.LogWarning((object)("Message codes under 256 are reserved for the game (" + ((object)(Msg)(ref val)).ToString() + ").")); Logger.LogWarning((object)"Could not register code action."); return null; } if (customMessages.ContainsKey(messageCode)) { Logger.LogWarning((object)("Message code number" + messageCode + " is already taken by another mod (" + customMessages[messageCode].messageName + ").")); Logger.LogWarning((object)"Could not register code action."); return null; } CustomMessage customMessage = new CustomMessage(pluginInfo, messageCode, messageName, messageActions); customMessages.Add(messageCode, customMessage); ManualLogSource logger2 = Logger; string[] obj = new string[8] { "Registered message code number ", null, null, null, null, null, null, null }; int messageCode2 = customMessage.messageCode; obj[1] = messageCode2.ToString(); obj[2] = " for "; obj[3] = customMessage.pluginInfo.Metadata.Name; obj[4] = ". Reason: "; obj[5] = customMessage.messageName; obj[6] = ". Callback name: "; obj[7] = customMessage.messageActions.onReceiveCode.Method.Name; logger2.LogDebug((object)string.Concat(obj)); return customMessage; } public static bool UnregisterCustomMessage(PluginInfo pluginInfo, ushort messageCode) { if (customMessages.ContainsKey(messageCode)) { if (pluginInfo.Metadata.GUID == customMessages[messageCode].pluginInfo.Metadata.GUID) { customMessages.Remove(messageCode); Logger.LogDebug((object)("Removed code number " + messageCode)); return true; } Logger.LogWarning((object)"Tried to unregister a code with the wrong plugin info. Ignoring."); } else { Logger.LogWarning((object)("No message code number " + messageCode + " previously registered")); } return false; } public static CustomMessage SubscribeToVanillaMessage(PluginInfo pluginInfo, Msg messageCode, string messageName, Action onReceiveMessageCallback) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return SubscribeToVanillaMessage(pluginInfo, messageCode, messageName, new MessageActions(onReceiveMessageCallback)); } public static CustomMessage SubscribeToVanillaMessage(PluginInfo pluginInfo, Msg messageCode, string messageName, MessageActions messageActions) { //IL_0005: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (!vanillaSubscriptions.ContainsKey((byte)messageCode)) { vanillaSubscriptions[(byte)messageCode] = new List(); } CustomMessage customMessage = new CustomMessage(pluginInfo, (byte)messageCode, messageName, messageActions); vanillaSubscriptions[(byte)messageCode].Add(customMessage); ManualLogSource logger = Logger; string[] obj = new string[8] { "Registered message code number ", null, null, null, null, null, null, null }; int messageCode2 = customMessage.messageCode; obj[1] = messageCode2.ToString(); obj[2] = " for "; obj[3] = customMessage.pluginInfo.Metadata.Name; obj[4] = ". Reason: "; obj[5] = customMessage.messageName; obj[6] = ". Callback name: "; obj[7] = customMessage.messageActions.onReceiveCode.Method.Name; logger.LogDebug((object)string.Concat(obj)); return customMessage; } public static bool UnsubscribeToVanillaMessage(PluginInfo pluginInfo, Msg messageCode, CustomMessage customMessage) { //IL_0005: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (vanillaSubscriptions.ContainsKey((byte)messageCode)) { int num = vanillaSubscriptions[(byte)messageCode].IndexOf(customMessage); if (num == -1) { Logger.LogWarning((object)("No custom message matching " + customMessage?.ToString() + " previously registered")); return false; } if (vanillaSubscriptions[(byte)messageCode][num].pluginInfo.Metadata.GUID == pluginInfo.Metadata.GUID) { customMessages.Remove((byte)messageCode); Logger.LogDebug((object)("Removed code number " + ((object)(Msg)(ref messageCode)).ToString())); return true; } Logger.LogWarning((object)"Tried to unregister a code with the wrong plugin info. Ignoring."); } else { Logger.LogWarning((object)("No message code number " + ((object)(Msg)(ref messageCode)).ToString() + " previously registered")); } return false; } } public class MessageEventArgs : EventArgs { public Message Message { get; private set; } public MessageEventArgs(Message message) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Message = message; } } } namespace LLBML.Players { public class Team : EnumWrapper { public enum Enum { RED, BLUE, YELLOW, GREEN, NONE } public enum Enum_Mappings { RED, BLUE, YELLOW, GREEN, NONE } public static readonly Team RED = Enum.RED; public static readonly Team BLUE = Enum.BLUE; public static readonly Team YELLOW = Enum.YELLOW; public static readonly Team GREEN = Enum.GREEN; public static readonly Team NONE = Enum.NONE; private Team(int id) : base(id) { } private Team(BGHNEHPFHGC team) : base((int)team) { }//IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected I4, but got Unknown public override string ToString() { return ((Enum)id).ToString(); } public static implicit operator BGHNEHPFHGC(Team ew) { return (BGHNEHPFHGC)ew.id; } public static implicit operator Team(int id) { return new Team(id); } public static implicit operator Enum(Team ew) { return (Enum)ew.id; } public static implicit operator Team(Enum val) { return new Team((int)val); } public static implicit operator Team(BGHNEHPFHGC val) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return new Team(val); } } public class Player { private readonly ALDOKEMAOMB _player; public Character Character { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _player.JPMBNEEFOJH(); } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _player.IJOLFCPOMJM(value); } } public CharacterVariant CharacterVariant { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return variant; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) variant = value; } } public Character CharacterSelected { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _player.CMLGLEHDOCN(); } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _player.CGNNOILEBDK(value); } } public bool CharacterSelectedIsRandom => _player.DELMJMNAENA(); public bool IsSpectator => _player.JOBHLLMCMID(); public bool IsLocalPeer => _player.GAFCIHKIGNM; public bool IsAI { get { return _player.GDFJKGJCICD(); } set { _player.ALKDJNJJBOP(value); } } public bool IsInMatch => _player.LAADACKBGLL(); public bool IsDisconnected => _player.JFHOEPFONPN(); public bool DidJoinedMatch => _player.JMHDJKAIMII(); public Team Team { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _player.FNHEBKCIFMJ(); } set { //IL_0007: Unknown result type (might be due to invalid IL or missing references) _player.MCKMFHILKIP((BGHNEHPFHGC)value); } } public int nr { get { return _player.CJFLMDNNMIE; } set { _player.CJFLMDNNMIE = value; } } public string name { get { return _player.COPBANHBAEE; } set { _player.COPBANHBAEE = value; } } public CharacterVariant variant { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _player.AIINAIDBHJI; } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) _player.AIINAIDBHJI = value; } } public Controller controller { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _player.GDEMBCKIDMA; } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) _player.GDEMBCKIDMA = value; } } public LLCursor cursor { get { return _player.OBELDJGOOIJ; } set { _player.OBELDJGOOIJ = value; } } public PlayerEntity playerEntity { get { return _player.JCCIAMJEODH; } set { _player.JCCIAMJEODH = value; } } public bool isLocal { get { return _player.GAFCIHKIGNM; } set { _player.GAFCIHKIGNM = value; } } public string ip { get { return _player.LGKJGGMLNFL; } set { _player.LGKJGGMLNFL = value; } } public int port { get { return _player.MIHNOINHDJN; } set { _player.MIHNOINHDJN = value; } } public Peer peer { get { return _player.KLEEADMGHNE; } set { _player.KLEEADMGHNE = value; } } public int cpuSelecting { get { return _player.OLNANNOFOJO; } set { _player.OLNANNOFOJO = value; } } public bool ready { get { return _player.GFCMODHPPCN; } set { _player.GFCMODHPPCN = value; } } public bool selected { get { return _player.CHNGAKOIJFE; } set { _player.CHNGAKOIJFE = value; } } public int aiLevel { get { return _player.INPJBIFEPMB; } set { _player.INPJBIFEPMB = value; } } public PlayerStatus playerStatus { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _player.LIPOCPBOHBP; } set { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) _player.LIPOCPBOHBP = value; } } public static int nPlayersJoinedMatch { get { return ALDOKEMAOMB.OBIEGJGBIDO; } set { ALDOKEMAOMB.OBIEGJGBIDO = value; } } public static int nPlayersInMatch { get { return ALDOKEMAOMB.HKOHPDFPMBK; } set { ALDOKEMAOMB.HKOHPDFPMBK = value; } } public static int MAX_PLAYERS => 4; public static int LocalPlayerNumber => ((Peer)(P2P.localPeer?)).playerNr ?? 0; public Player(ALDOKEMAOMB p) { _player = p; } public override bool Equals(object obj) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if (obj is ALDOKEMAOMB || obj is Player) { return object.Equals((object?)(ALDOKEMAOMB)obj, (ALDOKEMAOMB)this); } return false; } public override int GetHashCode() { return ((object)_player).GetHashCode(); } public override string ToString() { return $"P{nr} ({playerStatus})"; } public static implicit operator ALDOKEMAOMB(Player p) { return p._player; } public static implicit operator Player(ALDOKEMAOMB p) { return new Player(p); } public void JoinMatch(bool join) { _player.EKNFACPOJCM(join); } public void LeaveMatch() { _player.GBMGMFIBFGA(); } public void SetSpectator() { _player.OKDEILOGKFB(); } public void Reset() { _player.FMCGJNPNIPH(); } public void ResetName() { _player.IOCOPIHGLCK(); } public void SetCursorActive(bool active, float relX = -1f, float relY = -1f) { _player.PGIPMONCFAG(active, relX, relY); } public void UpdateLight() { _player.CFJBBPGANNF(); } public void ResetTeam(GameMode gameMode, bool changeAnyway) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _player.MLFHMGNCMNA(gameMode, changeAnyway); } public Team GetNextTeam(GameMode gameMode, int prevNext = 1) { //IL_0006: 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) return _player.EICBBKLGNBF(gameMode, prevNext); } public void CheckCheats(Character character) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _player.OKNJLPBPDGC(character); } public bool BiggerHeadActivated(Character character) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _player.ODEGEFBNONJ(character); } public bool SmallerHeadActivated(Character character) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _player.PJLGLGEHJNN(character); } public Character GetRandomCharacter(bool any) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return _player.HGPNPNPJBMK(any); } public Character GetRandomCharacter(Character[] skipCharacters = null) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return _player.HGPNPNPJBMK(skipCharacters); } public CharacterVariant GetVariantFirst() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _player.DIGHIEBNDPE(); } public CharacterVariant GetVariantFirst(Character forCharacter) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return _player.DIGHIEBNDPE(forCharacter); } public CharacterVariant GetVariantNext(int prevNext = 1) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return _player.MKDAGHDAMML(prevNext); } public CharacterVariant GetVariantRandom(bool any = false) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return _player.GLCHOPBLHEB(any); } public CharacterVariant GetVariantFixed() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _player.HCFKKMIPDIN(); } public void DetermineCharacter(Character[] skipCharacters = null) { _player.CHDHDGAHNPB(skipCharacters); } public void ClearDetermine() { _player.BIOONNIPAMK(); } public static void Init() { ALDOKEMAOMB.GJGPFIOMNJN(); } public static void ResetAll() { ALDOKEMAOMB.OPHACFDBPHM(); } public static IEnumerable EPlayers() { return ALDOKEMAOMB.BCLFPIDGLHE(); } public static Player GetPlayer(int playerNr) { return ALDOKEMAOMB.BJDPHEHJJJK(playerNr); } public static void ForAll(Action callback) { ALDOKEMAOMB.BCNIADLHPOH(callback); } public static void ForAll(Action callback) { ALDOKEMAOMB.BCNIADLHPOH((Action)delegate(ALDOKEMAOMB player) { callback(player); }); } public static void ForAllInMatch(Action callback) { ALDOKEMAOMB.ICOCPAFKCCE(callback); } public static void ForAllInMatch(Action callback) { ALDOKEMAOMB.ICOCPAFKCCE((Action)delegate(ALDOKEMAOMB player) { callback(player); }); } public static void ForAllInMatch(Action callback) { ALDOKEMAOMB.ICOCPAFKCCE(callback); } public static void ForAllInTeam(Team team, Action callback) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ALDOKEMAOMB.KPKPNDCBBOC((BGHNEHPFHGC)team, callback); } public static void UpdateLights() { ALDOKEMAOMB.ONMJIMANMKI(); } public static string GetRandomName() { return ALDOKEMAOMB.FAFALGPJHIA(); } public static List GetPlayerList() { List list = new List(); foreach (ALDOKEMAOMB item2 in EPlayers()) { Player item = item2; list.Add(item); } return list; } public static Player GetLocalPlayer() { int localPlayerNumber = LocalPlayerNumber; if (localPlayerNumber < 0 || localPlayerNumber > 3) { LLBMLPlugin.Log.LogWarning((object)("Requested Local Player but local player number was: " + localPlayerNumber)); return null; } Player player = ALDOKEMAOMB.BJDPHEHJJJK(localPlayerNumber); if (player == null) { LLBMLPlugin.Log.LogWarning((object)"Requested Local Player is null"); } return player; } public static void ForAllActivelyInMatch(Action callback) { ForAllInMatch(delegate(Player player) { if (((Entity)player.playerEntity).IsActivelyInMatch()) { callback(player); } }); } public static void ForAllActivelyInMatch(Action callback) { ForAllInMatch(delegate(PlayerEntity playerEntity) { if (((Entity)playerEntity).IsActivelyInMatch()) { callback(playerEntity); } }); } } public class PlayerStatus : EnumWrapper { public enum Enum { NONE, IN_MATCH, DISCONNECTED, SPECTATOR } public enum Enum_Mappings { NONE, IN_MATCH, DISCONNECTED, SPECTATOR } public static readonly PlayerStatus NONE = Enum.NONE; public static readonly PlayerStatus IN_MATCH = Enum.IN_MATCH; public static readonly PlayerStatus DISCONNECTED = Enum.DISCONNECTED; public static readonly PlayerStatus SPECTATOR = Enum.SPECTATOR; private PlayerStatus(int id) : base(id) { } private PlayerStatus(AKNMBDLMNJM team) : base((int)team) { }//IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected I4, but got Unknown public override string ToString() { return ((Enum)id).ToString(); } public static implicit operator AKNMBDLMNJM(PlayerStatus ew) { return (AKNMBDLMNJM)ew.id; } public static implicit operator PlayerStatus(int id) { return new PlayerStatus(id); } public static implicit operator Enum(PlayerStatus ew) { return (Enum)ew.id; } public static implicit operator PlayerStatus(Enum val) { return new PlayerStatus((int)val); } public static implicit operator PlayerStatus(AKNMBDLMNJM val) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return new PlayerStatus(val); } } } namespace LLBML.Audio { public class AudioCache : GenericCache { private int runningLoadingCoroutines; private const string audioLogPrefix = "[Audio]: "; public bool IsLoading => runningLoadingCoroutines > 0; public void LoadClip(string key, string filePath, string clipName = null) { LoadClip(filePath, new FileInfo(filePath), clipName); } public void LoadClip(string key, FileInfo file, string clipName = null) { LoadClip(key, AudioInfo.GetAudioInfo(file, clipName)); } public void LoadClip(string key, AudioInfo audioInfo) { ((MonoBehaviour)LLBMLPlugin.Instance).StartCoroutine(CLoadClip(key, audioInfo)); } public IEnumerator CLoadClip(string key, AudioInfo audioInfo) { runningLoadingCoroutines++; string clipName = audioInfo.clipNameHint ?? key; UnityWebRequest uwr = UnityWebRequestMultimedia.GetAudioClip(Utility.ConvertToWWWFormat(audioInfo.file.FullName), audioInfo.type); try { UnityWebRequestAsyncOperation val; try { val = uwr.SendWebRequest(); } catch (Exception ex) { GenericCache.Logger.LogError((object)"Exception caught: "); GenericCache.Logger.LogError((object)ex); yield break; } yield return val; while (!uwr.isDone) { yield return null; } AudioClip content; try { content = DownloadHandlerAudioClip.GetContent(uwr); } catch (Exception ex2) { GenericCache.Logger.LogError((object)("[Audio]: Failed trying to retrieve the AudioClip from UWR.\nPath: " + audioInfo.file.FullName + " .\n" + $"File type: {audioInfo.type} .\n" + $"Gathered Loop data : {audioInfo.loopData} .\n" + "Exception: " + ex2)); GenericCache.Logger.LogError((object)("[Audio]: " + ex2)); yield break; } if ((Object)(object)content == (Object)null) { GenericCache.Logger.LogError((object)("[Audio]: Audioclip " + key + " was null")); } else { ((Object)content).name = clipName; ((GenericCache)this).Add(key, new AudioAsset(content, audioInfo)); } } finally { ((IDisposable)uwr)?.Dispose(); } runningLoadingCoroutines--; } public void Add(string key, AudioClip audioClip) { base.Add(key, new AudioAsset(audioClip)); } public override void Add(string key, AudioAsset audioAsset) { base.Add(key, audioAsset); } public List GetClips(string key) { return cache[key].ConvertAll((AudioAsset audioAsset) => audioAsset.audioClip); } public AudioClip GetClip(string key) { return GetClips(key)[0]; } public List GetAssets(string key) { return cache[key]; } public AudioAsset GetAsset(string key) { return GetAssets(key)[0]; } } public static class AudioUtils { private static readonly ManualLogSource Logger = LLBMLPlugin.Log; private const string audioLogPrefix = "[Audio]: "; public static AudioAsset GetAssetSynchronously(string musicFilePath) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) Logger.LogInfo((object)("[Audio]: Urgent File Load: " + musicFilePath)); AudioInfo audioInfo = AudioInfo.GetAudioInfo(musicFilePath); UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(Utility.ConvertToWWWFormat(audioInfo.file.FullName), audioInfo.type); try { try { audioClip.SendWebRequest(); } catch (Exception ex) { Logger.LogError((object)"[Audio]: MusicHax: Exception caught: "); Logger.LogError((object)("[Audio]: " + ex)); } while (!audioClip.isDone) { Thread.Sleep(20); } AudioClip content = DownloadHandlerAudioClip.GetContent(audioClip); if (!((Object)(object)content == (Object)null)) { ((Object)content).name = audioInfo.clipNameHint; return new AudioAsset(content, audioInfo); } Logger.LogError((object)("[Audio]: Audioclip " + musicFilePath + " was null")); } finally { ((IDisposable)audioClip)?.Dispose(); } return null; } public static AudioClip GetClipSynchronously(string musicFilePath) { return GetAssetSynchronously(musicFilePath).audioClip; } public static List GetAudioInfos(DirectoryInfo dir) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) List list = new List(); FileInfo[] files = dir.GetFiles(); for (int i = 0; i < files.Length; i++) { AudioInfo audioInfo = AudioInfo.GetAudioInfo(files[i]); if ((int)audioInfo.type != 0) { list.Add(audioInfo); } } return list; } } public struct AudioInfo { private static readonly ManualLogSource Logger = LLBMLPlugin.Log; private const string audioLogPrefix = "[Audio]: "; public FileInfo file; public AudioType type; public string clipNameHint; public float volume; public Vector2 loopData; public AudioInfo(FileInfo fileInfo = null, AudioType audioType = 0, string clipNameHint = null, float volume = 1f, Vector2 loopData = default(Vector2)) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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) file = fileInfo; type = audioType; this.clipNameHint = clipNameHint; this.volume = volume; this.loopData = loopData; } public static AudioInfo GetAudioInfo(FileInfo file, string clipNameHint = null) { //IL_0001: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) AudioType audioType = (AudioType)0; switch (file.Extension.ToLower()) { case ".ogg": audioType = (AudioType)14; break; case ".wav": audioType = (AudioType)20; break; case ".mp3": audioType = (AudioType)13; break; case ".aif": audioType = (AudioType)2; break; default: Logger.LogWarning((object)("[Audio]: Unsupported audio file encountered: " + file.FullName)); break; } string[] array = Path.GetFileNameWithoutExtension(file.FullName).Split(new char[1] { ':' }); clipNameHint = clipNameHint ?? array[0]; float num = 1f; if (array.Length >= 2) { Logger.LogDebug((object)("[Audio]: Volume data parsed as: " + array[0] + " # " + array[1])); try { num = float.Parse(array[1]); } catch (Exception ex) { Logger.LogWarning((object)("[Audio]: Exception caught trying to parse volume from " + file.FullName + ", defaulting to default volume\n" + ex.Message)); } } Vector2 val = default(Vector2); if (array.Length >= 4) { Logger.LogDebug((object)("[Audio]: Loop data parsed as: " + array[0] + " # " + array[2] + " # " + array[3])); try { val = new Vector2(float.Parse(array[2]), float.Parse(array[3])); } catch (Exception ex2) { Logger.LogWarning((object)("[Audio]: Exception caught trying to parse loopdata from " + file.FullName + ", defaulting to default loopdata\n" + ex2.Message)); } } return new AudioInfo(file, audioType, clipNameHint, num, val); } public static AudioInfo GetAudioInfo(string filePath, string clipNameHint = null) { return GetAudioInfo(new FileInfo(filePath), clipNameHint); } } public class AudioAsset { public AudioClip audioClip; public AudioInfo audioInfo; public AudioAsset(AudioClip audioClip, AudioInfo audioInfo = default(AudioInfo)) { this.audioClip = audioClip; this.audioInfo = audioInfo; } public override string ToString() { return ((Object)audioClip).name; } } } namespace LLBML.Utils { public static class OSUtils { public static bool IsLinux() { int platform = (int)Environment.OSVersion.Platform; if (platform != 4 && platform != 6) { return platform == 128; } return true; } } public static class StringUtils { public static Dictionary characterNames = new Dictionary { [(Character)0] = "Raptor", [(Character)1] = "Switch", [(Character)2] = "Candyman", [(Character)8] = "Grid", [(Character)3] = "Sonata", [(Character)4] = "Latch", [(Character)5] = "Dice", [(Character)6] = "Doombox", [(Character)7] = "Nitro", [(Character)9] = "Jet", [(Character)10] = "Toxic", [(Character)11] = "Dust&Ashes" }; public static Dictionary regularStagesNames = new Dictionary { [(Stage)3] = "Outskirts", [(Stage)4] = "Sewers", [(Stage)5] = "Desert", [(Stage)6] = "Elevator", [(Stage)7] = "Factory", [(Stage)8] = "Subway", [(Stage)9] = "Stadium", [(Stage)10] = "Streets", [(Stage)11] = "Pool", [(Stage)12] = "Room21" }; public static Dictionary retroStagesNames = new Dictionary { [(Stage)20] = "Retro Outskirts", [(Stage)21] = "Retro Pool", [(Stage)22] = "Retro Sewers", [(Stage)23] = "Retro Room21", [(Stage)24] = "Retro Streets", [(Stage)25] = "Retro Train", [(Stage)26] = "Retro Factory" }; [Obsolete("Utils.StringUtils.GetCharacterByName() is deprecated, please use CharacterApi.GetCharacterByName() instead.")] public static Character GetCharacterByName(string characterName) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return CharacterApi.GetCharacterByName(characterName); } [Obsolete("Utils.StringUtils.TheWitcherGetCharacterByName() is deprecated, please use CharacterApi.TheWitcherGetCharacterByName() instead.")] public static Character TheWitcherGetCharacterByName(string characterName) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return CharacterApi.TheWitcherGetCharacterByName(characterName); } public static string GetCharacterSafeName(Character character) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 string text = characterNames[character]; if ((int)character == 11) { text.Replace('&', 'N'); } return text; } public static string GetStageReadableName(Stage stage) { //IL_0000: 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_000d: Unknown result type (might be due to invalid IL or missing references) if (StageHandler.Is2D(stage)) { return retroStagesNames[stage]; } return regularStagesNames[stage]; } public static string ByteToString(byte input) { return Convert.ToString(input, 2).PadLeft(8, '0'); } public static string[] BytesToStrings(byte[] input) { return input.Select(ByteToString).ToArray(); } public static string BytesToHexString(byte[] input) { return BitConverter.ToString(input).Replace("-", ""); } public static string PrettyPrintBytes(byte[] input) { return string.Join(" ", BytesToStrings(input)); } } public static class GenericUtils { public static IEnumerable GetEnumValues() where T : new() { T valueType = new T(); return (from fieldInfo in typeof(T).GetFields() select (T)fieldInfo.GetValue(valueType)).Distinct(); } } public static class ArrayExtension { public static T[] Add(this T[] target, params T[] items) { if (target == null) { target = new T[0]; } if (items == null) { items = new T[0]; } T[] array = new T[target.Length + items.Length]; target.CopyTo(array, 0); items.CopyTo(array, target.Length); return array; } public static void Fill(this T[] originalArray, T with) { for (int i = 0; i < originalArray.Length; i++) { originalArray[i] = with; } } } public static class LinqExtensions { public static IEnumerable Map(this IEnumerable self, Func selector) { return self.Select(selector); } public static T Reduce(this IEnumerable self, Func func) { return self.Aggregate(func); } public static IEnumerable Filter(this IEnumerable self, Func predicate) { return self.Where(predicate); } } public static class Texture2DExtension { public static Color GetRelativePixel(this Texture2D texture, int x, int y, int originalWidth = 512, int originalHeight = 512) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) return texture.GetRelativePixel(new Vector2((float)x, (float)y), new Vector2((float)originalWidth, (float)originalHeight)); } public static Color GetRelativePixel(this Texture2D texture, Vector2 coords, Vector2 orginalSize) { //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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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: 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) Vector2 val = new Vector2((float)((Texture)texture).width, (float)((Texture)texture).height) * coords / orginalSize; return texture.GetPixel((int)val.x, (int)val.y); } } public static class ModDependenciesUtils { private static readonly ManualLogSource Logger = LLBMLPlugin.Log; public static string ModMenuGUID = "no.mrgentle.plugins.llb.modmenu"; private static BaseUnityPlugin modmenuInstance = null; private static MethodInfo registerModMethod = null; private static MethodInfo inModOptionsMethod = null; private static bool lockLoadedState = false; private static bool isModMenuLoaded = false; public static bool IsModPresent(string modGUID) { return Chainloader.PluginInfos.ContainsKey(modGUID); } public static bool IsModLoaded(string modGUID) { if (IsModPresent(modGUID)) { PluginInfo obj = Chainloader.PluginInfos[modGUID]; if ((Object)(object)((obj != null) ? obj.Instance : null) != (Object)null) { return true; } } return false; } private static bool IsModMenuLoaded() { if (lockLoadedState) { return isModMenuLoaded; } isModMenuLoaded = false; if ((Object)(object)modmenuInstance != (Object)null) { isModMenuLoaded = true; } else if (IsModLoaded(ModMenuGUID)) { modmenuInstance = Chainloader.PluginInfos[ModMenuGUID].Instance; registerModMethod = AccessTools.Method(((object)modmenuInstance).GetType(), "RegisterMod", new Type[2] { typeof(PluginInfo), typeof(List) }, (Type[])null); inModOptionsMethod = AccessTools.Method(((object)modmenuInstance).GetType(), "InModOptions", new Type[0], (Type[])null); isModMenuLoaded = true; } if (LLBMLPlugin.StartReached) { lockLoadedState = true; } return isModMenuLoaded; } public static void RegisterToModMenu(PluginInfo pluginInfo, List modmenuText = null) { string name = pluginInfo.Metadata.Name; if (IsModMenuLoaded()) { try { registerModMethod.Invoke(modmenuInstance, new object[2] { pluginInfo, modmenuText }); Logger.LogDebug((object)("Registered " + name + " to ModMenu.")); return; } catch (Exception ex) { Logger.LogWarning((object)("Caught exception: " + ex.Message)); Logger.LogWarning((object)"ModMenu should be loaded, but RegisterToModMenu threw."); Logger.LogWarning((object)("Aborting Registration for " + name + ".")); return; } } Logger.LogWarning((object)("ModMenu is not loaded. " + name + " can't register.")); } public static bool InModOptions() { if (IsModMenuLoaded()) { try { return (bool)inModOptionsMethod.Invoke(modmenuInstance, new object[0]); } catch (Exception ex) { Logger.LogWarning((object)("Caught exception: " + ex.Message)); Logger.LogWarning((object)"ModMenu should be loaded, but InModOptions threw."); } } return false; } } public static class ModdingFolder { private static readonly ManualLogSource Logger = LLBMLPlugin.Log; private static ConfigEntry moddingFolderPath; private static ConfigEntry doneTutorial; private static string DefaultModdingFolderPath => Path.Combine(Paths.GameRootPath, "ModdingFolder"); internal static void InitConfig(ConfigFile config) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown moddingFolderPath = config.Bind("ModdingFolder", "ModdingFolderPath", DefaultModdingFolderPath, new ConfigDescription("The path of the folder that will be used to store mod's user provided information.", (AcceptableValueBase)null, new object[1] { "modmenu_directorypicker" })); doneTutorial = config.Bind("ModdingFolder", "DoneTutorial", false, new ConfigDescription("Whether or not the user was guided on using the modding folder.", (AcceptableValueBase)null, new object[1] { "modmenu_hidden" })); if (moddingFolderPath.Value.Contains("steamapps")) { moddingFolderPath.Value = DefaultModdingFolderPath; } Directory.CreateDirectory(moddingFolderPath.Value); } private static IEnumerator StartTutorial() { yield return (object)new WaitForSeconds(0.1f); int doTutorial = -1; Dialogs.OpenConfirmationDialog("Modding Folder", "Looks like you didn't set your modding folder yet!\nWould you like to set it now? =)", delegate { doTutorial = 1; }, delegate { doTutorial = 0; }); yield return (object)new WaitWhile((Func)(() => doTutorial == -1)); if (doTutorial == 0) { doneTutorial.Value = true; yield break; } GameStates.Send((Msg)13, -1, -1); yield return (object)new WaitForSeconds(0.1f); bool oked = false; Dialogs.OpenDialog("Modding Folder", "Go into 'mod settings', then LLBModdingLib.\nYou can then use the browse button to select a new folder.", "Ok", delegate { oked = true; }); yield return (object)new WaitWhile((Func)(() => oked)); doneTutorial.Value = true; } public static DirectoryInfo GetModSubFolder(PluginInfo modInfo) { return GetModdingFolder().CreateSubdirectory(modInfo.Metadata.Name); } public static DirectoryInfo GetModdingFolder() { DirectoryInfo directoryInfo = new DirectoryInfo(moddingFolderPath.Value); if (!directoryInfo.Exists) { if (!(moddingFolderPath.Value == DefaultModdingFolderPath)) { Logger.LogError((object)("[ModdingFolder] Invalid path: " + directoryInfo.FullName)); return null; } directoryInfo.Create(); } return directoryInfo; } } public static class DebugUtils { public static string DecisionsToString(int[] decisions) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) string text = "\n"; int num = 0; string[] obj = new string[5] { text, num.ToString(), ":\tStage:\t\t", null, null }; Stage val = (Stage)decisions[num++]; obj[3] = ((object)(Stage)(ref val)).ToString(); obj[4] = "\n"; text = string.Concat(obj); text = text + num + ":\tInputDelay:\t" + decisions[num++] + "\n"; text = text + num + ":\tSeed:\t\t" + decisions[num++] + "\n"; for (int i = 0; i < 4; i++) { string[] obj2 = new string[7] { text, num.ToString(), ":\tP", i.ToString(), " CharSel\t", null, null }; Character val2 = (Character)decisions[num++]; obj2[5] = ((object)(Character)(ref val2)).ToString(); obj2[6] = "\n"; text = string.Concat(obj2); string[] obj3 = new string[7] { text, num.ToString(), ":\tP", i.ToString(), " Char\t\t", null, null }; val2 = (Character)decisions[num++]; obj3[5] = ((object)(Character)(ref val2)).ToString(); obj3[6] = "\n"; text = string.Concat(obj3); string[] obj4 = new string[7] { text, num.ToString(), ":\tP", i.ToString(), " Variant\t", null, null }; CharacterVariant val3 = (CharacterVariant)decisions[num++]; obj4[5] = ((object)(CharacterVariant)(ref val3)).ToString(); obj4[6] = "\n"; text = string.Concat(obj4); text = text + num + ":\tP" + i + " Team\t\t" + ((Team)decisions[num++])?.ToString() + "\n"; text = text + num + ":\tP" + i + " IsSpec\t" + (decisions[num++] == 1) + "\n"; } for (int j = 0; j < HPNLMFHPHFD.ELPLKHOLJID.GEMMKJGHPPP(); j++) { string[] obj5 = new string[7] { text, num.ToString(), ":\t", null, null, null, null }; GameSetting val4 = (GameSetting)j; obj5[3] = ((object)(GameSetting)(ref val4)).ToString(); obj5[4] = ": "; obj5[5] = decisions[num++].ToString(); obj5[6] = "\n"; text = string.Concat(obj5); } if (num < decisions.Length) { for (int k = 0; k < 4; k++) { int num2 = decisions[num++]; bool flag = num2 != -1; text = text + num + ":\tP" + k + " IsAI\t\t" + flag; text = text + (flag ? ("\tAILevel\t" + num2) : "") + "\n"; } } return text; } public static void PrintStacktrace() { LLBMLPlugin.Log.LogDebug((object)("---------------------------- Stacktrace: \n" + new StackTrace())); } } public abstract class GenericCache { protected Dictionary> cache = new Dictionary>(); protected static ManualLogSource Logger => LLBMLPlugin.Log; public int Count => cache.Count; public virtual List this[K key] => GetEntries(key); public virtual void Clear() { cache.Clear(); } public virtual bool ContainsKey(K key) { return cache.ContainsKey(key); } public virtual void Add(K key, T value) { if (!cache.ContainsKey(key)) { cache.Add(key, new List()); } if (!cache[key].Contains(value)) { cache[key].Add(value); } } protected virtual List GetEntries(K key) { if (cache.ContainsKey(key)) { return cache[key]; } K val = key; throw new KeyNotFoundException("No asset list with the specified key: " + val); } protected virtual T GetEntry(K key) { return GetEntries(key)[0]; } public override string ToString() { string text = "[\n"; foreach (K key in cache.Keys) { string text2 = text; K val = key; text = text2 + "key: " + val?.ToString() + "\n"; foreach (T item in cache[key]) { string text3 = text; T val2 = item; text = text3 + " - " + val2?.ToString() + "\n"; } text += "---------\n"; } return text + "]"; } } public interface IByteable { byte[] ToBytes(); } public abstract class Hash : IEquatable { protected static int HashLength = 16; public byte[] Bytes { get; protected set; } public Hash() { Bytes = new byte[HashLength]; Bytes.Initialize(); } protected Hash(byte[] bytes) { if (bytes.Length != HashLength) { throw new NotSupportedException(); } Bytes = bytes; } public override string ToString() { return StringUtils.BytesToHexString(Bytes); } public static explicit operator byte[](Hash a) { return a.Bytes; } public abstract bool Equals(T other); public override bool Equals(object obj) { if (obj != null && obj is Hash) { Hash other = (Hash)obj; return Equals(other); } return false; } public bool Equals(byte[] other) { return BinaryUtils.ByteArraysEqual(Bytes, other); } public bool Equals(Hash other) { return BinaryUtils.ByteArraysEqual(Bytes, other.Bytes); } public override int GetHashCode() { return Bytes.GetHashCode(); } public static bool operator ==(Hash hash1, Hash hash2) { return hash1.Equals(hash2); } public static bool operator !=(Hash hash1, Hash hash2) { return !(hash1 == hash2); } public static bool operator ==(Hash hash1, byte[] hash2) { return hash1.Equals(hash2); } public static bool operator !=(Hash hash1, byte[] hash2) { return !(hash1 == hash2); } public static bool operator ==(byte[] hash1, Hash hash2) { return hash2.Equals(hash1); } public static bool operator !=(byte[] hash1, Hash hash2) { return !(hash1 == hash2); } } public abstract class EnumWrapper where T : Enum { protected readonly int id; protected EnumWrapper(int id) { this.id = id; } public override bool Equals(object obj) { if (obj is EnumWrapper || obj is T) { return object.Equals((int)obj, (int)this); } return false; } public override int GetHashCode() { int num = id; return num.GetHashCode(); } public override string ToString() { int num = id; return num.ToString(); } public static explicit operator int(EnumWrapper ew) { return ew.id; } public static bool Equals(EnumWrapper a, EnumWrapper b) { return a.id == b.id; } public static bool operator ==(EnumWrapper a, EnumWrapper b) { return Equals(a, b); } public static bool NotEquals(EnumWrapper a, EnumWrapper b) { return !Equals(a, b); } public static bool operator !=(EnumWrapper a, EnumWrapper b) { return NotEquals(a, b); } } public static class ControlledRandom { private static uint frame { get { return FKPOFIAIEAD.IGNMBCNLHHI; } set { FKPOFIAIEAD.IGNMBCNLHHI = value; } } private static uint seed { get { return FKPOFIAIEAD.FMIIELCJDNL; } set { FKPOFIAIEAD.FMIIELCJDNL = value; } } private static uint x { get { return FKPOFIAIEAD.GCPKPHMKLBN; } set { FKPOFIAIEAD.GCPKPHMKLBN = value; } } private static uint y { get { return FKPOFIAIEAD.CGJJEHPPOAN; } set { FKPOFIAIEAD.CGJJEHPPOAN = value; } } private static uint z { get { return FKPOFIAIEAD.KEEABMIGLLF; } set { FKPOFIAIEAD.KEEABMIGLLF = value; } } private static uint w { get { return FKPOFIAIEAD.HNAKLBBGADM; } set { FKPOFIAIEAD.HNAKLBBGADM = value; } } private static int filled { get { return FKPOFIAIEAD.GKMBAELHGJP; } set { FKPOFIAIEAD.GKMBAELHGJP = value; } } private static int iresolution { get { return FKPOFIAIEAD.FHIHEECJJNN; } set { FKPOFIAIEAD.FHIHEECJJNN = value; } } private static Floatf fresolution => FKPOFIAIEAD.NPINAIIJPDP; private static Floatf[] prefilled => FKPOFIAIEAD.HLHHJDFBOHE.Cast().ToArray(); public static void SetFrame(int frame) { FKPOFIAIEAD.BLHAAJFDOOB(frame); } public static void SetSeed(uint seed) { FKPOFIAIEAD.GKFENAHMMBI(seed); } private static void Reset() { FKPOFIAIEAD.FMCGJNPNIPH(); } private static Floatf GetNext() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return FKPOFIAIEAD.POFICLEECNH(); } public static Floatf GetF(int index) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return FKPOFIAIEAD.MEFPGLFENLM(index); } public static Floatf GetF(int index, Floatf min, Floatf max) { //IL_0002: 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_000d: Unknown result type (might be due to invalid IL or missing references) return FKPOFIAIEAD.MEFPGLFENLM(index, (HHBCPNCDNDH)min, (HHBCPNCDNDH)max); } public static int Get(int index, int min, int max) { return FKPOFIAIEAD.BJDPHEHJJJK(index, min, max); } public static string GetState() { return FKPOFIAIEAD.IANMMGNADPE(); } } [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] public class BepInRef : Attribute { private static readonly ManualLogSource Logger = LLBMLPlugin.Log; private static readonly Dictionary hexmap = new Dictionary { ['c'] = '0', ['d'] = '1', ['e'] = '2', ['f'] = '3', ['0'] = '4', ['1'] = '5', ['2'] = '6', ['3'] = '7', ['4'] = '8', ['5'] = '9', ['6'] = 'a', ['7'] = 'b', ['8'] = 'c', ['9'] = 'd', ['a'] = 'e', ['b'] = 'f' }; internal static void RefCheck() { foreach (KeyValuePair pluginInfo in Chainloader.PluginInfos) { PluginInfo value = pluginInfo.Value; BepInRef[] array = (BepInRef[])((value == null) ? null : ((object)value.Instance)?.GetType().GetCustomAttributes(typeof(BepInRef), inherit: true)); if (array == null || array.Length == 0) { continue; } string path = Path.Combine(Path.GetDirectoryName(value.Location), "cksm"); if (File.Exists(path)) { char[] array2 = File.ReadAllText(path).TrimEnd(new char[1] { '\n' }).ToCharArray(); for (int i = 0; i < array2.Length; i++) { array2[i] = hexmap[array2[i]]; } string text = new string(array2); using FileStream inputStream = File.OpenRead(value.Location); using MD5 mD = MD5.Create(); string text2 = BitConverter.ToString(mD.ComputeHash(inputStream)).Replace("-", "").ToLowerInvariant(); if (text == text2) { break; } } Object.Destroy((Object)(object)value.Instance); } } } public static class PatchUtils { public static void LogInstructions(IEnumerable instructions, int from = 0, int to = -1, ManualLogSource logSource = null) { List list = instructions.ToList(); if (logSource == null) { logSource = LLBMLPlugin.Log; } int num = 0; if (to == -1) { to = list.Count(); } foreach (CodeInstruction item in list) { if (num >= from && num <= to) { logSource.LogDebug((object)$"{num}: {item}"); } num++; } } public static void LogInstruction(CodeInstruction ci) { LLBMLPlugin.Log.LogDebug((object)string.Format("OpCode: {0} | Operand: {1} {2}", ci.opcode, ci.operand, (ci.operand != null) ? $"-> {ci.operand.GetType()}" : "NULL")); } } } namespace LLBML.Math { public struct Floatf { private readonly HHBCPNCDNDH _floatf; public static Floatf one => HHBCPNCDNDH.GNIKMEGGCEP; public static Floatf zero => HHBCPNCDNDH.DBOMOJGKIFI; public static Floatf half => HHBCPNCDNDH.GMEDDLALMGA; public static Floatf Pi => HHBCPNCDNDH.ICMHOBBMHHF; public static Floatf Deg2Rad => HHBCPNCDNDH.OBFOGADMFFJ; public static Floatf Rad2Deg => HHBCPNCDNDH.MJLJNMIAIFK; public Floatf(HHBCPNCDNDH f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) _floatf = f; } public Floatf(decimal n) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) _floatf = DecimalToFloatf(n); } public Floatf(int i) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) _floatf = IntToFloatf(i); } public Floatf(float f) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) _floatf = FloatToFloatf(f); } public Floatf(double d) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) _floatf = DoubleToFloatf(d); } public Floatf(long l) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) _floatf = LongToFloatf(l); } public override bool Equals(object obj) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (obj is HHBCPNCDNDH || obj is Floatf) { return Equals((HHBCPNCDNDH)obj, this); } return false; } public override int GetHashCode() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) HHBCPNCDNDH floatf = _floatf; return ((object)(HHBCPNCDNDH)(ref floatf)).GetHashCode(); } public static Floatf Sqrt(Floatf f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.PGBDOLPHANE((HHBCPNCDNDH)f); } public override string ToString() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return ToDecimal(this).ToString(); } public string ToString(string format) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return ToDecimal(this).ToString(format); } public static decimal ToDecimal(HHBCPNCDNDH f) { return (decimal)((HHBCPNCDNDH)(ref f)).MGPJCFKOGBH() / 4294967296m; } public static long ToLong(HHBCPNCDNDH f) { return ((HHBCPNCDNDH)(ref f)).MGPJCFKOGBH() >> 32; } public static float ToFloat(HHBCPNCDNDH f) { return (float)((HHBCPNCDNDH)(ref f)).MGPJCFKOGBH() / 4.2949673E+09f; } public static double ToDouble(HHBCPNCDNDH f) { return (double)((HHBCPNCDNDH)(ref f)).MGPJCFKOGBH() / 4294967296.0; } public static int FloorToInt(HHBCPNCDNDH f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.HGDAIHMEFKC(f); } public static HHBCPNCDNDH DecimalToFloatf(decimal n) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.NKKIFJJEPOL(n); } public static HHBCPNCDNDH IntToFloatf(int i) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.NKKIFJJEPOL(i); } public static HHBCPNCDNDH LongToFloatf(long l) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.GEIMAIJIPKI(l); } public static HHBCPNCDNDH FloatToFloatf(float f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.GEIMAIJIPKI(f); } public static HHBCPNCDNDH DoubleToFloatf(double d) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.GEIMAIJIPKI(d); } public static implicit operator HHBCPNCDNDH(Floatf a) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return a._floatf; } public static implicit operator decimal(Floatf a) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return ToDecimal(a); } public static implicit operator long(Floatf a) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return ToLong(a); } public static implicit operator float(Floatf a) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return ToFloat(a); } public static explicit operator double(Floatf a) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return ToDouble(a); } public static implicit operator Floatf(HHBCPNCDNDH a) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return new Floatf(a); } public static implicit operator Floatf(decimal a) { return new Floatf(a); } public static implicit operator Floatf(int a) { return new Floatf(a); } public static implicit operator Floatf(long a) { return new Floatf(a); } public static implicit operator Floatf(float a) { return new Floatf(a); } public static explicit operator Floatf(double a) { return new Floatf(a); } public static Floatf operator +(Floatf a) { return a; } public static HHBCPNCDNDH Negative(HHBCPNCDNDH a) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.GANELPBAOPN(a); } public static Floatf Negative(Floatf a) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.GANELPBAOPN((HHBCPNCDNDH)a); } public static Floatf operator -(Floatf a) { return Negative(a); } public static HHBCPNCDNDH Add(HHBCPNCDNDH a, HHBCPNCDNDH b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.GAFCIOAEGKD(a, b); } public static Floatf Add(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.GAFCIOAEGKD((HHBCPNCDNDH)a, (HHBCPNCDNDH)b); } public static Floatf operator +(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return Add(a._floatf, b._floatf); } public static HHBCPNCDNDH Subtract(HHBCPNCDNDH a, HHBCPNCDNDH b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.FCKBPDNEAOG(a, b); } public static Floatf Subtract(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.FCKBPDNEAOG((HHBCPNCDNDH)a, (HHBCPNCDNDH)b); } public static Floatf operator -(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return Subtract(a._floatf, b._floatf); } public static HHBCPNCDNDH Multiply(HHBCPNCDNDH a, HHBCPNCDNDH b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.AJOCFFLIIIH(a, b); } public static Floatf Multiply(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.AJOCFFLIIIH((HHBCPNCDNDH)a, (HHBCPNCDNDH)b); } public static Floatf operator *(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return Multiply(a._floatf, b._floatf); } public static HHBCPNCDNDH Divide(HHBCPNCDNDH a, HHBCPNCDNDH b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.FCGOICMIBEA(a, b); } public static Floatf Divide(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.FCGOICMIBEA((HHBCPNCDNDH)a, (HHBCPNCDNDH)b); } public static Floatf operator /(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return Divide(a._floatf, b._floatf); } public static HHBCPNCDNDH Modulus(HHBCPNCDNDH a, HHBCPNCDNDH b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.CFIEILGNOBP(a, b); } public static Floatf Modulus(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.CFIEILGNOBP((HHBCPNCDNDH)a, (HHBCPNCDNDH)b); } public static Floatf operator %(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return Modulus(a._floatf, b._floatf); } public static bool Equals(HHBCPNCDNDH a, HHBCPNCDNDH b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.ODMJDNBPOIH(a, b); } public static bool Equals(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.ODMJDNBPOIH((HHBCPNCDNDH)a, (HHBCPNCDNDH)b); } public static bool operator ==(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return Equals(a._floatf, b._floatf); } public static bool NotEquals(HHBCPNCDNDH a, HHBCPNCDNDH b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.EAOICALCHJI(a, b); } public static bool NotEquals(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.EAOICALCHJI((HHBCPNCDNDH)a, (HHBCPNCDNDH)b); } public static bool operator !=(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return NotEquals(a._floatf, b._floatf); } public static bool GreaterThan(HHBCPNCDNDH a, HHBCPNCDNDH b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.OAHDEOGKOIM(a, b); } public static bool GreaterThan(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.OAHDEOGKOIM((HHBCPNCDNDH)a, (HHBCPNCDNDH)b); } public static bool operator >(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return GreaterThan(a._floatf, b._floatf); } public static bool LesserThan(HHBCPNCDNDH a, HHBCPNCDNDH b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.HPLPMEAOJPM(a, b); } public static bool LesserThan(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.HPLPMEAOJPM((HHBCPNCDNDH)a, (HHBCPNCDNDH)b); } public static bool operator <(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return LesserThan(a._floatf, b._floatf); } public static bool GreaterThanEquals(HHBCPNCDNDH a, HHBCPNCDNDH b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.OCDKNPDIPOB(a, b); } public static bool GreaterThanEquals(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.OCDKNPDIPOB((HHBCPNCDNDH)a, (HHBCPNCDNDH)b); } public static bool operator >=(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return GreaterThanEquals(a._floatf, b._floatf); } public static bool LesserThanEquals(HHBCPNCDNDH a, HHBCPNCDNDH b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.OILKPMKKNAK(a, b); } public static bool LesserThanEquals(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.OILKPMKKNAK((HHBCPNCDNDH)a, (HHBCPNCDNDH)b); } public static bool operator <=(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return LesserThanEquals(a._floatf, b._floatf); } public static Floatf Min(HHBCPNCDNDH a, HHBCPNCDNDH b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.ANJPNFDPHFP(a, b); } public static Floatf Min(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.ANJPNFDPHFP((HHBCPNCDNDH)a, (HHBCPNCDNDH)b); } public static Floatf Max(HHBCPNCDNDH a, HHBCPNCDNDH b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.BBGBJJELCFJ(a, b); } public static Floatf Max(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.BBGBJJELCFJ((HHBCPNCDNDH)a, (HHBCPNCDNDH)b); } public static Floatf ATan2(HHBCPNCDNDH a, HHBCPNCDNDH b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.GBGDEABPILN(a, b); } public static Floatf ATan2(Floatf a, Floatf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.GBGDEABPILN((HHBCPNCDNDH)a, (HHBCPNCDNDH)b); } public static Floatf Clamp(HHBCPNCDNDH a, HHBCPNCDNDH b, HHBCPNCDNDH c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //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) return HHBCPNCDNDH.CIIKAHFKLAF(a, b, c); } public static Floatf Clamp(Floatf a, Floatf b, Floatf c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.CIIKAHFKLAF((HHBCPNCDNDH)a, (HHBCPNCDNDH)b, (HHBCPNCDNDH)c); } public static Floatf Abs(HHBCPNCDNDH a) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.NPDCPLFLLIG(a); } public static Floatf Abs(Floatf a) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.NPDCPLFLLIG((HHBCPNCDNDH)a); } public static Floatf RawToFloatf(long l) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.PLOKECDLDCK(l); } public static HHBCPNCDNDH RawToHHBCPNCDNDH(long l) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return HHBCPNCDNDH.PLOKECDLDCK(l); } public long ToRaw() { return _floatf.OHJPAPMBBKM; } public static long HHBCPNCDNDHToRaw(HHBCPNCDNDH f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return f.OHJPAPMBBKM; } public string ToMachineString() { return ToRaw().ToString(); } public static Floatf FromMachineString(string str) { return RawToFloatf(long.Parse(str)); } public static Floatf FramesDuration60fps(int frames) { return (Floatf)frames * (Floatf)(1f / 60f) - HHBCPNCDNDH.PDKFDOPFPDO * 2m; } public static float Time60Frames(Floatf f) { return (float)f / World.DELTA_TIME; } public float ToTime60Frames() { return Time60Frames(this); } public static float PixelStandard(Floatf f) { return (float)f * 100f; } public float ToPixelStandard() { return PixelStandard(this); } public static float Pixels(Floatf f, bool convert = true) { if (!convert) { return f; } return (float)f / World.PIXEL60_SIZE; } public float ToPixels(bool convert = true) { return Pixels(this, convert); } public static float BUnits(Floatf f) { return (float)f * World.PIXEL60_SIZE * 100f; } public float ToBUnits() { return BUnits(this); } public static float Value(Floatf f, bool isPixel) { if (!isPixel) { return BUnits(f); } return PixelStandard(f); } public float ToValue(bool isPixel) { return Value(this, isPixel); } } public struct Vector2i { public int x; public int y; public static Vector2i zero => new Vector2i(0, 0); public static Vector2i one => new Vector2i(1, 1); public static Vector2i up => new Vector2i(0, 1); public static Vector2i down => new Vector2i(0, -1); public Vector2i(int _x, int _y) { x = _x; y = _y; } public static implicit operator JKMAAHELEMF(Vector2i v) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) return new JKMAAHELEMF(v.x, v.y); } public static implicit operator Vector2i(JKMAAHELEMF v) { //IL_0000: 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 new Vector2i(v.GCPKPHMKLBN, v.CGJJEHPPOAN); } public static explicit operator Vector2(Vector2i v) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) return new Vector2((float)v.x, (float)v.y); } public static explicit operator Vector2i(Vector2 v) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return new Vector2i((int)v.x, (int)v.y); } public static explicit operator Vector2i(Vector2Int v) { return new Vector2i(((Vector2Int)(ref v)).x, ((Vector2Int)(ref v)).y); } public static explicit operator Vector2Int(Vector2i v) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) return new Vector2Int(v.x, v.y); } public static bool operator ==(Vector2i v1, Vector2i v2) { if (v1.x == v2.x) { return v1.y == v2.y; } return false; } public static bool operator !=(Vector2i v1, Vector2i v2) { if (v1.x == v2.x) { return v1.y != v2.y; } return true; } public static Vector2i operator +(Vector2i v1, Vector2i v2) { return new Vector2i(v1.x + v2.x, v1.y + v2.y); } public static Vector2i operator -(Vector2i v1) { return new Vector2i(-v1.x, -v1.y); } public static Vector2i operator -(Vector2i v1, Vector2i v2) { return new Vector2i(v1.x - v2.x, v1.y - v2.y); } public static Vector2i operator *(Vector2i v, int f) { return new Vector2i(v.x * f, v.y * f); } public static Vector2i operator *(int f, Vector2i v) { return v * f; } public static Vector2i operator *(Vector2i v1, Vector2i v2) { return new Vector2i(v1.x * v2.x, v1.y * v2.y); } public override bool Equals(object obj) { Vector2i vector2i = (Vector2i)obj; if (x == vector2i.x) { return y == vector2i.y; } return false; } public override int GetHashCode() { return (17 * 23 + x.GetHashCode()) * 23 + y.GetHashCode(); } public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append('(').Append(x).Append(", ") .Append(y) .Append(')'); return stringBuilder.ToString(); } } public struct Vector2f { public Floatf x; public Floatf y; public Floatf magnitude { get { if (x > 30000m || y > 30000m || x < -(Floatf)30000m || y < -(Floatf)30000m) { return Floatf.Sqrt(x / 10000m * x + y / 10000m * y) * 100m; } return Floatf.Sqrt(x * x + y * y); } } public Floatf sqrMagnitude => x * x + y * y; public Vector2f normalized { get { Floatf floatf = magnitude; if (floatf == Floatf.zero) { return zero; } return this / floatf; } } public static Vector2f one => new Vector2f(Floatf.one, Floatf.one); public static Vector2f right => new Vector2f(Floatf.one, Floatf.zero); public static Vector2f left => new Vector2f(-Floatf.one, Floatf.zero); public static Vector2f up => new Vector2f(Floatf.zero, Floatf.one); public static Vector2f down => new Vector2f(Floatf.zero, -Floatf.one); public static Vector2f zero => default(Vector2f); public Vector2f(Floatf _x, Floatf _y) { x = _x; y = _y; } public Vector2f(int _x, int _y) { x = _x; y = _y; } public static implicit operator IBGCBLLKIHA(Vector2f v) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return new IBGCBLLKIHA((HHBCPNCDNDH)v.x, (HHBCPNCDNDH)v.y); } public static implicit operator Vector2f(IBGCBLLKIHA v) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return new Vector2f(v.GCPKPHMKLBN, v.CGJJEHPPOAN); } public static Vector2f operator +(Vector2f a, Vector2f b) { return new Vector2f(a.x + b.x, a.y + b.y); } public static Vector2f operator -(Vector2f a) { return new Vector2f(-a.x, -a.y); } public static Vector2f operator -(Vector2f a, Vector2f b) { return new Vector2f(a.x - b.x, a.y - b.y); } public static bool operator ==(Vector2f lhs, Vector2f rhs) { if (lhs.x == rhs.x) { return lhs.y == rhs.y; } return false; } public static bool operator !=(Vector2f lhs, Vector2f rhs) { if (!(lhs.x != rhs.x)) { return lhs.y != rhs.y; } return true; } public static Vector2f operator *(Floatf d, Vector2f a) { return new Vector2f(d * a.x, d * a.y); } public static Vector2f operator *(Vector2f a, Floatf d) { return new Vector2f(d * a.x, d * a.y); } public static Vector2f operator /(Vector2f a, Floatf d) { return new Vector2f(a.x / d, a.y / d); } public static explicit operator Vector2f(Vector2 v) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) return new Vector2f(v.x, v.y); } public static explicit operator Vector2f(Vector3 v) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) return new Vector2f(v.x, v.y); } public static explicit operator Vector2f(Vector2i v) { return new Vector2f(v.x, v.y); } public static explicit operator Vector2(Vector2f v) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new Vector2((float)v.x, (float)v.y); } public static explicit operator Vector3(Vector2f v) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) return new Vector3((float)v.x, (float)v.y, 0f); } public static explicit operator Vector2i(Vector2f v) { return new Vector2i(Mathf.RoundToInt((float)v.x), Mathf.RoundToInt((float)v.y)); } public override bool Equals(object obj) { if (obj is Vector2f || obj is IBGCBLLKIHA) { return Equals((Vector2f)obj); } return false; } public bool Equals(Vector2f v) { if (v.x == x) { return v.y == y; } return false; } public override int GetHashCode() { return x.GetHashCode() + y.GetHashCode(); } public override string ToString() { return "(" + x.ToString() + ", " + y.ToString() + ")"; } public string ToString(string format) { return "(" + x.ToString(format) + ", " + y.ToString(format) + ")"; } public string ToMachineString() { return x.ToMachineString() + "|" + y.ToMachineString(); } public static Vector2f FromMachineString(string str) { string[] array = str.Split(new char[1] { '|' }); return new Vector2f(Floatf.FromMachineString(array[0]), Floatf.FromMachineString(array[1])); } public static Floatf DirectionToAngle(Vector2f dir) { return (Floatf.ATan2(dir.y, -dir.x) + Floatf.Pi) * Floatf.Rad2Deg; } public Floatf ToAngle() { return DirectionToAngle(this); } } public static class BinaryUtils { public static byte[] XORFold(byte[] input, int times = 1) { if (input.Length % 2 != 0) { throw new NotImplementedException(); } int num = input.Length / 2; byte[] array = new byte[num]; for (int i = 0; i < input.Length; i++) { if (i < num) { array[i] = input[i]; } else { array[i - num] ^= input[i]; } } if (times > 1) { return XORFold(array, times - 1); } return array; } public static bool ByteArraysEqual(byte[] b1, byte[] b2) { if (b1 == b2) { return true; } if (b1 == null || b2 == null) { return false; } if (b1.Length != b2.Length) { return false; } for (int i = 0; i < b1.Length; i++) { if (b1[i] != b2[i]) { return false; } } return true; } } public struct Boundsf { private readonly JEPKNLONCHD _boundsf; public Vector2f center { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) JEPKNLONCHD boundsf = _boundsf; return ((JEPKNLONCHD)(ref boundsf)).FDMPHHEJPCH(); } } public Vector2f extents { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) JEPKNLONCHD boundsf = _boundsf; return ((JEPKNLONCHD)(ref boundsf)).HJIKCJCLPOE(); } } public Vector2f max { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) JEPKNLONCHD boundsf = _boundsf; return ((JEPKNLONCHD)(ref boundsf)).GKKKKGIFFDH(); } } public Vector2f min { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) JEPKNLONCHD boundsf = _boundsf; return ((JEPKNLONCHD)(ref boundsf)).DLIFPGENCIG(); } } public Vector2f size { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) JEPKNLONCHD boundsf = _boundsf; return ((JEPKNLONCHD)(ref boundsf)).BFODNCPCHHN(); } } public Boundsf(JEPKNLONCHD b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) _boundsf = b; } public override bool Equals(object obj) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (obj is JEPKNLONCHD || obj is Boundsf) { return object.Equals((object)(JEPKNLONCHD)obj, (JEPKNLONCHD)this); } return false; } public override int GetHashCode() { return ((object)(JEPKNLONCHD)(ref _boundsf)).GetHashCode(); } public Boundsf(Vector2f _center, Vector2f _size) { //IL_0002: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) _boundsf = new JEPKNLONCHD((IBGCBLLKIHA)_center, (IBGCBLLKIHA)_size); } public static implicit operator JEPKNLONCHD(Boundsf b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return b._boundsf; } public static implicit operator Boundsf(JEPKNLONCHD b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return new Boundsf(b); } public override string ToString() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) JEPKNLONCHD boundsf = _boundsf; return ((object)(JEPKNLONCHD)(ref boundsf)).ToString(); } public string ToString(string format) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) JEPKNLONCHD boundsf = _boundsf; return ((JEPKNLONCHD)(ref boundsf)).FIEOOJHNDNF(format); } public bool Intersects(Boundsf against) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) JEPKNLONCHD boundsf = _boundsf; return ((JEPKNLONCHD)(ref boundsf)).GJNBHIPKIFH((JEPKNLONCHD)against); } } } namespace LLBML.Settings { public class ConfigVar : EnumWrapper { public enum Enum { NONE = 0, SCREEN_SHAKE = 100, LANGUAGE = 101, SCREEN_FLICKER = 102, RUMBLE = 103, CAMERA_MOVE = 104, VOLUME_GLOBAL = 200, VOLUME_SFX = 201, VOLUME_MUSIC = 202, VOLUME_VOICE = 203, VOLUME_MUTE = 204, VSYNC = 300, FULLSCREEN = 301, MSAA = 302, SHADOWRES = 303, FIRST_TIME_PLAYING = 305, RESOLUTION_WIDTH = 306, RESOLUTION_HEIGHT = 307, RESOLUTION_RR = 308, INPUT = 400 } public enum Enum_Mappings { NONE = 0, SCREEN_SHAKE = 100, LANGUAGE = 101, SCREEN_FLICKER = 102, RUMBLE = 103, CAMERA_MOVE = 104, VOLUME_GLOBAL = 200, VOLUME_SFX = 201, VOLUME_MUSIC = 202, VOLUME_VOICE = 203, VOLUME_MUTE = 204, VSYNC = 300, FULLSCREEN = 301, MSAA = 302, SHADOWRES = 303, FIRST_TIME_PLAYING = 305, RESOLUTION_WIDTH = 306, RESOLUTION_HEIGHT = 307, RESOLUTION_RR = 308, INPUT = 400 } public static readonly ConfigVar NONE = Enum.NONE; public static readonly ConfigVar SCREEN_SHAKE = Enum.SCREEN_SHAKE; public static readonly ConfigVar LANGUAGE = Enum.LANGUAGE; public static readonly ConfigVar SCREEN_FLICKER = Enum.SCREEN_FLICKER; public static readonly ConfigVar RUMBLE = Enum.RUMBLE; public static readonly ConfigVar CAMERA_MOVE = Enum.CAMERA_MOVE; public static readonly ConfigVar VOLUME_GLOBAL = Enum.VOLUME_GLOBAL; public static readonly ConfigVar VOLUME_SFX = Enum.VOLUME_SFX; public static readonly ConfigVar VOLUME_MUSIC = Enum.VOLUME_MUSIC; public static readonly ConfigVar VOLUME_VOICE = Enum.VOLUME_VOICE; public static readonly ConfigVar VOLUME_MUTE = Enum.VOLUME_MUTE; public static readonly ConfigVar VSYNC = Enum.VSYNC; public static readonly ConfigVar FULLSCREEN = Enum.FULLSCREEN; public static readonly ConfigVar MSAA = Enum.MSAA; public static readonly ConfigVar SHADOWRES = Enum.SHADOWRES; public static readonly ConfigVar FIRST_TIME_PLAYING = Enum.FIRST_TIME_PLAYING; public static readonly ConfigVar RESOLUTION_WIDTH = Enum.RESOLUTION_WIDTH; public static readonly ConfigVar RESOLUTION_HEIGHT = Enum.RESOLUTION_HEIGHT; public static readonly ConfigVar RESOLUTION_RR = Enum.RESOLUTION_RR; public static readonly ConfigVar INPUT = Enum.INPUT; private ConfigVar(int id) : base(id) { } private ConfigVar(HNEDEAGADKO configVar) : base((int)configVar) { }//IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected I4, but got Unknown public override string ToString() { return ((Enum)id).ToString(); } public static implicit operator BGHNEHPFHGC(ConfigVar ew) { return (BGHNEHPFHGC)ew.id; } public static implicit operator ConfigVar(int id) { return new ConfigVar(id); } public static implicit operator Enum(ConfigVar ew) { return (Enum)ew.id; } public static implicit operator ConfigVar(Enum val) { return new ConfigVar((int)val); } public static implicit operator ConfigVar(HNEDEAGADKO val) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return new ConfigVar(val); } } public class GameSettings { private readonly JOMBNFKIHIC _gameSettings; public static OnlineMode OnlineMode { get { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return JOMBNFKIHIC.OIACPNLFAKK(); } set { //IL_0000: Unknown result type (might be due to invalid IL or missing references) JOMBNFKIHIC.IELBAOAAHOE(value); } } private static OnlineMode mOnlineMode { get { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return JOMBNFKIHIC.BLKKOGIFHIB; } set { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) JOMBNFKIHIC.BLKKOGIFHIB = value; } } public static bool IsOnline => JOMBNFKIHIC.DGGHBHPEGNK(); public static GameSettings current { get { return JOMBNFKIHIC.GIGAKBJGFDI; } set { JOMBNFKIHIC.GIGAKBJGFDI = value; } } public static bool isChallenge { get { return JOMBNFKIHIC.ALEJJFPNIDP; } set { JOMBNFKIHIC.ALEJJFPNIDP = value; } } public static bool isStory { get { return JOMBNFKIHIC.PHGDGBCBJJA; } set { JOMBNFKIHIC.PHGDGBCBJJA = value; } } public static bool mayScreenShake { get { return JOMBNFKIHIC.KKLCEPHJMAM; } set { JOMBNFKIHIC.KKLCEPHJMAM = value; } } public static bool mayFlicker { get { return JOMBNFKIHIC.ALEJJFPNIDP; } set { JOMBNFKIHIC.ALEJJFPNIDP = value; } } public static bool mayRumble { get { return JOMBNFKIHIC.JAJPBJBPOBF; } set { JOMBNFKIHIC.JAJPBJBPOBF = value; } } public static bool mayMoveCamera { get { return JOMBNFKIHIC.DAIOEHBEJBC; } set { JOMBNFKIHIC.DAIOEHBEJBC = value; } } public static int maxPlayers { get { return JOMBNFKIHIC.JHLPJLNFODA; } set { JOMBNFKIHIC.JHLPJLNFODA = value; } } public PowerupSelection PowerupSelection { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _gameSettings.ABIHCBMELMF(); } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _gameSettings.CBLMNOPPMKP(value); } } public bool BallTagging { get { return _gameSettings.FILHOMMPHJK(); } set { _gameSettings.AHOLKPAFMBE(value); } } public int MinSpeed { get { return _gameSettings.OEJNIMMDLEA(); } set { _gameSettings.JJHLJMDPAPL(value); } } public bool UsePoints { get { return _gameSettings.JFNLOKKDCEB(); } set { _gameSettings.HEEBCJHJFBA(value); } } public bool SinglePowerup => _gameSettings.COANGJDDNBN(); public Stage stage { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _gameSettings.OOEPDFABFIP; } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) _gameSettings.OOEPDFABFIP = value; } } public StageRandom stageRandom { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _gameSettings.OCPOONFEMCA; } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) _gameSettings.OCPOONFEMCA = value; } } public int stocks { get { return _gameSettings.MLEKMMGIFMF; } set { _gameSettings.MLEKMMGIFMF = value; } } public int points { get { return _gameSettings.HGHFBMLJGEM; } set { _gameSettings.HGHFBMLJGEM = value; } } public bool pointInfinite { get { return _gameSettings.LDEAKMILLHE; } set { _gameSettings.LDEAKMILLHE = value; } } public bool mUsePoints { get { return _gameSettings.FONKOHIGBLE; } set { _gameSettings.FONKOHIGBLE = value; } } public int time { get { return _gameSettings.GKJAGGKNFCO; } set { _gameSettings.GKJAGGKNFCO = value; } } public bool timeInfinite { get { return _gameSettings.BLADHBMDPPK; } set { _gameSettings.BLADHBMDPPK = value; } } public bool mBallTagging { get { return _gameSettings.NAKDBIFCJDI; } set { _gameSettings.NAKDBIFCJDI = value; } } public int mMinSpeed { get { return _gameSettings.HMOBHEIJCLM; } set { _gameSettings.HMOBHEIJCLM = value; } } public int energy { get { return _gameSettings.IKGAIFLLLAG; } set { _gameSettings.IKGAIFLLLAG = value; } } public HpFactor useHP { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _gameSettings.BKKMIBGLAEC; } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) _gameSettings.BKKMIBGLAEC = value; } } public PowerupSelection havePowerups { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _gameSettings.JJLDLMPOEEI; } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) _gameSettings.JJLDLMPOEEI = value; } } public BallType ballType { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _gameSettings.HKOFJKJDPGL; } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) _gameSettings.HKOFJKJDPGL = value; } } public int headSize { get { return _gameSettings.JFMNKHHLOOM; } set { _gameSettings.JFMNKHHLOOM = value; } } public GameMode gameMode { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _gameSettings.PNJOKAICMNN; } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) _gameSettings.PNJOKAICMNN = value; } } public GameSettings() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown _gameSettings = new JOMBNFKIHIC(); } public GameSettings(JOMBNFKIHIC gs) { _gameSettings = gs; } public override bool Equals(object obj) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if (obj is JOMBNFKIHIC || obj is GameSettings) { return object.Equals((object?)(JOMBNFKIHIC)obj, (JOMBNFKIHIC)this); } return false; } public override int GetHashCode() { return ((object)_gameSettings).GetHashCode(); } public static implicit operator JOMBNFKIHIC(GameSettings gs) { return gs._gameSettings; } public static implicit operator GameSettings(JOMBNFKIHIC gs) { return new GameSettings(gs); } public void CopyFrom(GameSettings other) { _gameSettings.NKHJFGIJEJI((JOMBNFKIHIC)other); } public void FillDefault() { _gameSettings.MJPKBDBBAKI(); } public int Get(GameSetting setting) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _gameSettings.BJDPHEHJJJK(setting); } public int GetNSettings() { return _gameSettings.GEMMKJGHPPP(); } public int[] GetSettings() { return _gameSettings.JLFNEMOGFHO(); } public static void Reset() { JOMBNFKIHIC.FMCGJNPNIPH(); } public void ResetGameModeSettings() { _gameSettings.ADDBHIFLMEI(); } public void Set(GameSetting setting, int val) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _gameSettings.HOGJDNCMNFP(setting, val); } public void SetSettings(int[] settings) { _gameSettings.AJJOHGKAJJB(settings); } public static void UpdateToConfig() { JOMBNFKIHIC.LIDLDDLGBJJ(); } public static int MaxPlayers() { return JOMBNFKIHIC.OLGJDMMMJLB(); } public override string ToString() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) string text = ""; int[] settings = GetSettings(); for (int i = 0; i < 14; i++) { GameSetting val = (GameSetting)i; text += $"{((object)(GameSetting)(ref val)).ToString()} : {settings[i]} \n"; } return text; } } } namespace LLBML.Networking { public class PlatformSteam { private readonly KKMGLMJABKH _platformSteam; public static CSteamID curLobby { get { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return KKMGLMJABKH.KONAAMMBHHG; } set { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) KKMGLMJABKH.KONAAMMBHHG = value; } } public PlatformSteam(KKMGLMJABKH ps) { _platformSteam = ps; } public override bool Equals(object obj) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if (obj is KKMGLMJABKH || obj is PlatformSteam) { return object.Equals((object?)(KKMGLMJABKH)obj, (KKMGLMJABKH)this); } return false; } public override int GetHashCode() { return ((object)_platformSteam).GetHashCode(); } public override string ToString() { return ((object)_platformSteam).ToString(); } public static implicit operator KKMGLMJABKH(PlatformSteam ps) { return ps._platformSteam; } public static implicit operator PlatformSteam(KKMGLMJABKH ps) { return new PlatformSteam(ps); } public IEnumerator CLoadData(int maxSize, SaveDataPart part, bool machineStorage, Action funcResultBytes) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) return ((KIIIINKJKNI)_platformSteam).IHAPPLPHPAB(maxSize, (BJAOHMGHGNI)part, machineStorage, funcResultBytes); } public IEnumerator CSaveData(byte[] data, SaveDataPart part, bool machineStorage) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) return ((KIIIINKJKNI)_platformSteam).IFEPDHDDGDC(data, (BJAOHMGHGNI)part, machineStorage); } } public class SaveDataPart : EnumWrapper { public enum Enum { ALL, PROGRESS, INPUT, CONFIG, RESUMESTATE, RESUMESTATE_USERID, RESUMESTATE_USERID_CLEAR, SLOWFLUSH } public enum Enum_Mapping { ALL, PROGRESS, INPUT, CONFIG, RESUMESTATE, RESUMESTATE_USERID, RESUMESTATE_USERID_CLEAR, SLOWFLUSH } public static readonly SaveDataPart ALL = Enum.ALL; public static readonly SaveDataPart PROGRESS = Enum.PROGRESS; public static readonly SaveDataPart INPUT = Enum.INPUT; public static readonly SaveDataPart CONFIG = Enum.CONFIG; public static readonly SaveDataPart RESUMESTATE = Enum.RESUMESTATE; public static readonly SaveDataPart RESUMESTATE_USERID = Enum.RESUMESTATE_USERID; public static readonly SaveDataPart RESUMESTATE_USERID_CLEAR = Enum.RESUMESTATE_USERID_CLEAR; public static readonly SaveDataPart SLOWFLUSH = Enum.SLOWFLUSH; private SaveDataPart(int id) : base(id) { } private SaveDataPart(BJAOHMGHGNI saveDataPart) : base((int)saveDataPart) { }//IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected I4, but got Unknown public override string ToString() { return ((Enum)id).ToString(); } public static implicit operator BJAOHMGHGNI(SaveDataPart ew) { return (BJAOHMGHGNI)ew.id; } public static implicit operator SaveDataPart(BJAOHMGHGNI val) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return new SaveDataPart(val); } public static implicit operator SaveDataPart(int id) { return new SaveDataPart(id); } public static implicit operator SaveDataPart(Enum val) { return new SaveDataPart((int)val); } public static implicit operator Enum(SaveDataPart ew) { return (Enum)ew.id; } } public static class EnvelopeApi { public delegate void OnReceiveEnvelopeHandler(LocalPeer sender, EnvelopeEventArgs e); private static ManualLogSource Logger = LLBMLPlugin.Log; public static event OnReceiveEnvelopeHandler OnReceiveCustomEnvelope; internal static void OnReceiveCustomEnvelopeCall(LocalPeer sender, EnvelopeEventArgs e) { if (EnvelopeApi.OnReceiveCustomEnvelope != null) { EnvelopeApi.OnReceiveCustomEnvelope(sender, e); } } internal static byte[] WriteBytesEnvelope(Envelope envelope, SpecialCode specialCode = SpecialCode.SUPER_DUPER_SECRET_CODE_THAT_IS_THE_CHOOSEN_ONE_AS_DESTINY_WANTED_IT_TO_BE_THAT_WAS_DESCRIBED_IN_SACRED_DISCORD_PRIVATE_MESSAGES, bool socketHeader = false, byte byte0 = 0) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_006e: 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_0074: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_0118: 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) ushort num = (ushort)envelope.message.msg; if (MessageApi.customMessages.ContainsKey(num) || MessageApi.internalMessageCodes.Contains(num)) { using (MemoryStream memoryStream = new MemoryStream()) { using BinaryWriter binaryWriter = new BinaryWriter(memoryStream); if (socketHeader) { binaryWriter.Write(byte0); binaryWriter.Write(envelope.packetNr); } binaryWriter.Write(envelope.sender); binaryWriter.Write(envelope.receiver); binaryWriter.Write((byte)specialCode); binaryWriter.Write((ushort)envelope.message.msg); binaryWriter.Write(envelope.message.playerNr); binaryWriter.Write(envelope.message.index); if (MessageApi.customMessages[num].messageActions.customWriter != null) { MessageApi.customMessages[num].messageActions.customWriter(binaryWriter, envelope.message.ob, envelope.message.obSize); } else if (envelope.message.ob is byte[] array) { binaryWriter.Write(array.Length); binaryWriter.Write(array); } else { binaryWriter.Write(-1); if (envelope.message.ob != null) { Logger.LogWarning((object)"Got message with an invalid payload, either provide a custom writer or pass a byte[] as the message object"); } } return memoryStream.ToArray(); } } return null; } internal static Envelope? ReceiveEnvelope(byte[] bytes, bool socketHeader) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) Envelope val = default(Envelope); SpecialCode specialCode = SpecialCode.SUPER_DUPER_SECRET_CODE_THAT_IS_THE_CHOOSEN_ONE_AS_DESTINY_WANTED_IT_TO_BE_THAT_WAS_DESCRIBED_IN_SACRED_DISCORD_PRIVATE_MESSAGES; using (MemoryStream input = new MemoryStream(bytes)) { using BinaryReader binaryReader = new BinaryReader(input); if (socketHeader) { binaryReader.ReadByte(); val.packetNr = binaryReader.ReadInt32(); } val.sender = binaryReader.ReadString(); val.receiver = binaryReader.ReadString(); specialCode = (SpecialCode)binaryReader.ReadByte(); if (!MessageApi.internalMessageCodes.Contains((int)specialCode)) { return null; } ushort num = binaryReader.ReadUInt16(); if (!MessageApi.customMessages.ContainsKey(num)) { return null; } val.message.msg = (Msg)num; val.message.playerNr = binaryReader.ReadInt32(); val.message.index = binaryReader.ReadInt32(); if (MessageApi.customMessages[num].messageActions.customReader != null && specialCode == SpecialCode.SUPER_DUPER_SECRET_CODE_THAT_IS_THE_CHOOSEN_ONE_AS_DESTINY_WANTED_IT_TO_BE_THAT_WAS_DESCRIBED_IN_SACRED_DISCORD_PRIVATE_MESSAGES) { MessageApi.customMessages[num].messageActions.customReader(binaryReader, val.message); } else { val.message.obSize = binaryReader.ReadInt32(); if (val.message.obSize != -1) { val.message.ob = binaryReader.ReadBytes(val.message.obSize); } else { val.message.ob = null; } } } _ = 204; return val; } } public class EnvelopeEventArgs : EventArgs { public Envelope Envelope { get; private set; } public EnvelopeEventArgs(Envelope envelope) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Envelope = envelope; } } public enum TransactionState { Sending, Receiving, Done } public enum TransactionCode : byte { Start, Fragment, Ack } public class Transaction : IEnumerable, IByteable { private static ManualLogSource Logger = LLBMLPlugin.Log; internal const uint TransactionOverhead = 7u; internal const uint MaxFragmentSize = 1048569u; internal static Dictionary transactionCache = new Dictionary(); internal static ushort transactionCount = 0; private readonly ushort index; private readonly int channel; private readonly CSteamID sender; private readonly CSteamID receiver; private readonly uint fragmentSize; private byte[][] fragments; private uint currentFragment; internal Dictionary> TCodeMapping = new Dictionary> { [TransactionCode.Start] = ReceiveStart, [TransactionCode.Fragment] = ReceiveFragment, [TransactionCode.Ack] = ReceiveAck }; public string id { get; private set; } public Transaction(ushort index, CSteamID sender, CSteamID receiver, byte[] data, int channel = 0, uint fragmentSize = 1048569u, TransactionState state = TransactionState.Sending) { //IL_004b: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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) id = GetID(sender, receiver, index); this.index = index; this.channel = channel; this.sender = sender; this.receiver = receiver; this.fragmentSize = fragmentSize; uint num = (uint)System.Math.Ceiling((decimal)data.Length / (decimal)fragmentSize); fragments = new byte[num][]; Logger.LogDebug((object)$"Creating transaction from payload with size {data.Length} and with {num} fragments."); for (uint num2 = 0u; num2 < num; num2++) { Logger.LogDebug((object)$"Splitting fragment number {num2}"); byte[] array = new byte[fragmentSize]; uint num3 = num2 * fragmentSize; long length = ((data.Length - num3 - fragmentSize >= 0) ? fragmentSize : (data.Length - num3)); Array.Copy(data, num2 * fragmentSize, array, 0L, length); fragments[num2] = array; } currentFragment = 0u; } public Transaction(ushort index, CSteamID sender, CSteamID receiver, uint nbFragments, int channel, uint fragmentSize) { //IL_004b: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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) id = GetID(sender, receiver, index); this.index = index; this.channel = channel; this.sender = sender; this.receiver = receiver; this.fragmentSize = fragmentSize; fragments = new byte[nbFragments][]; currentFragment = 0u; } public static Transaction Create(Envelope envelope) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) CSteamID val = NetworkApi.PeerIDToCSteamID(envelope.sender); CSteamID val2 = NetworkApi.PeerIDToCSteamID(envelope.receiver); Transaction transaction = new Transaction(transactionCount++, val, val2, ((Envelope)(ref envelope)).ToBytes(false, (byte)0)); transactionCache.Add(transaction.id, transaction); return transaction; } public static Transaction Create(CSteamID destination, byte[] data, int channel = 0) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) CSteamID val = NetworkApi.PeerIDToCSteamID(((Peer)P2P.localPeer).peerId); Transaction transaction = new Transaction(transactionCount++, val, destination, data, channel); transactionCache.Add(transaction.id, transaction); return transaction; } public static string GetID(CSteamID sender, CSteamID receiver, int index) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) return $"{sender}_{receiver}_{index:00000}"; } internal void Start() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) byte[] array = new byte[1]; array.Add(ToBytes()); Logger.LogDebug((object)("Transaction " + id + " start!")); NetworkApi.SendP2PPacket(receiver, array, EP2PSend.k_EP2PSendUnreliable, 2, transactionSupport: false); } internal static void ReceiveStart(CSteamID sender, byte[] data) { Transaction transaction = FromBytes(data); transactionCache.Add(transaction.id, transaction); Logger.LogDebug((object)("Received transaction start for transaction " + transaction.id + ", start!")); transaction.SendAck(-1); } internal void SendNextFragment() { if (currentFragment <= fragments.Length) { SendFragment(currentFragment); currentFragment++; } } internal void SendFragment(uint fragmentId) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) byte[] array = new byte[1] { 1 }; byte[] fragment = GetFragment(fragmentId); using (MemoryStream memoryStream = new MemoryStream()) { using BinaryWriter binaryWriter = new BinaryWriter(memoryStream); binaryWriter.Write(index); binaryWriter.Write(fragmentId); binaryWriter.Write(fragment.Length); binaryWriter.Write(fragment); array.Add(memoryStream.ToArray()); } Logger.LogDebug((object)$"Sending fragment {fragmentId} for transaction {id}."); NetworkApi.SendP2PPacket(receiver, array, EP2PSend.k_EP2PSendReliable, 2, transactionSupport: false); } internal static void ReceiveFragment(CSteamID sender, byte[] data) { //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_003d: 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) using MemoryStream input = new MemoryStream(data); using BinaryReader binaryReader = new BinaryReader(input); binaryReader.ReadUInt16(); uint num = binaryReader.ReadUInt32(); int count = binaryReader.ReadInt32(); byte[] fragment = binaryReader.ReadBytes(count); CSteamID val = NetworkApi.PeerIDToCSteamID(((Peer)P2P.localPeer).peerId); string iD = GetID(sender, val, data[0]); Transaction transaction = transactionCache[iD]; Logger.LogDebug((object)$"Received fragment {num} for transaction {iD}."); transaction.AddFragment(num, fragment); transaction.SendAck((int)num); if (transaction.GetMissingFragments().Count == 0) { transaction.End(); } } internal void SendAck(int fragmentId) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) byte[] array = new byte[1] { 2 }; array.Add(ToBytes()); using (MemoryStream memoryStream = new MemoryStream()) { using BinaryWriter binaryWriter = new BinaryWriter(memoryStream); binaryWriter.Write(index); binaryWriter.Write(fragmentId); array.Add(memoryStream.ToArray()); } Logger.LogDebug((object)$"Sending Ack {fragmentId} for transaction {id}."); NetworkApi.SendP2PPacket(receiver, array, EP2PSend.k_EP2PSendUnreliable, 2, transactionSupport: false); } internal static void ReceiveAck(CSteamID sender, byte[] data) { //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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) using MemoryStream input = new MemoryStream(data); using BinaryReader binaryReader = new BinaryReader(input); binaryReader.ReadUInt16(); int num = binaryReader.ReadInt32(); CSteamID val = NetworkApi.PeerIDToCSteamID(((Peer)P2P.localPeer).peerId); string iD = GetID(sender, val, data[0]); Transaction transaction = transactionCache[iD]; Logger.LogDebug((object)$"Received Ack {num} for transaction {transaction.id}."); Logger.LogDebug((object)"Sending next fragment..."); if (num == -1) { transaction.currentFragment = 0u; transaction.SendNextFragment(); } else { transaction.SendNextFragment(); } } internal void End() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) byte[] array = fragments.SelectMany((byte[] byteArr) => byteArr).ToArray(); Dictionary> channelMapping = Networking_Patches.NetSteamPatch.channelMapping; Channel key = (Channel)channel; if (channelMapping.ContainsKey(key)) { channelMapping[key](array, (uint)array.Length, sender); } } public void AddFragment(uint fragmentId, byte[] fragment) { if (fragment.Length > fragmentSize) { throw new InvalidOperationException($"Received a fragment too big for transaction {id}. Fragment was {fragment.Length} byte long, expected {fragmentSize} max"); } if (fragmentId == currentFragment) { fragments[currentFragment] = fragment; currentFragment++; return; } throw new NotImplementedException(); } public List GetMissingFragments() { return (from index in fragments.Select((byte[] fragment, int index) => (fragment != null) ? (-1) : index) where index != -1 select index).ToList(); } public byte[] GetFragment(uint fragmentId) { return fragments[fragmentId]; } public IEnumerator GetEnumerator() { return fragments.SelectMany((byte[] fragment) => fragment).GetEnumerator(); } public byte[] ToBytes() { //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_004f: 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) using MemoryStream memoryStream = new MemoryStream(); using BinaryWriter binaryWriter = new BinaryWriter(memoryStream); binaryWriter.Write(index); binaryWriter.Write((uint)fragments.Length); binaryWriter.Write(fragmentSize); CSteamID val = sender; binaryWriter.Write(((object)(CSteamID)(ref val)).ToString()); val = receiver; binaryWriter.Write(((object)(CSteamID)(ref val)).ToString()); binaryWriter.Write(channel); return memoryStream.ToArray(); } public static Transaction FromBytes(byte[] data) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) using MemoryStream input = new MemoryStream(data); using BinaryReader binaryReader = new BinaryReader(input); ushort num = binaryReader.ReadUInt16(); uint nbFragments = binaryReader.ReadUInt32(); uint num2 = binaryReader.ReadUInt32(); CSteamID val = NetworkApi.PeerIDToCSteamID(binaryReader.ReadString()); CSteamID val2 = NetworkApi.PeerIDToCSteamID(binaryReader.ReadString()); int num3 = binaryReader.ReadInt32(); return new Transaction(num, val, val2, nbFragments, num3, num2); } } public static class Networking_Patches { public static class MessageBufferSizePatch { [HarmonyPatch(typeof(P2P), "get_messageBufferSize")] [HarmonyPostfix] public static int get_messageBufferSize_Postfix(int __result) { return 32768; } } public static class NetSteamPatch { public static Dictionary> channelMapping = new Dictionary> { [Channel.ModPackets] = ReceiveModPacket, [Channel.Transaction] = ReceiveTransaction }; [HarmonyPatch(typeof(NetSteam), "DoUpdate")] [HarmonyPrefix] public static bool DoUpdate_Prefix(NetSteam __instance) { //IL_0060: 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) uint num = default(uint); uint arg = default(uint); CSteamID val = default(CSteamID); foreach (KeyValuePair> item in channelMapping) { while (BEPOKFLHPBM.IAGFGJEKDNF(ref num, (int)item.Key)) { byte[] array = new byte[num]; if (BEPOKFLHPBM.FOPENCDPLGO(array, num, ref arg, ref val, (int)item.Key)) { item.Value(array, arg, val); continue; } Logger.LogError((object)$"ReadP2PPacket(Byte array from {val}) failed!"); Logger.LogError((object)$"Tried to read {num} bytes on channel {item.Key}."); } } return true; } public static void ReceiveModPacket(byte[] data, uint bytesRead, CSteamID sender) { byte[] array = data.Take(4).ToArray(); string key = StringUtils.PrettyPrintBytes(array); if (NetworkApi.modPacketCallbacks.ContainsKey(key)) { Action action = NetworkApi.modPacketCallbacks[key]; try { action(Peer.Get(((object)(CSteamID)(ref sender)).ToString()), data.Skip(4).ToArray()); return; } catch (Exception ex) { LLBMLPlugin.Log.LogError((object)("netID:" + array.ToString() + " returned error during ModPacket unpacking: " + ex)); return; } } Logger.LogWarning((object)$"Unknown PluginID: Couldn't find a plugin with \"{StringUtils.PrettyPrintBytes(array)}\" as netID. It had {bytesRead - 4} bytes of data."); } public static void ReceiveTransaction(byte[] data, uint bytesRead, CSteamID sender) { StringUtils.PrettyPrintBytes(data.Take(4).ToArray()); } } public static class ReceiveEnvelopePatch { [HarmonyPatch(typeof(LocalPeer), "OnReceiveMessage")] [HarmonyPrefix] public static bool OnReceiveMessage_Prefix(Envelope envelope, LocalPeer __instance) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_00c9: 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_015a: 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_0081: Unknown result type (might be due to invalid IL or missing references) Message message = envelope.message; ushort num = (ushort)message.msg; if (num <= 255) { if (MessageApi.vanillaMessageCodes.Contains((byte)num)) { if (MessageApi.vanillaSubscriptions.ContainsKey((byte)num)) { Logger.LogDebug((object)("Received vanilla message with custom subscriptions. Number: " + num + ". Sender: " + envelope.sender)); foreach (CustomMessage item in MessageApi.vanillaSubscriptions[(byte)num]) { item.messageActions.onReceiveCode(message); } } return true; } Logger.LogWarning((object)("Received non-vanilla message in vanilla range. Number: " + num + ". Sender: " + envelope.sender)); EnvelopeApi.OnReceiveCustomEnvelopeCall(__instance, new EnvelopeEventArgs(envelope)); return false; } if (MessageApi.customMessages.ContainsKey(num) || MessageApi.internalMessageCodes.Contains(num)) { Logger.LogDebug((object)("Received custom message. Number: " + num + ". Sender: " + envelope.sender)); MessageApi.customMessages[num].messageActions.onReceiveCode(envelope.message); return false; } EnvelopeApi.OnReceiveCustomEnvelopeCall(__instance, new EnvelopeEventArgs(envelope)); Logger.LogWarning((object)("Received unregistered custom message. Number: " + num + ". Sender: " + envelope.sender)); return false; } } public static class CustomEnvelopeEncodingPatch { [HarmonyPatch(typeof(Envelope), "ToBytes")] [HarmonyPrefix] public static bool ToBytes_Prefix(bool socketHeader, byte byte0, Envelope __instance, ref byte[] __result) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) byte[] array = EnvelopeApi.WriteBytesEnvelope(__instance, SpecialCode.SUPER_DUPER_SECRET_CODE_THAT_IS_THE_CHOOSEN_ONE_AS_DESTINY_WANTED_IT_TO_BE_THAT_WAS_DESCRIBED_IN_SACRED_DISCORD_PRIVATE_MESSAGES, socketHeader, byte0); if (array != null) { __result = new byte[array.Length]; array.CopyTo(__result, 0); return false; } return true; } [HarmonyPatch(typeof(Envelope), "FromBytes")] [HarmonyPrefix] public static bool FromBytes_Prefix(byte[] bytes, bool socketHeader, ref Envelope __result) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) try { Envelope? val = EnvelopeApi.ReceiveEnvelope(bytes, socketHeader); if (val.HasValue) { __result = val.Value; return false; } return true; } catch (Exception ex) { Logger.LogError((object)("Caught exception while reading Envelope: " + ex.Message + "\n" + ex.StackTrace)); } Logger.LogDebug((object)"Sending byte form envelope to vanilla."); return true; } } private static ManualLogSource Logger = LLBMLPlugin.Log; } internal enum SpecialCode { GREETINGS = 200, SUPER_DUPER_SECRET_CODE_THAT_IS_THE_CHOOSEN_ONE_AS_DESTINY_WANTED_IT_TO_BE_THAT_WAS_DESCRIBED_IN_SACRED_DISCORD_PRIVATE_MESSAGES = 204 } public enum Channel { Vanilla, ModPackets, Transaction } public static class NetworkApi { private static ManualLogSource Logger = LLBMLPlugin.Log; internal const int newMessageBufferSize = 32768; internal const int maxSteamworksReliablePacket = 1048576; public const int netIDSize = 4; internal static Dictionary> modPacketCallbacks = new Dictionary>(); public static bool IsOnline => JOMBNFKIHIC.DGGHBHPEGNK(); public static OnlineMode OnlineMode => JOMBNFKIHIC.OIACPNLFAKK(); [Obsolete("Deprecated, please use Player.LocalPlayerNumber instead.")] public static int LocalPlayerNumber => ((Peer)(P2P.localPeer?)).playerNr ?? 0; public static KIIIINKJKNI GetCurrentPlatform() { return CGLLJHHAJAK.GIGAKBJGFDI; } public static OperatingSystem GetOperatingSystem() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return CGLLJHHAJAK.EFECBCOGFHC; } public static byte[] GetNetworkIdentifier(string source) { MD5CryptoServiceProvider mD5CryptoServiceProvider = new MD5CryptoServiceProvider(); mD5CryptoServiceProvider.ComputeHash(Encoding.ASCII.GetBytes(source)); byte[] hash = mD5CryptoServiceProvider.Hash; LLBMLPlugin.Log.LogDebug((object)$"Hash for {source} = {hash}, length: {hash.Length}"); byte[] array = BinaryUtils.XORFold(hash, 2); LLBMLPlugin.Log.LogDebug((object)$"UID for {source} = {StringUtils.PrettyPrintBytes(array)}, length: {array.Length}"); return array; } public static void SendMessageToPlayer(int playerNr, Message message) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) SendMessageToPeer(Player.GetPlayer(playerNr).peer.peerId, message); } public static void SendMessageToPeer(string peerId, Message message) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) Envelope envelope = default(Envelope); envelope.sender = ((Peer)P2P.localPeer).peerId; envelope.receiver = peerId; envelope.message = message; envelope.packetNr = -1; SendEnvelope(envelope); } public static void SendEnvelope(Envelope envelope) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) P2P.localPeer.networkImplementation.Send(envelope); } public static void SendBytes(string receiver, byte[] data, bool toVanilla = true) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (data.Length > 32768) { Logger.LogError((object)$"Couldn't send byte array to {receiver} : buffer overflow ({data.Length})"); return; } CSteamID steamIDRemote = PeerIDToCSteamID(receiver); EP2PSend eP2PSend = EP2PSend.k_EP2PSendUnreliable; if (data.Length > 1024) { eP2PSend = EP2PSend.k_EP2PSendReliable; } SendP2PPacket(steamIDRemote, data, eP2PSend, (!toVanilla) ? 1 : 0); } public static string PlayerNrToPeerID(int playerNr) { return Player.GetPlayer(playerNr).peer.peerId; } public static CSteamID PeerIDToCSteamID(string peerId) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) CSteamID result = KKMGLMJABKH.KJANLAGMBAM(peerId); if (!((CSteamID)(ref result)).OIAPLNLLNNL() || !((CSteamID)(ref result)).BNAMNCNLOGD()) { Logger.LogError((object)$"Peer '{peerId} invalid ({((CSteamID)(ref result)).AECOKNACKLO()})"); throw new ArgumentException($"Peer '{peerId} invalid ({((CSteamID)(ref result)).AECOKNACKLO()})"); } return result; } public static void SendP2PPacket(Player player, byte[] data, EP2PSend.Enum eP2PSendType = EP2PSend.Enum.k_EP2PSendUnreliable, int nChannel = 0, bool transactionSupport = true) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) SendP2PPacket(PeerIDToCSteamID(PlayerNrToPeerID(player.nr)), data, eP2PSendType, nChannel); } public static void SendP2PPacket(CSteamID steamIDRemote, byte[] data, EP2PSend.Enum eP2PSendType = EP2PSend.Enum.k_EP2PSendUnreliable, int nChannel = 0, bool transactionSupport = true) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if ((long)data.Length > 1048569L) { if (transactionSupport) { Logger.LogDebug((object)$"Creating transaction for packet because it's size exeeded max length by {(long)data.Length - 1048569L}"); Transaction.Create(steamIDRemote, data, nChannel).Start(); } else { Logger.LogWarning((object)$"Packet exeeded max size by {(long)data.Length - 1048569L}, but transaction support was turned off. Aborting send."); } } else if (!BEPOKFLHPBM.BEMEPOKJHGF(steamIDRemote, data, (uint)data.Length, (HKNEJCDBFGF)(EP2PSend)eP2PSendType, nChannel)) { Logger.LogError((object)$"SendP2PPacket(Byte array to {steamIDRemote}) failed!"); P2P.Disconnect((DisconnectReason)11); } } public static void SendModPacket(PluginInfo pluginInfo, Player player, byte[] data) { byte[] data2 = CollectionExtensions.AddRangeToArray(GetNetworkIdentifier(pluginInfo.Metadata.GUID), data); SendP2PPacket(player, data2, EP2PSend.k_EP2PSendReliable, 1); } public static void RegisterModPacketCallback(PluginInfo pluginInfo, Action onReceivePacket) { string key = StringUtils.PrettyPrintBytes(GetNetworkIdentifier(pluginInfo.Metadata.GUID)); if (modPacketCallbacks.ContainsKey(key)) { LLBMLPlugin.Log.LogWarning((object)(pluginInfo.Metadata.Name + " has already registered a callback.")); } else { modPacketCallbacks.Add(key, onReceivePacket); } } internal static void Patch(Harmony harmonyPatcher) { harmonyPatcher.PatchAll(typeof(Networking_Patches.ReceiveEnvelopePatch)); harmonyPatcher.PatchAll(typeof(Networking_Patches.CustomEnvelopeEncodingPatch)); harmonyPatcher.PatchAll(typeof(Networking_Patches.MessageBufferSizePatch)); harmonyPatcher.PatchAll(typeof(Networking_Patches.NetSteamPatch)); } } public class EP2PSend : EnumWrapper { public enum Enum { k_EP2PSendUnreliable, k_EP2PSendUnreliableNoDelay, k_EP2PSendReliable, k_EP2PSendReliableWithBuffering } public enum Enum_Mapping { k_EP2PSendUnreliable, k_EP2PSendUnreliableNoDelay, k_EP2PSendReliable, k_EP2PSendReliableWithBuffering } public static readonly EP2PSend k_EP2PSendUnreliable = Enum.k_EP2PSendUnreliable; public static readonly EP2PSend k_EP2PSendUnreliableNoDelay = Enum.k_EP2PSendUnreliableNoDelay; public static readonly EP2PSend k_EP2PSendReliable = Enum.k_EP2PSendReliable; public static readonly EP2PSend k_EP2PSendReliableWithBuffering = Enum.k_EP2PSendReliableWithBuffering; private EP2PSend(int id) : base(id) { } private EP2PSend(HKNEJCDBFGF gameState) : base((int)gameState) { }//IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected I4, but got Unknown public override string ToString() { return ((Enum)id).ToString(); } public static implicit operator HKNEJCDBFGF(EP2PSend ew) { return (HKNEJCDBFGF)ew.id; } public static implicit operator EP2PSend(HKNEJCDBFGF val) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return new EP2PSend(val); } public static implicit operator EP2PSend(int id) { return new EP2PSend(id); } public static implicit operator EP2PSend(Enum val) { return new EP2PSend((int)val); } public static implicit operator Enum(EP2PSend ew) { return (Enum)ew.id; } } } namespace LLBML.GameEvents { public delegate void OnFrameUpdateHandler(object source, OnFrameUpdateArgs e); public delegate void OnLateFrameUpdateHandler(object source, OnFrameUpdateArgs e); public class WorldEvents { public static event OnFrameUpdateHandler OnFrameUpdate; public static event OnLateFrameUpdateHandler OnLateFrameUpdate; internal static void Patch(Harmony harmonyInstance) { } internal static void OnFrameUpdateCall(object source, OnFrameUpdateArgs e) { if (WorldEvents.OnFrameUpdate != null) { WorldEvents.OnFrameUpdate(source, e); } } internal static void OnLateFrameUpdateCall(object source, OnFrameUpdateArgs e) { if (WorldEvents.OnLateFrameUpdate != null) { WorldEvents.OnLateFrameUpdate(source, e); } } } public class OnFrameUpdateArgs : EventArgs { public int frameNr { get; private set; } public OnFrameUpdateArgs(int frameNr) { this.frameNr = frameNr; } } internal static class WorldEvents_Patches { [HarmonyPatch(typeof(World), "FrameUpdate")] [HarmonyTranspiler] public static IEnumerable FrameUpdate_HarmonyTranspiler(IEnumerable instructions, ILGenerator il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, il); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(World), "playerHandler"), (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null) }); val.Advance(1); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { Transpilers.EmitDelegate((Action)delegate { World instance2 = World.instance; WorldEvents.OnFrameUpdateCall(instance2, new OnFrameUpdateArgs(instance2.frameNrSaved)); }) }); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(World), "powerupHandler"), (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null) }); val.Advance(1); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { Transpilers.EmitDelegate((Action)delegate { World instance = World.instance; WorldEvents.OnLateFrameUpdateCall(instance, new OnFrameUpdateArgs(instance.frameNrSaved)); }) }); return val.InstructionEnumeration(); } } public delegate void OnSteamLobbyEnteredHandler(object source, SteamLobbyEventArgs e); public delegate void OnLobbyEnteredHandler(object source, LobbyEventArgs e); public delegate void OnLobbyReadyHandler(object source, LobbyReadyArgs e); public delegate void OnUserCharacterPickHandler(PlayersCharacterButton source, OnUserCharacterPickArgs e); public delegate void OnUserSkinClickHandler(PlayersSelection source, OnUserSkinClickArgs e); public delegate void OnPlayerJoinHandler(Player source, OnPlayerJoinArgs e); public delegate void OnUnlinkFromPlayerHandler(Peer source, OnUnlinkFromPlayerArgs e); public delegate void OnDecisionsHandler(HDLIJDBFGKN source, OnDecisionsArgs e); public delegate void OnStageSelectOpenHandler(HDLIJDBFGKN source, OnStageSelectOpenArgs e); public static class LobbyEvents { public static event OnSteamLobbyEnteredHandler OnSteamLobbyEntered; public static event OnLobbyEnteredHandler OnLobbyEntered; public static event OnLobbyReadyHandler OnLobbyReady; public static event OnUserCharacterPickHandler OnUserCharacterPick; public static event OnUserSkinClickHandler OnUserSkinClick; public static event OnPlayerJoinHandler OnPlayerJoin; public static event OnUnlinkFromPlayerHandler OnUnlinkFromPlayer; public static event OnDecisionsHandler OnDecisions; public static event OnStageSelectOpenHandler OnStageSelectOpen; internal static void Patch(Harmony harmonyInstance) { harmonyInstance.PatchAll(typeof(LobbyEvents_Patches)); OnUserCharacterPick += delegate(PlayersCharacterButton o, OnUserCharacterPickArgs a) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) LLBMLPlugin.Log.LogDebug((object)$"Event OnUserCharacterPick triggered. Player nr: {a.playerNr}. Char: {a.character}"); }; OnUserSkinClick += delegate(PlayersSelection o, OnUserSkinClickArgs a) { LLBMLPlugin.Log.LogDebug((object)$"Event OnUserSkinClick triggered. clicker nr: {a.clickerNr}. ToSkin nr: {a.toSkinNr}"); }; OnSteamLobbyEntered += delegate(object o, SteamLobbyEventArgs a) { LLBMLPlugin.Log.LogDebug((object)("Event OnSteamLobbyEntered triggered. Lobby ID: " + a.lobby_id + ". Lobby Host: " + a.host_id)); }; OnLobbyEntered += delegate(object o, LobbyEventArgs a) { LLBMLPlugin.Log.LogDebug((object)$"Event OnLobbyEntered triggered. Online? {a.isOnline}."); }; OnLobbyReady += delegate(object o, LobbyReadyArgs a) { LLBMLPlugin.Log.LogDebug((object)$"Event OnLobbyReady triggered. Online? {a.isOnline}. Lobby ID: {a.lobby_id}. Lobby Host: {a.host_id}"); }; OnPlayerJoin += delegate(Player o, OnPlayerJoinArgs a) { LLBMLPlugin.Log.LogDebug((object)string.Format("Event OnPlayerJoin triggered. Player nr: {0}. It's a {1} player.", a.playerNr, a.isLocal ? "local" : "remote")); }; OnUnlinkFromPlayer += delegate(Peer o, OnUnlinkFromPlayerArgs a) { LLBMLPlugin.Log.LogDebug((object)$"Event OnUnlinkFromPlayer triggered. Player nr: {a.playerNr}."); }; OnDecisions += delegate(HDLIJDBFGKN o, OnDecisionsArgs a) { LLBMLPlugin.Log.LogDebug((object)$"Event OnDecisions triggered. Is player host?: {a.sent}."); }; OnStageSelectOpen += delegate(HDLIJDBFGKN o, OnStageSelectOpenArgs a) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) LLBMLPlugin.Log.LogDebug((object)$"Event OnStageSelectOpen triggered. Can go back? {a.canGoBack}. Spec? {a.localSpectator}. ScreenType: {a.screenType}"); }; } internal static void OnSteamLobbyEnteredCall(object source, SteamLobbyEventArgs e) { if (LobbyEvents.OnSteamLobbyEntered != null) { LobbyEvents.OnSteamLobbyEntered(source, e); } } internal static void OnLobbyEnteredCall(object source, LobbyEventArgs e) { if (LobbyEvents.OnLobbyEntered != null) { LobbyEvents.OnLobbyEntered(source, e); } } internal static void OnLobbyReadyCall(object source, LobbyReadyArgs e) { if (LobbyEvents.OnLobbyReady != null) { LobbyEvents.OnLobbyReady(source, e); } } internal static void OnUserCharacterPickCall(PlayersCharacterButton source, OnUserCharacterPickArgs e) { if (LobbyEvents.OnUserCharacterPick != null) { LobbyEvents.OnUserCharacterPick(source, e); } } internal static void OnUserSkinClickCall(PlayersSelection source, OnUserSkinClickArgs e) { if (LobbyEvents.OnUserSkinClick != null) { LobbyEvents.OnUserSkinClick(source, e); } } internal static void OnPlayerJoinCall(Player source, OnPlayerJoinArgs e) { if (LobbyEvents.OnPlayerJoin != null) { LobbyEvents.OnPlayerJoin(source, e); } } internal static void OnUnlinkFromPlayerCall(Peer source, OnUnlinkFromPlayerArgs e) { if (LobbyEvents.OnUnlinkFromPlayer != null) { LobbyEvents.OnUnlinkFromPlayer(source, e); } } internal static void OnDecisionsCall(HDLIJDBFGKN source, OnDecisionsArgs e) { if (LobbyEvents.OnDecisions != null) { LobbyEvents.OnDecisions(source, e); } } internal static void OnStageSelectOpenCall(HDLIJDBFGKN source, OnStageSelectOpenArgs e) { if (LobbyEvents.OnStageSelectOpen != null) { LobbyEvents.OnStageSelectOpen(source, e); } } } public class SteamLobbyEventArgs : EventArgs { public string lobby_id { get; private set; } public string host_id { get; private set; } public SteamLobbyEventArgs(string lobby_id, string host_id) { this.lobby_id = lobby_id; this.host_id = host_id; } } public class LobbyEventArgs : EventArgs { public bool isOnline { get; private set; } public LobbyEventArgs(bool isOnline) { this.isOnline = isOnline; } } public class LobbyReadyArgs : EventArgs { public bool isOnline { get; private set; } public string lobby_id { get; private set; } public string host_id { get; private set; } public LobbyReadyArgs(bool isOnline, string lobby_id, string host_id) { this.isOnline = isOnline; this.lobby_id = lobby_id; this.host_id = host_id; } } public class OnUserCharacterPickArgs : EventArgs { public int playerNr { get; private set; } public Character character { get; private set; } public OnUserCharacterPickArgs(int playerNr, Character character) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) this.playerNr = playerNr; this.character = character; } } public class OnUserSkinClickArgs : EventArgs { public int clickerNr { get; private set; } public int toSkinNr { get; private set; } public OnUserSkinClickArgs(int clickerNr, int toSkinNr) { this.clickerNr = clickerNr; this.toSkinNr = toSkinNr; } } public class OnPlayerJoinArgs : EventArgs { public int playerNr { get; private set; } public bool isLocal { get; private set; } public OnPlayerJoinArgs(int playerNr, bool isLocal) { this.playerNr = playerNr; this.isLocal = isLocal; } } public class OnUnlinkFromPlayerArgs : EventArgs { public int playerNr { get; private set; } public OnUnlinkFromPlayerArgs(int playerNr) { this.playerNr = playerNr; } } public class OnDecisionsArgs : EventArgs { public bool sent { get; private set; } public int[] decisions { get; private set; } public OnDecisionsArgs(bool sent, int[] decisions) { this.sent = sent; this.decisions = decisions; } } public class OnStageSelectOpenArgs : EventArgs { public bool canGoBack { get; private set; } public bool localSpectator { get; private set; } public ScreenType screenType { get; private set; } public OnStageSelectOpenArgs(bool canGoBack, bool localSpectator, ScreenType screenType) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) this.canGoBack = canGoBack; this.localSpectator = localSpectator; this.screenType = screenType; } } internal static class LobbyEvents_Patches { private static LobbyEventArgs ui; private static SteamLobbyEventArgs steam; [HarmonyPatch(typeof(HDLIJDBFGKN), "OAACLLGMFLH", new Type[] { })] [HarmonyTranspiler] public static IEnumerable StartGameHost_Transpiler(IEnumerable instructions, ILGenerator iL) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, iL); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[8] { new CodeMatch((OpCode?)OpCodes.Blt, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_M1, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_M1, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldloc_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null) }); object operand = val.Operand; val.Advance(-6); try { val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[4] { new CodeInstruction(OpCodes.Ldloc_0, (object)null), new CodeInstruction(OpCodes.Ldfld, operand), new CodeInstruction(OpCodes.Ldloc_0, (object)null), Transpilers.EmitDelegate>((Action)delegate(HDLIJDBFGKN gameState, int[] decisions) { LobbyEvents.OnDecisionsCall(gameState, new OnDecisionsArgs(sent: true, decisions)); }) }); } catch (Exception ex) { LLBMLPlugin.Log.LogInfo((object)ex); } return val.InstructionEnumeration(); } [HarmonyPatch(typeof(HDLIJDBFGKN), "OAACLLGMFLH", new Type[] { typeof(int[]) })] [HarmonyPrefix] public static bool StartGame_Prefix(HDLIJDBFGKN __instance, int[] FHFDJMKAHCI) { LobbyEvents.OnDecisionsCall(__instance, new OnDecisionsArgs(sent: false, FHFDJMKAHCI)); return true; } [HarmonyPatch(typeof(HPNLMFHPHFD), "KOLLNKIKIKM")] [HarmonyPrefix] public static bool OpenStageSelect_Prefix(HDLIJDBFGKN __instance, bool JFEKJLHCEFD, bool PGJKMPOJCBC, ScreenType FLMBCGMOCKC) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) LobbyEvents.OnStageSelectOpenCall(__instance, new OnStageSelectOpenArgs(JFEKJLHCEFD, PGJKMPOJCBC, FLMBCGMOCKC)); return true; } [HarmonyPatch(typeof(PlayersCharacterButton), "m__0")] [HarmonyPostfix] public static void PickChar_Postfix(int pNr, PlayersCharacterButton __instance) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) LobbyEvents.OnUserCharacterPickCall(__instance, new OnUserCharacterPickArgs(pNr, __instance.character)); } [HarmonyPatch(typeof(PlayersSelection), "m__4")] [HarmonyPostfix] public static void PickSkin_Postfix(int pNr, PlayersSelection __instance) { LobbyEvents.OnUserSkinClickCall(__instance, new OnUserSkinClickArgs(pNr, __instance.playerNr)); } [HarmonyPatch(typeof(KKMGLMJABKH), "GECHFADPFEC")] [HarmonyPatch(typeof(KKMGLMJABKH), "AHFOJNGOAJK")] [HarmonyPostfix] public static IEnumerator OnLobbyEntered_Postfix(IEnumerator result, KKMGLMJABKH __instance) { while (result.MoveNext()) { yield return result.Current; } if (!(((object)(CSteamID)(ref KKMGLMJABKH.KONAAMMBHHG)).ToString() == "0")) { SteamLobbyEventArgs e = new SteamLobbyEventArgs(((object)(CSteamID)(ref KKMGLMJABKH.KONAAMMBHHG)).ToString(), ((Peer)(P2P.localPeer?)).peerId); LobbyEvents.OnSteamLobbyEnteredCall(__instance, e); ((MonoBehaviour)LLBMLPlugin.Instance).StartCoroutine(SteamLobbyReady(__instance, e)); } } [HarmonyPatch(typeof(HPNLMFHPHFD), "CNewState")] [HarmonyPostfix] public static IEnumerator CNewState_Postfix(IEnumerator orig, HPNLMFHPHFD __instance) { int c = 1; while (orig.MoveNext()) { yield return orig.Current; c++; } LobbyEventArgs e = ((!GameStates.IsInOnlineLobby()) ? new LobbyEventArgs(isOnline: false) : new LobbyEventArgs(isOnline: true)); LobbyEvents.OnLobbyEnteredCall(__instance, e); ui = null; ((MonoBehaviour)LLBMLPlugin.Instance).StartCoroutine(LobbyUIReady(__instance, e)); } public static IEnumerator LobbyUIReady(HPNLMFHPHFD instance, LobbyEventArgs _ui) { yield return (object)new WaitForSeconds(0.2f); ui = _ui; if (!_ui.isOnline || steam != null) { LLBMLPlugin.Log.LogDebug((object)string.Format("LobbyUIReady: {0} (ui {1})", (steam != null) ? ("(steam " + steam?.ToString() + ")") : "", ui)); CallLobbyReady(instance, ui, steam); } } public static IEnumerator SteamLobbyReady(KKMGLMJABKH instance, SteamLobbyEventArgs _steam) { yield return (object)new WaitForEndOfFrame(); steam = _steam; LLBMLPlugin.Log.LogDebug((object)$"SteamLobbyReady: (steam {steam}) (ui {ui})"); if (steam != null && ui != null) { CallLobbyReady(instance, ui, steam); } } public static void CallLobbyReady(object instance, LobbyEventArgs lobby_args, SteamLobbyEventArgs steam_args) { if (GameStates.IsInLobby()) { LLBMLPlugin.Log.LogDebug((object)string.Format("LobbyReady: {0} (ui {1})", (steam != null) ? ("(steam " + steam?.ToString() + ")") : "", ui)); LobbyEvents.OnLobbyReadyCall(instance, new LobbyReadyArgs(lobby_args.isOnline, steam_args?.lobby_id, steam_args?.host_id)); } steam = null; ui = null; } [HarmonyPatch(typeof(ALDOKEMAOMB), "EKNFACPOJCM")] [HarmonyPostfix] public static void JoinMatch_Postfix(bool __0, ALDOKEMAOMB __instance) { Player player = __instance; LobbyEvents.OnPlayerJoinCall(__instance, new OnPlayerJoinArgs(player.nr, player.isLocal)); } [HarmonyPatch(typeof(Peer), "UnlinkFromPlayer")] [HarmonyPostfix] public static void UnlinkFromPlayer_Postfix(Peer __instance) { LobbyEvents.OnUnlinkFromPlayerCall(__instance, new OnUnlinkFromPlayerArgs(__instance.playerNr)); } } public delegate void OnMainMenuFirstEnteredHandler(object source, OnMainMenuEnteredArgs e); public delegate void OnMainMenuEnteredHandler(object source, OnMainMenuEnteredArgs e); public class MenuEvents { public static event OnMainMenuFirstEnteredHandler OnMainMenuFirstEntered; public static event OnMainMenuEnteredHandler OnMainMenuEntered; internal static void Patch(Harmony harmonyInstance) { harmonyInstance.PatchAll(typeof(MenuEvents_Patches)); OnMainMenuFirstEntered += delegate(object o, OnMainMenuEnteredArgs a) { LLBMLPlugin.Log.LogDebug((object)("Event OnMainMenuFirstEntered triggered. Previous state: " + a.previousState)); }; OnMainMenuEntered += delegate(object o, OnMainMenuEnteredArgs a) { LLBMLPlugin.Log.LogDebug((object)("Event OnMainMenuEntered triggered. Previous state: " + a.previousState)); }; } internal static void OnMainMenuFirstEnteredCall(object source, OnMainMenuEnteredArgs e) { if (MenuEvents.OnMainMenuFirstEntered != null) { MenuEvents.OnMainMenuFirstEntered(source, e); } } internal static void OnMainMenuEnteredCall(object source, OnMainMenuEnteredArgs e) { if (MenuEvents.OnMainMenuEntered != null) { MenuEvents.OnMainMenuEntered(source, e); } } } public class OnMainMenuEnteredArgs : EventArgs { public GameState previousState { get; private set; } public OnMainMenuEnteredArgs(GameState previousState) { this.previousState = previousState; } } internal static class MenuEvents_Patches { private static bool firstSinceStart = true; [HarmonyPatch(typeof(IOGKKINMEFB), "CNewState")] [HarmonyPostfix] public static void CNewState_Postfix(JOFJHDJHJGI __0, JOFJHDJHJGI __1, IOGKKINMEFB __instance) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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) if (__1 == (JOFJHDJHJGI)GameState.MENU) { if (firstSinceStart) { MenuEvents.OnMainMenuFirstEnteredCall(__instance, new OnMainMenuEnteredArgs(__0)); firstSinceStart = false; } MenuEvents.OnMainMenuEnteredCall(__instance, new OnMainMenuEnteredArgs(__0)); } } } public delegate void OnStateChangeHandler(object source, OnStateChangeArgs e); public static class GameStateEvents { public static event OnStateChangeHandler OnStateChange; internal static void Patch(Harmony harmonyInstance) { harmonyInstance.PatchAll(typeof(GameStateEvents_Patches)); OnStateChange += delegate(object o, OnStateChangeArgs a) { LLBMLPlugin.Log.LogDebug((object)("Event OnStateChange triggered. OldState: " + a.oldState?.ToString() + ". NewState: " + a.newState)); }; } internal static void OnStateChangeCall(object source, OnStateChangeArgs e) { if (GameStateEvents.OnStateChange != null) { GameStateEvents.OnStateChange(source, e); } } } public class OnStateChangeArgs : EventArgs { public GameState oldState { get; private set; } public GameState newState { get; private set; } public OnStateChangeArgs(GameState oldState, GameState newState) { this.oldState = oldState; this.newState = newState; } } internal static class GameEvents { internal static void PatchAll(Harmony harmonyInstance) { GameStateEvents.Patch(harmonyInstance); LobbyEvents.Patch(harmonyInstance); MenuEvents.Patch(harmonyInstance); WorldEvents.Patch(harmonyInstance); } } internal static class GameStateEvents_Patches { [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool CSetState_Prefix(DNPFJHMAIBP __instance, ref GameState __state) { __state = GameStates.GetCurrent(); return true; } [HarmonyPostfix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static void CSetState_Postfix(DNPFJHMAIBP __instance, ref GameState __state) { GameState current = GameStates.GetCurrent(); if (__state != current) { GameStateEvents.OnStateChangeCall(__instance, new OnStateChangeArgs(__state, current)); } } } } namespace LLBML.Bundles { public static class Assets { public static VariantInfo[] variantInfos { get { return Array.ConvertAll(JPLELOFJOOH.LKIFMPEFNGB, (Converter)((NCBHPNHFLAJ input) => input)); } set { JPLELOFJOOH.LKIFMPEFNGB = Array.ConvertAll(value, (Converter)((VariantInfo input) => input)); } } public static MeshInfo[] meshInfos { get { return Array.ConvertAll(JPLELOFJOOH.OGAHHGABFPE, (Converter)((GHKGDLBCFPK input) => input)); } set { JPLELOFJOOH.OGAHHGABFPE = Array.ConvertAll(value, (Converter)((MeshInfo input) => input)); } } public static void AddSkinVariants() { JPLELOFJOOH.MHOHIACFLOH(); } public static void CharacterToIconSpriteIndex(Character character) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) JPLELOFJOOH.LPCPPJOIIEF(character); } public static IEnumerable ECharacters() { return JPLELOFJOOH.MOFHLDPOIEJ(); } public static AOOJOMIECLD GetCharacterModelValues(Character character, CharacterVariant variant = 0) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) return JPLELOFJOOH.NEBGBODHHCG(character, variant); } public static string GetCharacterName(Character character) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return JPLELOFJOOH.OAGHLPGCAOI(character); } public static Color GetTeamColor(Team team, bool forOutline = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return JPLELOFJOOH.FJOIEBBLMMI((BGHNEHPFHGC)team, forOutline); } public static string GetTeamColorPostfix(Team teamColor) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return JPLELOFJOOH.OODCFCKNLOD((BGHNEHPFHGC)teamColor); } public static Color GetTeamTextColor(Team team) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return JPLELOFJOOH.EGJAKCLDCGB((BGHNEHPFHGC)team); } public static T LoadFromBundle(Bundle bundle, string asset, bool noWarning = false) where T : Object { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return JPLELOFJOOH.PFKGPLFILIO(bundle, asset, noWarning); } public static T LoadFromResources(string path, string name, bool noWarning = false) where T : Object { return JPLELOFJOOH.NAMFPIPFAHP(path, name, noWarning); } public static T SpawnFromBundle(Bundle bundle, string asset) where T : Object { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return JPLELOFJOOH.ICBBOHPGIFM(bundle, asset); } public static GameObject SpawnScreen(ScreenType screenType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return JPLELOFJOOH.HNHBCLJGPCE(screenType); } public static GameObject SpawnDebugHudUber() { return JPLELOFJOOH.OEKMFNNLHHI(); } } public class MeshInfo { private readonly GHKGDLBCFPK _meshInfo; public static float scaleFactor => GHKGDLBCFPK.LINLLJFBAKF; public string model => _meshInfo.BADNNNCEKEF; public float scale => _meshInfo.OGMOEKPOBBP; public int offset => _meshInfo.AFPIBJADFLD; public MeshInfo(GHKGDLBCFPK mi) { //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) _meshInfo = mi; } public MeshInfo(string model, float scale, int offset) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) _meshInfo = new GHKGDLBCFPK(model, scale, offset); } public override bool Equals(object obj) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (obj is GHKGDLBCFPK || obj is MeshInfo) { return object.Equals((object)(GHKGDLBCFPK)obj, (GHKGDLBCFPK)this); } return false; } public override int GetHashCode() { return ((object)(GHKGDLBCFPK)(ref _meshInfo)).GetHashCode(); } public override string ToString() { return $"MeshInfo ({model} : {scale} | {offset})"; } public static implicit operator GHKGDLBCFPK(MeshInfo mi) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return mi._meshInfo; } public static implicit operator MeshInfo(GHKGDLBCFPK mi) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return new MeshInfo(mi); } } public class ModelInstruction : EnumWrapper { public enum Enum { NONE, OUTLINE_WHITE_ON_MESH, NO_SHADOW, SHARED_MATERIAL, MATERIAL_FROM_CHARACTER } public enum Enum_Mapping { NONE, OUTLINE_WHITE_ON_MESH, NO_SHADOW, SHARED_MATERIAL, MATERIAL_FROM_CHARACTER } public static readonly ModelInstruction NONE = Enum.NONE; public static readonly ModelInstruction OUTLINE_WHITE_ON_MESH = Enum.OUTLINE_WHITE_ON_MESH; public static readonly ModelInstruction NO_SHADOW = Enum.NO_SHADOW; public static readonly ModelInstruction SHARED_MATERIAL = Enum.SHARED_MATERIAL; public static readonly ModelInstruction MATERIAL_FROM_CHARACTER = Enum.MATERIAL_FROM_CHARACTER; private ModelInstruction(int id) : base(id) { } private ModelInstruction(FKBHNEMDBMK modelInstruction) : base((int)modelInstruction) { }//IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected I4, but got Unknown public override string ToString() { return ((Enum)id).ToString(); } public static implicit operator FKBHNEMDBMK(ModelInstruction ew) { return (FKBHNEMDBMK)ew.id; } public static implicit operator ModelInstruction(FKBHNEMDBMK val) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return new ModelInstruction(val); } public static implicit operator ModelInstruction(int id) { return new ModelInstruction(id); } public static implicit operator ModelInstruction(Enum val) { return new ModelInstruction((int)val); } public static implicit operator Enum(ModelInstruction ew) { return (Enum)ew.id; } } public class ModelValues { private readonly AOOJOMIECLD _modelValues; public string assetModel => _modelValues.DKADFKGPGHL; public string[] assetMaterials => _modelValues.IODEGBOKAAK; public Bundle bundle => _modelValues.EDKLFODCINA; public int offset => _modelValues.AFPIBJADFLD; public float scale => _modelValues.OGMOEKPOBBP; public ModelInstruction instruction => _modelValues.MIGKFLKFCIJ; public ModelValues(AOOJOMIECLD mv) { //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) _modelValues = mv; } public override bool Equals(object obj) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (obj is AOOJOMIECLD || obj is ModelValues) { return object.Equals((object)(AOOJOMIECLD)obj, (AOOJOMIECLD)this); } return false; } public override int GetHashCode() { return ((object)(AOOJOMIECLD)(ref _modelValues)).GetHashCode(); } public override string ToString() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) return $"ModelValues ({assetModel} | {bundle} | {instruction} | {offset} | {scale})"; } public static implicit operator AOOJOMIECLD(ModelValues mv) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return mv._modelValues; } public static implicit operator ModelValues(AOOJOMIECLD mv) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return new ModelValues(mv); } } public class VariantInfo { private readonly NCBHPNHFLAJ _variantInfo; public Character character => _variantInfo.LALEEFJMMLH; public CharacterVariant variant => _variantInfo.AIINAIDBHJI; public string model => _variantInfo.BADNNNCEKEF; public string[] materials => _variantInfo.MJJFEAGJICG; public ModelInstruction instruction => _variantInfo.MIGKFLKFCIJ; public DLC dlc => _variantInfo.DDHGFDLLDAG; public VariantInfo(NCBHPNHFLAJ vi) { //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) _variantInfo = vi; } public VariantInfo(Character character, CharacterVariant variant, string model, string[] materials, DLC dlc = 0) { //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_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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) _variantInfo = new NCBHPNHFLAJ(character, variant, model, materials, (FKBHNEMDBMK)ModelInstruction.NONE, dlc); } public VariantInfo(Character character, CharacterVariant variant, string model, string[] materials, ModelInstruction instruction, DLC dlc = 0) { //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (instruction == null) { instruction = ModelInstruction.NONE; } _variantInfo = new NCBHPNHFLAJ(character, variant, model, materials, (FKBHNEMDBMK)instruction, dlc); } public VariantInfo(Character character, CharacterVariant variant, string model, string material, DLC dlc = 0) { //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_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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) _variantInfo = new NCBHPNHFLAJ(character, variant, model, material, (FKBHNEMDBMK)ModelInstruction.NONE, dlc); } public VariantInfo(Character character, CharacterVariant variant, string model, string material, ModelInstruction instruction, DLC dlc = 0) { //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (instruction == null) { instruction = ModelInstruction.NONE; } _variantInfo = new NCBHPNHFLAJ(character, variant, model, material, (FKBHNEMDBMK)instruction, dlc); } public override bool Equals(object obj) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (obj is NCBHPNHFLAJ || obj is VariantInfo) { return object.Equals((object)(NCBHPNHFLAJ)obj, (NCBHPNHFLAJ)this); } return false; } public override int GetHashCode() { return ((object)(NCBHPNHFLAJ)(ref _variantInfo)).GetHashCode(); } public override string ToString() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) return $"VariantInfo ({character} | {variant} | {model} | {instruction} | {dlc})"; } public static implicit operator NCBHPNHFLAJ(VariantInfo vi) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return vi._variantInfo; } public static implicit operator VariantInfo(NCBHPNHFLAJ vi) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return new VariantInfo(vi); } } }